@aarongoldenthal/eslint-config-standard 34.0.0 → 35.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 +48 -42
- package/base-configs.js +17 -7
- package/eslint-comments-config.js +4 -5
- package/esm-config.js +6 -9
- package/jest-config.js +5 -6
- package/jsdoc-config.js +4 -5
- package/node-config.js +5 -6
- package/package.json +31 -15
- package/playwright-config.js +5 -6
- package/promise-config.js +4 -5
- package/recommended-esm.js +15 -15
- package/recommended.js +14 -14
- package/unicorn-configs.js +17 -6
- package/vitest-config.js +4 -6
package/README.md
CHANGED
|
@@ -5,25 +5,25 @@
|
|
|
5
5
|
Custom ESLint configuration for all projects. Includes flat-config formatted
|
|
6
6
|
configurations compatible with ESLint v9+ for the following:
|
|
7
7
|
|
|
8
|
-
| Plugin Name | Config
|
|
9
|
-
| ------------------------------------------------- |
|
|
10
|
-
| `eslint` | [`base-configs
|
|
11
|
-
| `@eslint-community/eslint-plugin-eslint-comments` | [`eslint-comments-config
|
|
12
|
-
| `eslint-plugin-jest` | [`jest-config
|
|
13
|
-
| `eslint-plugin-jsdoc` | [`jsdoc-config
|
|
14
|
-
| `eslint-plugin-n` | [`node-config
|
|
15
|
-
| `eslint-plugin-playwright` | [`playwright-config
|
|
16
|
-
| `eslint-plugin-promise` | [`promise-config
|
|
17
|
-
| `eslint-plugin-unicorn` | [`unicorn-configs
|
|
18
|
-
| `eslint-plugin-vitest` | [`vitest-config
|
|
8
|
+
| Plugin Name | Config name | Rule Prefix |
|
|
9
|
+
| ------------------------------------------------- | -------------------------------------------------------------------------- | ------------ |
|
|
10
|
+
| `eslint` | [`base-configs`](./base-configs.js) | none, `core` |
|
|
11
|
+
| `@eslint-community/eslint-plugin-eslint-comments` | [`eslint-comments-config`](./eslint-comments-config.js) | `comments` |
|
|
12
|
+
| `eslint-plugin-jest` | [`jest-config`](./jest-config.js) | `jest` |
|
|
13
|
+
| `eslint-plugin-jsdoc` | [`jsdoc-config`](./jsdoc-config.js) | `jsdoc` |
|
|
14
|
+
| `eslint-plugin-n` | [`node-config`](./node-config.js) | `node` |
|
|
15
|
+
| `eslint-plugin-playwright` | [`playwright-config`](./playwright-config.js) | `playwright` |
|
|
16
|
+
| `eslint-plugin-promise` | [`promise-config`](./promise-config.js) | `promise` |
|
|
17
|
+
| `eslint-plugin-unicorn` | [`unicorn-configs`](./unicorn-configs.js), [`esm-config`](./esm-config.js) | `unicorn` |
|
|
18
|
+
| `eslint-plugin-vitest` | [`vitest-config`](./vitest-config.js) | `vitest` |
|
|
19
19
|
|
|
20
20
|
As flat configs, the package defines all required plugins/configurations as
|
|
21
21
|
`dependencies`. Since flat config allows flexibility in the rule prefixes (that
|
|
22
22
|
is, they don't have to match the plugin name), the rules prefixes are adapted
|
|
23
23
|
in some cases to be more intuitive or readable. Since they may be combined, and
|
|
24
24
|
flat config doesn't allow nested arrays of rules, file names that are singular
|
|
25
|
-
export a single config object (for example `jsdoc-config
|
|
26
|
-
that are plural export an array of config objects (for example `base-configs
|
|
25
|
+
export a single config object (for example `jsdoc-config`), and file names
|
|
26
|
+
that are plural export an array of config objects (for example `base-configs`).
|
|
27
27
|
|
|
28
28
|
The `core` prefix has only one rule, `core/complexity`, that has a higher threshold.
|
|
29
29
|
This provides a secondary check for cases where the lower threshold in the `complexity`
|
|
@@ -34,7 +34,9 @@ rules is an experimental capability, this must be enabled with environment varia
|
|
|
34
34
|
Most rule configurations are applicable to files matching `'**/*.{js,mjs,cjs}'`. The
|
|
35
35
|
following configurations are exceptions and are applicable to files as noted:
|
|
36
36
|
|
|
37
|
-
- `base-configs
|
|
37
|
+
- `base-configs` sets `sourceType` to `commonjs` for `*.js`/`*.cjs` files and
|
|
38
|
+
`module` for `*.mjs` files.
|
|
39
|
+
- `base-configs` includes a config that disables some rules for test files
|
|
38
40
|
matching any of the following test patterns (for example `max-lines`,
|
|
39
41
|
`max-lines-per-function`).
|
|
40
42
|
- `jest-config` applies rules to files matching
|
|
@@ -43,33 +45,38 @@ following configurations are exceptions and are applicable to files as noted:
|
|
|
43
45
|
`'**/__tests__/**/*.{js,mjs}'` or `'**/?(*.)+(spec|test).{js,mjs}'`.
|
|
44
46
|
- `playwright-config`: applies rules to files matching `'**/*.pwtest.{js,mjs,cjs}'`,
|
|
45
47
|
which differentiates them from Jest/Vitest test files.
|
|
46
|
-
- `unicorn-configs
|
|
47
|
-
(matching any of the following test patterns)
|
|
48
|
+
- `unicorn-configs` includes a config that disables some rules for test files
|
|
49
|
+
(matching any of the following test patterns), and applies some ESM-specific
|
|
50
|
+
rules only applicable to `*.mjs` files.
|
|
48
51
|
|
|
49
52
|
With ESLint v9 the majority of formatting rules are deprecated and removed from
|
|
50
53
|
`base-configs`, but the `eslint-config-prettier` package is included and can be
|
|
51
|
-
added to the config if `prettier` is also being used to ensure it takes priority
|
|
52
|
-
formatting.
|
|
54
|
+
added to the config if `prettier` is also being used to ensure it takes priority
|
|
55
|
+
for formatting.
|
|
53
56
|
|
|
54
|
-
There is also an `esm-config` included
|
|
55
|
-
|
|
57
|
+
There is also an `esm-config` included for projects using ES modules instead of
|
|
58
|
+
CommonJS modules. This config sets `sourceType` to `module` for `*.js` files and
|
|
59
|
+
includes `unicorn-config` ESM-specific rules.
|
|
56
60
|
|
|
57
61
|
### Usage
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
This module is now pure ESM, so must be called from an ESM file, either
|
|
64
|
+
`eslint.config.js` (if the project is ESM) or `eslint.config.mjs` (if the
|
|
65
|
+
project is CJS).
|
|
66
|
+
|
|
67
|
+
There is a `recommended` configuration for CJS with all plugin configurations
|
|
68
|
+
enabled except `vitest-config` (it does include `jest-config`, and applies
|
|
69
|
+
ESM-specific rules to `*.mjs files`). To configure `eslint.config.mjs` with
|
|
70
|
+
this configuration:
|
|
62
71
|
|
|
63
72
|
```js
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
];
|
|
73
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
74
|
+
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended';
|
|
75
|
+
|
|
76
|
+
export default defineConfig([
|
|
77
|
+
recommendedConfig,
|
|
78
|
+
globalIgnores(['.vscode/**', 'archive/**', 'node_modules/**', 'coverage/**'])
|
|
79
|
+
]);
|
|
73
80
|
```
|
|
74
81
|
|
|
75
82
|
Note the optional `ignores` config that can be added last to ignore certain
|
|
@@ -77,18 +84,17 @@ directories.
|
|
|
77
84
|
|
|
78
85
|
There is also a `recommended-esm` configuration that's the same as the
|
|
79
86
|
`recommended` config, but includes the `vitest-config` instead of the
|
|
80
|
-
`jest-config`, and also the `esm-config
|
|
87
|
+
`jest-config`, and also the `esm-config` (applicable to `*.js` files).
|
|
88
|
+
It can be configured with:
|
|
81
89
|
|
|
82
90
|
```js
|
|
83
|
-
import
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
];
|
|
91
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
92
|
+
import recommendedConfig from '@aarongoldenthal/eslint-config-standard/recommended-esm';
|
|
93
|
+
|
|
94
|
+
export default defineConfig([
|
|
95
|
+
recommendedConfig,
|
|
96
|
+
globalIgnores(['.vscode/**', 'archive/**', 'node_modules/**', 'coverage/**'])
|
|
97
|
+
]);
|
|
92
98
|
```
|
|
93
99
|
|
|
94
100
|
To configure `eslint.config.js` with individual plugins, see the
|
package/base-configs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable max-lines -- required given number of rules */
|
|
2
|
-
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
3
3
|
|
|
4
4
|
const complexityThresholdLow = 5;
|
|
5
5
|
const maxFunctionLinesThreshold = 30;
|
|
@@ -10,12 +10,24 @@ const nestedThreshold = 5;
|
|
|
10
10
|
|
|
11
11
|
const configs = [
|
|
12
12
|
{
|
|
13
|
-
files: ['**/*.{js,
|
|
13
|
+
files: ['**/*.{js,cjs}'],
|
|
14
14
|
languageOptions: {
|
|
15
15
|
sourceType: 'commonjs'
|
|
16
16
|
},
|
|
17
|
+
name: 'CJS files'
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.mjs'],
|
|
21
|
+
languageOptions: {
|
|
22
|
+
sourceType: 'module'
|
|
23
|
+
},
|
|
24
|
+
name: 'ESM files'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
files: ['**/*.{js,mjs,cjs}'],
|
|
17
28
|
linterOptions: {
|
|
18
|
-
reportUnusedDisableDirectives: 'error'
|
|
29
|
+
reportUnusedDisableDirectives: 'error',
|
|
30
|
+
reportUnusedInlineConfigs: 'error'
|
|
19
31
|
},
|
|
20
32
|
name: 'eslint (all files)',
|
|
21
33
|
rules: {
|
|
@@ -370,9 +382,7 @@ const configs = [
|
|
|
370
382
|
];
|
|
371
383
|
|
|
372
384
|
if (process.env.ENABLE_ESLINT_CORE_RULE_DUPLICATES === 'true') {
|
|
373
|
-
|
|
374
|
-
nature, only require when enabled */
|
|
375
|
-
const { builtinRules } = require('eslint/use-at-your-own-risk');
|
|
385
|
+
const { builtinRules } = await import('eslint/use-at-your-own-risk');
|
|
376
386
|
const complexity = builtinRules.get('complexity');
|
|
377
387
|
|
|
378
388
|
const complexityThresholdHigh = 15;
|
|
@@ -394,4 +404,4 @@ if (process.env.ENABLE_ESLINT_CORE_RULE_DUPLICATES === 'true') {
|
|
|
394
404
|
configs.push(coreDuplicateConfig);
|
|
395
405
|
}
|
|
396
406
|
|
|
397
|
-
|
|
407
|
+
export default defineConfig(configs);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
4
|
+
export default defineConfig({
|
|
6
5
|
files: ['**/*.{js,mjs,cjs}'],
|
|
7
6
|
name: 'eslint-comments (all files)',
|
|
8
7
|
plugins: { comments: eslintCommentsPlugin },
|
|
@@ -26,4 +25,4 @@ module.exports = {
|
|
|
26
25
|
],
|
|
27
26
|
'comments/require-description': 'error'
|
|
28
27
|
}
|
|
29
|
-
};
|
|
28
|
+
});
|
package/esm-config.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
files: ['**/*.{js,mjs}'],
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
files: ['**/*.js'],
|
|
7
6
|
languageOptions: {
|
|
8
7
|
sourceType: 'module'
|
|
9
8
|
},
|
|
10
|
-
name: 'esm (
|
|
9
|
+
name: 'esm (js files)',
|
|
11
10
|
plugins: { unicorn: unicornPlugin },
|
|
12
11
|
rules: {
|
|
13
|
-
'unicorn/prefer-export-from': 'error',
|
|
14
12
|
'unicorn/prefer-module': 'error',
|
|
15
|
-
'unicorn/prefer-node-protocol': 'error',
|
|
16
13
|
'unicorn/prefer-top-level-await': 'error'
|
|
17
14
|
}
|
|
18
|
-
};
|
|
15
|
+
});
|
package/jest-config.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import jestPlugin from 'eslint-plugin-jest';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
const globals = require('globals');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
5
|
+
export default defineConfig({
|
|
7
6
|
files: [
|
|
8
7
|
'**/__tests__/**/*.{js,mjs,cjs}',
|
|
9
8
|
'**/?(*.)+(spec|test).{js,mjs,cjs}'
|
|
@@ -87,4 +86,4 @@ module.exports = {
|
|
|
87
86
|
'jest/valid-expect-in-promise': 'error',
|
|
88
87
|
'jest/valid-title': 'error'
|
|
89
88
|
}
|
|
90
|
-
};
|
|
89
|
+
});
|
package/jsdoc-config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
4
|
+
export default defineConfig({
|
|
6
5
|
files: ['**/*.{js,mjs,cjs}'],
|
|
7
6
|
name: 'jsdoc (all files)',
|
|
8
7
|
plugins: { jsdoc: jsdocPlugin },
|
|
@@ -98,4 +97,4 @@ module.exports = {
|
|
|
98
97
|
],
|
|
99
98
|
'jsdoc/valid-types': 'error' // Recommended
|
|
100
99
|
}
|
|
101
|
-
};
|
|
100
|
+
});
|
package/node-config.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import nodePlugin from 'eslint-plugin-n';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
const globals = require('globals');
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
5
|
+
export default defineConfig({
|
|
7
6
|
files: ['**/*.{js,mjs,cjs}'],
|
|
8
7
|
languageOptions: {
|
|
9
8
|
globals: {
|
|
@@ -52,4 +51,4 @@ module.exports = {
|
|
|
52
51
|
'node/prefer-promises/fs': 'error',
|
|
53
52
|
'node/process-exit-as-throw': 'error'
|
|
54
53
|
}
|
|
55
|
-
};
|
|
54
|
+
});
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarongoldenthal/eslint-config-standard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.0",
|
|
4
4
|
"description": "Standard ESLint configuration settings",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"hooks:pre-commit": "npm run lint && npm run prettier:check",
|
|
7
|
-
"hooks:pre-push": "npm audit --audit-level=
|
|
8
|
+
"hooks:pre-push": "npm audit --audit-level=critical && npm test",
|
|
8
9
|
"lint": "npm run lint:js && npm run lint:md",
|
|
9
10
|
"lint:js": "eslint .",
|
|
10
11
|
"lint:md": "markdownlint-cli2 \"**/*.md\" \"#node_modules\"",
|
|
11
12
|
"prettier:check": "prettier --check .",
|
|
12
13
|
"prettier:fix": "prettier --write .",
|
|
13
|
-
"test": "
|
|
14
|
-
"test:no-coverage": "
|
|
14
|
+
"test": "vitest run --coverage",
|
|
15
|
+
"test:no-coverage": "vitest run"
|
|
15
16
|
},
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
@@ -25,6 +26,20 @@
|
|
|
25
26
|
"engines": {
|
|
26
27
|
"node": "^18.12.0 || ^20.9.0 || >=22.0.0"
|
|
27
28
|
},
|
|
29
|
+
"exports": {
|
|
30
|
+
"./base-configs": "./base-configs.js",
|
|
31
|
+
"./eslint-comments-config": "./eslint-comments-config.js",
|
|
32
|
+
"./esm-config": "./esm-config.js",
|
|
33
|
+
"./jest-config": "./jest-config.js",
|
|
34
|
+
"./jsdoc-config": "./jsdoc-config.js",
|
|
35
|
+
"./node-config": "./node-config.js",
|
|
36
|
+
"./playwright-config": "./playwright-config.js",
|
|
37
|
+
"./promise-config": "./promise-config.js",
|
|
38
|
+
"./recommended": "./recommended.js",
|
|
39
|
+
"./recommended-esm": "./recommended-esm.js",
|
|
40
|
+
"./unicorn-configs": "./unicorn-configs.js",
|
|
41
|
+
"./vitest-config": "./vitest-config.js"
|
|
42
|
+
},
|
|
28
43
|
"files": [
|
|
29
44
|
"*-config*.js",
|
|
30
45
|
"recommended*.js"
|
|
@@ -35,25 +50,26 @@
|
|
|
35
50
|
"homepage": "https://gitlab.com/gitlab-ci-utils/eslint-config-standard",
|
|
36
51
|
"dependencies": {
|
|
37
52
|
"@eslint-community/eslint-plugin-eslint-comments": "4.4.1",
|
|
38
|
-
"@vitest/eslint-plugin": "1.1.
|
|
39
|
-
"eslint-config-prettier": "10.
|
|
53
|
+
"@vitest/eslint-plugin": "1.1.38",
|
|
54
|
+
"eslint-config-prettier": "10.1.1",
|
|
40
55
|
"eslint-plugin-jest": "28.11.0",
|
|
41
|
-
"eslint-plugin-jsdoc": "50.6.
|
|
42
|
-
"eslint-plugin-n": "17.
|
|
56
|
+
"eslint-plugin-jsdoc": "50.6.8",
|
|
57
|
+
"eslint-plugin-n": "17.16.2",
|
|
43
58
|
"eslint-plugin-playwright": "2.2.0",
|
|
44
59
|
"eslint-plugin-promise": "7.2.1",
|
|
45
|
-
"eslint-plugin-unicorn": "
|
|
46
|
-
"globals": "
|
|
60
|
+
"eslint-plugin-unicorn": "57.0.0",
|
|
61
|
+
"globals": "16.0.0"
|
|
47
62
|
},
|
|
48
63
|
"devDependencies": {
|
|
49
|
-
"@eslint/config-inspector": "1.0.
|
|
50
|
-
"
|
|
64
|
+
"@eslint/config-inspector": "1.0.2",
|
|
65
|
+
"@vitest/coverage-v8": "3.0.9",
|
|
66
|
+
"eslint": "9.23.0",
|
|
51
67
|
"jest": "29.7.0",
|
|
52
|
-
"jest-junit": "16.0.0",
|
|
53
68
|
"markdownlint-cli2": "0.17.2",
|
|
54
|
-
"prettier": "3.
|
|
69
|
+
"prettier": "3.5.3",
|
|
70
|
+
"vitest": "3.0.9"
|
|
55
71
|
},
|
|
56
72
|
"peerDependencies": {
|
|
57
|
-
"eslint": "^9.
|
|
73
|
+
"eslint": "^9.22.0"
|
|
58
74
|
}
|
|
59
75
|
}
|
package/playwright-config.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const globals = require('globals');
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
import playwrightPlugin from 'eslint-plugin-playwright';
|
|
5
4
|
|
|
6
5
|
const maxExpects = 5;
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export default defineConfig({
|
|
9
8
|
files: ['**/*.pwtest.{js,mjs,cjs}'],
|
|
10
9
|
languageOptions: {
|
|
11
10
|
globals: {
|
|
@@ -65,4 +64,4 @@ module.exports = {
|
|
|
65
64
|
'playwright/valid-expect-in-promise': 'error',
|
|
66
65
|
'playwright/valid-title': 'error'
|
|
67
66
|
}
|
|
68
|
-
};
|
|
67
|
+
});
|
package/promise-config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
4
|
+
export default defineConfig({
|
|
6
5
|
files: ['**/*.{js,mjs,cjs}'],
|
|
7
6
|
name: 'promise (all files)',
|
|
8
7
|
plugins: { promise: promisePlugin },
|
|
@@ -26,4 +25,4 @@ module.exports = {
|
|
|
26
25
|
'promise/prefer-await-to-then': 'error',
|
|
27
26
|
'promise/valid-params': 'error'
|
|
28
27
|
}
|
|
29
|
-
};
|
|
28
|
+
});
|
package/recommended-esm.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import baseConfigs from './base-configs.js';
|
|
4
|
+
import eslintCommentsConfig from './eslint-comments-config.js';
|
|
5
|
+
import esmConfig from './esm-config.js';
|
|
6
|
+
import jsdocConfig from './jsdoc-config.js';
|
|
7
|
+
import nodeConfig from './node-config.js';
|
|
8
|
+
import playwrightConfig from './playwright-config.js';
|
|
9
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
10
|
+
import promiseConfig from './promise-config.js';
|
|
11
|
+
import unicornConfigs from './unicorn-configs.js';
|
|
12
|
+
import vitestConfig from './vitest-config.js';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
export default defineConfig([
|
|
15
15
|
eslintCommentsConfig,
|
|
16
16
|
jsdocConfig,
|
|
17
17
|
nodeConfig,
|
|
18
18
|
playwrightConfig,
|
|
19
19
|
promiseConfig,
|
|
20
|
-
|
|
20
|
+
unicornConfigs,
|
|
21
21
|
vitestConfig,
|
|
22
|
-
|
|
22
|
+
baseConfigs,
|
|
23
23
|
esmConfig,
|
|
24
24
|
prettierConfig
|
|
25
|
-
];
|
|
25
|
+
]);
|
package/recommended.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import baseConfigs from './base-configs.js';
|
|
4
|
+
import eslintCommentsConfig from './eslint-comments-config.js';
|
|
5
|
+
import jestConfig from './jest-config.js';
|
|
6
|
+
import jsdocConfig from './jsdoc-config.js';
|
|
7
|
+
import nodeConfig from './node-config.js';
|
|
8
|
+
import playwrightConfig from './playwright-config.js';
|
|
9
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
10
|
+
import promiseConfig from './promise-config.js';
|
|
11
|
+
import unicornConfigs from './unicorn-configs.js';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
export default defineConfig([
|
|
14
14
|
eslintCommentsConfig,
|
|
15
15
|
jestConfig,
|
|
16
16
|
jsdocConfig,
|
|
17
17
|
nodeConfig,
|
|
18
18
|
playwrightConfig,
|
|
19
19
|
promiseConfig,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
unicornConfigs,
|
|
21
|
+
baseConfigs,
|
|
22
22
|
{ name: 'prettier (all files)', ...prettierConfig }
|
|
23
|
-
];
|
|
23
|
+
]);
|
package/unicorn-configs.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = [
|
|
4
|
+
export default defineConfig([
|
|
6
5
|
{
|
|
7
6
|
files: ['**/*.{js,mjs,cjs}'],
|
|
8
7
|
name: 'unicorn (all files)',
|
|
@@ -10,6 +9,8 @@ module.exports = [
|
|
|
10
9
|
rules: {
|
|
11
10
|
'unicorn/better-regex': 'error',
|
|
12
11
|
'unicorn/catch-error-name': 'error', // Recommended
|
|
12
|
+
'unicorn/consistent-assert': 'error', // Recommended
|
|
13
|
+
'unicorn/consistent-date-clone': 'error', // Recommended
|
|
13
14
|
'unicorn/consistent-destructuring': 'error',
|
|
14
15
|
'unicorn/consistent-empty-array-spread': 'error', // Recommended
|
|
15
16
|
'unicorn/consistent-existence-index-check': 'error', // Recommended
|
|
@@ -24,6 +25,7 @@ module.exports = [
|
|
|
24
25
|
'unicorn/import-style': 'error', // Recommended
|
|
25
26
|
'unicorn/new-for-builtins': 'error', // Recommended
|
|
26
27
|
'unicorn/no-abusive-eslint-disable': 'error', // Recommended
|
|
28
|
+
'unicorn/no-accessor-recursion': 'error', // Recommended
|
|
27
29
|
'unicorn/no-anonymous-default-export': 'error', // Recommended
|
|
28
30
|
'unicorn/no-array-callback-reference': 'error', // Recommended
|
|
29
31
|
'unicorn/no-array-for-each': 'error', // Recommended
|
|
@@ -37,13 +39,14 @@ module.exports = [
|
|
|
37
39
|
'unicorn/no-empty-file': 'error', // Recommended
|
|
38
40
|
'unicorn/no-for-loop': 'error', // Recommended
|
|
39
41
|
'unicorn/no-hex-escape': 'error', // Recommended
|
|
40
|
-
'unicorn/no-instanceof-
|
|
42
|
+
'unicorn/no-instanceof-builtins': 'error', // Recommended
|
|
41
43
|
'unicorn/no-invalid-fetch-options': 'error', // Recommended
|
|
42
44
|
'unicorn/no-invalid-remove-event-listener': 'error', // Recommended
|
|
43
45
|
'unicorn/no-keyword-prefix': 'off', // Recommended
|
|
44
46
|
'unicorn/no-length-as-slice-end': 'error', // Recommended
|
|
45
47
|
'unicorn/no-lonely-if': 'error', // Recommended
|
|
46
48
|
'unicorn/no-magic-array-flat-depth': 'error', // Recommended
|
|
49
|
+
'unicorn/no-named-default': 'error', // Recommended
|
|
47
50
|
'unicorn/no-negated-condition': 'error', // Recommended
|
|
48
51
|
'unicorn/no-negation-in-equality-check': 'error', // Recommended
|
|
49
52
|
'unicorn/no-nested-ternary': 'error', // Recommended, Prettier
|
|
@@ -157,5 +160,13 @@ module.exports = [
|
|
|
157
160
|
// nested with the tests
|
|
158
161
|
'unicorn/consistent-function-scoping': 'off'
|
|
159
162
|
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
files: ['**/*.mjs'],
|
|
166
|
+
name: 'esm (mjs files)',
|
|
167
|
+
rules: {
|
|
168
|
+
'unicorn/prefer-module': 'error',
|
|
169
|
+
'unicorn/prefer-top-level-await': 'error'
|
|
170
|
+
}
|
|
160
171
|
}
|
|
161
|
-
];
|
|
172
|
+
]);
|
package/vitest-config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import vitestPlugin from '@vitest/eslint-plugin';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
4
|
+
export default defineConfig({
|
|
6
5
|
files: ['**/__tests__/**/*.{js,mjs}', '**/?(*.)+(spec|test).{js,mjs}'],
|
|
7
6
|
name: 'vitest (test files)',
|
|
8
7
|
plugins: { vitest: vitestPlugin },
|
|
@@ -27,7 +26,6 @@ module.exports = {
|
|
|
27
26
|
'vitest/no-conditional-in-test': 'error',
|
|
28
27
|
'vitest/no-conditional-tests': 'error',
|
|
29
28
|
'vitest/no-disabled-tests': 'error',
|
|
30
|
-
'vitest/no-done-callback': 'error',
|
|
31
29
|
'vitest/no-duplicate-hooks': 'error',
|
|
32
30
|
'vitest/no-focused-tests': 'error',
|
|
33
31
|
'vitest/no-hooks': 'off',
|
|
@@ -74,4 +72,4 @@ module.exports = {
|
|
|
74
72
|
'vitest/valid-expect': 'error', // Recommended
|
|
75
73
|
'vitest/valid-title': 'error' // Recommended
|
|
76
74
|
}
|
|
77
|
-
};
|
|
75
|
+
});
|