@futagoza/eslint-config-node 16.0.0 → 17.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/10.js +6 -5
- package/12.js +6 -5
- package/14.js +6 -5
- package/16.js +13 -0
- package/18.js +13 -0
- package/20.js +13 -0
- package/22.js +13 -0
- package/24.js +13 -0
- package/26.js +13 -0
- package/4.js +6 -5
- package/6.js +6 -5
- package/8.js +6 -5
- package/README.md +81 -46
- package/index.js +45 -287
- package/internal/create-node-config.js +80 -20
- package/package.json +7 -5
- package/rules/deprecated.js +37 -0
- package/rules/general.js +13 -0
- package/rules/layout.js +13 -0
- package/rules/problem.js +144 -0
- package/rules/suggestion.js +198 -0
- package/test.js +34 -0
- package/deprecated.js +0 -20
- package/internal/index.js +0 -5
- package/internal/typescript-overrides.js +0 -12
package/10.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2018,
|
|
9
7
|
node: 10,
|
|
10
8
|
},
|
|
11
9
|
|
|
12
|
-
} )
|
|
10
|
+
} )
|
|
11
|
+
|
|
12
|
+
export const config = x.ConfigObject
|
|
13
|
+
export default x.ConfigArray
|
package/12.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2019,
|
|
9
7
|
node: 12,
|
|
10
8
|
},
|
|
11
9
|
|
|
12
|
-
} )
|
|
10
|
+
} )
|
|
11
|
+
|
|
12
|
+
export const config = x.ConfigObject
|
|
13
|
+
export default x.ConfigArray
|
package/14.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2020,
|
|
9
7
|
node: 14,
|
|
10
8
|
},
|
|
11
9
|
|
|
12
|
-
} )
|
|
10
|
+
} )
|
|
11
|
+
|
|
12
|
+
export const config = x.ConfigObject
|
|
13
|
+
export default x.ConfigArray
|
package/16.js
ADDED
package/18.js
ADDED
package/20.js
ADDED
package/22.js
ADDED
package/24.js
ADDED
package/26.js
ADDED
package/4.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2015,
|
|
@@ -16,4 +14,7 @@ module.exports = CreateNodeConfig( {
|
|
|
16
14
|
|
|
17
15
|
},
|
|
18
16
|
|
|
19
|
-
} )
|
|
17
|
+
} )
|
|
18
|
+
|
|
19
|
+
export const config = x.ConfigObject
|
|
20
|
+
export default x.ConfigArray
|
package/6.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2015,
|
|
9
7
|
node: 6,
|
|
10
8
|
},
|
|
11
9
|
|
|
12
|
-
} )
|
|
10
|
+
} )
|
|
11
|
+
|
|
12
|
+
export const config = x.ConfigObject
|
|
13
|
+
export default x.ConfigArray
|
package/8.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import CreateConfig from "./internal/create-node-config.js"
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
module.exports = CreateNodeConfig( {
|
|
3
|
+
const x = await CreateConfig( {
|
|
6
4
|
|
|
7
5
|
versions: {
|
|
8
6
|
es: 2017,
|
|
9
7
|
node: 8,
|
|
10
8
|
},
|
|
11
9
|
|
|
12
|
-
} )
|
|
10
|
+
} )
|
|
11
|
+
|
|
12
|
+
export const config = x.ConfigObject
|
|
13
|
+
export default x.ConfigArray
|
package/README.md
CHANGED
|
@@ -1,46 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
1
|
+
> This package contains configuration files for ESLint v10+<br>
|
|
2
|
+
|
|
3
|
+
These are configuration files for ESLint that are used to lint my Node.js projects.
|
|
4
|
+
|
|
5
|
+
**NOTE:** Apart from the default configuration, all configurations extend [@futagoza/eslint-config-javascript](https://www.npmjs.com/package/@futagoza/eslint-config-javascript) (which itself extends [@futagoza/eslint-config-core](https://www.npmjs.com/package/@futagoza/eslint-config-core)), so you don't have to include either as a dependency when using this package.
|
|
6
|
+
|
|
7
|
+
## installation
|
|
8
|
+
|
|
9
|
+
```console
|
|
10
|
+
$ npm i --save-dev @futagoza/eslint-config-node
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## usage
|
|
14
|
+
|
|
15
|
+
Put the following into your eslint configuration file:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { defineConfig } from "eslint/config"
|
|
19
|
+
import nodeConfig from "@futagoza/eslint-config-node"
|
|
20
|
+
|
|
21
|
+
// Used alongside other configurations:
|
|
22
|
+
export default [
|
|
23
|
+
|
|
24
|
+
// ...
|
|
25
|
+
|
|
26
|
+
nodeConfig,
|
|
27
|
+
|
|
28
|
+
// ...
|
|
29
|
+
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
// Used as base configuration for other configurations:
|
|
33
|
+
export default defineConfig(
|
|
34
|
+
{
|
|
35
|
+
|
|
36
|
+
// ...
|
|
37
|
+
|
|
38
|
+
extends: [ nodeConfig ],
|
|
39
|
+
|
|
40
|
+
// ...
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// direct access to unprocessed config object
|
|
46
|
+
import { config } from "@futagoza/eslint-config-node"
|
|
47
|
+
|
|
48
|
+
// direct access to `eslint-plugin-n` rules used in this config
|
|
49
|
+
import { configRules } from "@futagoza/eslint-config-node"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## configurations
|
|
53
|
+
|
|
54
|
+
A list of usable configurations:
|
|
55
|
+
|
|
56
|
+
- __`@futagoza/eslint-config-node`__ (_default_, extends the below auto-generated _@futagoza/eslint-config-node/rules/*_ configurations)
|
|
57
|
+
- __`@futagoza/eslint-config-node/rules/deprecated.js`__
|
|
58
|
+
- __`@futagoza/eslint-config-node/rules/general.js`__
|
|
59
|
+
- __`@futagoza/eslint-config-node/rules/layout.js`__
|
|
60
|
+
- __`@futagoza/eslint-config-node/rules/problem.js`__
|
|
61
|
+
- __`@futagoza/eslint-config-node/rules/suggestion.js`__
|
|
62
|
+
|
|
63
|
+
These configurations target LTS versions (and from 2026, current versions) of Node:
|
|
64
|
+
|
|
65
|
+
- __`@futagoza/eslint-config-node/4.js`__
|
|
66
|
+
- __`@futagoza/eslint-config-node/6.js`__
|
|
67
|
+
- __`@futagoza/eslint-config-node/8.js`__
|
|
68
|
+
- __`@futagoza/eslint-config-node/10.js`__
|
|
69
|
+
- __`@futagoza/eslint-config-node/12.js`__
|
|
70
|
+
- __`@futagoza/eslint-config-node/14.js`__
|
|
71
|
+
- __`@futagoza/eslint-config-node/16.js`__
|
|
72
|
+
- __`@futagoza/eslint-config-node/18.js`__
|
|
73
|
+
- __`@futagoza/eslint-config-node/20.js`__
|
|
74
|
+
- __`@futagoza/eslint-config-node/22.js`__
|
|
75
|
+
- __`@futagoza/eslint-config-node/24.js`__
|
|
76
|
+
- __`@futagoza/eslint-config-node/26.js`__
|
|
77
|
+
|
|
78
|
+
## license
|
|
79
|
+
|
|
80
|
+
Copyright © 2017+ Futago-za Ryuu<br>
|
|
81
|
+
Released under the MIT License, [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)
|
package/index.js
CHANGED
|
@@ -1,292 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from "eslint/config"
|
|
2
|
+
import node from "eslint-plugin-n"
|
|
3
|
+
import globals from "@futagoza/eslint-config-globals/node.js"
|
|
4
|
+
import { config as DeprecatedConfig } from "./rules/deprecated.js"
|
|
5
|
+
import { config as GeneralConfig } from "./rules/general.js"
|
|
6
|
+
import { config as LayoutConfig } from "./rules/layout.js"
|
|
7
|
+
import { config as ProblemConfig } from "./rules/problem.js"
|
|
8
|
+
import { config as SuggestionConfig } from "./rules/suggestion.js"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `eslint-plugin-n` rules
|
|
12
|
+
*/
|
|
13
|
+
export const ConfigRules = {
|
|
14
|
+
...DeprecatedConfig.rules,
|
|
15
|
+
...GeneralConfig.rules,
|
|
16
|
+
...LayoutConfig.rules,
|
|
17
|
+
...ProblemConfig.rules,
|
|
18
|
+
...SuggestionConfig.rules,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Raw config for `@futagoza/eslint-config-node`
|
|
23
|
+
*
|
|
24
|
+
* **NOTE:** Will not work properly with ESLint until passed through `require( "eslint/config" ).defineConfig`
|
|
25
|
+
*/
|
|
26
|
+
export const config = {
|
|
27
|
+
|
|
28
|
+
name: "@futagoza/eslint-config-node",
|
|
29
|
+
|
|
30
|
+
plugins: {
|
|
31
|
+
|
|
32
|
+
"n": node,
|
|
2
33
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"extends": [
|
|
6
|
-
|
|
7
|
-
"@futagoza/globals/node",
|
|
8
|
-
"@futagoza/javascript/strict",
|
|
9
|
-
|
|
10
|
-
],
|
|
11
|
-
|
|
12
|
-
"plugins": [ "node" ],
|
|
13
|
-
|
|
14
|
-
"overrides": [
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
"files": [ "*.mjs" ],
|
|
18
|
-
"extends": "@futagoza/javascript/modules",
|
|
34
|
+
},
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
extends: [
|
|
37
|
+
globals,
|
|
38
|
+
DeprecatedConfig,
|
|
39
|
+
GeneralConfig,
|
|
40
|
+
LayoutConfig,
|
|
41
|
+
ProblemConfig,
|
|
42
|
+
SuggestionConfig,
|
|
21
43
|
],
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* --------------- eslint-plugin-node | Possible Errors --------------- */
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* require error handling in callbacks
|
|
29
|
-
*
|
|
30
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/handle-callback-err.md
|
|
31
|
-
*/
|
|
32
|
-
"node/handle-callback-err": "off",
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Ensure Node.js-style error-first callback pattern is followed
|
|
36
|
-
*
|
|
37
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-callback-literal.md
|
|
38
|
-
*/
|
|
39
|
-
"node/no-callback-literal": "off",
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Disallow the assignment to `exports`.
|
|
43
|
-
*
|
|
44
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-exports-assign.md
|
|
45
|
-
*/
|
|
46
|
-
"node/no-exports-assign": "error",
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Disallow `import` declarations of extraneous packages.
|
|
50
|
-
*
|
|
51
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-extraneous-import.md
|
|
52
|
-
*/
|
|
53
|
-
"node/no-extraneous-import": "off",
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Disallow `require()` expressions of extraneous packages.
|
|
57
|
-
*
|
|
58
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-extraneous-require.md
|
|
59
|
-
*/
|
|
60
|
-
"node/no-extraneous-require": "off",
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Disallow `import` declarations for files that don't exist.
|
|
64
|
-
*
|
|
65
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-import.md
|
|
66
|
-
*/
|
|
67
|
-
"node/no-missing-import": "off",
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Disallow `require()`s for files that don't exist.
|
|
71
|
-
*
|
|
72
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-missing-require.md
|
|
73
|
-
*/
|
|
74
|
-
"node/no-missing-require": "off",
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* disallow `new` operators with calls to `require`
|
|
78
|
-
*
|
|
79
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-new-require.md
|
|
80
|
-
*/
|
|
81
|
-
"node/no-new-require": "off",
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* disallow string concatenation with `__dirname` and `__filename`
|
|
85
|
-
*
|
|
86
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-path-concat.md
|
|
87
|
-
*/
|
|
88
|
-
"node/no-path-concat": "warn",
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* disallow the use of `process.exit()`
|
|
92
|
-
*
|
|
93
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-exit.md
|
|
94
|
-
*/
|
|
95
|
-
"node/no-process-exit": "off",
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Disallow `bin` files that npm ignores.
|
|
99
|
-
*
|
|
100
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-bin.md
|
|
101
|
-
*/
|
|
102
|
-
"node/no-unpublished-bin": "off",
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Disallow `import` declarations for files that npm ignores.
|
|
106
|
-
*
|
|
107
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-import.md
|
|
108
|
-
*/
|
|
109
|
-
"node/no-unpublished-import": "off",
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Disallow `require()`s for files that npm ignores.
|
|
113
|
-
*
|
|
114
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unpublished-require.md
|
|
115
|
-
*/
|
|
116
|
-
"node/no-unpublished-require": "off",
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Disallow unsupported ECMAScript built-ins on the specified version.
|
|
120
|
-
*
|
|
121
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/es-builtins.md
|
|
122
|
-
*/
|
|
123
|
-
"node/no-unsupported-features/es-builtins": "off",
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Disallow unsupported ECMAScript syntax on the specified version.
|
|
127
|
-
*
|
|
128
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
129
|
-
*/
|
|
130
|
-
"node/no-unsupported-features/es-syntax": "off",
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Disallow unsupported Node.js built-in APIs on the specified version.
|
|
134
|
-
*
|
|
135
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
136
|
-
*/
|
|
137
|
-
"node/no-unsupported-features/node-builtins": "off",
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Make the same code path as throw at `process.exit()`.
|
|
141
|
-
*
|
|
142
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/process-exit-as-throw.md
|
|
143
|
-
*/
|
|
144
|
-
"node/process-exit-as-throw": "off",
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* 🔧 Suggest correct usage of shebang.
|
|
148
|
-
*
|
|
149
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/shebang.md
|
|
150
|
-
*/
|
|
151
|
-
"node/shebang": "error",
|
|
152
|
-
|
|
153
|
-
/* --------------- eslint-plugin-node | Best Practices --------------- */
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Disallow deprecated API.
|
|
157
|
-
*
|
|
158
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md
|
|
159
|
-
*/
|
|
160
|
-
"node/no-deprecated-api": "warn",
|
|
161
|
-
|
|
162
|
-
/* --------------- eslint-plugin-node | Stylistic Issues --------------- */
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* require `return` statements after callbacks
|
|
166
|
-
*
|
|
167
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/callback-return.md
|
|
168
|
-
*/
|
|
169
|
-
"node/callback-return": "off",
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Enforce either `module.exports` or `exports`.
|
|
173
|
-
*
|
|
174
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/exports-style.md
|
|
175
|
-
*/
|
|
176
|
-
"node/exports-style": "off",
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* 🔧 Enforce the style of file extensions in `import` declarations.
|
|
180
|
-
*
|
|
181
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/file-extension-in-import.md
|
|
182
|
-
*/
|
|
183
|
-
"node/file-extension-in-import": "off",
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* require `require()` calls to be placed at top-level module scope
|
|
187
|
-
*
|
|
188
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/global-require.md
|
|
189
|
-
*/
|
|
190
|
-
"node/global-require": "off",
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* disallow `require` calls to be mixed with regular variable declarations
|
|
194
|
-
*
|
|
195
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-mixed-requires.md
|
|
196
|
-
*/
|
|
197
|
-
"node/no-mixed-requires": "off",
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* disallow the use of `process.env`
|
|
201
|
-
*
|
|
202
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-process-env.md
|
|
203
|
-
*/
|
|
204
|
-
"node/no-process-env": "off",
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* disallow specified modules when loaded by `import` declarations
|
|
208
|
-
*
|
|
209
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-restricted-import.md
|
|
210
|
-
*/
|
|
211
|
-
"node/no-restricted-import": "off",
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* disallow specified modules when loaded by `require`
|
|
215
|
-
*
|
|
216
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-restricted-require.md
|
|
217
|
-
*/
|
|
218
|
-
"node/no-restricted-require": "off",
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* disallow synchronous methods
|
|
222
|
-
*
|
|
223
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-sync.md
|
|
224
|
-
*/
|
|
225
|
-
"node/no-sync": "off",
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Enforce either `Buffer` or `require("buffer").Buffer`.
|
|
229
|
-
*
|
|
230
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/buffer.md
|
|
231
|
-
*/
|
|
232
|
-
"node/prefer-global/buffer": "off",
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Enforce either `console` or `require("console")`.
|
|
236
|
-
*
|
|
237
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/console.md
|
|
238
|
-
*/
|
|
239
|
-
"node/prefer-global/console": "off",
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Enforce either `process` or `require("process")`.
|
|
243
|
-
*
|
|
244
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/process.md
|
|
245
|
-
*/
|
|
246
|
-
"node/prefer-global/process": "off",
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Enforce either `TextDecoder` or `require("util").TextDecoder`
|
|
250
|
-
*
|
|
251
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-decoder.md
|
|
252
|
-
*/
|
|
253
|
-
"node/prefer-global/text-decoder": "off",
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Enforce either `TextEncoder` or `require("util").TextEncoder`
|
|
257
|
-
*
|
|
258
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/text-encoder.md
|
|
259
|
-
*/
|
|
260
|
-
"node/prefer-global/text-encoder": "off",
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Enforce either `URLSearchParams` or `require("url").URLSearchParams`.
|
|
264
|
-
*
|
|
265
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/url-search-params.md
|
|
266
|
-
*/
|
|
267
|
-
"node/prefer-global/url-search-params": "off",
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Enforce either `URL` or `require("url").URL`.
|
|
271
|
-
*
|
|
272
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-global/url.md
|
|
273
|
-
*/
|
|
274
|
-
"node/prefer-global/url": "off",
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Enforce `require("dns").promises`
|
|
278
|
-
*
|
|
279
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/dns.md
|
|
280
|
-
*/
|
|
281
|
-
"node/prefer-promises/dns": "off",
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Enforce `require("fs").promises`
|
|
285
|
-
*
|
|
286
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/prefer-promises/fs.md
|
|
287
|
-
*/
|
|
288
|
-
"node/prefer-promises/fs": "off",
|
|
289
|
-
|
|
290
|
-
},
|
|
45
|
+
}
|
|
291
46
|
|
|
292
|
-
|
|
47
|
+
/**
|
|
48
|
+
* ESLint ready config for `@futagoza/eslint-config-node`
|
|
49
|
+
*/
|
|
50
|
+
export default defineConfig( config )
|
|
@@ -1,42 +1,102 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineConfig } from "eslint/config"
|
|
2
|
+
import MainNodeConfig from "../index.js"
|
|
3
|
+
|
|
4
|
+
const noUnsupportedFeatures = [
|
|
5
|
+
|
|
6
|
+
"es-builtins",
|
|
7
|
+
"es-syntax",
|
|
8
|
+
"node-builtins",
|
|
9
|
+
|
|
10
|
+
]
|
|
2
11
|
|
|
3
12
|
/**
|
|
4
|
-
* A helper function to build configurations that use rules from `eslint-plugin-
|
|
13
|
+
* A helper function to build configurations that use rules from `eslint-plugin-n`
|
|
14
|
+
*
|
|
15
|
+
* @param {{ action: string, ignore: string[], versions: Record<string,string|number>, rules: {} }} param0
|
|
5
16
|
*/
|
|
17
|
+
export default async function CreateNodeConfig( { action = "error", ignore = {}, versions = {}, rules = {} } ) {
|
|
6
18
|
|
|
7
|
-
|
|
19
|
+
const esVersion = typeof versions.es === "number"
|
|
20
|
+
? `es${ versions.es }`
|
|
21
|
+
: ( versions.es ?? "es2015" )
|
|
8
22
|
|
|
9
|
-
|
|
10
|
-
|
|
23
|
+
const version = typeof versions.node === "number"
|
|
24
|
+
? `>=${ versions.node }`
|
|
25
|
+
: ( versions.node ?? ">=4" )
|
|
11
26
|
|
|
12
|
-
for ( const rule of
|
|
27
|
+
for ( const rule of noUnsupportedFeatures )
|
|
13
28
|
|
|
14
|
-
rules[ "
|
|
29
|
+
rules[ "n/no-unsupported-features/" + rule ] = [ action, {
|
|
15
30
|
|
|
16
31
|
ignores: ignore[ rule ],
|
|
17
|
-
version
|
|
32
|
+
version,
|
|
18
33
|
|
|
19
|
-
} ]
|
|
34
|
+
} ]
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
// https://stackoverflow.com/a/67880017
|
|
37
|
+
const { default: JavascriptConfig } = await import( `@futagoza/eslint-config-javascript/${ esVersion }.js` )
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
extends: [
|
|
39
|
+
// the Node.js config
|
|
40
|
+
const ConfigObject = {
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
require.resolve( "../index.js" ),
|
|
42
|
+
name: "@futagoza/eslint-config-node/" + version,
|
|
29
43
|
|
|
44
|
+
files: [
|
|
45
|
+
"**/*.cjs",
|
|
46
|
+
"**/*.mjs",
|
|
47
|
+
"**/*.js",
|
|
48
|
+
"**/*.jsx",
|
|
49
|
+
"**/*.cts",
|
|
50
|
+
"**/*.mts",
|
|
51
|
+
"**/*.ts",
|
|
52
|
+
"**/*.tsx",
|
|
30
53
|
],
|
|
31
54
|
|
|
32
|
-
|
|
55
|
+
extends: [ MainNodeConfig ],
|
|
33
56
|
|
|
34
|
-
|
|
57
|
+
settings: {
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
"n": { version },
|
|
60
|
+
|
|
61
|
+
},
|
|
37
62
|
|
|
38
63
|
rules,
|
|
39
64
|
|
|
40
|
-
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
|
|
69
|
+
ConfigObject,
|
|
70
|
+
|
|
71
|
+
ConfigArray: defineConfig(
|
|
72
|
+
{
|
|
73
|
+
name: "@futagoza/eslint-config-node/commonjs",
|
|
74
|
+
files: [
|
|
75
|
+
"**/*.cjs",
|
|
76
|
+
"**/*.cts",
|
|
77
|
+
],
|
|
78
|
+
languageOptions: {
|
|
79
|
+
sourceType: "commonjs",
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "@futagoza/eslint-config-node/module",
|
|
84
|
+
files: [
|
|
85
|
+
"**/*.mjs",
|
|
86
|
+
"**/*.js",
|
|
87
|
+
"**/*.jsx",
|
|
88
|
+
"**/*.mts",
|
|
89
|
+
"**/*.ts",
|
|
90
|
+
"**/*.tsx",
|
|
91
|
+
],
|
|
92
|
+
languageOptions: {
|
|
93
|
+
sourceType: "module",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
JavascriptConfig,
|
|
97
|
+
ConfigObject,
|
|
98
|
+
),
|
|
99
|
+
|
|
100
|
+
}
|
|
41
101
|
|
|
42
|
-
}
|
|
102
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futagoza/eslint-config-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0",
|
|
4
4
|
"description": "Futago-za Ryuu's ESLint configurations for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
7
7
|
"configuration",
|
|
8
|
+
"ecmascript",
|
|
8
9
|
"javascript",
|
|
9
10
|
"node",
|
|
10
11
|
"lts"
|
|
@@ -13,15 +14,16 @@
|
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"author": "Futago-za Ryuu",
|
|
15
16
|
"main": "index.js",
|
|
17
|
+
"type": "module",
|
|
16
18
|
"dependencies": {
|
|
17
|
-
"@futagoza/eslint-config-globals": "
|
|
18
|
-
"@futagoza/eslint-config-javascript": "
|
|
19
|
-
"eslint-plugin-
|
|
19
|
+
"@futagoza/eslint-config-globals": "17.0.0",
|
|
20
|
+
"@futagoza/eslint-config-javascript": "17.0.0",
|
|
21
|
+
"eslint-plugin-n": "18.2.1"
|
|
20
22
|
},
|
|
21
23
|
"peerDependencies": {
|
|
22
24
|
"eslint": "*"
|
|
23
25
|
},
|
|
24
26
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
27
|
+
"node": ">=20.0.0"
|
|
26
28
|
}
|
|
27
29
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//
|
|
2
|
+
// WARNING: AUTO-GENERATED USING eslint-plugin-n
|
|
3
|
+
//
|
|
4
|
+
// These rules have been deprecated
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Raw config for `@futagoza/eslint-config-node/rules/deprecated.js`
|
|
9
|
+
*/
|
|
10
|
+
export const config = {
|
|
11
|
+
|
|
12
|
+
name: "@futagoza/eslint-config-node/deprecated",
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* disallow third-party modules which are hiding core modules
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-hide-core-modules.md
|
|
20
|
+
*/
|
|
21
|
+
"n/no-hide-core-modules": "off",
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 🔧 require correct usage of hashbang
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
27
|
+
*/
|
|
28
|
+
"n/shebang": "off",
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* ESLint ready config for `@futagoza/eslint-config-node/rules/deprecated.js`
|
|
36
|
+
*/
|
|
37
|
+
export default [ config ]
|
package/rules/general.js
ADDED
package/rules/layout.js
ADDED
package/rules/problem.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
//
|
|
2
|
+
// WARNING: AUTO-GENERATED USING eslint-plugin-n
|
|
3
|
+
//
|
|
4
|
+
// These rules relate to possible logic errors in code
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Raw config for `@futagoza/eslint-config-node/rules/problem.js`
|
|
9
|
+
*/
|
|
10
|
+
export const config = {
|
|
11
|
+
|
|
12
|
+
name: "@futagoza/eslint-config-node/problem",
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* enforce Node.js-style error-first callback pattern is followed
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-callback-literal.md
|
|
20
|
+
*/
|
|
21
|
+
"n/no-callback-literal": "off",
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* disallow deprecated APIs
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-deprecated-api.md
|
|
27
|
+
*/
|
|
28
|
+
"n/no-deprecated-api": "warn",
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* disallow the assignment to `exports`
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-exports-assign.md
|
|
34
|
+
*/
|
|
35
|
+
"n/no-exports-assign": "error",
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* disallow `import` declarations which import extraneous modules
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
|
|
41
|
+
*/
|
|
42
|
+
"n/no-extraneous-import": "off",
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* disallow `require()` expressions which import extraneous modules
|
|
46
|
+
*
|
|
47
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
48
|
+
*/
|
|
49
|
+
"n/no-extraneous-require": "off",
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* disallow `import` declarations which import missing modules
|
|
53
|
+
*
|
|
54
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
55
|
+
*/
|
|
56
|
+
"n/no-missing-import": "off",
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* disallow `require()` expressions which import missing modules
|
|
60
|
+
*
|
|
61
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-require.md
|
|
62
|
+
*/
|
|
63
|
+
"n/no-missing-require": "off",
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* disallow top-level `await` in published modules
|
|
67
|
+
*
|
|
68
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-top-level-await.md
|
|
69
|
+
*/
|
|
70
|
+
"n/no-top-level-await": "off",
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* disallow `bin` files that npm ignores
|
|
74
|
+
*
|
|
75
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-bin.md
|
|
76
|
+
*/
|
|
77
|
+
"n/no-unpublished-bin": "off",
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* disallow `import` declarations which import private modules
|
|
81
|
+
*
|
|
82
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-import.md
|
|
83
|
+
*/
|
|
84
|
+
"n/no-unpublished-import": "off",
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* disallow `require()` expressions which import private modules
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-require.md
|
|
90
|
+
*/
|
|
91
|
+
"n/no-unpublished-require": "off",
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* disallow unsupported ECMAScript built-ins on the specified version
|
|
95
|
+
*
|
|
96
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-builtins.md
|
|
97
|
+
*/
|
|
98
|
+
"n/no-unsupported-features/es-builtins": "off",
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* disallow unsupported ECMAScript syntax on the specified version
|
|
102
|
+
*
|
|
103
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
104
|
+
*/
|
|
105
|
+
"n/no-unsupported-features/es-syntax": "off",
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* disallow unsupported Node.js built-in APIs on the specified version
|
|
109
|
+
*
|
|
110
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
111
|
+
*/
|
|
112
|
+
"n/no-unsupported-features/node-builtins": "off",
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* require that `process.exit()` expressions use the same code path as `throw`
|
|
116
|
+
*
|
|
117
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/process-exit-as-throw.md
|
|
118
|
+
*/
|
|
119
|
+
"n/process-exit-as-throw": "off",
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 🔧 require correct usage of hashbang
|
|
123
|
+
*
|
|
124
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/hashbang.md
|
|
125
|
+
*/
|
|
126
|
+
"n/hashbang": [
|
|
127
|
+
"error",
|
|
128
|
+
{
|
|
129
|
+
"ignoreUnpublished": true,
|
|
130
|
+
"executableMap": {
|
|
131
|
+
".js": "node",
|
|
132
|
+
".ts": "ts-node",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* ESLint ready config for `@futagoza/eslint-config-node/rules/problem.js`
|
|
143
|
+
*/
|
|
144
|
+
export default [ config ]
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
//
|
|
2
|
+
// WARNING: AUTO-GENERATED USING eslint-plugin-n
|
|
3
|
+
//
|
|
4
|
+
// These rules suggest alternate ways of doing things
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Raw config for `@futagoza/eslint-config-node/rules/suggestion.js`
|
|
9
|
+
*/
|
|
10
|
+
export const config = {
|
|
11
|
+
|
|
12
|
+
name: "@futagoza/eslint-config-node/suggestion",
|
|
13
|
+
|
|
14
|
+
rules: {
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* require `return` statements after callbacks
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
|
|
20
|
+
*/
|
|
21
|
+
"n/callback-return": "off",
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 🔧 enforce either `module.exports` or `exports`
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/exports-style.md
|
|
27
|
+
*/
|
|
28
|
+
"n/exports-style": "off",
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 🔧 enforce the style of file extensions in `import` declarations
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/file-extension-in-import.md
|
|
34
|
+
*/
|
|
35
|
+
"n/file-extension-in-import": "off",
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* require `require()` calls to be placed at top-level module scope
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
|
|
41
|
+
*/
|
|
42
|
+
"n/global-require": "off",
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* require error handling in callbacks
|
|
46
|
+
*
|
|
47
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err.md
|
|
48
|
+
*/
|
|
49
|
+
"n/handle-callback-err": "off",
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* disallow `require` calls to be mixed with regular variable declarations
|
|
53
|
+
*
|
|
54
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
|
|
55
|
+
*/
|
|
56
|
+
"n/no-mixed-requires": "off",
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* disallow `new` operators with calls to `require`
|
|
60
|
+
*
|
|
61
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
|
|
62
|
+
*/
|
|
63
|
+
"n/no-new-require": "off",
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* disallow string concatenation with `__dirname` and `__filename`
|
|
67
|
+
*
|
|
68
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
|
|
69
|
+
*/
|
|
70
|
+
"n/no-path-concat": "warn",
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* disallow the use of `process.env`
|
|
74
|
+
*
|
|
75
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md
|
|
76
|
+
*/
|
|
77
|
+
"n/no-process-env": "off",
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* disallow the use of `process.exit()`
|
|
81
|
+
*
|
|
82
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
|
|
83
|
+
*/
|
|
84
|
+
"n/no-process-exit": "off",
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* disallow specified modules when loaded by `import` declarations
|
|
88
|
+
*
|
|
89
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
90
|
+
*/
|
|
91
|
+
"n/no-restricted-import": "off",
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* disallow specified modules when loaded by `require`
|
|
95
|
+
*
|
|
96
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
97
|
+
*/
|
|
98
|
+
"n/no-restricted-require": "off",
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* disallow synchronous methods
|
|
102
|
+
*
|
|
103
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-sync.md
|
|
104
|
+
*/
|
|
105
|
+
"n/no-sync": "off",
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* enforce either `Buffer` or `require("buffer").Buffer`
|
|
109
|
+
*
|
|
110
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/buffer.md
|
|
111
|
+
*/
|
|
112
|
+
"n/prefer-global/buffer": "warn",
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* enforce either `console` or `require("console")`
|
|
116
|
+
*
|
|
117
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/console.md
|
|
118
|
+
*/
|
|
119
|
+
"n/prefer-global/console": "warn",
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* enforce either `crypto` or `require("crypto").webcrypto`
|
|
123
|
+
*
|
|
124
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/crypto.md
|
|
125
|
+
*/
|
|
126
|
+
"n/prefer-global/crypto": "warn",
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* enforce either `process` or `require("process")`
|
|
130
|
+
*
|
|
131
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/process.md
|
|
132
|
+
*/
|
|
133
|
+
"n/prefer-global/process": "warn",
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* enforce either `TextDecoder` or `require("util").TextDecoder`
|
|
137
|
+
*
|
|
138
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-decoder.md
|
|
139
|
+
*/
|
|
140
|
+
"n/prefer-global/text-decoder": "warn",
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* enforce either `TextEncoder` or `require("util").TextEncoder`
|
|
144
|
+
*
|
|
145
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-encoder.md
|
|
146
|
+
*/
|
|
147
|
+
"n/prefer-global/text-encoder": "warn",
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* enforce either `URLSearchParams` or `require("url").URLSearchParams`
|
|
151
|
+
*
|
|
152
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url-search-params.md
|
|
153
|
+
*/
|
|
154
|
+
"n/prefer-global/url-search-params": "warn",
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* enforce either `URL` or `require("url").URL`
|
|
158
|
+
*
|
|
159
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url.md
|
|
160
|
+
*/
|
|
161
|
+
"n/prefer-global/url": "warn",
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* enforce either global timer functions or `require("timers")`
|
|
165
|
+
*
|
|
166
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/timers.md
|
|
167
|
+
*/
|
|
168
|
+
"n/prefer-global/timers": "warn",
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 🔧 enforce using the `node:` protocol when importing Node.js builtin modules.
|
|
172
|
+
*
|
|
173
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-node-protocol.md
|
|
174
|
+
*/
|
|
175
|
+
"n/prefer-node-protocol": "off",
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* enforce `require("dns").promises`
|
|
179
|
+
*
|
|
180
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/dns.md
|
|
181
|
+
*/
|
|
182
|
+
"n/prefer-promises/dns": "off",
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* enforce `require("fs").promises`
|
|
186
|
+
*
|
|
187
|
+
* @see https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/fs.md
|
|
188
|
+
*/
|
|
189
|
+
"n/prefer-promises/fs": "off",
|
|
190
|
+
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* ESLint ready config for `@futagoza/eslint-config-node/rules/suggestion.js`
|
|
197
|
+
*/
|
|
198
|
+
export default [ config ]
|
package/test.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config"
|
|
2
|
+
import globals from "@futagoza/eslint-config-globals/test.js"
|
|
3
|
+
|
|
4
|
+
const entry = postfix => [
|
|
5
|
+
|
|
6
|
+
`**/*.${ postfix }.cjs`,
|
|
7
|
+
`**/*.${ postfix }.mjs`,
|
|
8
|
+
`**/*.${ postfix }.js`,
|
|
9
|
+
`**/*.${ postfix }.jsx`,
|
|
10
|
+
|
|
11
|
+
`**/*.${ postfix }.cts`,
|
|
12
|
+
`**/*.${ postfix }.mts`,
|
|
13
|
+
`**/*.${ postfix }.ts`,
|
|
14
|
+
`**/*.${ postfix }.tsx`,
|
|
15
|
+
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
export const config = {
|
|
19
|
+
|
|
20
|
+
name: "@futagoza/eslint-config-node/test",
|
|
21
|
+
|
|
22
|
+
extends: [ globals ],
|
|
23
|
+
|
|
24
|
+
files: [
|
|
25
|
+
|
|
26
|
+
...entry( "benchmark" ),
|
|
27
|
+
...entry( "spec" ),
|
|
28
|
+
...entry( "test" ),
|
|
29
|
+
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default defineConfig( config )
|
package/deprecated.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
|
|
5
|
-
"rules": {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Disallow unsupported ECMAScript features on the specified version.
|
|
9
|
-
*
|
|
10
|
-
* This rule `node/no-unsupported-features` was replaced by `node/no-unsupported-features/es-builtins`
|
|
11
|
-
* and `node/no-unsupported-features/es-syntax`.
|
|
12
|
-
*
|
|
13
|
-
* @deprecated eslint-plugin-node 7.0.0
|
|
14
|
-
* @see https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-unsupported-features.md
|
|
15
|
-
*/
|
|
16
|
-
"node/no-unsupported-features": void 0,
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
};
|
package/internal/index.js
DELETED