eslint-config-airbnb-extended 1.0.0 → 1.0.2
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.
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
var _a, _b;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
8
8
|
const config_1 = __importDefault(require("../../configs/node/config"));
|
|
9
9
|
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../../rules/node/nodeNoUnsupportedFeatures"));
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const flatNodeConfig = eslint_plugin_n_1.default.configs['flat/recommended'];
|
|
12
|
+
const flatModuleConfig = eslint_plugin_n_1.default.configs['flat/recommended-module'];
|
|
13
|
+
const flatScriptConfig = eslint_plugin_n_1.default.configs['flat/recommended-script'];
|
|
12
14
|
const nodeRecommendedConfig = [
|
|
13
15
|
...Object.values(config_1.default),
|
|
14
16
|
Object.assign({ name: 'airbnb/config/node-configurations', files: utils_1.allFiles }, (flatNodeConfig
|
|
@@ -19,5 +21,21 @@ const nodeRecommendedConfig = [
|
|
|
19
21
|
},
|
|
20
22
|
}
|
|
21
23
|
: null)),
|
|
24
|
+
Object.assign({ name: 'airbnb/config/node-configurations-for-module', files: ['**/*.mjs', '**/*.mts'] }, (flatModuleConfig
|
|
25
|
+
? {
|
|
26
|
+
languageOptions: flatModuleConfig.languageOptions,
|
|
27
|
+
rules: {
|
|
28
|
+
'n/no-unsupported-features/es-syntax': (_d = (_c = flatModuleConfig.rules) === null || _c === void 0 ? void 0 : _c['n/no-unsupported-features/es-syntax']) !== null && _d !== void 0 ? _d : nodeNoUnsupportedFeatures_1.default.rules['n/no-unsupported-features/es-syntax'],
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
: null)),
|
|
32
|
+
Object.assign({ name: 'airbnb/config/node-configurations-for-script', files: ['**/*.cjs', '**/*.cts'] }, (flatScriptConfig
|
|
33
|
+
? {
|
|
34
|
+
languageOptions: flatScriptConfig.languageOptions,
|
|
35
|
+
rules: {
|
|
36
|
+
'n/no-unsupported-features/es-syntax': (_f = (_e = flatScriptConfig.rules) === null || _e === void 0 ? void 0 : _e['n/no-unsupported-features/es-syntax']) !== null && _f !== void 0 ? _f : nodeNoUnsupportedFeatures_1.default.rules['n/no-unsupported-features/es-syntax'],
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
: null)),
|
|
22
40
|
];
|
|
23
41
|
exports.default = nodeRecommendedConfig;
|
|
@@ -10,14 +10,17 @@ const getStylisticLegacyConfig = (language) => {
|
|
|
10
10
|
const REACT = 'react/';
|
|
11
11
|
const TYPESCRIPT = '@typescript-eslint/';
|
|
12
12
|
const rules = Object.entries((_a = legacyConfig.rules) !== null && _a !== void 0 ? _a : {}).reduce((acc, [key, value]) => {
|
|
13
|
-
if (language === 'javascript'
|
|
14
|
-
|
|
13
|
+
if (language === 'javascript') {
|
|
14
|
+
const condition = !key.startsWith(REACT) && !key.startsWith(TYPESCRIPT);
|
|
15
|
+
return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
|
|
15
16
|
}
|
|
16
|
-
if (language === 'typescript'
|
|
17
|
-
|
|
17
|
+
if (language === 'typescript') {
|
|
18
|
+
const condition = key.startsWith(TYPESCRIPT);
|
|
19
|
+
return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
|
|
18
20
|
}
|
|
19
|
-
if (language === 'react'
|
|
20
|
-
|
|
21
|
+
if (language === 'react') {
|
|
22
|
+
const condition = key.startsWith(REACT);
|
|
23
|
+
return Object.assign(Object.assign({}, acc), (condition ? { [key]: value } : null));
|
|
21
24
|
}
|
|
22
25
|
return null;
|
|
23
26
|
}, {});
|
|
@@ -10,7 +10,7 @@ const nodeNoUnsupportedFeaturesRules = {
|
|
|
10
10
|
'n/no-unsupported-features/es-builtins': 'error',
|
|
11
11
|
// Disallow unsupported ECMAScript syntax on the specified version
|
|
12
12
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
13
|
-
'n/no-unsupported-features/es-syntax': '
|
|
13
|
+
'n/no-unsupported-features/es-syntax': 'off',
|
|
14
14
|
// Disallow unsupported Node.js built-in APIs on the specified version
|
|
15
15
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/node-builtins.md
|
|
16
16
|
'n/no-unsupported-features/node-builtins': 'error',
|
|
@@ -120,7 +120,7 @@ const typescriptEslintStrictRules = {
|
|
|
120
120
|
{
|
|
121
121
|
checksConditionals: true,
|
|
122
122
|
checksSpreads: true,
|
|
123
|
-
checksVoidReturn:
|
|
123
|
+
checksVoidReturn: false,
|
|
124
124
|
},
|
|
125
125
|
],
|
|
126
126
|
// Disallow using the spread operator when it might cause unexpected behavior.
|
|
@@ -146,9 +146,6 @@ const typescriptEslintStrictRules = {
|
|
|
146
146
|
// Disallow unnecessary equality comparisons against boolean literals.
|
|
147
147
|
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
|
|
148
148
|
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
|
149
|
-
// Disallow calling a value with type any.
|
|
150
|
-
// https://typescript-eslint.io/rules/no-unsafe-call
|
|
151
|
-
'@typescript-eslint/no-unsafe-call': 'error',
|
|
152
149
|
// Disallow returning a value with type any from a function.
|
|
153
150
|
// https://typescript-eslint.io/rules/no-unsafe-return
|
|
154
151
|
'@typescript-eslint/no-unsafe-return': 'error',
|