eslint-config-airbnb-extended 2.0.0 → 2.1.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 +21 -16
- package/dist/@types/index.d.ts +6 -0
- package/dist/configs/base/recommended.js +2 -23
- package/dist/configs/base/typescript.js +2 -11
- package/dist/configs/next/recommended.js +2 -16
- package/dist/configs/node/recommended.js +2 -31
- package/dist/configs/react/recommended.js +2 -59
- package/dist/extensions/base/index.js +15 -0
- package/dist/extensions/base/recommended.js +31 -0
- package/dist/extensions/base/typescript.js +19 -0
- package/dist/extensions/index.js +21 -0
- package/dist/extensions/next/index.js +12 -0
- package/dist/extensions/next/recommended.js +21 -0
- package/dist/extensions/node/index.js +12 -0
- package/dist/extensions/node/recommended.js +39 -0
- package/dist/extensions/react/index.js +12 -0
- package/dist/extensions/react/recommended.js +67 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,12 +22,17 @@ To learn more about the configuration options available for `create-airbnb-x-con
|
|
|
22
22
|
|
|
23
23
|
First, you need to decide whether you want to use the `legacy` config or the `extended` config. If you're not sure about the difference between the two, you can refer to the [Extended vs Legacy Config](https://github.com/NishargShah/eslint-config-airbnb-extended/tree/master/packages/eslint-config-airbnb-extended#difference-between-extended-vs-legacy-config) for a brief explanation. For more information specifically about the Legacy config, check out the [Legacy Config](https://github.com/NishargShah/eslint-config-airbnb-extended/tree/master/packages/eslint-config-airbnb-extended#legacy-config). If you decide to use the Extended config, you can proceed with the steps below. Otherwise, feel free to switch to the Legacy config if that better fits your requirements.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Once you've completed the selection steps in `create-airbnb-x-config`, you'll be prompted to choose whether or not to **install dependencies** based on your preferences:
|
|
26
26
|
|
|
27
|
-
- If you choose **
|
|
28
|
-
- If you choose **
|
|
27
|
+
- If you choose **to install**, the tool will automatically detect your project's package manager and install all required dependencies for you.
|
|
28
|
+
- If you choose **not to install**, you'll receive the appropriate commands to install the dependencies manually.
|
|
29
29
|
|
|
30
|
-
After
|
|
30
|
+
After that, you'll be asked whether you want the tool to **generate an `eslint.config.mjs` file** for you:
|
|
31
|
+
|
|
32
|
+
- If you agree, the file will be created automatically.
|
|
33
|
+
- If not, you’ll need to create the file yourself.
|
|
34
|
+
|
|
35
|
+
At the end of the process, you’ll be given a **GitHub URL** containing your ESLint configuration template. If you chose **not** to auto-generate the config file, simply visit the URL, copy the template, and paste it into your `eslint.config.mjs` file. The content of the template will reflect the options you selected earlier.
|
|
31
36
|
|
|
32
37
|
### Manual Installation (Not Recommended)
|
|
33
38
|
|
|
@@ -50,7 +55,7 @@ In short, the goal is:
|
|
|
50
55
|
|
|
51
56
|
Here’s the way to use the **Airbnb legacy configurations** with the flat config format under `eslint-config-airbnb-extended/legacy`.
|
|
52
57
|
|
|
53
|
-
#### For `eslint-config-airbnb-base`
|
|
58
|
+
#### For [`eslint-config-airbnb-base`](https://www.npmjs.com/package/eslint-config-airbnb-base)
|
|
54
59
|
|
|
55
60
|
```ts
|
|
56
61
|
import { configs } from 'eslint-config-airbnb-extended/legacy';
|
|
@@ -64,7 +69,7 @@ export default [...configs.base.recommended];
|
|
|
64
69
|
|
|
65
70
|
---
|
|
66
71
|
|
|
67
|
-
#### For `eslint-config-airbnb`
|
|
72
|
+
#### For [`eslint-config-airbnb`](https://www.npmjs.com/package/eslint-config-airbnb)
|
|
68
73
|
|
|
69
74
|
```ts
|
|
70
75
|
import { configs } from 'eslint-config-airbnb-extended/legacy';
|
|
@@ -84,7 +89,7 @@ export default [...configs.react.hooks];
|
|
|
84
89
|
|
|
85
90
|
---
|
|
86
91
|
|
|
87
|
-
#### For `eslint-config-airbnb-typescript`
|
|
92
|
+
#### For [`eslint-config-airbnb-typescript`](https://www.npmjs.com/package/eslint-config-airbnb-typescript)
|
|
88
93
|
|
|
89
94
|
```ts
|
|
90
95
|
import { configs } from 'eslint-config-airbnb-extended/legacy';
|
|
@@ -100,14 +105,14 @@ export default [...configs.react.typescript];
|
|
|
100
105
|
|
|
101
106
|
This configuration relies on the following essential packages:
|
|
102
107
|
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
108
|
+
- **[`@stylistic/eslint-plugin`](https://www.npmjs.com/package/@stylistic/eslint-plugin)**: Ensures fine-tuned styling rules for code formatting.
|
|
109
|
+
- **[`eslint-plugin-import-x`](https://www.npmjs.com/package/eslint-plugin-import-x)**: A powerful tool for managing and validating imports.
|
|
110
|
+
- **[`eslint-plugin-n`](https://www.npmjs.com/package/eslint-plugin-n)**: Enforces best practices for Node.js.
|
|
111
|
+
- **[`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react)**: Enforces React-specific linting rules and best practices.
|
|
112
|
+
- **[`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks)**: Ensures proper use of React hooks.
|
|
113
|
+
- **[`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y)**: Improves accessibility in JSX code.
|
|
114
|
+
- **[`typescript-eslint`](https://www.npmjs.com/package/typescript-eslint)**: Provides linting support for TypeScript codebases.
|
|
115
|
+
- **[`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript)**: Ensures TypeScript compatibility for import statements.
|
|
111
116
|
|
|
112
117
|
## Strict Rules
|
|
113
118
|
|
|
@@ -167,7 +172,7 @@ If you're working in a monorepo setup, it's recommended to run the installation
|
|
|
167
172
|
|
|
168
173
|
### Why did we switch from `import` to `import-x`?
|
|
169
174
|
|
|
170
|
-
The switch from the `import` ESLint plugin to `import-x` is due to several improvements. `import-x` provides **better TypeScript support**, ensuring more accurate linting for TypeScript projects. It is **actively maintained**, with regular updates and bug fixes, unlike the original plugin. It also has **fewer issues reported on GitHub**, indicating better stability. Additionally, `import-x` offers a **more performant and lightweight version**, reducing linting overhead and improving build performance. These factors make `import-x` a more reliable and efficient choice.
|
|
175
|
+
The switch from the [`import`](https://www.npmjs.com/package/eslint-plugin-import) ESLint plugin to [`import-x`](https://www.npmjs.com/package/eslint-plugin-import-x) is due to several improvements. `import-x` provides **better TypeScript support**, ensuring more accurate linting for TypeScript projects. It is **actively maintained**, with regular updates and bug fixes, unlike the original plugin. It also has **fewer issues reported on GitHub**, indicating better stability. Additionally, `import-x` offers a **more performant and lightweight version**, reducing linting overhead and improving build performance. These factors make `import-x` a more reliable and efficient choice.
|
|
171
176
|
|
|
172
177
|
### Why are `plugins` separated from the `config` in this package?
|
|
173
178
|
|
package/dist/@types/index.d.ts
CHANGED
|
@@ -24,3 +24,9 @@ export declare const plugins: {
|
|
|
24
24
|
readonly next: import("eslint").Linter.Config;
|
|
25
25
|
readonly typescriptEslint: import("eslint").Linter.Config;
|
|
26
26
|
};
|
|
27
|
+
export declare const extensions: {
|
|
28
|
+
readonly base: Record<"recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
29
|
+
readonly react: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
30
|
+
readonly next: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
31
|
+
readonly node: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
32
|
+
};
|
|
@@ -4,30 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_1 = __importDefault(require("../../configs/base/config"));
|
|
7
|
-
const
|
|
8
|
-
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
9
|
-
const utils_1 = require("../../utils");
|
|
7
|
+
const recommended_1 = __importDefault(require("../../extensions/base/recommended"));
|
|
10
8
|
const baseRecommendedConfig = [
|
|
11
9
|
...Object.values(config_1.default),
|
|
12
|
-
|
|
13
|
-
name: 'airbnb/config/base-configurations',
|
|
14
|
-
files: utils_1.allFiles,
|
|
15
|
-
languageOptions: {
|
|
16
|
-
parserOptions: {
|
|
17
|
-
ecmaVersion: 2018,
|
|
18
|
-
sourceType: 'module',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
settings: {
|
|
22
|
-
'import-x/core-modules': [],
|
|
23
|
-
'import-x/ignore': ['node_modules', String.raw `\.(coffee|scss|css|less|hbs|svg|json)$`],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'airbnb/config/base-settings-extensions-configurations',
|
|
28
|
-
files: utils_1.jsFileWithoutReact,
|
|
29
|
-
settings: (0, getImportSettings_1.default)({ javascript: true, typescript: false, jsx: false }),
|
|
30
|
-
},
|
|
31
|
-
Object.assign({ name: 'airbnb/config/base-disable-legacy-stylistic-js-config', files: utils_1.allFiles }, (0, getStylisticLegacyConfig_1.default)('javascript')),
|
|
10
|
+
...recommended_1.default,
|
|
32
11
|
];
|
|
33
12
|
exports.default = baseRecommendedConfig;
|
|
@@ -3,19 +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 typescript_eslint_1 = require("typescript-eslint");
|
|
7
6
|
const config_1 = __importDefault(require("../../configs/typescript/config"));
|
|
8
|
-
const
|
|
9
|
-
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
7
|
+
const typescript_1 = __importDefault(require("../../extensions/base/typescript"));
|
|
11
8
|
const baseTypescriptConfig = [
|
|
12
9
|
...Object.values(config_1.default),
|
|
13
|
-
|
|
14
|
-
name: 'airbnb/config/base-typescript-settings-extensions-configurations',
|
|
15
|
-
files: utils_1.tsFileWithoutReact,
|
|
16
|
-
settings: (0, getImportSettings_1.default)({ javascript: false, typescript: true, jsx: false }),
|
|
17
|
-
},
|
|
18
|
-
Object.assign({ name: 'airbnb/config/base-typescript-disable-legacy-stylistic-ts-config', files: utils_1.tsFiles }, (0, getStylisticLegacyConfig_1.default)('typescript')),
|
|
19
|
-
Object.assign(Object.assign({}, typescript_eslint_1.configs.disableTypeChecked), { name: 'airbnb/config/base-typescript-disable-type-checked', files: utils_1.jsFiles }),
|
|
10
|
+
...typescript_1.default,
|
|
20
11
|
];
|
|
21
12
|
exports.default = baseTypescriptConfig;
|
|
@@ -5,24 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_1 = __importDefault(require("../../configs/next/config"));
|
|
7
7
|
const recommended_1 = __importDefault(require("../../configs/react/recommended"));
|
|
8
|
-
const
|
|
8
|
+
const recommended_2 = __importDefault(require("../../extensions/next/recommended"));
|
|
9
9
|
const nextRecommendedConfig = [
|
|
10
10
|
...recommended_1.default,
|
|
11
11
|
...Object.values(config_1.default),
|
|
12
|
-
|
|
13
|
-
name: 'airbnb/config/next-import-x',
|
|
14
|
-
files: ['**/app/**/route.ts', '**/middleware.ts'],
|
|
15
|
-
rules: {
|
|
16
|
-
'import-x/prefer-default-export': 'off',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'airbnb/config/next-react-jsx-runtime',
|
|
21
|
-
files: utils_1.allFiles,
|
|
22
|
-
rules: {
|
|
23
|
-
'react/jsx-uses-react': 'off',
|
|
24
|
-
'react/react-in-jsx-scope': 'off',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
12
|
+
...recommended_2.default,
|
|
27
13
|
];
|
|
28
14
|
exports.default = nextRecommendedConfig;
|
|
@@ -2,40 +2,11 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
8
6
|
const config_1 = __importDefault(require("../../configs/node/config"));
|
|
9
|
-
const
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
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'];
|
|
7
|
+
const recommended_1 = __importDefault(require("../../extensions/node/recommended"));
|
|
14
8
|
const nodeRecommendedConfig = [
|
|
15
9
|
...Object.values(config_1.default),
|
|
16
|
-
|
|
17
|
-
? {
|
|
18
|
-
languageOptions: flatNodeConfig.languageOptions,
|
|
19
|
-
rules: {
|
|
20
|
-
'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'],
|
|
21
|
-
},
|
|
22
|
-
}
|
|
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)),
|
|
10
|
+
...recommended_1.default,
|
|
40
11
|
];
|
|
41
12
|
exports.default = nodeRecommendedConfig;
|
|
@@ -4,66 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const config_1 = __importDefault(require("../../configs/react/config"));
|
|
7
|
-
const
|
|
8
|
-
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
9
|
-
const style_1 = __importDefault(require("../../rules/style"));
|
|
10
|
-
const utils_1 = require("../../utils");
|
|
11
|
-
const dangleRules = style_1.default.rules['no-underscore-dangle'];
|
|
7
|
+
const recommended_1 = __importDefault(require("../../extensions/react/recommended"));
|
|
12
8
|
const reactRecommendedConfig = [
|
|
13
9
|
...Object.values(config_1.default),
|
|
14
|
-
|
|
15
|
-
name: 'airbnb/config/react-settings-extensions-configurations',
|
|
16
|
-
files: utils_1.jsFiles,
|
|
17
|
-
settings: (0, getImportSettings_1.default)({ javascript: true, typescript: false, jsx: true }),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
name: 'airbnb/config/react-configurations',
|
|
21
|
-
files: utils_1.allFiles,
|
|
22
|
-
rules: {
|
|
23
|
-
// disallow dangling underscores in identifiers
|
|
24
|
-
// https://eslint.org/docs/latest/rules/no-underscore-dangle
|
|
25
|
-
// Allow Redux devtools variable
|
|
26
|
-
'no-underscore-dangle': [
|
|
27
|
-
dangleRules[0],
|
|
28
|
-
Object.assign(Object.assign({}, dangleRules[1]), { allow: [...dangleRules[1].allow, '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] }),
|
|
29
|
-
],
|
|
30
|
-
// enforce that class methods use "this"
|
|
31
|
-
// https://eslint.org/docs/rules/class-methods-use-this
|
|
32
|
-
// Class Methods can be used in React
|
|
33
|
-
'class-methods-use-this': [
|
|
34
|
-
'error',
|
|
35
|
-
{
|
|
36
|
-
exceptMethods: [
|
|
37
|
-
'render',
|
|
38
|
-
'getInitialState',
|
|
39
|
-
'getDefaultProps',
|
|
40
|
-
'getChildContext',
|
|
41
|
-
'componentWillMount',
|
|
42
|
-
'UNSAFE_componentWillMount',
|
|
43
|
-
'componentDidMount',
|
|
44
|
-
'componentWillReceiveProps',
|
|
45
|
-
'UNSAFE_componentWillReceiveProps',
|
|
46
|
-
'shouldComponentUpdate',
|
|
47
|
-
'componentWillUpdate',
|
|
48
|
-
'UNSAFE_componentWillUpdate',
|
|
49
|
-
'componentDidUpdate',
|
|
50
|
-
'componentWillUnmount',
|
|
51
|
-
'componentDidCatch',
|
|
52
|
-
'getSnapshotBeforeUpdate',
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'airbnb/config/react-stylistic',
|
|
60
|
-
files: utils_1.allFiles,
|
|
61
|
-
rules: {
|
|
62
|
-
// specify whether double or single quotes should be used in JSX attributes
|
|
63
|
-
// https://eslint.style/rules/js/jsx-quotes
|
|
64
|
-
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
Object.assign({ name: 'airbnb/config/react-disable-legacy-stylistic-react-config', files: utils_1.allFiles }, (0, getStylisticLegacyConfig_1.default)('react')),
|
|
10
|
+
...recommended_1.default,
|
|
68
11
|
];
|
|
69
12
|
exports.default = reactRecommendedConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, unicorn/prefer-module */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* as is given due to less size of index.d.ts
|
|
6
|
+
*/
|
|
7
|
+
const baseExtensions = {
|
|
8
|
+
get recommended() {
|
|
9
|
+
return require('../../extensions/base/recommended').default;
|
|
10
|
+
},
|
|
11
|
+
get typescript() {
|
|
12
|
+
return require('../../extensions/base/typescript').default;
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
exports.default = baseExtensions;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 getImportSettings_1 = __importDefault(require("../../helpers/getImportSettings"));
|
|
7
|
+
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
8
|
+
const utils_1 = require("../../utils");
|
|
9
|
+
const baseRecommendedExtensionsConfig = [
|
|
10
|
+
{
|
|
11
|
+
name: 'airbnb/config/base-configurations',
|
|
12
|
+
files: utils_1.allFiles,
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 2018,
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
20
|
+
'import-x/core-modules': [],
|
|
21
|
+
'import-x/ignore': ['node_modules', String.raw `\.(coffee|scss|css|less|hbs|svg|json)$`],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'airbnb/config/base-settings-extensions-configurations',
|
|
26
|
+
files: utils_1.jsFileWithoutReact,
|
|
27
|
+
settings: (0, getImportSettings_1.default)({ javascript: true, typescript: false, jsx: false }),
|
|
28
|
+
},
|
|
29
|
+
Object.assign({ name: 'airbnb/config/base-disable-legacy-stylistic-js-config', files: utils_1.allFiles }, (0, getStylisticLegacyConfig_1.default)('javascript')),
|
|
30
|
+
];
|
|
31
|
+
exports.default = baseRecommendedExtensionsConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 typescript_eslint_1 = require("typescript-eslint");
|
|
7
|
+
const getImportSettings_1 = __importDefault(require("../../helpers/getImportSettings"));
|
|
8
|
+
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const baseTypescriptExtensionsConfig = [
|
|
11
|
+
{
|
|
12
|
+
name: 'airbnb/config/base-typescript-settings-extensions-configurations',
|
|
13
|
+
files: utils_1.tsFileWithoutReact,
|
|
14
|
+
settings: (0, getImportSettings_1.default)({ javascript: false, typescript: true, jsx: false }),
|
|
15
|
+
},
|
|
16
|
+
Object.assign({ name: 'airbnb/config/base-typescript-disable-legacy-stylistic-ts-config', files: utils_1.tsFiles }, (0, getStylisticLegacyConfig_1.default)('typescript')),
|
|
17
|
+
Object.assign(Object.assign({}, typescript_eslint_1.configs.disableTypeChecked), { name: 'airbnb/config/base-typescript-disable-type-checked', files: utils_1.jsFiles }),
|
|
18
|
+
];
|
|
19
|
+
exports.default = baseTypescriptExtensionsConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, unicorn/prefer-module */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* as is given due to less size of index.d.ts
|
|
6
|
+
*/
|
|
7
|
+
const extensions = {
|
|
8
|
+
get base() {
|
|
9
|
+
return require('../extensions/base').default;
|
|
10
|
+
},
|
|
11
|
+
get react() {
|
|
12
|
+
return require('../extensions/react').default;
|
|
13
|
+
},
|
|
14
|
+
get next() {
|
|
15
|
+
return require('../extensions/next').default;
|
|
16
|
+
},
|
|
17
|
+
get node() {
|
|
18
|
+
return require('../extensions/node').default;
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
exports.default = extensions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, unicorn/prefer-module */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* as is given due to less size of index.d.ts
|
|
6
|
+
*/
|
|
7
|
+
const nextExtensions = {
|
|
8
|
+
get recommended() {
|
|
9
|
+
return require('../../extensions/next/recommended').default;
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = nextExtensions;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../utils");
|
|
4
|
+
const nextRecommendedExtensionsConfig = [
|
|
5
|
+
{
|
|
6
|
+
name: 'airbnb/config/next-import-x',
|
|
7
|
+
files: ['**/app/**/route.ts', '**/middleware.ts'],
|
|
8
|
+
rules: {
|
|
9
|
+
'import-x/prefer-default-export': 'off',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'airbnb/config/next-react-jsx-runtime',
|
|
14
|
+
files: utils_1.allFiles,
|
|
15
|
+
rules: {
|
|
16
|
+
'react/jsx-uses-react': 'off',
|
|
17
|
+
'react/react-in-jsx-scope': 'off',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
exports.default = nextRecommendedExtensionsConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, unicorn/prefer-module */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* as is given due to less size of index.d.ts
|
|
6
|
+
*/
|
|
7
|
+
const nodeExtensions = {
|
|
8
|
+
get recommended() {
|
|
9
|
+
return require('../../extensions/node/recommended').default;
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = nodeExtensions;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
8
|
+
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../../rules/node/nodeNoUnsupportedFeatures"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const flatNodeConfig = eslint_plugin_n_1.default.configs['flat/recommended'];
|
|
11
|
+
const flatModuleConfig = eslint_plugin_n_1.default.configs['flat/recommended-module'];
|
|
12
|
+
const flatScriptConfig = eslint_plugin_n_1.default.configs['flat/recommended-script'];
|
|
13
|
+
const nodeRecommendedExtensionsConfig = [
|
|
14
|
+
Object.assign({ name: 'airbnb/config/node-configurations', files: utils_1.allFiles }, (flatNodeConfig
|
|
15
|
+
? {
|
|
16
|
+
languageOptions: flatNodeConfig.languageOptions,
|
|
17
|
+
rules: {
|
|
18
|
+
'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'],
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
: null)),
|
|
22
|
+
Object.assign({ name: 'airbnb/config/node-configurations-for-module', files: ['**/*.mjs', '**/*.mts'] }, (flatModuleConfig
|
|
23
|
+
? {
|
|
24
|
+
languageOptions: flatModuleConfig.languageOptions,
|
|
25
|
+
rules: {
|
|
26
|
+
'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'],
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
: null)),
|
|
30
|
+
Object.assign({ name: 'airbnb/config/node-configurations-for-script', files: ['**/*.cjs', '**/*.cts'] }, (flatScriptConfig
|
|
31
|
+
? {
|
|
32
|
+
languageOptions: flatScriptConfig.languageOptions,
|
|
33
|
+
rules: {
|
|
34
|
+
'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'],
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
: null)),
|
|
38
|
+
];
|
|
39
|
+
exports.default = nodeRecommendedExtensionsConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-unsafe-return, unicorn/prefer-module */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/**
|
|
5
|
+
* as is given due to less size of index.d.ts
|
|
6
|
+
*/
|
|
7
|
+
const reactExtensions = {
|
|
8
|
+
get recommended() {
|
|
9
|
+
return require('../../extensions/react/recommended').default;
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = reactExtensions;
|
|
@@ -0,0 +1,67 @@
|
|
|
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 getImportSettings_1 = __importDefault(require("../../helpers/getImportSettings"));
|
|
7
|
+
const getStylisticLegacyConfig_1 = __importDefault(require("../../helpers/getStylisticLegacyConfig"));
|
|
8
|
+
const style_1 = __importDefault(require("../../rules/style"));
|
|
9
|
+
const utils_1 = require("../../utils");
|
|
10
|
+
const dangleRules = style_1.default.rules['no-underscore-dangle'];
|
|
11
|
+
const reactRecommendedExtensionsConfig = [
|
|
12
|
+
{
|
|
13
|
+
name: 'airbnb/config/react-settings-extensions-configurations',
|
|
14
|
+
files: utils_1.jsFiles,
|
|
15
|
+
settings: (0, getImportSettings_1.default)({ javascript: true, typescript: false, jsx: true }),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'airbnb/config/react-configurations',
|
|
19
|
+
files: utils_1.allFiles,
|
|
20
|
+
rules: {
|
|
21
|
+
// disallow dangling underscores in identifiers
|
|
22
|
+
// https://eslint.org/docs/latest/rules/no-underscore-dangle
|
|
23
|
+
// Allow Redux devtools variable
|
|
24
|
+
'no-underscore-dangle': [
|
|
25
|
+
dangleRules[0],
|
|
26
|
+
Object.assign(Object.assign({}, dangleRules[1]), { allow: [...dangleRules[1].allow, '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] }),
|
|
27
|
+
],
|
|
28
|
+
// enforce that class methods use "this"
|
|
29
|
+
// https://eslint.org/docs/rules/class-methods-use-this
|
|
30
|
+
// Class Methods can be used in React
|
|
31
|
+
'class-methods-use-this': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
exceptMethods: [
|
|
35
|
+
'render',
|
|
36
|
+
'getInitialState',
|
|
37
|
+
'getDefaultProps',
|
|
38
|
+
'getChildContext',
|
|
39
|
+
'componentWillMount',
|
|
40
|
+
'UNSAFE_componentWillMount',
|
|
41
|
+
'componentDidMount',
|
|
42
|
+
'componentWillReceiveProps',
|
|
43
|
+
'UNSAFE_componentWillReceiveProps',
|
|
44
|
+
'shouldComponentUpdate',
|
|
45
|
+
'componentWillUpdate',
|
|
46
|
+
'UNSAFE_componentWillUpdate',
|
|
47
|
+
'componentDidUpdate',
|
|
48
|
+
'componentWillUnmount',
|
|
49
|
+
'componentDidCatch',
|
|
50
|
+
'getSnapshotBeforeUpdate',
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'airbnb/config/react-stylistic',
|
|
58
|
+
files: utils_1.allFiles,
|
|
59
|
+
rules: {
|
|
60
|
+
// specify whether double or single quotes should be used in JSX attributes
|
|
61
|
+
// https://eslint.style/rules/js/jsx-quotes
|
|
62
|
+
'@stylistic/jsx-quotes': ['error', 'prefer-double'],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
Object.assign({ name: 'airbnb/config/react-disable-legacy-stylistic-react-config', files: utils_1.allFiles }, (0, getStylisticLegacyConfig_1.default)('react')),
|
|
66
|
+
];
|
|
67
|
+
exports.default = reactRecommendedExtensionsConfig;
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.plugins = exports.configs = exports.rules = void 0;
|
|
7
|
+
exports.extensions = exports.plugins = exports.configs = exports.rules = void 0;
|
|
8
8
|
const configs_1 = __importDefault(require("./configs"));
|
|
9
|
+
const extensions_1 = __importDefault(require("./extensions"));
|
|
9
10
|
const plugins_1 = __importDefault(require("./plugins"));
|
|
10
11
|
const rules_1 = __importDefault(require("./rules"));
|
|
11
12
|
/**
|
|
@@ -14,3 +15,4 @@ const rules_1 = __importDefault(require("./rules"));
|
|
|
14
15
|
exports.rules = rules_1.default;
|
|
15
16
|
exports.configs = configs_1.default;
|
|
16
17
|
exports.plugins = plugins_1.default;
|
|
18
|
+
exports.extensions = extensions_1.default;
|