@fullstacksjs/eslint-config 10.11.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +6 -4
- package/package.json +27 -50
- package/src/index.js +86 -0
- package/src/init.d.ts +21 -0
- package/src/modules/base.js +187 -0
- package/src/modules/cypress.js +23 -0
- package/{esm.js → src/modules/esm.js} +1 -1
- package/src/modules/fp.js +16 -0
- package/src/modules/graphql.js +84 -0
- package/src/modules/ignores.js +39 -0
- package/src/modules/imports.js +100 -0
- package/src/modules/jest.js +74 -0
- package/src/modules/next.js +32 -0
- package/src/modules/node.js +33 -0
- package/src/modules/prettier.js +93 -0
- package/src/modules/promise.js +27 -0
- package/src/modules/react.js +151 -0
- package/src/modules/storybook.js +34 -0
- package/src/modules/strict.js +16 -0
- package/src/modules/tailwind.js +19 -0
- package/src/modules/tests.js +43 -0
- package/src/modules/typescript.js +255 -0
- package/src/modules/vitest.js +84 -0
- package/src/utils/conditions.js +20 -0
- package/src/utils/globs.js +40 -0
- package/base.js +0 -246
- package/cypress.js +0 -31
- package/expensive-rules.js +0 -4
- package/fp.js +0 -23
- package/graphql.js +0 -79
- package/import.js +0 -64
- package/index.js +0 -20
- package/init.d.ts +0 -22
- package/init.js +0 -64
- package/jest.js +0 -80
- package/next.js +0 -27
- package/node.js +0 -43
- package/prettier.js +0 -8
- package/promise.js +0 -21
- package/react.js +0 -147
- package/registerOpts.js +0 -20
- package/storybook.js +0 -31
- package/strict.js +0 -15
- package/tailwind.js +0 -15
- package/test.js +0 -40
- package/typecheck.js +0 -89
- package/typescript.js +0 -169
- package/utils.js +0 -21
- /package/{naming-convention.js → src/utils/naming-convention.js} +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
const { parser, plugin } = require('typescript-eslint');
|
|
2
|
+
const { globs } = require('../utils/globs');
|
|
3
|
+
const namingConvention = require('../utils/naming-convention');
|
|
4
|
+
const { predicate } = require('../utils/conditions');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('../init').Options} options
|
|
8
|
+
* @return { import('eslint').Linter.FlatConfig }
|
|
9
|
+
*/
|
|
10
|
+
function typescript(options = {}) {
|
|
11
|
+
return {
|
|
12
|
+
files: [globs.ts, globs.tsx],
|
|
13
|
+
plugins: { '@typescript-eslint': plugin },
|
|
14
|
+
languageOptions: { parser },
|
|
15
|
+
rules: {
|
|
16
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
17
|
+
'@typescript-eslint/array-type': 'error',
|
|
18
|
+
'@typescript-eslint/ban-ts-comment': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
'ts-expect-error': 'allow-with-description',
|
|
22
|
+
'ts-ignore': 'allow-with-description',
|
|
23
|
+
'ts-nocheck': 'allow-with-description',
|
|
24
|
+
'ts-check': 'allow-with-description',
|
|
25
|
+
'minimumDescriptionLength': 3,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
'@typescript-eslint/ban-tslint-comment': 'off',
|
|
29
|
+
'@typescript-eslint/ban-types': 'error',
|
|
30
|
+
'@typescript-eslint/camelcase': 'off',
|
|
31
|
+
'@typescript-eslint/class-literal-property-style': ['error', 'getters'],
|
|
32
|
+
'@typescript-eslint/consistent-generic-constructors': ['warn', 'constructor'],
|
|
33
|
+
'@typescript-eslint/consistent-indexed-object-style': 'off',
|
|
34
|
+
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
35
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
36
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
37
|
+
'warn',
|
|
38
|
+
{ prefer: 'type-imports', disallowTypeAnnotations: false, fixStyle: 'separate-type-imports' },
|
|
39
|
+
],
|
|
40
|
+
'@typescript-eslint/default-param-last': 'warn',
|
|
41
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
42
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
43
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
44
|
+
'@typescript-eslint/generic-type-naming': 'off',
|
|
45
|
+
'@typescript-eslint/init-declarations': 'off',
|
|
46
|
+
'@typescript-eslint/member-naming': 'off',
|
|
47
|
+
'@typescript-eslint/member-ordering': 'off',
|
|
48
|
+
'@typescript-eslint/method-signature-style': ['warn', 'property'],
|
|
49
|
+
'@typescript-eslint/naming-convention': [
|
|
50
|
+
'warn',
|
|
51
|
+
...namingConvention,
|
|
52
|
+
...(options.typescript && options.typescript.projects
|
|
53
|
+
? [
|
|
54
|
+
{
|
|
55
|
+
selector: 'variable',
|
|
56
|
+
types: ['boolean'],
|
|
57
|
+
format: ['PascalCase'],
|
|
58
|
+
prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'enable', 'loading'],
|
|
59
|
+
},
|
|
60
|
+
]
|
|
61
|
+
: []),
|
|
62
|
+
],
|
|
63
|
+
'@typescript-eslint/no-array-constructor': 'error',
|
|
64
|
+
'@typescript-eslint/no-base-to-string': 'off', // false negative
|
|
65
|
+
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
|
66
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
67
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
68
|
+
'@typescript-eslint/no-dynamic-delete': 'error',
|
|
69
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
70
|
+
'@typescript-eslint/no-empty-interface': 'off', // Annoying with auto-fix on save.
|
|
71
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
72
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
73
|
+
'@typescript-eslint/no-extraneous-class': ['warn', { allowWithDecorator: true }],
|
|
74
|
+
'@typescript-eslint/no-import-type-side-effects': 'warn',
|
|
75
|
+
'@typescript-eslint/no-inferrable-types': 'off',
|
|
76
|
+
'@typescript-eslint/no-invalid-this': ['error', { capIsConstructor: false }],
|
|
77
|
+
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
78
|
+
'@typescript-eslint/no-loop-func': 'error',
|
|
79
|
+
'@typescript-eslint/no-loss-of-precision': 'error',
|
|
80
|
+
'@typescript-eslint/no-magic-numbers': ['off', { ignoreEnums: true }], // Not good enough yet
|
|
81
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
82
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
83
|
+
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
|
84
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
85
|
+
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
86
|
+
'@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
|
|
87
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
88
|
+
'@typescript-eslint/no-restricted-imports': 'off',
|
|
89
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
90
|
+
'@typescript-eslint/no-this-alias': 'error',
|
|
91
|
+
'@typescript-eslint/no-type-alias': 'off',
|
|
92
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
|
|
93
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
94
|
+
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
95
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
96
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
|
|
97
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
98
|
+
'@typescript-eslint/no-unsafe-return': 'off',
|
|
99
|
+
'@typescript-eslint/no-untyped-public-signature': 'off',
|
|
100
|
+
'@typescript-eslint/no-unused-expressions': 'error',
|
|
101
|
+
'@typescript-eslint/no-unused-vars': [
|
|
102
|
+
'warn',
|
|
103
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^([iI]gnore(d)?)|(_+)', args: 'after-used', ignoreRestSiblings: true },
|
|
104
|
+
],
|
|
105
|
+
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: true }],
|
|
106
|
+
'@typescript-eslint/no-useless-constructor': 'error',
|
|
107
|
+
'@typescript-eslint/no-useless-empty-export': 'warn',
|
|
108
|
+
'@typescript-eslint/no-var-requires': 'error',
|
|
109
|
+
'@typescript-eslint/object-curly-spacing': 'warn',
|
|
110
|
+
'@typescript-eslint/parameter-properties': 'off',
|
|
111
|
+
'@typescript-eslint/prefer-as-const': 'warn',
|
|
112
|
+
'@typescript-eslint/prefer-enum-initializers': 'off',
|
|
113
|
+
'@typescript-eslint/prefer-for-of': 'warn',
|
|
114
|
+
'@typescript-eslint/prefer-function-type': 'warn',
|
|
115
|
+
'@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
|
|
116
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
117
|
+
'@typescript-eslint/prefer-readonly-parameter-types': [
|
|
118
|
+
'off',
|
|
119
|
+
{ checkParameterProperties: true, ignoreInferredTypes: false, treatMethodsAsReadonly: true },
|
|
120
|
+
], // I'm not sure...
|
|
121
|
+
'@typescript-eslint/prefer-readonly': 'off',
|
|
122
|
+
'@typescript-eslint/prefer-readonlysemi': 'off', // Annoying with auto-fix on save.
|
|
123
|
+
'@typescript-eslint/prefer-ts-expect-error': 'off',
|
|
124
|
+
'@typescript-eslint/promise-function-async': 'off',
|
|
125
|
+
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
126
|
+
'@typescript-eslint/sort-type-constituents': [
|
|
127
|
+
'warn',
|
|
128
|
+
{
|
|
129
|
+
checkIntersections: true,
|
|
130
|
+
checkUnions: true,
|
|
131
|
+
groupOrder: [
|
|
132
|
+
'named',
|
|
133
|
+
'keyword',
|
|
134
|
+
'operator',
|
|
135
|
+
'literal',
|
|
136
|
+
'function',
|
|
137
|
+
'import',
|
|
138
|
+
'conditional',
|
|
139
|
+
'object',
|
|
140
|
+
'tuple',
|
|
141
|
+
'intersection',
|
|
142
|
+
'union',
|
|
143
|
+
'nullish',
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
'@typescript-eslint/strict-boolean-expressions': 'off', // Annoying
|
|
148
|
+
'@typescript-eslint/space-before-blocks': 'off',
|
|
149
|
+
|
|
150
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
151
|
+
'@typescript-eslint/typedef': ['error', { parameter: false, arrowParameter: false, variableDeclaration: false }],
|
|
152
|
+
'@typescript-eslint/unified-signatures': 'error',
|
|
153
|
+
'@typescript-eslint/key-spacing': 'off',
|
|
154
|
+
|
|
155
|
+
...predicate(options.typescript && options.typescript.projects, {
|
|
156
|
+
'@typescript-eslint/await-thenable': 'error',
|
|
157
|
+
'@typescript-eslint/consistent-return': 'off',
|
|
158
|
+
'@typescript-eslint/consistent-type-exports': 'warn',
|
|
159
|
+
'@typescript-eslint/dot-notation': [
|
|
160
|
+
'warn',
|
|
161
|
+
{
|
|
162
|
+
allowPrivateClassPropertyAccess: false,
|
|
163
|
+
allowProtectedClassPropertyAccess: false,
|
|
164
|
+
allowIndexSignaturePropertyAccess: true,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
'@typescript-eslint/no-confusing-void-expression': ['off', { ignoreArrowShorthand: true, ignoreVoidOperator: true }], // Annoying and conflict with @typescript-eslint/no-meaningless-void-operator
|
|
168
|
+
'@typescript-eslint/no-duplicate-type-constituents': 'warn',
|
|
169
|
+
'@typescript-eslint/no-for-in-array': 'error',
|
|
170
|
+
'@typescript-eslint/no-implied-eval': 'error',
|
|
171
|
+
'@typescript-eslint/no-meaningless-void-operator': ['warn', { checkNever: false }],
|
|
172
|
+
...predicate(!options.disableExpensiveRules, {
|
|
173
|
+
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
|
174
|
+
'@typescript-eslint/no-misused-promises': ['warn', { checksVoidReturn: { attributes: false } }],
|
|
175
|
+
}),
|
|
176
|
+
'@typescript-eslint/no-mixed-enums': 'error',
|
|
177
|
+
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
178
|
+
'@typescript-eslint/no-throw-literal': ['warn', { allowThrowingUnknown: false }],
|
|
179
|
+
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
180
|
+
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
|
|
181
|
+
'@typescript-eslint/no-unnecessary-condition': [
|
|
182
|
+
'warn',
|
|
183
|
+
{
|
|
184
|
+
allowConstantLoopConditions: false,
|
|
185
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
189
|
+
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
|
190
|
+
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
191
|
+
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
|
192
|
+
'@typescript-eslint/no-useless-template-literals': 'warn',
|
|
193
|
+
'@typescript-eslint/non-nullable-type-assertion-style': 'warn',
|
|
194
|
+
'@typescript-eslint/prefer-includes': 'warn',
|
|
195
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
196
|
+
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
|
|
197
|
+
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
198
|
+
'warn',
|
|
199
|
+
{
|
|
200
|
+
ignoreConditionalTests: false,
|
|
201
|
+
ignoreTernaryTests: false,
|
|
202
|
+
ignoreMixedLogicalExpressions: false,
|
|
203
|
+
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
'@typescript-eslint/prefer-regexp-exec': 'warn',
|
|
207
|
+
'@typescript-eslint/prefer-promise-reject-errors': 'warn',
|
|
208
|
+
'@typescript-eslint/prefer-return-this-type': 'warn',
|
|
209
|
+
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
|
|
210
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
211
|
+
'warn',
|
|
212
|
+
{ allowNumber: true, allowBoolean: false, allowAny: false, allowNullish: false, allowRegExp: false, allowNever: false },
|
|
213
|
+
],
|
|
214
|
+
'@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
|
|
215
|
+
'@typescript-eslint/require-await': 'error',
|
|
216
|
+
'@typescript-eslint/return-await': 'error',
|
|
217
|
+
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
218
|
+
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
|
|
219
|
+
|
|
220
|
+
// collisions
|
|
221
|
+
'prefer-promise-reject-errors': 'off',
|
|
222
|
+
'consistent-return': 'off',
|
|
223
|
+
}),
|
|
224
|
+
|
|
225
|
+
// open issues
|
|
226
|
+
'react/jsx-no-useless-fragment': 'off', // Need useless-fragment for JSX return type
|
|
227
|
+
|
|
228
|
+
// Conflicts with @typescript-eslint
|
|
229
|
+
'import/named': 'off',
|
|
230
|
+
'import/namespace': 'off',
|
|
231
|
+
'import/default': 'off',
|
|
232
|
+
'import/no-named-as-default-member': 'off',
|
|
233
|
+
'key-spacing': 'off',
|
|
234
|
+
'camelcase': 'off',
|
|
235
|
+
'default-param-last': 'off',
|
|
236
|
+
'init-declarations': 'off',
|
|
237
|
+
'no-invalid-this': 'off',
|
|
238
|
+
'no-loop-func': 'off',
|
|
239
|
+
'no-redeclare': 'off',
|
|
240
|
+
'no-restricted-imports': 'off',
|
|
241
|
+
'no-shadow': 'off',
|
|
242
|
+
'no-unused-vars': 'off',
|
|
243
|
+
'no-use-before-define': 'off',
|
|
244
|
+
'no-useless-constructor': 'off',
|
|
245
|
+
'object-curly-spacing': 'off',
|
|
246
|
+
'padding-line-between-statements': 'off',
|
|
247
|
+
'space-before-blocks': 'off',
|
|
248
|
+
'dot-notation': 'off',
|
|
249
|
+
'no-throw-literal': 'off',
|
|
250
|
+
'require-await': 'off',
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
module.exports = typescript;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const plugin = require('eslint-plugin-vitest');
|
|
2
|
+
const { globs } = require('../utils/globs');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @return { import('eslint').Linter.FlatConfig }
|
|
6
|
+
*/
|
|
7
|
+
function vitest() {
|
|
8
|
+
return {
|
|
9
|
+
files: globs.test,
|
|
10
|
+
plugins: { vitest: plugin },
|
|
11
|
+
languageOptions: {
|
|
12
|
+
globals: {
|
|
13
|
+
suite: 'writable',
|
|
14
|
+
test: 'writable',
|
|
15
|
+
describe: 'writable',
|
|
16
|
+
it: 'writable',
|
|
17
|
+
expect: 'writable',
|
|
18
|
+
assert: 'writable',
|
|
19
|
+
vitest: 'writable',
|
|
20
|
+
vi: 'writable',
|
|
21
|
+
beforeAll: 'writable',
|
|
22
|
+
afterAll: 'writable',
|
|
23
|
+
beforeEach: 'writable',
|
|
24
|
+
afterEach: 'writable',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'vitest/consistent-test-filename': 'off',
|
|
29
|
+
'vitest/consistent-test-it': 'warn',
|
|
30
|
+
'vitest/expect-expect': 'warn',
|
|
31
|
+
'vitest/max-expects': 'off',
|
|
32
|
+
'vitest/max-nested-describe': 'off',
|
|
33
|
+
'vitest/no-alias-methods': 'off',
|
|
34
|
+
'vitest/no-commented-out-tests': 'warn',
|
|
35
|
+
'vitest/no-conditional-expect': 'warn',
|
|
36
|
+
'vitest/no-conditional-in-test': 'off',
|
|
37
|
+
'vitest/no-conditional-tests': 'warn',
|
|
38
|
+
'vitest/no-disabled-tests': 'warn',
|
|
39
|
+
'vitest/no-done-callback': 'off',
|
|
40
|
+
'vitest/no-duplicate-hooks': 'error',
|
|
41
|
+
'vitest/no-focused-tests': 'warn',
|
|
42
|
+
'vitest/no-hooks': 'off',
|
|
43
|
+
'vitest/no-identical-title': 'error',
|
|
44
|
+
'vitest/no-import-node-test': 'error',
|
|
45
|
+
'vitest/no-interpolation-in-snapshots': 'warn',
|
|
46
|
+
'vitest/no-large-snapshots': 'warn',
|
|
47
|
+
'vitest/no-mocks-import': 'warn',
|
|
48
|
+
'vitest/no-restricted-matchers': 'warn',
|
|
49
|
+
'vitest/no-restricted-vi-methods': 'warn',
|
|
50
|
+
'vitest/no-standalone-expect': 'warn',
|
|
51
|
+
'vitest/no-test-prefixes': 'warn',
|
|
52
|
+
'vitest/no-test-return-statement': 'warn',
|
|
53
|
+
'vitest/prefer-called-with': 'warn',
|
|
54
|
+
'vitest/prefer-comparison-matcher': 'warn',
|
|
55
|
+
'vitest/prefer-each': 'warn',
|
|
56
|
+
'vitest/prefer-equality-matcher': 'warn',
|
|
57
|
+
'vitest/prefer-expect-assertions': 'off',
|
|
58
|
+
'vitest/prefer-expect-resolves': 'warn',
|
|
59
|
+
'vitest/prefer-hooks-in-order': 'warn',
|
|
60
|
+
'vitest/prefer-hooks-on-top': 'warn',
|
|
61
|
+
'vitest/prefer-lowercase-title': 'warn',
|
|
62
|
+
'vitest/prefer-mock-promise-shorthand': 'warn',
|
|
63
|
+
'vitest/prefer-snapshot-hint': 'warn',
|
|
64
|
+
'vitest/prefer-spy-on': 'warn',
|
|
65
|
+
'vitest/prefer-strict-equal': 'warn',
|
|
66
|
+
'vitest/prefer-to-be': 'warn',
|
|
67
|
+
'vitest/prefer-to-be-falsy': 'warn',
|
|
68
|
+
'vitest/prefer-to-be-object': 'warn',
|
|
69
|
+
'vitest/prefer-to-be-truthy': 'warn',
|
|
70
|
+
'vitest/prefer-to-contain': 'warn',
|
|
71
|
+
'vitest/prefer-to-have-length': 'warn',
|
|
72
|
+
'vitest/prefer-todo': 'warn',
|
|
73
|
+
'vitest/require-hook': 'warn',
|
|
74
|
+
'vitest/require-local-test-context-for-concurrent-snapshots': 'warn',
|
|
75
|
+
'vitest/require-to-throw-message': 'warn',
|
|
76
|
+
'vitest/require-top-level-describe': 'warn',
|
|
77
|
+
'vitest/valid-describe-callback': 'warn',
|
|
78
|
+
'vitest/valid-expect': 'warn',
|
|
79
|
+
'vitest/valid-title': 'warn',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = vitest;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {{strict?: boolean}} options
|
|
3
|
+
* @param {import('eslint').Linter.RuleEntry} config
|
|
4
|
+
* @returns {import('eslint').Linter.RuleEntry}
|
|
5
|
+
*/
|
|
6
|
+
const strictRule = (options, config) => {
|
|
7
|
+
return options.strict ? config : 'off';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {boolean} options
|
|
12
|
+
* @param {import('eslint').Linter.RulesRecord} config
|
|
13
|
+
* @returns {import('eslint').Linter.RulesRecord | undefined}
|
|
14
|
+
*/
|
|
15
|
+
const predicate = (condition, config) => {
|
|
16
|
+
return condition ? config : undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
module.exports.strict = strictRule;
|
|
20
|
+
module.exports.predicate = predicate;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const srcExt = '?([cm])[jt]s?(x)';
|
|
2
|
+
|
|
3
|
+
const globs = {
|
|
4
|
+
src: `**/*.${srcExt}`,
|
|
5
|
+
js: '**/*.?([cm])js',
|
|
6
|
+
jsx: '**/*.?([cm])jsx',
|
|
7
|
+
ts: '**/*.?([cm])ts',
|
|
8
|
+
tsx: '**/*.?([cm])tsx',
|
|
9
|
+
|
|
10
|
+
style: '**/*.{css,less,scss}',
|
|
11
|
+
css: '**/*.css',
|
|
12
|
+
postcss: '**/*.postcss',
|
|
13
|
+
less: '**/*.less',
|
|
14
|
+
scss: '**/*.scss',
|
|
15
|
+
|
|
16
|
+
json: '**/*.json',
|
|
17
|
+
json5: '**/*.json5',
|
|
18
|
+
jsonc: '**/*.jsonc',
|
|
19
|
+
allJson: '**/*.json?([c5])',
|
|
20
|
+
|
|
21
|
+
md: '**/*.md',
|
|
22
|
+
svelte: '**/*.svelte',
|
|
23
|
+
vue: '**/*.vue',
|
|
24
|
+
yaml: '**/*.{yml,yaml}',
|
|
25
|
+
toml: '**/*.toml',
|
|
26
|
+
xml: '**/*.xml',
|
|
27
|
+
html: '**/*.html',
|
|
28
|
+
astro: '**/*.astro',
|
|
29
|
+
graphql: '**/*.{gql,graphql}',
|
|
30
|
+
|
|
31
|
+
storybook: ['**/*.stories.{js,jsx,ts,tsx}'],
|
|
32
|
+
|
|
33
|
+
test: [`**/__tests__/*.${srcExt}`, `**/*.spec.${srcExt}`, `**/*.test.${srcExt}`],
|
|
34
|
+
e2e: [`**/e2e/*.${srcExt}`],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const allSrc = [globs.src, globs.style, globs.allJson, globs.md, globs.svelte, globs.vue, globs.yaml, globs.xml, globs.html];
|
|
38
|
+
|
|
39
|
+
module.exports.globs = globs;
|
|
40
|
+
module.exports.allSrc = allSrc;
|
package/base.js
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
/** @type { import('eslint').Linter.Config } */
|
|
2
|
-
module.exports = {
|
|
3
|
-
parserOptions: {
|
|
4
|
-
ecmaVersion: 'latest',
|
|
5
|
-
sourceType: 'module',
|
|
6
|
-
},
|
|
7
|
-
reportUnusedDisableDirectives: true,
|
|
8
|
-
env: {
|
|
9
|
-
browser: true,
|
|
10
|
-
node: true,
|
|
11
|
-
es6: true,
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
'accessor-pairs': 'error',
|
|
15
|
-
'array-callback-return': 'error',
|
|
16
|
-
'arrow-body-style': ['off', 'as-needed'], // Annoying
|
|
17
|
-
'block-scoped-var': 'error',
|
|
18
|
-
'brace-style': 'off', // prettier
|
|
19
|
-
'camelcase': ['warn', { properties: 'always' }],
|
|
20
|
-
'capitalized-comments': 'off',
|
|
21
|
-
'class-methods-use-this': 'off',
|
|
22
|
-
'comma-spacing': ['warn', { after: true, before: false }],
|
|
23
|
-
'complexity': ['error', 14],
|
|
24
|
-
'consistent-return': 'off',
|
|
25
|
-
'consistent-this': 'off',
|
|
26
|
-
'constructor-super': 'error',
|
|
27
|
-
'default-case': 'error',
|
|
28
|
-
'default-case-last': 'error',
|
|
29
|
-
'default-param-last': 'warn',
|
|
30
|
-
'dot-notation': 'error',
|
|
31
|
-
'eqeqeq': ['error', 'smart'],
|
|
32
|
-
'for-direction': 'error',
|
|
33
|
-
'func-name-matching': 'error',
|
|
34
|
-
'func-names': 'error',
|
|
35
|
-
'func-style': 'off',
|
|
36
|
-
'getter-return': ['error', { allowImplicit: true }],
|
|
37
|
-
'grouped-accessor-pairs': 'off',
|
|
38
|
-
'guard-for-in': 'error',
|
|
39
|
-
'id-denylist': 'off',
|
|
40
|
-
'id-length': 'off',
|
|
41
|
-
'id-match': ['error', '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$'], // __filename, camelCase, PascalCase, CONST_VALUE, stream$, $el
|
|
42
|
-
'init-declarations': 'off',
|
|
43
|
-
'line-comment-position': 'off',
|
|
44
|
-
'linebreak-style': ['error', 'unix'],
|
|
45
|
-
'lines-around-comment': 'off',
|
|
46
|
-
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: false }],
|
|
47
|
-
'logical-assignment-operators': 'off',
|
|
48
|
-
'max-classes-per-file': 'off',
|
|
49
|
-
'max-depth': ['error', 4],
|
|
50
|
-
'max-lines': ['error', { max: 2500, skipBlankLines: false, skipComments: false }],
|
|
51
|
-
'max-lines-per-function': ['error', 150],
|
|
52
|
-
'max-nested-callbacks': ['error', 7],
|
|
53
|
-
'max-params': ['error', 7],
|
|
54
|
-
'max-statements': ['error', 40],
|
|
55
|
-
'max-statements-per-line': ['error', { max: 1 }],
|
|
56
|
-
'multiline-comment-style': 'off',
|
|
57
|
-
'new-cap': 'off',
|
|
58
|
-
'no-alert': 'error',
|
|
59
|
-
'no-array-constructor': 'error',
|
|
60
|
-
'no-async-promise-executor': 'off',
|
|
61
|
-
'no-await-in-loop': 'error',
|
|
62
|
-
'no-bitwise': 'error',
|
|
63
|
-
'no-caller': 'error',
|
|
64
|
-
'no-case-declarations': 'error',
|
|
65
|
-
'no-class-assign': 'error',
|
|
66
|
-
'no-compare-neg-zero': 'error',
|
|
67
|
-
'no-cond-assign': 'error',
|
|
68
|
-
'no-console': 'off',
|
|
69
|
-
'no-const-assign': 'error',
|
|
70
|
-
'no-constant-binary-expression': 'warn',
|
|
71
|
-
'no-constant-condition': 'error',
|
|
72
|
-
'no-constructor-return': 'error',
|
|
73
|
-
'no-continue': 'off',
|
|
74
|
-
'no-control-regex': 'error',
|
|
75
|
-
'no-debugger': 'error',
|
|
76
|
-
'no-delete-var': 'error',
|
|
77
|
-
'no-div-regex': 'error',
|
|
78
|
-
'no-dupe-args': 'error',
|
|
79
|
-
'no-dupe-class-members': 'error',
|
|
80
|
-
'no-dupe-else-if': 'error',
|
|
81
|
-
'no-dupe-keys': 'error',
|
|
82
|
-
'no-duplicate-case': 'error',
|
|
83
|
-
'no-duplicate-imports': 'off', // Handled by import plugin
|
|
84
|
-
'no-else-return': 'off',
|
|
85
|
-
'no-empty': 'error',
|
|
86
|
-
'no-empty-character-class': 'error',
|
|
87
|
-
'no-empty-function': 'off',
|
|
88
|
-
'no-empty-pattern': 'error',
|
|
89
|
-
'no-empty-static-block': 'warn',
|
|
90
|
-
'no-eq-null': 'off',
|
|
91
|
-
'no-eval': 'error',
|
|
92
|
-
'no-ex-assign': 'error',
|
|
93
|
-
'no-extend-native': 'error',
|
|
94
|
-
'no-extra-bind': 'error',
|
|
95
|
-
'no-extra-boolean-cast': 'off',
|
|
96
|
-
'no-extra-label': 'error',
|
|
97
|
-
'no-fallthrough': 'error',
|
|
98
|
-
'no-floating-decimal': 'error',
|
|
99
|
-
'no-func-assign': 'error',
|
|
100
|
-
'no-global-assign': 'error',
|
|
101
|
-
'no-implicit-coercion': 'off',
|
|
102
|
-
'no-implicit-globals': 'error',
|
|
103
|
-
'no-implied-eval': 'error',
|
|
104
|
-
'no-import-assign': 'error',
|
|
105
|
-
'no-inline-comments': 'off',
|
|
106
|
-
'no-inner-declarations': 'error',
|
|
107
|
-
'no-invalid-regexp': 'error',
|
|
108
|
-
'no-invalid-this': 'warn',
|
|
109
|
-
'no-irregular-whitespace': 'error',
|
|
110
|
-
'no-iterator': 'error',
|
|
111
|
-
'no-label-var': 'error',
|
|
112
|
-
'no-labels': 'error',
|
|
113
|
-
'no-lone-blocks': 'error',
|
|
114
|
-
'no-lonely-if': 'error',
|
|
115
|
-
'no-loop-func': 'error',
|
|
116
|
-
'no-loss-of-precision': 'warn',
|
|
117
|
-
'no-magic-numbers': 'off',
|
|
118
|
-
'no-misleading-character-class': 'off',
|
|
119
|
-
'no-multi-assign': 'error',
|
|
120
|
-
'no-multi-str': 'error',
|
|
121
|
-
'no-negated-condition': 'off',
|
|
122
|
-
'no-nested-ternary': 'off',
|
|
123
|
-
'no-new': 'error',
|
|
124
|
-
'no-new-func': 'error',
|
|
125
|
-
'no-new-native-nonconstructor': 'error',
|
|
126
|
-
'no-new-object': 'error',
|
|
127
|
-
'no-new-symbol': 'error',
|
|
128
|
-
'no-new-wrappers': 'error',
|
|
129
|
-
'no-nonoctal-decimal-escape': 'error',
|
|
130
|
-
'no-obj-calls': 'error',
|
|
131
|
-
'no-octal': 'error',
|
|
132
|
-
'no-octal-escape': 'error',
|
|
133
|
-
'no-param-reassign': 'off',
|
|
134
|
-
'no-plusplus': 'off',
|
|
135
|
-
'no-promise-executor-return': 'error',
|
|
136
|
-
'no-proto': 'error',
|
|
137
|
-
'no-prototype-builtins': 'off',
|
|
138
|
-
'no-redeclare': 'error',
|
|
139
|
-
'no-regex-spaces': 'error',
|
|
140
|
-
'no-restricted-exports': 'off',
|
|
141
|
-
'no-restricted-globals': ['error', 'event', 'fdescribe'],
|
|
142
|
-
'no-restricted-imports': 'off',
|
|
143
|
-
'no-restricted-properties': 'off',
|
|
144
|
-
'no-restricted-syntax': ['error', 'WithStatement'],
|
|
145
|
-
'no-return-assign': 'error',
|
|
146
|
-
'no-return-await': 'error',
|
|
147
|
-
'no-script-url': 'error',
|
|
148
|
-
'no-self-assign': 'error',
|
|
149
|
-
'no-self-compare': 'error',
|
|
150
|
-
'no-sequences': 'error',
|
|
151
|
-
'no-setter-return': 'error',
|
|
152
|
-
'no-shadow': 'error',
|
|
153
|
-
'no-shadow-restricted-names': 'error',
|
|
154
|
-
'no-sparse-arrays': 'error',
|
|
155
|
-
'no-template-curly-in-string': 'off', // Some libs need curly in string for internal templates.
|
|
156
|
-
'no-ternary': 'off',
|
|
157
|
-
'no-this-before-super': 'error',
|
|
158
|
-
'no-throw-literal': 'error',
|
|
159
|
-
'no-undef': 'error',
|
|
160
|
-
'no-undef-init': 'error',
|
|
161
|
-
'no-undefined': 'off',
|
|
162
|
-
'no-underscore-dangle': 'off',
|
|
163
|
-
'no-unexpected-multiline': 'error',
|
|
164
|
-
'no-unmodified-loop-condition': 'error',
|
|
165
|
-
'no-unneeded-ternary': 'error',
|
|
166
|
-
'no-unreachable': 'error',
|
|
167
|
-
'no-unreachable-loop': 'error',
|
|
168
|
-
'no-unsafe-finally': 'error',
|
|
169
|
-
'no-unsafe-negation': 'error',
|
|
170
|
-
'no-unsafe-optional-chaining': 'error',
|
|
171
|
-
'no-unused-expressions': 'off',
|
|
172
|
-
'no-unused-labels': 'error',
|
|
173
|
-
'no-unused-private-class-members': 'warn',
|
|
174
|
-
'no-unused-vars': [
|
|
175
|
-
'error',
|
|
176
|
-
{ argsIgnorePattern: '^_', varsIgnorePattern: '^ignore(d)?', args: 'after-used', ignoreRestSiblings: true },
|
|
177
|
-
],
|
|
178
|
-
'no-use-before-define': ['error', 'nofunc'],
|
|
179
|
-
'no-useless-backreference': 'error',
|
|
180
|
-
'no-useless-call': 'error',
|
|
181
|
-
'no-useless-catch': 'error',
|
|
182
|
-
'no-useless-computed-key': 'error',
|
|
183
|
-
'no-useless-concat': 'error',
|
|
184
|
-
'no-useless-constructor': 'error',
|
|
185
|
-
'no-useless-escape': 'error',
|
|
186
|
-
'no-useless-rename': 'error',
|
|
187
|
-
'no-useless-return': 'error',
|
|
188
|
-
'no-var': 'warn',
|
|
189
|
-
'no-void': 'off',
|
|
190
|
-
'no-warning-comments': ['warn', { terms: ['fixme'], location: 'anywhere' }],
|
|
191
|
-
'no-with': 'off',
|
|
192
|
-
'object-shorthand': ['error', 'properties'],
|
|
193
|
-
'one-var': ['error', { uninitialized: 'never', initialized: 'never' }],
|
|
194
|
-
'operator-assignment': 'off',
|
|
195
|
-
'padding-line-between-statements': 'off',
|
|
196
|
-
'prefer-arrow-callback': ['warn', { allowNamedFunctions: true, allowUnboundThis: true }],
|
|
197
|
-
'prefer-const': 'warn',
|
|
198
|
-
'prefer-destructuring': 'off',
|
|
199
|
-
'prefer-exponentiation-operator': 'warn',
|
|
200
|
-
'prefer-named-capture-group': 'off',
|
|
201
|
-
'prefer-numeric-literals': 'error',
|
|
202
|
-
'prefer-object-has-own': 'warn',
|
|
203
|
-
'prefer-object-spread': 'off',
|
|
204
|
-
'prefer-promise-reject-errors': 'off',
|
|
205
|
-
'prefer-regex-literals': 'off',
|
|
206
|
-
'prefer-rest-params': 'error',
|
|
207
|
-
'prefer-spread': 'error',
|
|
208
|
-
'prefer-template': 'error',
|
|
209
|
-
'radix': 'error',
|
|
210
|
-
'require-atomic-updates': 'off',
|
|
211
|
-
'require-await': 'error',
|
|
212
|
-
'require-unicode-regexp': 'off',
|
|
213
|
-
'require-yield': 'error',
|
|
214
|
-
'sort-keys': 'off',
|
|
215
|
-
'sort-vars': 'off',
|
|
216
|
-
'spaced-comment': ['warn', 'always', { markers: ['/'] }], // ignore typescript triple-slash
|
|
217
|
-
'strict': 'error',
|
|
218
|
-
'symbol-description': 'error',
|
|
219
|
-
'use-isnan': 'error',
|
|
220
|
-
'valid-typeof': 'error',
|
|
221
|
-
'vars-on-top': 'error',
|
|
222
|
-
'yoda': 'error',
|
|
223
|
-
|
|
224
|
-
...(global.fullstacksjs?.typescript && {
|
|
225
|
-
'key-spacing': 'off',
|
|
226
|
-
'camelcase': 'off',
|
|
227
|
-
'default-param-last': 'off',
|
|
228
|
-
'init-declarations': 'off',
|
|
229
|
-
'lines-between-class-members': 'off',
|
|
230
|
-
'no-invalid-this': 'off',
|
|
231
|
-
'no-loop-func': 'off',
|
|
232
|
-
'no-redeclare': 'off',
|
|
233
|
-
'no-restricted-imports': 'off',
|
|
234
|
-
'no-shadow': 'off',
|
|
235
|
-
'no-unused-vars': 'off',
|
|
236
|
-
'no-use-before-define': 'off',
|
|
237
|
-
'no-useless-constructor': 'off',
|
|
238
|
-
'object-curly-spacing': 'off',
|
|
239
|
-
'padding-line-between-statements': 'off',
|
|
240
|
-
'space-before-blocks': 'off',
|
|
241
|
-
'dot-notation': 'off',
|
|
242
|
-
'no-throw-literal': 'off',
|
|
243
|
-
'require-await': 'off',
|
|
244
|
-
}),
|
|
245
|
-
},
|
|
246
|
-
};
|