eslint-config-airbnb-extended 0.5.2 → 0.7.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 +1 -0
- package/dist/@types/index.d.ts +3 -2
- package/dist/configs/base/index.js +0 -2
- package/dist/configs/base/recommended.js +2 -2
- package/dist/configs/index.js +14 -10
- package/dist/configs/node/index.js +16 -0
- package/dist/configs/node/recommended.js +22 -0
- package/dist/configs/react/recommended.js +2 -2
- package/dist/configs/typescript/recommended.js +2 -2
- package/dist/plugins/nodePlugin.js +13 -0
- package/dist/rules/index.js +2 -0
- package/dist/rules/node/nodeBase.js +115 -0
- package/dist/rules/node/nodeGlobals.js +29 -0
- package/dist/rules/node/nodeNoUnsupportedFeatures.js +17 -0
- package/dist/rules/node/nodePromises.js +14 -0
- package/package.json +5 -1
- package/dist/rules/node.js +0 -40
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ The configuration may change over time, and `create-airbnb-x-config` will always
|
|
|
38
38
|
This configuration relies on the following essential packages:
|
|
39
39
|
|
|
40
40
|
- **`eslint-import-x`**: A powerful tool for managing and validating imports.
|
|
41
|
+
- **`eslint-plugin-n`**: Enforces best practices for Node.js.
|
|
41
42
|
- **`eslint-plugin-react`**: Enforces React-specific linting rules and best practices.
|
|
42
43
|
- **`eslint-plugin-react-hooks`**: Ensures proper use of React hooks.
|
|
43
44
|
- **`eslint-plugin-jsx-a11y`**: Improves accessibility in JSX code.
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Direct export not allowed, it will increase the size of d.ts
|
|
3
3
|
*/
|
|
4
4
|
export declare const rules: {
|
|
5
|
-
base: Record<"bestPractices" | "errors" | "es6" | "imports" | "
|
|
5
|
+
base: Record<"bestPractices" | "errors" | "es6" | "imports" | "strict" | "style" | "stylistic" | "variables" | "importsStrict" | "reactStrict", import("eslint").Linter.Config>;
|
|
6
|
+
node: Record<"globals" | "base" | "promises" | "noUnsupportedFeatures", import("eslint").Linter.Config>;
|
|
6
7
|
react: Record<"react" | "reactA11y" | "reactHooks", import("eslint").Linter.Config>;
|
|
7
8
|
next: Record<"next", import("eslint").Linter.Config>;
|
|
8
9
|
typescript: Record<"imports" | "base" | "typescriptEslint", import("eslint").Linter.Config>;
|
|
@@ -11,7 +12,7 @@ export declare const configs: {
|
|
|
11
12
|
base: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
12
13
|
react: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
13
14
|
next: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
14
|
-
node: Record<"
|
|
15
|
+
node: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
15
16
|
};
|
|
16
17
|
export declare const plugins: {
|
|
17
18
|
next: import("eslint").Linter.Config;
|
|
@@ -7,7 +7,6 @@ const best_practices_1 = __importDefault(require("../../rules/best-practices"));
|
|
|
7
7
|
const errors_1 = __importDefault(require("../../rules/errors"));
|
|
8
8
|
const es6_1 = __importDefault(require("../../rules/es6"));
|
|
9
9
|
const imports_1 = __importDefault(require("../../rules/imports"));
|
|
10
|
-
const node_1 = __importDefault(require("../../rules/node"));
|
|
11
10
|
const strict_1 = __importDefault(require("../../rules/strict"));
|
|
12
11
|
const style_1 = __importDefault(require("../../rules/style"));
|
|
13
12
|
const stylistic_1 = __importDefault(require("../../rules/stylistic"));
|
|
@@ -17,7 +16,6 @@ const baseConfig = {
|
|
|
17
16
|
errors: errors_1.default,
|
|
18
17
|
es6: es6_1.default,
|
|
19
18
|
imports: imports_1.default,
|
|
20
|
-
node: node_1.default,
|
|
21
19
|
strict: strict_1.default,
|
|
22
20
|
style: style_1.default,
|
|
23
21
|
stylistic: stylistic_1.default,
|
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const base_1 = __importDefault(require("../../configs/base"));
|
|
7
7
|
const baseRecommendedConfig = [
|
|
8
|
-
...Object.values(
|
|
8
|
+
...Object.values(base_1.default),
|
|
9
9
|
{
|
|
10
10
|
name: 'airbnb/config/language-configurations',
|
|
11
11
|
languageOptions: {
|
package/dist/configs/index.js
CHANGED
|
@@ -5,22 +5,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const recommended_1 = __importDefault(require("../configs/base/recommended"));
|
|
7
7
|
const recommended_2 = __importDefault(require("../configs/next/recommended"));
|
|
8
|
-
const recommended_3 = __importDefault(require("../configs/
|
|
9
|
-
const recommended_4 = __importDefault(require("../configs/
|
|
8
|
+
const recommended_3 = __importDefault(require("../configs/node/recommended"));
|
|
9
|
+
const recommended_4 = __importDefault(require("../configs/react/recommended"));
|
|
10
|
+
const recommended_5 = __importDefault(require("../configs/typescript/recommended"));
|
|
10
11
|
const base = {
|
|
11
12
|
recommended: recommended_1.default,
|
|
12
|
-
typescript:
|
|
13
|
-
all: [...recommended_1.default, ...
|
|
13
|
+
typescript: recommended_5.default.base,
|
|
14
|
+
all: [...recommended_1.default, ...recommended_5.default.base],
|
|
14
15
|
};
|
|
15
16
|
const react = {
|
|
16
|
-
recommended:
|
|
17
|
-
typescript:
|
|
18
|
-
all: [...
|
|
17
|
+
recommended: recommended_4.default,
|
|
18
|
+
typescript: recommended_5.default.react,
|
|
19
|
+
all: [...recommended_4.default, ...recommended_5.default.react],
|
|
19
20
|
};
|
|
20
21
|
const next = {
|
|
21
22
|
recommended: recommended_2.default,
|
|
22
|
-
typescript:
|
|
23
|
-
all: [...recommended_2.default, ...
|
|
23
|
+
typescript: recommended_5.default.next,
|
|
24
|
+
all: [...recommended_2.default, ...recommended_5.default.next],
|
|
25
|
+
};
|
|
26
|
+
const node = {
|
|
27
|
+
recommended: recommended_3.default,
|
|
24
28
|
};
|
|
25
29
|
/**
|
|
26
30
|
* as is given due to less size of index.d.ts
|
|
@@ -29,6 +33,6 @@ const configs = {
|
|
|
29
33
|
base: base,
|
|
30
34
|
react: react,
|
|
31
35
|
next: next,
|
|
32
|
-
node:
|
|
36
|
+
node: node,
|
|
33
37
|
};
|
|
34
38
|
exports.default = configs;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nodeBase_1 = __importDefault(require("../../rules/node/nodeBase"));
|
|
7
|
+
const nodeGlobals_1 = __importDefault(require("../../rules/node/nodeGlobals"));
|
|
8
|
+
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../../rules/node/nodeNoUnsupportedFeatures"));
|
|
9
|
+
const nodePromises_1 = __importDefault(require("../../rules/node/nodePromises"));
|
|
10
|
+
const nodeConfig = {
|
|
11
|
+
base: nodeBase_1.default,
|
|
12
|
+
globals: nodeGlobals_1.default,
|
|
13
|
+
promises: nodePromises_1.default,
|
|
14
|
+
noUnsupportedFeatures: nodeNoUnsupportedFeatures_1.default,
|
|
15
|
+
};
|
|
16
|
+
exports.default = nodeConfig;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a, _b;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
8
|
+
const node_1 = __importDefault(require("../../configs/node"));
|
|
9
|
+
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../../rules/node/nodeNoUnsupportedFeatures"));
|
|
10
|
+
const flatNodeConfig = eslint_plugin_n_1.default.configs['flat/recommended'];
|
|
11
|
+
const nodeRecommendedConfig = [
|
|
12
|
+
...Object.values(node_1.default),
|
|
13
|
+
Object.assign({ name: 'airbnb/config/node-configurations' }, (flatNodeConfig
|
|
14
|
+
? {
|
|
15
|
+
languageOptions: flatNodeConfig.languageOptions,
|
|
16
|
+
rules: {
|
|
17
|
+
'n/no-unsupported-features/es-syntax': (_b = (_a = flatNodeConfig.rules) === null || _a === void 0 ? void 0 : _a['n/no-unsupported-features/es-syntax']) !== null && _b !== void 0 ? _b : nodeNoUnsupportedFeatures_1.default.rules['n/no-unsupported-features/es-syntax'],
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
: null)),
|
|
21
|
+
];
|
|
22
|
+
exports.default = nodeRecommendedConfig;
|
|
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const react_1 = __importDefault(require("../../configs/react"));
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const reactRecommendedConfig = [
|
|
9
|
-
...Object.values(
|
|
9
|
+
...Object.values(react_1.default),
|
|
10
10
|
{
|
|
11
11
|
name: 'airbnb/config/react-settings',
|
|
12
12
|
settings: {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const typescript_1 = __importDefault(require("../../configs/typescript"));
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const react = [
|
|
9
9
|
{
|
|
@@ -31,7 +31,7 @@ const react = [
|
|
|
31
31
|
},
|
|
32
32
|
];
|
|
33
33
|
const typescriptRecommendedConfig = {
|
|
34
|
-
base: Object.values(
|
|
34
|
+
base: Object.values(typescript_1.default),
|
|
35
35
|
react,
|
|
36
36
|
next: react,
|
|
37
37
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
7
|
+
const reactPlugin = {
|
|
8
|
+
name: 'airbnb/config/plugin/node',
|
|
9
|
+
plugins: {
|
|
10
|
+
n: eslint_plugin_n_1.default,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = reactPlugin;
|
package/dist/rules/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const base_1 = __importDefault(require("../configs/base"));
|
|
7
7
|
const next_1 = __importDefault(require("../configs/next"));
|
|
8
|
+
const node_1 = __importDefault(require("../configs/node"));
|
|
8
9
|
const react_1 = __importDefault(require("../configs/react"));
|
|
9
10
|
const typescript_1 = __importDefault(require("../configs/typescript"));
|
|
10
11
|
const importsStrict_1 = __importDefault(require("../rules/importsStrict"));
|
|
@@ -15,6 +16,7 @@ const baseRules = Object.assign(Object.assign({}, base_1.default), { importsStri
|
|
|
15
16
|
*/
|
|
16
17
|
const rules = {
|
|
17
18
|
base: baseRules,
|
|
19
|
+
node: node_1.default,
|
|
18
20
|
react: react_1.default,
|
|
19
21
|
next: next_1.default,
|
|
20
22
|
typescript: typescript_1.default,
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nodeBaseRules = {
|
|
4
|
+
name: 'airbnb/config/node/base',
|
|
5
|
+
rules: {
|
|
6
|
+
// Require return statements after callbacks
|
|
7
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/callback-return.md
|
|
8
|
+
'n/callback-return': 'off',
|
|
9
|
+
// Enforce either module.exports or exports
|
|
10
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/exports-style.md
|
|
11
|
+
'n/exports-style': [
|
|
12
|
+
'error',
|
|
13
|
+
'module.exports',
|
|
14
|
+
{
|
|
15
|
+
allowBatchAssign: false,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
// Enforce the style of file extensions in import declarations
|
|
19
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/file-extension-in-import.md
|
|
20
|
+
// Off due to 'import-x/extensions'
|
|
21
|
+
'n/file-extension-in-import': 'off',
|
|
22
|
+
// Require require() calls to be placed at top-level module scope
|
|
23
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md
|
|
24
|
+
'n/global-require': 'error',
|
|
25
|
+
// Require error handling in callbacks
|
|
26
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/handle-callback-err.md
|
|
27
|
+
'n/handle-callback-err': 'off',
|
|
28
|
+
// Require correct usage of hashbang
|
|
29
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/hashbang.md
|
|
30
|
+
'n/hashbang': 'error',
|
|
31
|
+
// Enforce Node.js-style error-first callback pattern is followed
|
|
32
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-callback-literal.md
|
|
33
|
+
'n/no-callback-literal': 'off',
|
|
34
|
+
// Disallow deprecated APIs
|
|
35
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-deprecated-api.md
|
|
36
|
+
'n/no-deprecated-api': 'error',
|
|
37
|
+
// Disallow the assignment to exports
|
|
38
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-exports-assign.md
|
|
39
|
+
'n/no-exports-assign': 'error',
|
|
40
|
+
// Disallow import declarations which import extraneous modules
|
|
41
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-import.md
|
|
42
|
+
// Off due to 'import-x/no-extraneous-dependencies'
|
|
43
|
+
'n/no-extraneous-import': 'off',
|
|
44
|
+
// Disallow require() expressions which import extraneous modules
|
|
45
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
46
|
+
// Off due to 'import-x/no-extraneous-dependencies'
|
|
47
|
+
'n/no-extraneous-require': 'off',
|
|
48
|
+
// Disallow third-party modules which are hiding core modules
|
|
49
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-hide-core-modules.md
|
|
50
|
+
// @deprecated
|
|
51
|
+
'n/no-hide-core-modules': 'off',
|
|
52
|
+
// Disallow import declarations which import non-existence modules
|
|
53
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
54
|
+
// Off due to 'import-x/no-unresolved'
|
|
55
|
+
'n/no-missing-import': 'off',
|
|
56
|
+
// Disallow require() expressions which import non-existence modules
|
|
57
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-require.md
|
|
58
|
+
// Off due to 'import-x/no-unresolved'
|
|
59
|
+
'n/no-missing-require': 'off',
|
|
60
|
+
// Disallow require calls to be mixed with regular variable declarations
|
|
61
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-mixed-requires.md
|
|
62
|
+
'n/no-mixed-requires': 'off',
|
|
63
|
+
// Disallow new operators with calls to require
|
|
64
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md
|
|
65
|
+
'n/no-new-require': 'error',
|
|
66
|
+
// Disallow string concatenation with __dirname and __filename
|
|
67
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md
|
|
68
|
+
'n/no-path-concat': 'error',
|
|
69
|
+
// Disallow the use of process.env
|
|
70
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-env.md
|
|
71
|
+
'n/no-process-env': 'off',
|
|
72
|
+
// Disallow the use of process.exit()
|
|
73
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-process-exit.md
|
|
74
|
+
'n/no-process-exit': 'error',
|
|
75
|
+
// Disallow specified modules when loaded by import declarations
|
|
76
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-import.md
|
|
77
|
+
// Off due to 'no-restricted-imports'
|
|
78
|
+
'n/no-restricted-import': 'off',
|
|
79
|
+
// Disallow specified modules when loaded by require
|
|
80
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-restricted-require.md
|
|
81
|
+
// Off due to 'no-restricted-imports'
|
|
82
|
+
'n/no-restricted-require': 'off',
|
|
83
|
+
// Disallow synchronous methods
|
|
84
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-sync.md
|
|
85
|
+
'n/no-sync': [
|
|
86
|
+
'error',
|
|
87
|
+
{
|
|
88
|
+
allowAtRootLevel: false,
|
|
89
|
+
ignores: [],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
// Disallow bin files that npm ignores
|
|
93
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-bin.md
|
|
94
|
+
'n/no-unpublished-bin': 'error',
|
|
95
|
+
// Disallow import declarations which import private modules
|
|
96
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-import.md
|
|
97
|
+
// Off due to 'import-x/no-extraneous-dependencies'
|
|
98
|
+
'n/no-unpublished-import': 'off',
|
|
99
|
+
// Disallow require() expressions which import private modules
|
|
100
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unpublished-require.md
|
|
101
|
+
// Off due to 'import-x/no-extraneous-dependencies'
|
|
102
|
+
'n/no-unpublished-require': 'off',
|
|
103
|
+
// Enforce using the node: protocol when importing Node.js builtin modules
|
|
104
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-node-protocol.md
|
|
105
|
+
'n/prefer-node-protocol': 'error',
|
|
106
|
+
// Require that process.exit() expressions use the same code path as throw
|
|
107
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/process-exit-as-throw.md
|
|
108
|
+
'n/process-exit-as-throw': 'error',
|
|
109
|
+
// Require correct usage of hashbang
|
|
110
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
111
|
+
// @deprecated
|
|
112
|
+
'n/shebang': 'off',
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
exports.default = nodeBaseRules;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nodeGlobalsRules = {
|
|
4
|
+
name: 'airbnb/config/node/globals',
|
|
5
|
+
rules: {
|
|
6
|
+
// Enforce either Buffer or require("buffer").Buffer
|
|
7
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/buffer.md
|
|
8
|
+
'n/prefer-global/buffer': ['error', 'always'],
|
|
9
|
+
// Enforce either console or require("console")
|
|
10
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/console.md
|
|
11
|
+
'n/prefer-global/console': ['error', 'always'],
|
|
12
|
+
// Enforce either process or require("process")
|
|
13
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/process.md
|
|
14
|
+
'n/prefer-global/process': ['error', 'always'],
|
|
15
|
+
// Enforce either TextDecoder or require("util").TextDecoder
|
|
16
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-decoder.md
|
|
17
|
+
'n/prefer-global/text-decoder': ['error', 'always'],
|
|
18
|
+
// Enforce either TextEncoder or require("util").TextEncoder
|
|
19
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/text-encoder.md
|
|
20
|
+
'n/prefer-global/text-encoder': ['error', 'always'],
|
|
21
|
+
// Enforce either URLSearchParams or require("url").URLSearchParams
|
|
22
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url-search-params.md
|
|
23
|
+
'n/prefer-global/url-search-params': ['error', 'always'],
|
|
24
|
+
// Enforce either URL or require("url").URL
|
|
25
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-global/url.md
|
|
26
|
+
'n/prefer-global/url': ['error', 'always'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
exports.default = nodeGlobalsRules;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nodeNoUnsupportedFeaturesRules = {
|
|
4
|
+
name: 'airbnb/config/node/unsupported-features',
|
|
5
|
+
rules: {
|
|
6
|
+
// Disallow unsupported ECMAScript built-ins on the specified version
|
|
7
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-builtins.md
|
|
8
|
+
'n/no-unsupported-features/es-builtin': 'error',
|
|
9
|
+
// Disallow unsupported ECMAScript syntax on the specified version
|
|
10
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
11
|
+
'n/no-unsupported-features/es-syntax': 'error',
|
|
12
|
+
// Disallow unsupported Node.js built-in APIs on the specified version
|
|
13
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
14
|
+
'n/no-unsupported-features/node-builtins': 'error',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
exports.default = nodeNoUnsupportedFeaturesRules;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const nodePromisesRules = {
|
|
4
|
+
name: 'airbnb/config/node/promises',
|
|
5
|
+
rules: {
|
|
6
|
+
// Enforce require("dns").promises
|
|
7
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/dns.md
|
|
8
|
+
'n/prefer-promises/dns': 'error',
|
|
9
|
+
// Enforce require("fs").promises
|
|
10
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/prefer-promises/fs.md
|
|
11
|
+
'n/prefer-promises/fs': 'error',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
exports.default = nodePromisesRules;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"eslint-import-resolver-typescript": "^4.3.1",
|
|
53
53
|
"eslint-plugin-import-x": "4.x",
|
|
54
54
|
"eslint-plugin-jsx-a11y": "6.x",
|
|
55
|
+
"eslint-plugin-n": "^17.17.0",
|
|
55
56
|
"eslint-plugin-react": "7.x",
|
|
56
57
|
"eslint-plugin-react-hooks": "5.x",
|
|
57
58
|
"typescript-eslint": "8.x"
|
|
@@ -66,6 +67,9 @@
|
|
|
66
67
|
"eslint-plugin-jsx-a11y": {
|
|
67
68
|
"optional": true
|
|
68
69
|
},
|
|
70
|
+
"eslint-plugin-n": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
69
73
|
"eslint-plugin-react": {
|
|
70
74
|
"optional": true
|
|
71
75
|
},
|
package/dist/rules/node.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const globals_1 = __importDefault(require("globals"));
|
|
7
|
-
const nodeRules = {
|
|
8
|
-
name: 'airbnb/config/node',
|
|
9
|
-
languageOptions: {
|
|
10
|
-
globals: Object.assign({}, globals_1.default.nodeBuiltin),
|
|
11
|
-
},
|
|
12
|
-
rules: {
|
|
13
|
-
// enforce return after a callback
|
|
14
|
-
'callback-return': 'off',
|
|
15
|
-
// require all requires be top-level
|
|
16
|
-
// https://eslint.org/docs/rules/global-require
|
|
17
|
-
'global-require': 'error',
|
|
18
|
-
// enforces error handling in callbacks (node environment)
|
|
19
|
-
'handle-callback-err': 'off',
|
|
20
|
-
// disallow use of the Buffer() constructor
|
|
21
|
-
// https://eslint.org/docs/rules/no-buffer-constructor
|
|
22
|
-
'no-buffer-constructor': 'error',
|
|
23
|
-
// disallow mixing regular variable and require declarations
|
|
24
|
-
'no-mixed-requires': ['off', false],
|
|
25
|
-
// disallow use of new operator with the require function
|
|
26
|
-
'no-new-require': 'error',
|
|
27
|
-
// disallow string concatenation with __dirname and __filename
|
|
28
|
-
// https://eslint.org/docs/rules/no-path-concat
|
|
29
|
-
'no-path-concat': 'error',
|
|
30
|
-
// disallow use of process.env
|
|
31
|
-
'no-process-env': 'off',
|
|
32
|
-
// disallow process.exit()
|
|
33
|
-
'no-process-exit': 'off',
|
|
34
|
-
// restrict usage of specified node modules
|
|
35
|
-
'no-restricted-modules': 'off',
|
|
36
|
-
// disallow use of synchronous methods (off by default)
|
|
37
|
-
'no-sync': 'off',
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
exports.default = nodeRules;
|