eslint-config-airbnb-extended 0.3.1 → 0.5.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 +10 -0
- package/dist/@types/index.d.ts +22 -0
- package/dist/configs/base/index.js +26 -0
- package/dist/{base → configs/base}/recommended.js +4 -4
- package/dist/configs/index.js +34 -0
- package/dist/{react → configs/react}/index.js +5 -4
- package/dist/{react → configs/react}/recommended.js +5 -6
- package/dist/configs/typescript/index.js +14 -0
- package/dist/{typescript → configs/typescript}/recommended.js +7 -6
- package/dist/helpers/getDevDepsList.js +1 -2
- package/dist/index.js +11 -37
- package/dist/plugins/index.js +21 -0
- package/dist/plugins/nextPlugin.js +12 -0
- package/dist/plugins/reactA11yPlugin.js +12 -0
- package/dist/plugins/reactHooksPlugin.js +44 -0
- package/dist/plugins/reactPlugin.js +13 -0
- package/dist/plugins/typescriptEslintPlugin.js +13 -0
- package/dist/rules/best-practices.js +65 -42
- package/dist/rules/errors.js +24 -32
- package/dist/rules/es6.js +2 -33
- package/dist/rules/imports.js +9 -14
- package/dist/rules/importsStrict.js +3 -16
- package/dist/rules/index.js +22 -0
- package/dist/rules/next.js +2 -4
- package/dist/rules/node.js +2 -1
- package/dist/rules/react-a11y.js +81 -80
- package/dist/rules/react-hooks.js +6 -42
- package/dist/rules/react.js +374 -340
- package/dist/rules/reactStrict.js +86 -0
- package/dist/rules/strict.js +2 -1
- package/dist/rules/style.js +38 -365
- package/dist/rules/stylistic.js +526 -0
- package/dist/rules/typescript/typescriptBase.js +3 -2
- package/dist/rules/typescript/typescriptEslint.js +22 -34
- package/dist/rules/typescript/typescriptImports.js +8 -4
- package/dist/rules/variables.js +2 -3
- package/package.json +3 -3
- package/dist/base/index.d.ts +0 -990
- package/dist/base/index.js +0 -23
- package/dist/base/recommended.d.ts +0 -990
- package/dist/helpers/getDevDepsList.d.ts +0 -3
- package/dist/index.d.ts +0 -17982
- package/dist/react/index.d.ts +0 -1793
- package/dist/react/recommended.d.ts +0 -2786
- package/dist/rules/best-practices.d.ts +0 -177
- package/dist/rules/errors.d.ts +0 -69
- package/dist/rules/es6.d.ts +0 -146
- package/dist/rules/imports.d.ts +0 -151
- package/dist/rules/importsStrict.d.ts +0 -43
- package/dist/rules/next.d.ts +0 -8
- package/dist/rules/node.d.ts +0 -90
- package/dist/rules/react-a11y.d.ts +0 -117
- package/dist/rules/react-hooks.d.ts +0 -19
- package/dist/rules/react.d.ts +0 -1659
- package/dist/rules/strict.d.ts +0 -7
- package/dist/rules/style.d.ts +0 -320
- package/dist/rules/typescript/typescriptBase.d.ts +0 -23
- package/dist/rules/typescript/typescriptEslint.d.ts +0 -3
- package/dist/rules/typescript/typescriptImports.d.ts +0 -37
- package/dist/rules/typescript.d.ts +0 -47
- package/dist/rules/typescript.js +0 -9
- package/dist/rules/variables.d.ts +0 -35
- package/dist/typescript/index.d.ts +0 -58
- package/dist/typescript/index.js +0 -11
- package/dist/typescript/recommended.d.ts +0 -112
- package/dist/utils/index.d.ts +0 -13
package/README.md
CHANGED
|
@@ -53,3 +53,13 @@ If you're working in a monorepo setup, it's recommended to run the installation
|
|
|
53
53
|
### Why did we switch from `import` to `import-x`?
|
|
54
54
|
|
|
55
55
|
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.
|
|
56
|
+
|
|
57
|
+
### Why are `plugins` separated from the `config` in this package?
|
|
58
|
+
|
|
59
|
+
The main reason for separating `plugins` from the config is to avoid a common issue developers face when extending multiple ESLint configurations. Specifically, many run into the error:
|
|
60
|
+
`Config "package": Key "plugins": Cannot redefine plugin "key".`
|
|
61
|
+
Unfortunately, there's no built-in way to resolve this conflict when plugins are directly included within shared configs.
|
|
62
|
+
|
|
63
|
+
This package combines multiple ESLint configurations (see [Packages Used](https://github.com/NishargShah/eslint-config-airbnb-extended/tree/master/packages/eslint-config-airbnb-extended#packages-used)), and based on experience, it's better to keep `plugins` separate. If you'd like to use the recommended plugins, you can import them directly from the `plugins` export provided by the package.
|
|
64
|
+
|
|
65
|
+
By doing this, you can safely use this package alongside official ESLint configs without running into plugin redefinition issues.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Direct export not allowed, it will increase the size of d.ts
|
|
3
|
+
*/
|
|
4
|
+
export declare const rules: {
|
|
5
|
+
base: Record<"imports" | "variables" | "bestPractices" | "errors" | "es6" | "node" | "strict" | "style" | "stylistic" | "importsStrict" | "reactStrict", import("eslint").Linter.Config>;
|
|
6
|
+
react: Record<"react" | "reactA11y" | "reactHooks", import("eslint").Linter.Config>;
|
|
7
|
+
next: import("eslint").Linter.Config;
|
|
8
|
+
typescript: Record<"imports" | "base" | "typescriptEslint", import("eslint").Linter.Config>;
|
|
9
|
+
};
|
|
10
|
+
export declare const configs: {
|
|
11
|
+
base: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
12
|
+
react: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
13
|
+
next: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
14
|
+
node: Record<"all" | "recommended" | "typescript", import("eslint").Linter.Config[]>;
|
|
15
|
+
};
|
|
16
|
+
export declare const plugins: {
|
|
17
|
+
next: import("eslint").Linter.Config;
|
|
18
|
+
react: import("eslint").Linter.Config;
|
|
19
|
+
reactA11y: import("eslint").Linter.Config;
|
|
20
|
+
reactHooks: import("eslint").Linter.Config;
|
|
21
|
+
typescriptEslint: import("eslint").Linter.Config;
|
|
22
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
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 best_practices_1 = __importDefault(require("../../rules/best-practices"));
|
|
7
|
+
const errors_1 = __importDefault(require("../../rules/errors"));
|
|
8
|
+
const es6_1 = __importDefault(require("../../rules/es6"));
|
|
9
|
+
const imports_1 = __importDefault(require("../../rules/imports"));
|
|
10
|
+
const node_1 = __importDefault(require("../../rules/node"));
|
|
11
|
+
const strict_1 = __importDefault(require("../../rules/strict"));
|
|
12
|
+
const style_1 = __importDefault(require("../../rules/style"));
|
|
13
|
+
const stylistic_1 = __importDefault(require("../../rules/stylistic"));
|
|
14
|
+
const variables_1 = __importDefault(require("../../rules/variables"));
|
|
15
|
+
const baseConfig = {
|
|
16
|
+
bestPractices: best_practices_1.default,
|
|
17
|
+
errors: errors_1.default,
|
|
18
|
+
es6: es6_1.default,
|
|
19
|
+
imports: imports_1.default,
|
|
20
|
+
node: node_1.default,
|
|
21
|
+
strict: strict_1.default,
|
|
22
|
+
style: style_1.default,
|
|
23
|
+
stylistic: stylistic_1.default,
|
|
24
|
+
variables: variables_1.default,
|
|
25
|
+
};
|
|
26
|
+
exports.default = baseConfig;
|
|
@@ -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
|
|
7
|
-
|
|
8
|
-
...Object.values(
|
|
6
|
+
const index_1 = __importDefault(require("../../configs/base/index"));
|
|
7
|
+
const baseRecommendedConfig = [
|
|
8
|
+
...Object.values(index_1.default),
|
|
9
9
|
{
|
|
10
10
|
name: 'airbnb/config/language-configurations',
|
|
11
11
|
languageOptions: {
|
|
@@ -14,6 +14,6 @@ exports.default = [
|
|
|
14
14
|
sourceType: 'module',
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
rules: {},
|
|
18
17
|
},
|
|
19
18
|
];
|
|
19
|
+
exports.default = baseRecommendedConfig;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 recommended_1 = __importDefault(require("../configs/base/recommended"));
|
|
7
|
+
const recommended_2 = __importDefault(require("../configs/react/recommended"));
|
|
8
|
+
const recommended_3 = __importDefault(require("../configs/typescript/recommended"));
|
|
9
|
+
const next_1 = __importDefault(require("../rules/next"));
|
|
10
|
+
const base = {
|
|
11
|
+
recommended: recommended_1.default,
|
|
12
|
+
typescript: recommended_3.default.base,
|
|
13
|
+
all: [...recommended_1.default, ...recommended_3.default.base],
|
|
14
|
+
};
|
|
15
|
+
const react = {
|
|
16
|
+
recommended: recommended_2.default,
|
|
17
|
+
typescript: recommended_3.default.react,
|
|
18
|
+
all: [...recommended_2.default, ...recommended_3.default.react],
|
|
19
|
+
};
|
|
20
|
+
const next = {
|
|
21
|
+
recommended: [...react.recommended, next_1.default],
|
|
22
|
+
typescript: react.typescript,
|
|
23
|
+
all: [...react.all, next_1.default],
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* as is given due to less size of index.d.ts
|
|
27
|
+
*/
|
|
28
|
+
const configs = {
|
|
29
|
+
base: base,
|
|
30
|
+
react: react,
|
|
31
|
+
next: next,
|
|
32
|
+
node: base,
|
|
33
|
+
};
|
|
34
|
+
exports.default = configs;
|
|
@@ -3,11 +3,12 @@ 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 react_1 = __importDefault(require("
|
|
7
|
-
const react_a11y_1 = __importDefault(require("
|
|
8
|
-
const react_hooks_1 = __importDefault(require("
|
|
9
|
-
|
|
6
|
+
const react_1 = __importDefault(require("../../rules/react"));
|
|
7
|
+
const react_a11y_1 = __importDefault(require("../../rules/react-a11y"));
|
|
8
|
+
const react_hooks_1 = __importDefault(require("../../rules/react-hooks"));
|
|
9
|
+
const reactConfig = {
|
|
10
10
|
react: react_1.default,
|
|
11
11
|
reactA11y: react_a11y_1.default,
|
|
12
12
|
reactHooks: react_hooks_1.default,
|
|
13
13
|
};
|
|
14
|
+
exports.default = reactConfig;
|
|
@@ -3,12 +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
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
...recommended_1.default,
|
|
11
|
-
...Object.values(react_1.default),
|
|
6
|
+
const index_1 = __importDefault(require("../../configs/react/index"));
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const reactRecommendedConfig = [
|
|
9
|
+
...Object.values(index_1.default),
|
|
12
10
|
{
|
|
13
11
|
name: 'airbnb/config/react-settings',
|
|
14
12
|
settings: {
|
|
@@ -20,3 +18,4 @@ exports.default = [
|
|
|
20
18
|
},
|
|
21
19
|
},
|
|
22
20
|
];
|
|
21
|
+
exports.default = reactRecommendedConfig;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 typescriptBase_1 = __importDefault(require("../../rules/typescript/typescriptBase"));
|
|
7
|
+
const typescriptEslint_1 = __importDefault(require("../../rules/typescript/typescriptEslint"));
|
|
8
|
+
const typescriptImports_1 = __importDefault(require("../../rules/typescript/typescriptImports"));
|
|
9
|
+
const typescriptConfig = {
|
|
10
|
+
base: typescriptBase_1.default,
|
|
11
|
+
typescriptEslint: typescriptEslint_1.default,
|
|
12
|
+
imports: typescriptImports_1.default,
|
|
13
|
+
};
|
|
14
|
+
exports.default = typescriptConfig;
|
|
@@ -3,16 +3,16 @@ 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
|
|
7
|
-
const utils_1 = require("
|
|
8
|
-
|
|
9
|
-
base:
|
|
6
|
+
const index_1 = __importDefault(require("../../configs/typescript/index"));
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const typescriptRecommendedConfig = {
|
|
9
|
+
base: Object.values(index_1.default),
|
|
10
10
|
react: [
|
|
11
|
-
...typescript_1.default.typescript,
|
|
12
11
|
{
|
|
13
12
|
name: 'airbnb/config/typescript-react',
|
|
14
13
|
rules: {
|
|
15
|
-
//
|
|
14
|
+
// only .jsx and .tsx files may have JSX
|
|
15
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
16
16
|
'react/jsx-filename-extension': [
|
|
17
17
|
'error',
|
|
18
18
|
{
|
|
@@ -33,3 +33,4 @@ exports.default = {
|
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
35
|
};
|
|
36
|
+
exports.default = typescriptRecommendedConfig;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDevDepsList = void 0;
|
|
4
3
|
const getDevDepsList = (extensions) => [
|
|
5
4
|
'test/**',
|
|
6
5
|
'tests/**',
|
|
@@ -28,4 +27,4 @@ const getDevDepsList = (extensions) => [
|
|
|
28
27
|
`**/eslint.config.{${extensions}}`,
|
|
29
28
|
`**/prettier.config.{${extensions}}`,
|
|
30
29
|
];
|
|
31
|
-
exports.
|
|
30
|
+
exports.default = getDevDepsList;
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable import-x/no-rename-default, unicorn/prefer-export-from */
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
5
|
};
|
|
5
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.configs = exports.rules = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
base: Object.assign(Object.assign({}, base_1.default), { importsStrict: importsStrict_1.default }),
|
|
17
|
-
react: react_1.default,
|
|
18
|
-
next: next_1.default,
|
|
19
|
-
typescript: typescript_1.default,
|
|
20
|
-
};
|
|
21
|
-
exports.configs = {
|
|
22
|
-
base: {
|
|
23
|
-
recommended: recommended_1.default,
|
|
24
|
-
typescript: recommended_3.default.base,
|
|
25
|
-
all: [...recommended_1.default, ...recommended_3.default.base],
|
|
26
|
-
},
|
|
27
|
-
react: {
|
|
28
|
-
recommended: recommended_2.default,
|
|
29
|
-
typescript: recommended_3.default.react,
|
|
30
|
-
all: [...recommended_2.default, ...recommended_3.default.react],
|
|
31
|
-
},
|
|
32
|
-
next: {
|
|
33
|
-
recommended: [...recommended_2.default, next_1.default],
|
|
34
|
-
typescript: recommended_3.default.react,
|
|
35
|
-
all: [...recommended_2.default, ...recommended_3.default.react, next_1.default],
|
|
36
|
-
},
|
|
37
|
-
node: {
|
|
38
|
-
recommended: recommended_1.default,
|
|
39
|
-
typescript: recommended_3.default.base,
|
|
40
|
-
all: [...recommended_1.default, ...recommended_3.default.base],
|
|
41
|
-
},
|
|
42
|
-
};
|
|
7
|
+
exports.plugins = exports.configs = exports.rules = void 0;
|
|
8
|
+
const configs_1 = __importDefault(require("./configs"));
|
|
9
|
+
const plugins_1 = __importDefault(require("./plugins"));
|
|
10
|
+
const rules_1 = __importDefault(require("./rules"));
|
|
11
|
+
/**
|
|
12
|
+
* Direct export not allowed, it will increase the size of d.ts
|
|
13
|
+
*/
|
|
14
|
+
exports.rules = rules_1.default;
|
|
15
|
+
exports.configs = configs_1.default;
|
|
16
|
+
exports.plugins = plugins_1.default;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 nextPlugin_1 = __importDefault(require("../plugins/nextPlugin"));
|
|
7
|
+
const reactA11yPlugin_1 = __importDefault(require("../plugins/reactA11yPlugin"));
|
|
8
|
+
const reactHooksPlugin_1 = __importDefault(require("../plugins/reactHooksPlugin"));
|
|
9
|
+
const reactPlugin_1 = __importDefault(require("../plugins/reactPlugin"));
|
|
10
|
+
const typescriptEslintPlugin_1 = __importDefault(require("../plugins/typescriptEslintPlugin"));
|
|
11
|
+
/**
|
|
12
|
+
* as is given due to less size of index.d.ts
|
|
13
|
+
*/
|
|
14
|
+
const plugins = {
|
|
15
|
+
next: nextPlugin_1.default,
|
|
16
|
+
react: reactPlugin_1.default,
|
|
17
|
+
reactA11y: reactA11yPlugin_1.default,
|
|
18
|
+
reactHooks: reactHooksPlugin_1.default,
|
|
19
|
+
typescriptEslint: typescriptEslintPlugin_1.default,
|
|
20
|
+
};
|
|
21
|
+
exports.default = plugins;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// @ts-expect-error eslint-plugin-import not working in import
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
|
|
5
|
+
const ESLintPluginNext = require('@next/eslint-plugin-next');
|
|
6
|
+
const nextPlugin = {
|
|
7
|
+
name: 'airbnb/config/plugin/next',
|
|
8
|
+
plugins: {
|
|
9
|
+
'@next/next': ESLintPluginNext,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = nextPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// @ts-expect-error eslint-plugin-import not working in import
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
|
|
5
|
+
const EsLintPluginJSXA11y = require('eslint-plugin-jsx-a11y');
|
|
6
|
+
const reactA11yPlugin = {
|
|
7
|
+
name: 'airbnb/config/plugin/react-a11y',
|
|
8
|
+
plugins: {
|
|
9
|
+
'jsx-a11y': EsLintPluginJSXA11y,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
exports.default = reactA11yPlugin;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
// eslint-disable-next-line import-x/no-namespace
|
|
37
|
+
const EsLintPluginReactHooks = __importStar(require("eslint-plugin-react-hooks"));
|
|
38
|
+
const reactHooksPlugin = {
|
|
39
|
+
name: 'airbnb/config/plugin/react-hooks',
|
|
40
|
+
plugins: {
|
|
41
|
+
'react-hooks': EsLintPluginReactHooks,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
exports.default = reactHooksPlugin;
|
|
@@ -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_react_1 = __importDefault(require("eslint-plugin-react"));
|
|
7
|
+
const reactPlugin = {
|
|
8
|
+
name: 'airbnb/config/plugin/react',
|
|
9
|
+
plugins: {
|
|
10
|
+
react: eslint_plugin_react_1.default,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = reactPlugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const typescript_eslint_1 = require("typescript-eslint");
|
|
4
|
+
const typescriptEslintPlugin = {
|
|
5
|
+
name: 'airbnb/config/plugin/typescript-eslint',
|
|
6
|
+
plugins: {
|
|
7
|
+
'@typescript-eslint': typescript_eslint_1.plugin,
|
|
8
|
+
},
|
|
9
|
+
languageOptions: {
|
|
10
|
+
parser: typescript_eslint_1.parser,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
exports.default = typescriptEslintPlugin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
const bestPracticesRules = {
|
|
4
4
|
name: 'airbnb/config/best-practices',
|
|
5
5
|
rules: {
|
|
6
6
|
// enforces getter/setter pairs in objects
|
|
@@ -8,13 +8,15 @@ exports.default = {
|
|
|
8
8
|
'accessor-pairs': 'off',
|
|
9
9
|
// enforces return statements in callbacks of array's methods
|
|
10
10
|
// https://eslint.org/docs/rules/array-callback-return
|
|
11
|
-
'array-callback-return': [
|
|
11
|
+
'array-callback-return': [
|
|
12
|
+
'error',
|
|
13
|
+
{
|
|
14
|
+
allowImplicit: true,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
12
17
|
// treat var statements as if they were block scoped
|
|
13
18
|
// https://eslint.org/docs/rules/block-scoped-var
|
|
14
19
|
'block-scoped-var': 'error',
|
|
15
|
-
// specify the maximum cyclomatic complexity allowed in a program
|
|
16
|
-
// https://eslint.org/docs/rules/complexity
|
|
17
|
-
complexity: ['off', 20],
|
|
18
20
|
// enforce that class methods use "this"
|
|
19
21
|
// https://eslint.org/docs/rules/class-methods-use-this
|
|
20
22
|
'class-methods-use-this': [
|
|
@@ -23,15 +25,23 @@ exports.default = {
|
|
|
23
25
|
exceptMethods: [],
|
|
24
26
|
},
|
|
25
27
|
],
|
|
28
|
+
// specify the maximum cyclomatic complexity allowed in a program
|
|
29
|
+
// https://eslint.org/docs/rules/complexity
|
|
30
|
+
complexity: 'off',
|
|
26
31
|
// require return statements to either always or never specify values
|
|
27
32
|
// https://eslint.org/docs/rules/consistent-return
|
|
28
33
|
'consistent-return': 'error',
|
|
29
34
|
// specify curly brace conventions for all control statements
|
|
30
35
|
// https://eslint.org/docs/rules/curly
|
|
31
|
-
curly: ['error', 'multi-line'],
|
|
36
|
+
curly: ['error', 'multi-line'],
|
|
32
37
|
// require default case in switch statements
|
|
33
38
|
// https://eslint.org/docs/rules/default-case
|
|
34
|
-
'default-case': [
|
|
39
|
+
'default-case': [
|
|
40
|
+
'error',
|
|
41
|
+
{
|
|
42
|
+
commentPattern: '^no default$',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
35
45
|
// Enforce default clauses in switch statements to be last
|
|
36
46
|
// https://eslint.org/docs/rules/default-case-last
|
|
37
47
|
'default-case-last': 'error',
|
|
@@ -39,13 +49,21 @@ exports.default = {
|
|
|
39
49
|
'default-param-last': 'error',
|
|
40
50
|
// encourages use of dot notation whenever possible
|
|
41
51
|
// https://eslint.org/docs/rules/dot-notation
|
|
42
|
-
'dot-notation': [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
'dot-notation': [
|
|
53
|
+
'error',
|
|
54
|
+
{
|
|
55
|
+
allowKeywords: true,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
46
58
|
// require the use of === and !==
|
|
47
59
|
// https://eslint.org/docs/rules/eqeqeq
|
|
48
|
-
eqeqeq: [
|
|
60
|
+
eqeqeq: [
|
|
61
|
+
'error',
|
|
62
|
+
'always',
|
|
63
|
+
{
|
|
64
|
+
null: 'ignore',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
49
67
|
// Require grouped accessor pairs in object literals and classes
|
|
50
68
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
51
69
|
'grouped-accessor-pairs': 'error',
|
|
@@ -57,7 +75,6 @@ exports.default = {
|
|
|
57
75
|
'max-classes-per-file': ['error', 1],
|
|
58
76
|
// disallow the use of alert, confirm, and prompt
|
|
59
77
|
// https://eslint.org/docs/rules/no-alert
|
|
60
|
-
// TODO: enable, semver-major
|
|
61
78
|
'no-alert': 'warn',
|
|
62
79
|
// disallow use of arguments.caller or arguments.callee
|
|
63
80
|
// https://eslint.org/docs/rules/no-caller
|
|
@@ -73,7 +90,12 @@ exports.default = {
|
|
|
73
90
|
'no-div-regex': 'off',
|
|
74
91
|
// disallow else after a return in an if
|
|
75
92
|
// https://eslint.org/docs/rules/no-else-return
|
|
76
|
-
'no-else-return': [
|
|
93
|
+
'no-else-return': [
|
|
94
|
+
'error',
|
|
95
|
+
{
|
|
96
|
+
allowElseIf: false,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
77
99
|
// disallow empty functions, except for standalone funcs/arrows
|
|
78
100
|
// https://eslint.org/docs/rules/no-empty-function
|
|
79
101
|
'no-empty-function': [
|
|
@@ -87,7 +109,6 @@ exports.default = {
|
|
|
87
109
|
'no-empty-pattern': 'error',
|
|
88
110
|
// Disallow empty static blocks
|
|
89
111
|
// https://eslint.org/docs/latest/rules/no-empty-static-block
|
|
90
|
-
// TODO: semver-major, enable
|
|
91
112
|
'no-empty-static-block': 'off',
|
|
92
113
|
// disallow comparisons to null without a type-checking operator
|
|
93
114
|
// https://eslint.org/docs/rules/no-eq-null
|
|
@@ -107,15 +128,14 @@ exports.default = {
|
|
|
107
128
|
// disallow fallthrough of case statements
|
|
108
129
|
// https://eslint.org/docs/rules/no-fallthrough
|
|
109
130
|
'no-fallthrough': 'error',
|
|
110
|
-
// disallow the use of leading or trailing decimal points in numeric literals
|
|
111
|
-
// https://eslint.org/docs/rules/no-floating-decimal
|
|
112
|
-
'no-floating-decimal': 'error',
|
|
113
131
|
// disallow reassignments of native objects or read-only globals
|
|
114
132
|
// https://eslint.org/docs/rules/no-global-assign
|
|
115
|
-
'no-global-assign': [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
'no-global-assign': [
|
|
134
|
+
'error',
|
|
135
|
+
{
|
|
136
|
+
exceptions: [],
|
|
137
|
+
},
|
|
138
|
+
],
|
|
119
139
|
// disallow implicit type conversions
|
|
120
140
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
121
141
|
'no-implicit-coercion': [
|
|
@@ -141,7 +161,13 @@ exports.default = {
|
|
|
141
161
|
'no-iterator': 'error',
|
|
142
162
|
// disallow use of labels for anything other than loops and switches
|
|
143
163
|
// https://eslint.org/docs/rules/no-labels
|
|
144
|
-
'no-labels': [
|
|
164
|
+
'no-labels': [
|
|
165
|
+
'error',
|
|
166
|
+
{
|
|
167
|
+
allowLoop: false,
|
|
168
|
+
allowSwitch: false,
|
|
169
|
+
},
|
|
170
|
+
],
|
|
145
171
|
// disallow unnecessary nested blocks
|
|
146
172
|
// https://eslint.org/docs/rules/no-lone-blocks
|
|
147
173
|
'no-lone-blocks': 'error',
|
|
@@ -159,14 +185,6 @@ exports.default = {
|
|
|
159
185
|
detectObjects: false,
|
|
160
186
|
},
|
|
161
187
|
],
|
|
162
|
-
// disallow use of multiple spaces
|
|
163
|
-
// https://eslint.org/docs/rules/no-multi-spaces
|
|
164
|
-
'no-multi-spaces': [
|
|
165
|
-
'error',
|
|
166
|
-
{
|
|
167
|
-
ignoreEOLComments: false,
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
188
|
// disallow use of multiline strings
|
|
171
189
|
// https://eslint.org/docs/rules/no-multi-str
|
|
172
190
|
'no-multi-str': 'error',
|
|
@@ -277,9 +295,6 @@ exports.default = {
|
|
|
277
295
|
// disallow use of assignment in return statement
|
|
278
296
|
// https://eslint.org/docs/rules/no-return-assign
|
|
279
297
|
'no-return-assign': ['error', 'always'],
|
|
280
|
-
// disallow redundant `return await`
|
|
281
|
-
// https://eslint.org/docs/rules/no-return-await
|
|
282
|
-
'no-return-await': 'error',
|
|
283
298
|
// disallow use of `javascript:` urls.
|
|
284
299
|
// https://eslint.org/docs/rules/no-script-url
|
|
285
300
|
'no-script-url': 'error',
|
|
@@ -334,22 +349,32 @@ exports.default = {
|
|
|
334
349
|
// disallow use of void operator
|
|
335
350
|
// https://eslint.org/docs/rules/no-void
|
|
336
351
|
'no-void': 'error',
|
|
337
|
-
// disallow usage of configurable warning terms in comments
|
|
352
|
+
// disallow usage of configurable warning terms in comments
|
|
338
353
|
// https://eslint.org/docs/rules/no-warning-comments
|
|
339
|
-
'no-warning-comments': [
|
|
354
|
+
'no-warning-comments': [
|
|
355
|
+
'off',
|
|
356
|
+
{
|
|
357
|
+
terms: ['todo', 'fixme', 'remember'],
|
|
358
|
+
location: 'start',
|
|
359
|
+
},
|
|
360
|
+
],
|
|
340
361
|
// disallow use of the with statement
|
|
341
362
|
// https://eslint.org/docs/rules/no-with
|
|
342
363
|
'no-with': 'error',
|
|
343
364
|
// require using Error objects as Promise rejection reasons
|
|
344
365
|
// https://eslint.org/docs/rules/prefer-promise-reject-errors
|
|
345
|
-
'prefer-promise-reject-errors': [
|
|
366
|
+
'prefer-promise-reject-errors': [
|
|
367
|
+
'error',
|
|
368
|
+
{
|
|
369
|
+
allowEmptyReject: true,
|
|
370
|
+
},
|
|
371
|
+
],
|
|
346
372
|
// Suggest using named capture group in regular expression
|
|
347
373
|
// https://eslint.org/docs/rules/prefer-named-capture-group
|
|
348
374
|
'prefer-named-capture-group': 'off',
|
|
349
375
|
// Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call()
|
|
350
376
|
// https://eslint.org/docs/rules/prefer-object-has-own
|
|
351
|
-
|
|
352
|
-
'prefer-object-has-own': 'off',
|
|
377
|
+
'prefer-object-has-own': 'error',
|
|
353
378
|
// https://eslint.org/docs/rules/prefer-regex-literals
|
|
354
379
|
'prefer-regex-literals': [
|
|
355
380
|
'error',
|
|
@@ -369,11 +394,9 @@ exports.default = {
|
|
|
369
394
|
// requires to declare all vars on top of their containing scope
|
|
370
395
|
// https://eslint.org/docs/rules/vars-on-top
|
|
371
396
|
'vars-on-top': 'error',
|
|
372
|
-
// require immediate function invocation to be wrapped in parentheses
|
|
373
|
-
// https://eslint.org/docs/rules/wrap-iife.html
|
|
374
|
-
'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
|
|
375
397
|
// require or disallow Yoda conditions
|
|
376
398
|
// https://eslint.org/docs/rules/yoda
|
|
377
399
|
yoda: 'error',
|
|
378
400
|
},
|
|
379
401
|
};
|
|
402
|
+
exports.default = bestPracticesRules;
|