@ornikar/eslint-config 22.7.3 → 22.7.4
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/CHANGELOG.md +8 -0
- package/README.md +62 -33
- package/_shared.js +9 -11
- package/graphql.js +12 -10
- package/index.js +24 -16
- package/node-module-override.js +12 -6
- package/node.js +5 -3
- package/package.json +4 -3
- package/rollup.js +9 -5
- package/root.js +17 -14
- package/rules/best-practices.js +11 -9
- package/rules/imports.js +10 -8
- package/rules/jest.js +13 -7
- package/rules/node-override.js +25 -23
- package/rules/node.js +28 -32
- package/rules/ornikar.js +8 -4
- package/rules/prettier.js +13 -10
- package/rules/security.js +21 -19
- package/rules/sort-imports-exports.js +15 -11
- package/rules/style.js +33 -31
- package/rules/unicorn.js +218 -214
- package/tests-override.js +17 -18
- package/.eslintrc.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## <small>22.7.4 (2026-05-28)</small>
|
|
7
|
+
|
|
8
|
+
* feat!: ESLint flat-config migration [OSE-20589] (#820) ([6c7897b](https://github.com/ornikar/eslint-configs/commit/6c7897b)), closes [#820](https://github.com/ornikar/eslint-configs/issues/820)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## <small>22.7.3 (2026-05-26)</small>
|
|
7
15
|
|
|
8
16
|
* feat!: ESLint v9 engine bump (legacy .eslintrc preserved) [OSE-20589] (#818) ([9683864](https://github.com/ornikar/eslint-configs/commit/9683864)), closes [#818](https://github.com/ornikar/eslint-configs/issues/818)
|
package/README.md
CHANGED
|
@@ -15,76 +15,105 @@ Also see:
|
|
|
15
15
|
|
|
16
16
|
## How to install
|
|
17
17
|
|
|
18
|
+
These configs ship as flat-config arrays. Require the subpath you need and spread it into your `eslint.config.js`.
|
|
19
|
+
|
|
18
20
|
### root
|
|
19
21
|
|
|
20
22
|
1. `npm install --save-dev eslint @ornikar/eslint-config`
|
|
21
|
-
2.
|
|
23
|
+
2. In your root `eslint.config.js`:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const ornikarRoot = require('@ornikar/eslint-config/root');
|
|
27
|
+
|
|
28
|
+
module.exports = [...ornikarRoot];
|
|
29
|
+
```
|
|
22
30
|
|
|
23
31
|
### node without babel or typescript
|
|
24
32
|
|
|
25
33
|
1. `npm install --save-dev eslint @ornikar/eslint-config`
|
|
26
|
-
2.
|
|
34
|
+
2. In your source `eslint.config.js`:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
const ornikarNode = require('@ornikar/eslint-config/node');
|
|
38
|
+
|
|
39
|
+
module.exports = [...ornikarNode];
|
|
40
|
+
```
|
|
27
41
|
|
|
28
42
|
### node with babel (deprecated, please use typescript instead)
|
|
29
43
|
|
|
30
44
|
1. `npm install --save-dev eslint @ornikar/eslint-config @ornikar/eslint-config-babel`
|
|
31
|
-
2.
|
|
45
|
+
2. In your source `eslint.config.js`:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const babelConfig = require('@ornikar/eslint-config-babel');
|
|
49
|
+
|
|
50
|
+
module.exports = [...babelConfig];
|
|
51
|
+
```
|
|
32
52
|
|
|
33
53
|
### node with typescript
|
|
34
54
|
|
|
35
55
|
1. `npm install --save-dev eslint @ornikar/eslint-config @ornikar/eslint-config-typescript`
|
|
36
|
-
2.
|
|
56
|
+
2. In your source `eslint.config.js`:
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
const tsNode = require('@ornikar/eslint-config-typescript/node');
|
|
60
|
+
|
|
61
|
+
module.exports = [...tsNode];
|
|
62
|
+
```
|
|
37
63
|
|
|
38
64
|
### module override
|
|
39
65
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
66
|
+
In flat config, file-specific overrides are separate entries with `files:`. Use `defineConfig` from `eslint/config` so the `extends:` keyword works:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const { defineConfig } = require('eslint/config');
|
|
70
|
+
const ornikarRoot = require('@ornikar/eslint-config/root');
|
|
71
|
+
const nodeModuleOverride = require('@ornikar/eslint-config/node-module-override');
|
|
72
|
+
|
|
73
|
+
module.exports = defineConfig([
|
|
74
|
+
...ornikarRoot,
|
|
75
|
+
{
|
|
76
|
+
files: ['test-setup.js'],
|
|
77
|
+
extends: [nodeModuleOverride],
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
51
80
|
```
|
|
52
81
|
|
|
53
82
|
## How to configure a project
|
|
54
83
|
|
|
55
|
-
### Two
|
|
84
|
+
### Two configuration files
|
|
56
85
|
|
|
57
|
-
In a project you should have two
|
|
86
|
+
In a project you should have two configuration files:
|
|
58
87
|
|
|
59
|
-
-
|
|
60
|
-
- /{src,lib}
|
|
88
|
+
- /eslint.config.js
|
|
89
|
+
- /{src,lib}/eslint.config.js
|
|
61
90
|
|
|
62
91
|
If the project is compiled, use `src` for source and `dist` for compilation with rollup.
|
|
63
92
|
If the project is not compiled, use `lib`.
|
|
64
|
-
If the project is CRA, next or
|
|
93
|
+
If the project is CRA, next or built with webpack, use `src` for source and `build` or the build directory your tool uses.
|
|
65
94
|
|
|
66
95
|
Using two config files is important:
|
|
67
96
|
|
|
68
|
-
- the root
|
|
69
|
-
- the source
|
|
97
|
+
- the root config is for config files and scripts. It should allow dev dependencies
|
|
98
|
+
- the source config is for your source and test files
|
|
70
99
|
|
|
71
|
-
|
|
100
|
+
ESLint v9 flat config does not cascade like legacy `.eslintrc` did — only the nearest `eslint.config.js` to the file being linted is used. Compose what you need at each location.
|
|
72
101
|
|
|
73
|
-
|
|
102
|
+
### Use `ignores`
|
|
74
103
|
|
|
75
|
-
|
|
104
|
+
Replace `.eslintignore` with the `ignores` property in your flat config:
|
|
76
105
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
106
|
+
```js
|
|
107
|
+
module.exports = [{ ignores: ['dist/**', 'coverage/**'] }, ...ornikarRoot];
|
|
108
|
+
```
|
|
80
109
|
|
|
81
110
|
### Use `--report-unused-disable-directives`
|
|
82
111
|
|
|
83
|
-
Really
|
|
112
|
+
Really useful tip — it prevents leaving unused eslint-disable directives.
|
|
84
113
|
|
|
85
|
-
### Lerna/Workspaces
|
|
114
|
+
### Lerna/Workspaces configuration
|
|
86
115
|
|
|
87
|
-
Assuming your package.json
|
|
116
|
+
Assuming your `package.json` has `"workspaces": ["packages/*"]`:
|
|
88
117
|
|
|
89
|
-
-
|
|
90
|
-
- /packages/\*/{src,lib}
|
|
118
|
+
- /eslint.config.js
|
|
119
|
+
- /packages/\*/{src,lib}/eslint.config.js
|
package/_shared.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
].map(require.resolve),
|
|
13
|
-
};
|
|
3
|
+
const bestPractices = require('./rules/best-practices');
|
|
4
|
+
const imports = require('./rules/imports');
|
|
5
|
+
const ornikar = require('./rules/ornikar');
|
|
6
|
+
const security = require('./rules/security');
|
|
7
|
+
const sortImportsExports = require('./rules/sort-imports-exports');
|
|
8
|
+
const style = require('./rules/style');
|
|
9
|
+
const unicorn = require('./rules/unicorn');
|
|
10
|
+
|
|
11
|
+
module.exports = [...bestPractices, ...ornikar, ...imports, ...style, ...sortImportsExports, ...security, ...unicorn];
|
package/graphql.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
rules: {
|
|
6
|
+
// https://eslint.org/docs/rules/no-underscore-dangle
|
|
7
|
+
'no-underscore-dangle': [
|
|
8
|
+
'error',
|
|
9
|
+
{
|
|
10
|
+
allow: ['__typename'],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
12
14
|
},
|
|
13
|
-
|
|
15
|
+
];
|
package/index.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const { FlatCompat } = require('@eslint/eslintrc');
|
|
4
|
+
const sharedConfig = require('./_shared');
|
|
5
|
+
const prettierConfig = require('./rules/prettier');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
sourceType: 'script',
|
|
8
|
-
ecmaVersion: 2021,
|
|
9
|
-
},
|
|
7
|
+
const compat = new FlatCompat({ baseDirectory: __dirname });
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
module.exports = [
|
|
10
|
+
...compat.extends('eslint-config-airbnb-base'),
|
|
11
|
+
...sharedConfig,
|
|
12
|
+
...prettierConfig,
|
|
13
|
+
{
|
|
14
|
+
languageOptions: {
|
|
15
|
+
sourceType: 'script',
|
|
16
|
+
ecmaVersion: 2021,
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
strict: ['error', 'safe'],
|
|
20
|
+
'import/extensions': [
|
|
21
|
+
'error',
|
|
22
|
+
'ignorePackages',
|
|
23
|
+
{
|
|
24
|
+
js: 'never',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
20
28
|
},
|
|
21
|
-
|
|
29
|
+
];
|
package/node-module-override.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const nPlugin = require('eslint-plugin-n');
|
|
4
|
+
const nodeOverride = require('./rules/node-override');
|
|
5
|
+
|
|
3
6
|
/* prefer usage of .mjs files over this override */
|
|
4
|
-
module.exports =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
module.exports = [
|
|
8
|
+
nPlugin.configs['flat/recommended-module'],
|
|
9
|
+
...nodeOverride,
|
|
10
|
+
{
|
|
11
|
+
languageOptions: {
|
|
12
|
+
// top level await is introduced in ecmaVersion: 2022 but supported since node 14
|
|
13
|
+
ecmaVersion: 2022,
|
|
14
|
+
},
|
|
9
15
|
},
|
|
10
|
-
|
|
16
|
+
];
|
package/node.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const nodeRules = require('./rules/node');
|
|
4
|
+
const prettierConfig = require('./rules/prettier');
|
|
5
|
+
const indexConfig = require('.');
|
|
6
|
+
|
|
7
|
+
module.exports = [...indexConfig, ...nodeRules, ...prettierConfig];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornikar/eslint-config",
|
|
3
|
-
"version": "22.7.
|
|
3
|
+
"version": "22.7.4",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "@ornikar/eslint-config",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"access": "public"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@
|
|
19
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
20
|
+
"@ornikar/eslint-plugin-ornikar": "22.7.4",
|
|
20
21
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
21
22
|
"eslint-config-prettier": "^10.0.0",
|
|
22
23
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -37,6 +38,6 @@
|
|
|
37
38
|
"prettier": "2.8.8"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {
|
|
40
|
-
"lint:eslint": "
|
|
41
|
+
"lint:eslint": "yarn ../.. eslint --report-unused-disable-directives --quiet @ornikar/eslint-config"
|
|
41
42
|
}
|
|
42
43
|
}
|
package/rollup.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// See https://github.com/ornikar/shared-configs/tree/master/%40ornikar/rollup-config
|
|
4
|
-
module.exports =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
module.exports = [
|
|
5
|
+
{
|
|
6
|
+
languageOptions: {
|
|
7
|
+
globals: {
|
|
8
|
+
__DEV__: 'writable',
|
|
9
|
+
__TARGET__: 'writable',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
8
12
|
},
|
|
9
|
-
|
|
13
|
+
];
|
package/root.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
extends: ['./node'].map(require.resolve),
|
|
3
|
+
const nodeConfig = require('./node');
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
module.exports = [
|
|
6
|
+
...nodeConfig,
|
|
7
|
+
{
|
|
8
|
+
rules: {
|
|
9
|
+
'no-console': 'off',
|
|
10
|
+
'import/no-extraneous-dependencies': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
devDependencies: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
// Allow non-literal fs filename for dev scripts
|
|
18
|
+
'security/detect-non-literal-fs-filename': 'off',
|
|
19
|
+
'security/detect-non-literal-require': 'off',
|
|
20
|
+
},
|
|
18
21
|
},
|
|
19
|
-
|
|
22
|
+
];
|
package/rules/best-practices.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
rules: {
|
|
6
|
+
// https://eslint.org/docs/rules/require-await
|
|
7
|
+
'require-await': 'error',
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
// https://eslint.org/docs/rules/no-warning-comments
|
|
10
|
+
'no-warning-comments': ['error', { terms: ['fixme', 'xxx', 'console.'], location: 'start' }],
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
// https://eslint.org/docs/rules/max-depth
|
|
13
|
+
'max-depth': ['warn', 6],
|
|
14
|
+
},
|
|
13
15
|
},
|
|
14
|
-
|
|
16
|
+
];
|
package/rules/imports.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports =
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
rules: {
|
|
6
|
+
/* https://ornikar.atlassian.net/wiki/spaces/TECH/pages/2670330094/Avoid+default+export */
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
|
|
9
|
+
'import/prefer-default-export': 'off',
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-default-export.md
|
|
12
|
+
'import/no-default-export': 'error',
|
|
13
|
+
},
|
|
12
14
|
},
|
|
13
|
-
|
|
15
|
+
];
|
package/rules/jest.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const jestPlugin = require('eslint-plugin-jest');
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
plugins: { jest: jestPlugin },
|
|
8
|
+
// `eslint-plugin-jest` ships the Jest test globals (describe/it/expect/…) here.
|
|
9
|
+
languageOptions: jestPlugin.configs['flat/recommended'].languageOptions,
|
|
10
|
+
rules: {
|
|
11
|
+
'jest/no-disabled-tests': 'error',
|
|
12
|
+
'jest/no-focused-tests': 'error',
|
|
13
|
+
'jest/prefer-called-with': 'error',
|
|
14
|
+
},
|
|
9
15
|
},
|
|
10
|
-
|
|
16
|
+
];
|
package/rules/node-override.js
CHANGED
|
@@ -2,31 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
const airbnbStyleRules = require('eslint-config-airbnb-base/rules/style');
|
|
4
4
|
|
|
5
|
-
module.exports =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
rules: {
|
|
8
|
+
// already checked by import plugin
|
|
9
|
+
'n/no-unpublished-require': 'off',
|
|
10
|
+
'n/no-unpublished-import': 'off',
|
|
11
|
+
'n/no-extraneous-require': 'off',
|
|
12
|
+
'n/no-extraneous-import': 'off',
|
|
13
|
+
'n/no-missing-require': 'off',
|
|
14
|
+
'n/no-missing-import': 'off',
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
// Use for-of instead of for
|
|
17
|
+
'unicorn/no-for-loop': 'error',
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// allow process.exit, disallowed when not used in script via https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-process-exit.md
|
|
20
|
+
'no-process-exit': 'off',
|
|
21
|
+
'n/no-process-exit': 'off',
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
// Allow for-of, now supported by node 6
|
|
24
|
+
'no-restricted-syntax': [
|
|
25
|
+
'error',
|
|
26
|
+
...airbnbStyleRules.rules['no-restricted-syntax']
|
|
27
|
+
.slice(1)
|
|
28
|
+
.filter(({ selector }) => selector !== 'ForOfStatement'),
|
|
29
|
+
],
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
'unicorn/prefer-at': 'error',
|
|
32
|
+
},
|
|
31
33
|
},
|
|
32
|
-
|
|
34
|
+
];
|
package/rules/node.js
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
extends: ['plugin:n/recommended', require.resolve('./node-override')],
|
|
3
|
+
const nPlugin = require('eslint-plugin-n');
|
|
4
|
+
const nodeOverride = require('./node-override');
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
module.exports = [
|
|
7
|
+
// `eslint-plugin-n`'s flat/recommended ships the Node globals and sourceType.
|
|
8
|
+
nPlugin.configs['flat/recommended'],
|
|
9
|
+
...nodeOverride,
|
|
10
|
+
{
|
|
11
|
+
languageOptions: {
|
|
12
|
+
// top level await is introduced in ecmaVersion: 2022 but supported since node 14
|
|
13
|
+
ecmaVersion: 2022,
|
|
14
|
+
},
|
|
10
15
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
node: true,
|
|
15
|
-
es6: true,
|
|
16
|
+
{
|
|
17
|
+
...nPlugin.configs['flat/recommended-script'],
|
|
18
|
+
files: ['**/*.cjs'],
|
|
16
19
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
files: ['*.mjs'],
|
|
25
|
-
extends: ['plugin:n/recommended-module', require.resolve('./node-override')],
|
|
26
|
-
parserOptions: {
|
|
27
|
-
// top level await is introduced in ecmaVersion: 2022 but supported since node 14
|
|
28
|
-
ecmaVersion: 2022,
|
|
29
|
-
},
|
|
20
|
+
...nodeOverride.map((entry) => ({ ...entry, files: ['**/*.cjs'] })),
|
|
21
|
+
{
|
|
22
|
+
...nPlugin.configs['flat/recommended-module'],
|
|
23
|
+
files: ['**/*.mjs'],
|
|
24
|
+
languageOptions: {
|
|
25
|
+
...nPlugin.configs['flat/recommended-module'].languageOptions,
|
|
26
|
+
ecmaVersion: 2022,
|
|
30
27
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
28
|
+
},
|
|
29
|
+
...nodeOverride.map((entry) => ({ ...entry, files: ['**/*.mjs'] })),
|
|
30
|
+
{
|
|
31
|
+
files: ['**/scripts/**'],
|
|
32
|
+
rules: { 'n/hashbang': 'off' },
|
|
33
|
+
},
|
|
34
|
+
];
|
package/rules/ornikar.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const ornikarPlugin = require('@ornikar/eslint-plugin-ornikar');
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
{
|
|
7
|
+
plugins: { '@ornikar/ornikar': ornikarPlugin },
|
|
8
|
+
rules: ornikarPlugin.configs.recommended.rules,
|
|
9
|
+
},
|
|
10
|
+
];
|
package/rules/prettier.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
extends: ['eslint-config-prettier'].map(require.resolve),
|
|
3
|
+
const prettierConfig = require('eslint-config-prettier');
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
module.exports = [
|
|
6
|
+
prettierConfig,
|
|
7
|
+
{
|
|
8
|
+
rules: {
|
|
9
|
+
// https://github.com/prettier/eslint-config-prettier#curly
|
|
10
|
+
// prettier doesn't enforce {} with multiline
|
|
11
|
+
curly: ['error', 'multi-line'],
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
// https://github.com/prettier/eslint-config-prettier#quotes
|
|
14
|
+
// prettier doesn't change backtick to single
|
|
15
|
+
quotes: ['error', 'single', { avoidEscape: true }],
|
|
16
|
+
},
|
|
14
17
|
},
|
|
15
|
-
|
|
18
|
+
];
|