@fullstacksjs/eslint-config 10.11.1 → 11.1.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 +28 -50
- package/src/index.js +89 -0
- package/src/init.d.ts +22 -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/playwright.js +30 -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 +48 -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,48 @@
|
|
|
1
|
+
const plugin = require('eslint-plugin-jest-formatting');
|
|
2
|
+
const { globs } = require('../utils/globs');
|
|
3
|
+
const { predicate } = require('../utils/conditions');
|
|
4
|
+
const globals = require('globals');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('../init').Options} options
|
|
8
|
+
* @return { import('eslint').Linter.FlatConfig }
|
|
9
|
+
*/
|
|
10
|
+
function tests(options = {}) {
|
|
11
|
+
return {
|
|
12
|
+
plugins: { 'jest-formatting': plugin },
|
|
13
|
+
files: [...globs.test, ...globs.e2e],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
globals: globals['shared-node-browser'],
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
'jest-formatting/padding-around-after-all-blocks': 'warn',
|
|
19
|
+
'jest-formatting/padding-around-after-each-blocks': 'warn',
|
|
20
|
+
'jest-formatting/padding-around-before-all-blocks': 'warn',
|
|
21
|
+
'jest-formatting/padding-around-before-each-blocks': 'warn',
|
|
22
|
+
'jest-formatting/padding-around-describe-blocks': 'warn',
|
|
23
|
+
'jest-formatting/padding-around-test-blocks': 'warn',
|
|
24
|
+
|
|
25
|
+
'max-lines-per-function': 'off',
|
|
26
|
+
'no-sparse-arrays': 'off',
|
|
27
|
+
|
|
28
|
+
...predicate(options.fp, {
|
|
29
|
+
'functional/no-let': 'off',
|
|
30
|
+
'functional/no-loop-statements': 'off',
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
...predicate(options.react, {
|
|
34
|
+
'react/jsx-no-constructed-context-values': 'off',
|
|
35
|
+
}),
|
|
36
|
+
|
|
37
|
+
...predicate(options.typescript, {
|
|
38
|
+
'@typescript-eslint/method-signature-style': 'off',
|
|
39
|
+
'@typescript-eslint/no-namespace ': 'off',
|
|
40
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
41
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
42
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = tests;
|
|
@@ -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;
|