Skip to content

Commit 58cb385

Browse files
committed
feat: add cli
1 parent 08c0a24 commit 58cb385

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3569
-2176
lines changed

.eslintrc.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
parser: '@typescript-eslint/parser'
2+
3+
parserOptions:
4+
ecmaFeatures:
5+
jsx: true
6+
ecmaVersion: latest
7+
sourceType: module
8+
project: ./tsconfig.json
9+
10+
env:
11+
browser: true
12+
es6: true
13+
node: true
14+
jest: true
15+
16+
ignorePatterns: ['index.js']
17+
18+
plugins:
19+
- import
20+
- '@typescript-eslint'
21+
22+
extends:
23+
- eslint:recommended
24+
- plugin:prettier/recommended
25+
26+
rules:
27+
# 0 = off, 1 = warn, 2 = error
28+
'space-before-function-paren': 0
29+
'no-useless-constructor': 0
30+
'no-undef': 2
31+
'no-console': [2, { allow: ['error', 'warn', 'info', 'assert'] }]
32+
'comma-dangle': ['error', 'only-multiline']
33+
'no-unused-vars': 0
34+
'no-var': 2
35+
'one-var-declaration-per-line': 2
36+
'prefer-const': 2
37+
'no-const-assign': 2
38+
'no-duplicate-imports': 2
39+
'no-use-before-define': [2, { 'functions': false, 'classes': false }]
40+
'eqeqeq': [2, 'always', { 'null': 'ignore' }]
41+
'no-case-declarations': 0
42+
'no-restricted-syntax':
43+
[
44+
2,
45+
{
46+
'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
47+
'message': Don't compare for equality against boolean literals,
48+
},
49+
]
50+
51+
# https://github.com/benmosher/eslint-plugin-import/pull/334
52+
'import/no-duplicates': 2
53+
'import/first': 2
54+
'import/newline-after-import': 2
55+
'import/order':
56+
[
57+
2,
58+
{
59+
'newlines-between': 'always',
60+
'alphabetize': { 'order': 'asc' },
61+
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
62+
},
63+
]
64+
65+
overrides:
66+
- files:
67+
- ./**/*{.ts,.tsx}
68+
rules:
69+
'no-unused-vars': [2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
70+
'no-undef': 0
71+
# TypeScript declare merge
72+
'no-redeclare': 0
73+
'no-useless-constructor': 0
74+
'no-dupe-class-members': 0
75+
'no-case-declarations': 0
76+
'no-duplicate-imports': 0
77+
# TypeScript Interface and Type
78+
'no-use-before-define': 0
79+
80+
'@typescript-eslint/adjacent-overload-signatures': 2
81+
'@typescript-eslint/await-thenable': 2
82+
'@typescript-eslint/consistent-type-assertions': 2
83+
'@typescript-eslint/ban-types':
84+
[
85+
'error',
86+
{
87+
'types':
88+
{
89+
'String': { 'message': 'Use string instead', 'fixWith': 'string' },
90+
'Number': { 'message': 'Use number instead', 'fixWith': 'number' },
91+
'Boolean': { 'message': 'Use boolean instead', 'fixWith': 'boolean' },
92+
'Function': { 'message': 'Use explicit type instead' },
93+
},
94+
},
95+
]
96+
'@typescript-eslint/explicit-member-accessibility':
97+
[
98+
'error',
99+
{
100+
accessibility: 'explicit',
101+
overrides:
102+
{
103+
accessors: 'no-public',
104+
constructors: 'no-public',
105+
methods: 'no-public',
106+
properties: 'no-public',
107+
parameterProperties: 'explicit',
108+
},
109+
},
110+
]
111+
'@typescript-eslint/method-signature-style': 2
112+
'@typescript-eslint/no-floating-promises': 2
113+
'@typescript-eslint/no-implied-eval': 2
114+
'@typescript-eslint/no-for-in-array': 2
115+
'@typescript-eslint/no-inferrable-types': 2
116+
'@typescript-eslint/no-invalid-void-type': 2
117+
'@typescript-eslint/no-misused-new': 2
118+
'@typescript-eslint/no-misused-promises': 2
119+
'@typescript-eslint/no-namespace': 2
120+
'@typescript-eslint/no-non-null-asserted-optional-chain': 2
121+
'@typescript-eslint/no-throw-literal': 2
122+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 2
123+
'@typescript-eslint/prefer-for-of': 2
124+
'@typescript-eslint/prefer-nullish-coalescing': 2
125+
'@typescript-eslint/switch-exhaustiveness-check': 2
126+
'@typescript-eslint/prefer-optional-chain': 2
127+
'@typescript-eslint/prefer-readonly': 2
128+
'@typescript-eslint/prefer-string-starts-ends-with': 0
129+
'@typescript-eslint/no-array-constructor': 2
130+
'@typescript-eslint/require-await': 2
131+
'@typescript-eslint/return-await': 2
132+
'@typescript-eslint/ban-ts-comment':
133+
[2, { 'ts-expect-error': false, 'ts-ignore': true, 'ts-nocheck': true, 'ts-check': false }]
134+
'@typescript-eslint/naming-convention':
135+
[
136+
2,
137+
{
138+
selector: 'memberLike',
139+
format: ['camelCase', 'PascalCase'],
140+
modifiers: ['private'],
141+
leadingUnderscore: 'forbid',
142+
},
143+
]
144+
'@typescript-eslint/no-unused-vars':
145+
[2, { varsIgnorePattern: '^_', argsIgnorePattern: '^_', ignoreRestSiblings: true }]
146+
'@typescript-eslint/member-ordering':
147+
[
148+
2,
149+
{
150+
default:
151+
[
152+
'public-static-field',
153+
'protected-static-field',
154+
'private-static-field',
155+
'public-static-method',
156+
'protected-static-method',
157+
'private-static-method',
158+
'public-instance-field',
159+
'protected-instance-field',
160+
'private-instance-field',
161+
'public-constructor',
162+
'protected-constructor',
163+
'private-constructor',
164+
'public-instance-method',
165+
'protected-instance-method',
166+
'private-instance-method',
167+
],
168+
},
169+
]

.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
5+
*.ts text eol=lf merge=union
6+
*.tsx text eol=lf merge=union
7+
*.rs text eol=lf merge=union
8+
*.js text eol=lf merge=union
9+
*.json text eol=lf merge=union
10+
*.debug text eol=lf merge=union
11+
12+
# Generated codes
13+
index.js linguist-detectable=false
14+
index.d.ts linguist-detectable=false

.github/renovate.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["config:base", "group:allNonMajor", ":preserveSemverRanges", ":disablePeerDependencies"],
4+
"labels": ["dependencies"],
5+
"packageRules": [
6+
{
7+
"matchPackageNames": ["@napi/cli", "napi", "napi-build", "napi-derive"],
8+
"addLabels": ["napi-rs"],
9+
"groupName": "napi-rs"
10+
},
11+
{
12+
"matchPackagePatterns": ["^eslint", "^@typescript-eslint"],
13+
"groupName": "linter"
14+
}
15+
],
16+
"commitMessagePrefix": "chore: ",
17+
"commitMessageAction": "bump up",
18+
"commitMessageTopic": "{{depName}} version",
19+
"ignoreDeps": []
20+
}

0 commit comments

Comments
 (0)