zeno-config 2.1.0 → 3.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/README.md +2 -2
- package/package.json +1 -1
- package/src/eslint/index.d.ts +1 -1
- package/src/eslint/index.js +13 -5
- package/src/eslint/rules/baseRules.js +6 -6
- package/src/eslint/rules/importPluginRules.js +2 -2
- package/src/eslint/rules/jsxA11yPluginRules.js +1 -1
- package/src/eslint/rules/reactPluginRules.js +6 -6
- package/src/eslint/rules/unicornPluginRules.js +6 -6
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ export default defineZenoConfig(
|
|
|
70
70
|
ts: true,
|
|
71
71
|
|
|
72
72
|
// Additional directories to ignore (added to defaults: node_modules, dist, build, coverage)
|
|
73
|
-
|
|
73
|
+
ignores: ['out', '.next'],
|
|
74
74
|
|
|
75
75
|
// If using .js extensions for React files, specify React directories
|
|
76
76
|
reactDirs: ['src/client', 'src/components'],
|
|
@@ -199,7 +199,7 @@ import {
|
|
|
199
199
|
| `react` | `boolean` | `false` | Enable React-specific rules |
|
|
200
200
|
| `ts` | `boolean` | `false` | Enable TypeScript-specific rules |
|
|
201
201
|
| `performanceMode` | `boolean` | `false` | Disables expensive rules for better performance |
|
|
202
|
-
| `
|
|
202
|
+
| `ignores` | `string[]` | `[]` | Additional directories to ignore (added to defaults: node_modules, dist, build, coverage) |
|
|
203
203
|
| `reactDirs` | `string[]` | `[]` | Directories containing React files (for projects using .js for both React and Node) |
|
|
204
204
|
| `nodeIgnoreDirs` | `string[]` | `[]` | Directories to ignore for Node-specific rules (defaults to `reactDirs` if not set) |
|
|
205
205
|
| `ignoreExports` | `string[]` | `[]` | Export patterns to ignore for import/no-unresolved rule |
|
package/package.json
CHANGED
package/src/eslint/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ interface DefineZenoConfigOptions {
|
|
|
38
38
|
/** Disables expensive rules for performance */
|
|
39
39
|
performanceMode?: boolean;
|
|
40
40
|
/** Additional directories to ignore (added to defaults: dist, build) */
|
|
41
|
-
|
|
41
|
+
ignores?: string[];
|
|
42
42
|
/** Directories containing React files (for projects using .js for both React and Node) */
|
|
43
43
|
reactDirs?: string[];
|
|
44
44
|
/** Directories to ignore for Node-specific rules only */
|
package/src/eslint/index.js
CHANGED
|
@@ -308,7 +308,7 @@ const internals = {
|
|
|
308
308
|
* @param {boolean} [arg1.react=false] - Enable React-specific rules.
|
|
309
309
|
* @param {boolean} [arg1.ts=true] - Enable TypeScript-specific rules.
|
|
310
310
|
* @param {boolean} [arg1.performanceMode=false] - Disables expensive rules for performance.
|
|
311
|
-
* @param {string[]} [arg1.
|
|
311
|
+
* @param {string[]} [arg1.ignores=[]] - Additional directories to ignore (added to defaults: dist, build).
|
|
312
312
|
* @param {string[]} [arg1.reactDirs=[]] - Directories containing React files (for projects using .js for both React and Node).
|
|
313
313
|
* @param {string[]} [arg1.nodeIgnoreDirs=[]] - Directories to ignore for Node-specific rules only.
|
|
314
314
|
* @param {string[]} [arg1.ignoreExports=[]] - Export patterns to ignore for import rules.
|
|
@@ -337,7 +337,7 @@ const defineZenoConfig = (arg1, arg2) => {
|
|
|
337
337
|
performanceMode: false,
|
|
338
338
|
|
|
339
339
|
// additional directories to ignore (added to defaults: dist, build)
|
|
340
|
-
|
|
340
|
+
ignores: [],
|
|
341
341
|
|
|
342
342
|
// if a project uses .js file extension for both react and node files this will help separate the rules for each
|
|
343
343
|
reactDirs: [],
|
|
@@ -358,8 +358,8 @@ const defineZenoConfig = (arg1, arg2) => {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
// Ensure array options are arrays
|
|
361
|
-
if (!Array.isArray(options.
|
|
362
|
-
options.
|
|
361
|
+
if (!Array.isArray(options.ignores)) {
|
|
362
|
+
options.ignores = [];
|
|
363
363
|
}
|
|
364
364
|
if (!Array.isArray(options.reactDirs)) {
|
|
365
365
|
options.reactDirs = [];
|
|
@@ -401,7 +401,7 @@ const defineZenoConfig = (arg1, arg2) => {
|
|
|
401
401
|
: [];
|
|
402
402
|
|
|
403
403
|
return defineConfig([
|
|
404
|
-
{ ignores: [...defaultIgnoreDirs, ...options.
|
|
404
|
+
{ ignores: [...defaultIgnoreDirs, ...options.ignores] },
|
|
405
405
|
...configs.getBase({
|
|
406
406
|
ignoreExports: options.ignoreExports,
|
|
407
407
|
additionalDevDependencies: options.additionalDevDependencies,
|
|
@@ -419,6 +419,14 @@ const defineZenoConfig = (arg1, arg2) => {
|
|
|
419
419
|
|
|
420
420
|
// Turn off formatting rules that might conflict with Prettier
|
|
421
421
|
prettierPlugin,
|
|
422
|
+
|
|
423
|
+
{
|
|
424
|
+
files: [`**/*{${allExtensionsString}}`],
|
|
425
|
+
rules: {
|
|
426
|
+
// prettier disables this but we can safely enable it
|
|
427
|
+
curly: 'error',
|
|
428
|
+
},
|
|
429
|
+
},
|
|
422
430
|
]);
|
|
423
431
|
};
|
|
424
432
|
|
|
@@ -16,7 +16,7 @@ const getBaseRules = () => {
|
|
|
16
16
|
'no-async-promise-executor': 'error',
|
|
17
17
|
|
|
18
18
|
// https://eslint.org/docs/latest/rules/no-await-in-loop
|
|
19
|
-
'no-await-in-loop': '
|
|
19
|
+
'no-await-in-loop': 'off',
|
|
20
20
|
|
|
21
21
|
// https://eslint.org/docs/latest/rules/no-class-assign
|
|
22
22
|
'no-class-assign': 'error',
|
|
@@ -196,7 +196,7 @@ const getBaseRules = () => {
|
|
|
196
196
|
'no-useless-backreference': 'error',
|
|
197
197
|
|
|
198
198
|
// https://eslint.org/docs/latest/rules/require-atomic-updates
|
|
199
|
-
'require-atomic-updates': ['
|
|
199
|
+
'require-atomic-updates': ['off', { allowProperties: false }], // noticed a feew weird cases with this one
|
|
200
200
|
|
|
201
201
|
// https://eslint.org/docs/latest/rules/use-isnan
|
|
202
202
|
'use-isnan': 'error',
|
|
@@ -215,7 +215,7 @@ const getBaseRules = () => {
|
|
|
215
215
|
|
|
216
216
|
// https://eslint.org/docs/latest/rules/camelcase
|
|
217
217
|
camelcase: [
|
|
218
|
-
'
|
|
218
|
+
'off',
|
|
219
219
|
{
|
|
220
220
|
properties: 'always',
|
|
221
221
|
ignoreDestructuring: false,
|
|
@@ -250,7 +250,7 @@ const getBaseRules = () => {
|
|
|
250
250
|
'default-case-last': 'error',
|
|
251
251
|
|
|
252
252
|
// https://eslint.org/docs/latest/rules/default-param-last
|
|
253
|
-
'default-param-last': '
|
|
253
|
+
'default-param-last': 'off',
|
|
254
254
|
|
|
255
255
|
// https://eslint.org/docs/latest/rules/dot-notation
|
|
256
256
|
'dot-notation': ['error', { allowKeywords: true }],
|
|
@@ -319,7 +319,7 @@ const getBaseRules = () => {
|
|
|
319
319
|
|
|
320
320
|
// https://eslint.org/docs/latest/rules/new-cap
|
|
321
321
|
'new-cap': [
|
|
322
|
-
'
|
|
322
|
+
'off',
|
|
323
323
|
{
|
|
324
324
|
newIsCap: true,
|
|
325
325
|
capIsNew: true,
|
|
@@ -401,7 +401,7 @@ const getBaseRules = () => {
|
|
|
401
401
|
number: true,
|
|
402
402
|
string: true,
|
|
403
403
|
disallowTemplateShorthand: true,
|
|
404
|
-
allow: ['!!', '~'],
|
|
404
|
+
allow: ['!!', '~', '+'],
|
|
405
405
|
},
|
|
406
406
|
],
|
|
407
407
|
|
|
@@ -135,7 +135,7 @@ const getImportPluginRules = (options = {}) => {
|
|
|
135
135
|
'import-x/dynamic-import-chunkname': 'off',
|
|
136
136
|
|
|
137
137
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/exports-last.md
|
|
138
|
-
'import-x/exports-last': '
|
|
138
|
+
'import-x/exports-last': 'off',
|
|
139
139
|
|
|
140
140
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/extensions.md
|
|
141
141
|
'import-x/extensions': [
|
|
@@ -148,7 +148,7 @@ const getImportPluginRules = (options = {}) => {
|
|
|
148
148
|
'import-x/first': 'error',
|
|
149
149
|
|
|
150
150
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
|
|
151
|
-
'import-x/group-exports': '
|
|
151
|
+
'import-x/group-exports': 'off',
|
|
152
152
|
|
|
153
153
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
|
|
154
154
|
'import-x/max-dependencies': 'off',
|
|
@@ -73,7 +73,7 @@ const getJsxA11yPluginRules = () => {
|
|
|
73
73
|
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
74
74
|
|
|
75
75
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
|
|
76
|
-
'jsx-a11y/no-autofocus': '
|
|
76
|
+
'jsx-a11y/no-autofocus': 'off',
|
|
77
77
|
|
|
78
78
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
|
|
79
79
|
'jsx-a11y/no-distracting-elements': 'error',
|
|
@@ -59,11 +59,11 @@ const getReactPluginRules = (options = {}) => {
|
|
|
59
59
|
'react/forbid-elements': 'off',
|
|
60
60
|
|
|
61
61
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
|
|
62
|
-
'react/forbid-foreign-prop-types': '
|
|
62
|
+
'react/forbid-foreign-prop-types': 'warn',
|
|
63
63
|
|
|
64
64
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
|
|
65
65
|
'react/forbid-prop-types': [
|
|
66
|
-
'
|
|
66
|
+
'warn',
|
|
67
67
|
{
|
|
68
68
|
forbid: ['any', 'array', 'object'],
|
|
69
69
|
checkContextTypes: true,
|
|
@@ -142,7 +142,7 @@ const getReactPluginRules = (options = {}) => {
|
|
|
142
142
|
|
|
143
143
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
144
144
|
'react/jsx-handler-names': [
|
|
145
|
-
'
|
|
145
|
+
'off',
|
|
146
146
|
{
|
|
147
147
|
eventHandlerPrefix: 'handle',
|
|
148
148
|
eventHandlerPropPrefix: 'on',
|
|
@@ -210,7 +210,7 @@ const getReactPluginRules = (options = {}) => {
|
|
|
210
210
|
|
|
211
211
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
|
|
212
212
|
'react/jsx-no-leaked-render': [
|
|
213
|
-
'
|
|
213
|
+
'off',
|
|
214
214
|
{ validStrategies: ['ternary', 'coerce'] },
|
|
215
215
|
],
|
|
216
216
|
|
|
@@ -254,7 +254,7 @@ const getReactPluginRules = (options = {}) => {
|
|
|
254
254
|
|
|
255
255
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
256
256
|
'react/jsx-props-no-spreading': [
|
|
257
|
-
'
|
|
257
|
+
'warn',
|
|
258
258
|
{
|
|
259
259
|
html: 'enforce',
|
|
260
260
|
custom: 'ignore',
|
|
@@ -457,7 +457,7 @@ const getReactPluginRules = (options = {}) => {
|
|
|
457
457
|
],
|
|
458
458
|
|
|
459
459
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
460
|
-
'react/state-in-constructor': ['
|
|
460
|
+
'react/state-in-constructor': ['off', 'always'],
|
|
461
461
|
|
|
462
462
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
463
463
|
'react/static-property-placement': 'off',
|
|
@@ -22,7 +22,7 @@ const getUnicornPluginRules = () => {
|
|
|
22
22
|
'unicorn/consistent-existence-index-check': 'off',
|
|
23
23
|
|
|
24
24
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/consistent-function-scoping.md
|
|
25
|
-
'unicorn/consistent-function-scoping': '
|
|
25
|
+
'unicorn/consistent-function-scoping': 'off',
|
|
26
26
|
|
|
27
27
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md
|
|
28
28
|
'unicorn/custom-error-definition': 'error',
|
|
@@ -44,7 +44,7 @@ const getUnicornPluginRules = () => {
|
|
|
44
44
|
|
|
45
45
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/filename-case.md
|
|
46
46
|
'unicorn/filename-case': [
|
|
47
|
-
'
|
|
47
|
+
'off',
|
|
48
48
|
{
|
|
49
49
|
cases: {
|
|
50
50
|
camelCase: true,
|
|
@@ -91,7 +91,7 @@ const getUnicornPluginRules = () => {
|
|
|
91
91
|
'unicorn/no-array-sort': 'warn',
|
|
92
92
|
|
|
93
93
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-expression-member.md
|
|
94
|
-
'unicorn/no-await-expression-member': '
|
|
94
|
+
'unicorn/no-await-expression-member': 'off', // auto fix breaks logic
|
|
95
95
|
|
|
96
96
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-await-in-promise-methods.md
|
|
97
97
|
'unicorn/no-await-in-promise-methods': 'error',
|
|
@@ -160,7 +160,7 @@ const getUnicornPluginRules = () => {
|
|
|
160
160
|
'unicorn/no-process-exit': 'off',
|
|
161
161
|
|
|
162
162
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-single-promise-in-promise-methods.md
|
|
163
|
-
'unicorn/no-single-promise-in-promise-methods': '
|
|
163
|
+
'unicorn/no-single-promise-in-promise-methods': 'off', // false positives with new Class as elements in arrays
|
|
164
164
|
|
|
165
165
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-static-only-class.md
|
|
166
166
|
'unicorn/no-static-only-class': 'error',
|
|
@@ -217,7 +217,7 @@ const getUnicornPluginRules = () => {
|
|
|
217
217
|
'unicorn/no-useless-spread': 'error',
|
|
218
218
|
|
|
219
219
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-switch-case.md
|
|
220
|
-
'unicorn/no-useless-switch-case': '
|
|
220
|
+
'unicorn/no-useless-switch-case': 'off',
|
|
221
221
|
|
|
222
222
|
// this conflicts with requiring default props in React
|
|
223
223
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-useless-undefined.md
|
|
@@ -386,7 +386,7 @@ const getUnicornPluginRules = () => {
|
|
|
386
386
|
'unicorn/prefer-string-trim-start-end': 'warn',
|
|
387
387
|
|
|
388
388
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-structured-clone.md
|
|
389
|
-
'unicorn/prefer-structured-clone': '
|
|
389
|
+
'unicorn/prefer-structured-clone': 'off',
|
|
390
390
|
|
|
391
391
|
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-switch.md
|
|
392
392
|
'unicorn/prefer-switch': 'off',
|