eslint-config-airbnb-extended 0.7.0 → 0.8.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/dist/@types/index.d.ts +4 -2
- package/dist/configs/react/index.js +2 -2
- package/dist/configs/react/recommended.js +41 -1
- package/dist/plugins/importXPlugin.js +44 -0
- package/dist/plugins/index.js +5 -1
- package/dist/plugins/nextPlugin.js +2 -2
- package/dist/plugins/nodePlugin.js +2 -2
- package/dist/plugins/reactA11yPlugin.js +2 -2
- package/dist/plugins/reactHooksPlugin.js +2 -2
- package/dist/rules/imports.js +19 -10
- package/dist/rules/node/nodeBase.js +10 -4
- package/dist/rules/node/nodeNoUnsupportedFeatures.js +1 -1
- package/dist/rules/react-a11y.js +15 -12
- package/dist/rules/react-jsx-a11y.js +259 -0
- package/dist/rules/react.js +12 -42
- package/dist/script/checkUpdates.js +114 -0
- package/package.json +7 -1
package/dist/@types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export declare const rules: {
|
|
5
5
|
base: Record<"bestPractices" | "errors" | "es6" | "imports" | "strict" | "style" | "stylistic" | "variables" | "importsStrict" | "reactStrict", import("eslint").Linter.Config>;
|
|
6
6
|
node: Record<"globals" | "base" | "promises" | "noUnsupportedFeatures", import("eslint").Linter.Config>;
|
|
7
|
-
react: Record<"react" | "
|
|
7
|
+
react: Record<"react" | "reactJsxA11y" | "reactHooks", import("eslint").Linter.Config>;
|
|
8
8
|
next: Record<"next", import("eslint").Linter.Config>;
|
|
9
9
|
typescript: Record<"imports" | "base" | "typescriptEslint", import("eslint").Linter.Config>;
|
|
10
10
|
};
|
|
@@ -15,9 +15,11 @@ export declare const configs: {
|
|
|
15
15
|
node: Record<"recommended", import("eslint").Linter.Config[]>;
|
|
16
16
|
};
|
|
17
17
|
export declare const plugins: {
|
|
18
|
-
|
|
18
|
+
importX: import("eslint").Linter.Config;
|
|
19
|
+
node: import("eslint").Linter.Config;
|
|
19
20
|
react: import("eslint").Linter.Config;
|
|
20
21
|
reactA11y: import("eslint").Linter.Config;
|
|
21
22
|
reactHooks: import("eslint").Linter.Config;
|
|
23
|
+
next: import("eslint").Linter.Config;
|
|
22
24
|
typescriptEslint: import("eslint").Linter.Config;
|
|
23
25
|
};
|
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("../../rules/react"));
|
|
7
|
-
const react_a11y_1 = __importDefault(require("../../rules/react-a11y"));
|
|
8
7
|
const react_hooks_1 = __importDefault(require("../../rules/react-hooks"));
|
|
8
|
+
const react_jsx_a11y_1 = __importDefault(require("../../rules/react-jsx-a11y"));
|
|
9
9
|
const reactConfig = {
|
|
10
10
|
react: react_1.default,
|
|
11
|
-
|
|
11
|
+
reactJsxA11y: react_jsx_a11y_1.default,
|
|
12
12
|
reactHooks: react_hooks_1.default,
|
|
13
13
|
};
|
|
14
14
|
exports.default = reactConfig;
|
|
@@ -4,11 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("../../configs/react"));
|
|
7
|
+
const style_1 = __importDefault(require("../../rules/style"));
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
9
|
+
const dangleRules = style_1.default.rules['no-underscore-dangle'];
|
|
8
10
|
const reactRecommendedConfig = [
|
|
9
11
|
...Object.values(react_1.default),
|
|
10
12
|
{
|
|
11
|
-
name: 'airbnb/config/react-
|
|
13
|
+
name: 'airbnb/config/react-import-x',
|
|
12
14
|
settings: {
|
|
13
15
|
'import-x/resolver': {
|
|
14
16
|
node: {
|
|
@@ -17,5 +19,43 @@ const reactRecommendedConfig = [
|
|
|
17
19
|
},
|
|
18
20
|
},
|
|
19
21
|
},
|
|
22
|
+
{
|
|
23
|
+
name: 'airbnb/config/react-configurations',
|
|
24
|
+
rules: {
|
|
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
|
+
// Specify whether double or single quotes should be used in JSX attributes
|
|
31
|
+
// https://eslint.org/docs/rules/jsx-quotes
|
|
32
|
+
// @deprecated
|
|
33
|
+
'jsx-quotes': ['error', 'prefer-double'],
|
|
34
|
+
// Class Methods can be used in react
|
|
35
|
+
'class-methods-use-this': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
exceptMethods: [
|
|
39
|
+
'render',
|
|
40
|
+
'getInitialState',
|
|
41
|
+
'getDefaultProps',
|
|
42
|
+
'getChildContext',
|
|
43
|
+
'componentWillMount',
|
|
44
|
+
'UNSAFE_componentWillMount',
|
|
45
|
+
'componentDidMount',
|
|
46
|
+
'componentWillReceiveProps',
|
|
47
|
+
'UNSAFE_componentWillReceiveProps',
|
|
48
|
+
'shouldComponentUpdate',
|
|
49
|
+
'componentWillUpdate',
|
|
50
|
+
'UNSAFE_componentWillUpdate',
|
|
51
|
+
'componentDidUpdate',
|
|
52
|
+
'componentWillUnmount',
|
|
53
|
+
'componentDidCatch',
|
|
54
|
+
'getSnapshotBeforeUpdate',
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
20
60
|
];
|
|
21
61
|
exports.default = reactRecommendedConfig;
|
|
@@ -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 importXPlugin = __importStar(require("eslint-plugin-import-x"));
|
|
38
|
+
const importXPluginConfig = {
|
|
39
|
+
name: 'airbnb/config/plugin/import-x',
|
|
40
|
+
plugins: {
|
|
41
|
+
'import-x': importXPlugin,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
exports.default = importXPluginConfig;
|
package/dist/plugins/index.js
CHANGED
|
@@ -3,7 +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 importXPlugin_1 = __importDefault(require("../plugins/importXPlugin"));
|
|
6
7
|
const nextPlugin_1 = __importDefault(require("../plugins/nextPlugin"));
|
|
8
|
+
const nodePlugin_1 = __importDefault(require("../plugins/nodePlugin"));
|
|
7
9
|
const reactA11yPlugin_1 = __importDefault(require("../plugins/reactA11yPlugin"));
|
|
8
10
|
const reactHooksPlugin_1 = __importDefault(require("../plugins/reactHooksPlugin"));
|
|
9
11
|
const reactPlugin_1 = __importDefault(require("../plugins/reactPlugin"));
|
|
@@ -12,10 +14,12 @@ const typescriptEslintPlugin_1 = __importDefault(require("../plugins/typescriptE
|
|
|
12
14
|
* as is given due to less size of index.d.ts
|
|
13
15
|
*/
|
|
14
16
|
const plugins = {
|
|
15
|
-
|
|
17
|
+
importX: importXPlugin_1.default,
|
|
18
|
+
node: nodePlugin_1.default,
|
|
16
19
|
react: reactPlugin_1.default,
|
|
17
20
|
reactA11y: reactA11yPlugin_1.default,
|
|
18
21
|
reactHooks: reactHooksPlugin_1.default,
|
|
22
|
+
next: nextPlugin_1.default,
|
|
19
23
|
typescriptEslint: typescriptEslintPlugin_1.default,
|
|
20
24
|
};
|
|
21
25
|
exports.default = plugins;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-expect-error eslint-plugin-import not working in import
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
|
|
5
|
-
const
|
|
5
|
+
const plugin = require('@next/eslint-plugin-next');
|
|
6
6
|
const nextPlugin = {
|
|
7
7
|
name: 'airbnb/config/plugin/next',
|
|
8
8
|
plugins: {
|
|
9
|
-
'@next/next':
|
|
9
|
+
'@next/next': plugin,
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
exports.default = nextPlugin;
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
7
|
-
const
|
|
7
|
+
const nodePlugin = {
|
|
8
8
|
name: 'airbnb/config/plugin/node',
|
|
9
9
|
plugins: {
|
|
10
10
|
n: eslint_plugin_n_1.default,
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
exports.default =
|
|
13
|
+
exports.default = nodePlugin;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
// @ts-expect-error eslint-plugin-import not working in import
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-require-imports,unicorn/prefer-module
|
|
5
|
-
const
|
|
5
|
+
const plugin = require('eslint-plugin-jsx-a11y');
|
|
6
6
|
const reactA11yPlugin = {
|
|
7
7
|
name: 'airbnb/config/plugin/react-a11y',
|
|
8
8
|
plugins: {
|
|
9
|
-
'jsx-a11y':
|
|
9
|
+
'jsx-a11y': plugin,
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
exports.default = reactA11yPlugin;
|
|
@@ -34,11 +34,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
// eslint-disable-next-line import-x/no-namespace
|
|
37
|
-
const
|
|
37
|
+
const plugin = __importStar(require("eslint-plugin-react-hooks"));
|
|
38
38
|
const reactHooksPlugin = {
|
|
39
39
|
name: 'airbnb/config/plugin/react-hooks',
|
|
40
40
|
plugins: {
|
|
41
|
-
'react-hooks':
|
|
41
|
+
'react-hooks': plugin,
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
exports.default = reactHooksPlugin;
|
package/dist/rules/imports.js
CHANGED
|
@@ -3,17 +3,20 @@ 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
|
-
|
|
6
|
+
exports.deprecatedImportsRules = void 0;
|
|
7
7
|
const globals_1 = __importDefault(require("globals"));
|
|
8
8
|
const getDevDepsList_1 = __importDefault(require("../helpers/getDevDepsList"));
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
|
-
const importsRules =
|
|
10
|
+
const importsRules = {
|
|
11
|
+
name: 'airbnb/config/import-x',
|
|
12
|
+
languageOptions: {
|
|
11
13
|
globals: Object.assign({}, globals_1.default.es2015),
|
|
12
14
|
parserOptions: {
|
|
13
|
-
ecmaVersion:
|
|
15
|
+
ecmaVersion: 2018,
|
|
14
16
|
sourceType: 'module',
|
|
15
17
|
},
|
|
16
|
-
},
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
17
20
|
'import-x/resolver': {
|
|
18
21
|
node: {
|
|
19
22
|
extensions: utils_1.jsExtensionsResolver,
|
|
@@ -22,7 +25,8 @@ const importsRules = Object.assign(Object.assign({}, eslint_plugin_import_x_1.fl
|
|
|
22
25
|
'import-x/extensions': utils_1.jsExtensionsWithReact,
|
|
23
26
|
'import-x/core-modules': [],
|
|
24
27
|
'import-x/ignore': ['node_modules', String.raw `\.(coffee|scss|css|less|hbs|svg|json)$`],
|
|
25
|
-
},
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
26
30
|
// enforce a consistent style for type specifiers (inline or top-level)
|
|
27
31
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/consistent-type-specifier-style.md
|
|
28
32
|
'import-x/consistent-type-specifier-style': 'off',
|
|
@@ -49,10 +53,6 @@ const importsRules = Object.assign(Object.assign({}, eslint_plugin_import_x_1.fl
|
|
|
49
53
|
// in a single file.
|
|
50
54
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/group-exports.md
|
|
51
55
|
'import-x/group-exports': 'off',
|
|
52
|
-
// disallow non-import statements appearing before import statements
|
|
53
|
-
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
|
|
54
|
-
// @deprecated: use `import-x/first`
|
|
55
|
-
// 'import-x/imports-first': 'off',
|
|
56
56
|
// Forbid modules to have too many dependencies
|
|
57
57
|
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/max-dependencies.md
|
|
58
58
|
'import-x/max-dependencies': 'off',
|
|
@@ -194,5 +194,14 @@ const importsRules = Object.assign(Object.assign({}, eslint_plugin_import_x_1.fl
|
|
|
194
194
|
// this should not be enabled until this proposal has at least been *presented* to TC39.
|
|
195
195
|
// At the moment, it's not a thing.
|
|
196
196
|
'import-x/unambiguous': 'off',
|
|
197
|
-
}
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
exports.deprecatedImportsRules = {
|
|
200
|
+
name: 'airbnb/config/import-x/deprecated',
|
|
201
|
+
rules: {
|
|
202
|
+
// disallow non-import statements appearing before import statements
|
|
203
|
+
// https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/imports-first.md
|
|
204
|
+
'import-x/imports-first': 'off',
|
|
205
|
+
},
|
|
206
|
+
};
|
|
198
207
|
exports.default = importsRules;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecatedNodeBaseRules = void 0;
|
|
3
4
|
const nodeBaseRules = {
|
|
4
5
|
name: 'airbnb/config/node/base',
|
|
5
6
|
rules: {
|
|
@@ -45,10 +46,6 @@ const nodeBaseRules = {
|
|
|
45
46
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-extraneous-require.md
|
|
46
47
|
// Off due to 'import-x/no-extraneous-dependencies'
|
|
47
48
|
'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
49
|
// Disallow import declarations which import non-existence modules
|
|
53
50
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-missing-import.md
|
|
54
51
|
// Off due to 'import-x/no-unresolved'
|
|
@@ -106,6 +103,15 @@ const nodeBaseRules = {
|
|
|
106
103
|
// Require that process.exit() expressions use the same code path as throw
|
|
107
104
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/process-exit-as-throw.md
|
|
108
105
|
'n/process-exit-as-throw': 'error',
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
exports.deprecatedNodeBaseRules = {
|
|
109
|
+
name: 'airbnb/config/node/base/deprecated',
|
|
110
|
+
rules: {
|
|
111
|
+
// Disallow third-party modules which are hiding core modules
|
|
112
|
+
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-hide-core-modules.md
|
|
113
|
+
// @deprecated
|
|
114
|
+
'n/no-hide-core-modules': 'off',
|
|
109
115
|
// Require correct usage of hashbang
|
|
110
116
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/shebang.md
|
|
111
117
|
// @deprecated
|
|
@@ -5,7 +5,7 @@ const nodeNoUnsupportedFeaturesRules = {
|
|
|
5
5
|
rules: {
|
|
6
6
|
// Disallow unsupported ECMAScript built-ins on the specified version
|
|
7
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-
|
|
8
|
+
'n/no-unsupported-features/es-builtins': 'error',
|
|
9
9
|
// Disallow unsupported ECMAScript syntax on the specified version
|
|
10
10
|
// https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-unsupported-features/es-syntax.md
|
|
11
11
|
'n/no-unsupported-features/es-syntax': 'error',
|
package/dist/rules/react-a11y.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecatedReactA11yRules = void 0;
|
|
3
4
|
const reactA11yRules = {
|
|
4
5
|
name: 'airbnb/config/react-a11y',
|
|
5
6
|
languageOptions: {
|
|
@@ -10,10 +11,6 @@ const reactA11yRules = {
|
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
13
|
rules: {
|
|
13
|
-
// ensure emoji are accessible
|
|
14
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
|
|
15
|
-
// @deprecated
|
|
16
|
-
// 'jsx-a11y/accessible-emoji': 'off',
|
|
17
14
|
// Enforce that all elements that require alternative text have meaningful information
|
|
18
15
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
|
|
19
16
|
'jsx-a11y/alt-text': [
|
|
@@ -134,10 +131,6 @@ const reactA11yRules = {
|
|
|
134
131
|
depth: 25,
|
|
135
132
|
},
|
|
136
133
|
],
|
|
137
|
-
// require that JSX labels use "htmlFor"
|
|
138
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
139
|
-
// @deprecated: replaced by `label-has-associated-control` rule
|
|
140
|
-
// 'jsx-a11y/label-has-for': 'off',
|
|
141
134
|
// require HTML element's lang prop to be valid
|
|
142
135
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
|
|
143
136
|
'jsx-a11y/lang': 'error',
|
|
@@ -214,10 +207,6 @@ const reactA11yRules = {
|
|
|
214
207
|
allowExpressionValues: true,
|
|
215
208
|
},
|
|
216
209
|
],
|
|
217
|
-
// require onBlur instead of onChange
|
|
218
|
-
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
219
|
-
// @deprecated
|
|
220
|
-
// 'jsx-a11y/no-onchange': 'off',
|
|
221
210
|
// ensure HTML elements do not specify redundant ARIA roles
|
|
222
211
|
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
|
|
223
212
|
'jsx-a11y/no-redundant-roles': [
|
|
@@ -253,4 +242,18 @@ const reactA11yRules = {
|
|
|
253
242
|
'jsx-a11y/tabindex-no-positive': 'error',
|
|
254
243
|
},
|
|
255
244
|
};
|
|
245
|
+
exports.deprecatedReactA11yRules = {
|
|
246
|
+
name: 'airbnb/config/react-a11y/deprecated',
|
|
247
|
+
rules: {
|
|
248
|
+
// ensure emoji are accessible
|
|
249
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
|
|
250
|
+
'jsx-a11y/accessible-emoji': 'off',
|
|
251
|
+
// require that JSX labels use "htmlFor"
|
|
252
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
253
|
+
'jsx-a11y/label-has-for': 'off',
|
|
254
|
+
// require onBlur instead of onChange
|
|
255
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
256
|
+
'jsx-a11y/no-onchange': 'off',
|
|
257
|
+
},
|
|
258
|
+
};
|
|
256
259
|
exports.default = reactA11yRules;
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deprecatedReactJsxA11yRules = void 0;
|
|
4
|
+
const reactJsxA11yRules = {
|
|
5
|
+
name: 'airbnb/config/react-jsx-a11y',
|
|
6
|
+
languageOptions: {
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaFeatures: {
|
|
9
|
+
jsx: true,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
// Enforce that all elements that require alternative text have meaningful information
|
|
15
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/alt-text.md
|
|
16
|
+
'jsx-a11y/alt-text': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
elements: ['img', 'object', 'area', 'input[type="image"]'],
|
|
20
|
+
img: [],
|
|
21
|
+
object: [],
|
|
22
|
+
area: [],
|
|
23
|
+
'input[type="image"]': [],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
// Ensures anchor text is not ambiguous
|
|
27
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-ambiguous-text.md
|
|
28
|
+
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
29
|
+
// Enforce that anchors have content
|
|
30
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-has-content.md
|
|
31
|
+
'jsx-a11y/anchor-has-content': [
|
|
32
|
+
'error',
|
|
33
|
+
{
|
|
34
|
+
components: [],
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
// ensure <a> tags are valid
|
|
38
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/anchor-is-valid.md
|
|
39
|
+
'jsx-a11y/anchor-is-valid': [
|
|
40
|
+
'error',
|
|
41
|
+
{
|
|
42
|
+
components: ['Link'],
|
|
43
|
+
specialLink: ['to'],
|
|
44
|
+
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
// elements with aria-activedescendant must be tabbable
|
|
48
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-activedescendant-has-tabindex.md
|
|
49
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
50
|
+
// Enforce all aria-* props are valid.
|
|
51
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-props.md
|
|
52
|
+
'jsx-a11y/aria-props': 'error',
|
|
53
|
+
// Enforce ARIA state and property values are valid.
|
|
54
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-proptypes.md
|
|
55
|
+
'jsx-a11y/aria-proptypes': 'error',
|
|
56
|
+
// Require ARIA roles to be valid and non-abstract
|
|
57
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-role.md
|
|
58
|
+
'jsx-a11y/aria-role': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
ignoreNonDOM: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
// Enforce that elements that do not support ARIA roles, states, and
|
|
65
|
+
// properties do not have those attributes.
|
|
66
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/aria-unsupported-elements.md
|
|
67
|
+
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
68
|
+
// Ensure the autocomplete attribute is correct and suitable for the form field it is used with
|
|
69
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/autocomplete-valid.md
|
|
70
|
+
'jsx-a11y/autocomplete-valid': [
|
|
71
|
+
'error',
|
|
72
|
+
{
|
|
73
|
+
inputComponents: ['Input'],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
// require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress
|
|
77
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/click-events-have-key-events.md
|
|
78
|
+
'jsx-a11y/click-events-have-key-events': 'error',
|
|
79
|
+
// Enforce that a control (an interactive element) has a text label.
|
|
80
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/control-has-associated-label.md
|
|
81
|
+
'jsx-a11y/control-has-associated-label': [
|
|
82
|
+
'error',
|
|
83
|
+
{
|
|
84
|
+
labelAttributes: ['label'],
|
|
85
|
+
controlComponents: [],
|
|
86
|
+
ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'],
|
|
87
|
+
ignoreRoles: [
|
|
88
|
+
'grid',
|
|
89
|
+
'listbox',
|
|
90
|
+
'menu',
|
|
91
|
+
'menubar',
|
|
92
|
+
'radiogroup',
|
|
93
|
+
'row',
|
|
94
|
+
'tablist',
|
|
95
|
+
'toolbar',
|
|
96
|
+
'tree',
|
|
97
|
+
'treegrid',
|
|
98
|
+
],
|
|
99
|
+
depth: 5,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
// ensure <hX> tags have content and are not aria-hidden
|
|
103
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/heading-has-content.md
|
|
104
|
+
'jsx-a11y/heading-has-content': [
|
|
105
|
+
'error',
|
|
106
|
+
{
|
|
107
|
+
components: ['Typography', 'Text'],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
// require HTML elements to have a "lang" prop
|
|
111
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/html-has-lang.md
|
|
112
|
+
'jsx-a11y/html-has-lang': 'error',
|
|
113
|
+
// ensure iframe elements have a unique title
|
|
114
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/iframe-has-title.md
|
|
115
|
+
'jsx-a11y/iframe-has-title': 'error',
|
|
116
|
+
// Prevent img alt text from containing redundant words like "image", "picture", or "photo"
|
|
117
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/img-redundant-alt.md
|
|
118
|
+
'jsx-a11y/img-redundant-alt': 'error',
|
|
119
|
+
// Elements with an interactive role and interaction handlers must be focusable
|
|
120
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/interactive-supports-focus.md
|
|
121
|
+
'jsx-a11y/interactive-supports-focus': 'error',
|
|
122
|
+
// Enforce that a label tag has a text label and an associated control.
|
|
123
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-associated-control.md
|
|
124
|
+
'jsx-a11y/label-has-associated-control': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
labelComponents: [],
|
|
128
|
+
labelAttributes: [],
|
|
129
|
+
controlComponents: [],
|
|
130
|
+
assert: 'both',
|
|
131
|
+
depth: 25,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
// require HTML element's lang prop to be valid
|
|
135
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/lang.md
|
|
136
|
+
'jsx-a11y/lang': 'error',
|
|
137
|
+
// media elements must have captions
|
|
138
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/media-has-caption.md
|
|
139
|
+
'jsx-a11y/media-has-caption': [
|
|
140
|
+
'error',
|
|
141
|
+
{
|
|
142
|
+
audio: [],
|
|
143
|
+
video: [],
|
|
144
|
+
track: [],
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
// require that mouseover/outcome with focus/blur, for keyboard-only users
|
|
148
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/mouse-events-have-key-events.md
|
|
149
|
+
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
150
|
+
// Prevent use of `accessKey`
|
|
151
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-access-key.md
|
|
152
|
+
'jsx-a11y/no-access-key': 'error',
|
|
153
|
+
// Enforce that aria-hidden="true" is not set on focusable elements.
|
|
154
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-aria-hidden-on-focusable.md
|
|
155
|
+
'jsx-a11y/no-aria-hidden-on-focusable': 'off',
|
|
156
|
+
// prohibit autoFocus prop
|
|
157
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-autofocus.md
|
|
158
|
+
'jsx-a11y/no-autofocus': [
|
|
159
|
+
'error',
|
|
160
|
+
{
|
|
161
|
+
ignoreNonDOM: true,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
// prevent distracting elements, like <marquee> and <blink>
|
|
165
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-distracting-elements.md
|
|
166
|
+
'jsx-a11y/no-distracting-elements': [
|
|
167
|
+
'error',
|
|
168
|
+
{
|
|
169
|
+
elements: ['marquee', 'blink'],
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
// WAI-ARIA roles should not be used to convert an interactive element to non-interactive
|
|
173
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-interactive-element-to-noninteractive-role.md
|
|
174
|
+
'jsx-a11y/no-interactive-element-to-noninteractive-role': [
|
|
175
|
+
'error',
|
|
176
|
+
{
|
|
177
|
+
tr: ['none', 'presentation'],
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
// A non-interactive element does not support event handlers (mouse and key handlers)
|
|
181
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-interactions.md
|
|
182
|
+
'jsx-a11y/no-noninteractive-element-interactions': [
|
|
183
|
+
'error',
|
|
184
|
+
{
|
|
185
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
// WAI-ARIA roles should not be used to convert a non-interactive element to interactive
|
|
189
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-element-to-interactive-role.md
|
|
190
|
+
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
|
|
191
|
+
'error',
|
|
192
|
+
{
|
|
193
|
+
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
194
|
+
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
|
|
195
|
+
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'],
|
|
196
|
+
table: ['grid'],
|
|
197
|
+
td: ['gridcell'],
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
// Tab key navigation should be limited to elements on the page that can be interacted with.
|
|
201
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-noninteractive-tabindex.md
|
|
202
|
+
'jsx-a11y/no-noninteractive-tabindex': [
|
|
203
|
+
'error',
|
|
204
|
+
{
|
|
205
|
+
tags: [],
|
|
206
|
+
roles: ['tabpanel'],
|
|
207
|
+
allowExpressionValues: true,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
// ensure HTML elements do not specify redundant ARIA roles
|
|
211
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-redundant-roles.md
|
|
212
|
+
'jsx-a11y/no-redundant-roles': [
|
|
213
|
+
'error',
|
|
214
|
+
{
|
|
215
|
+
nav: ['navigation'],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
// Enforce that DOM elements without semantic behavior not have interaction handlers
|
|
219
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-static-element-interactions.md
|
|
220
|
+
'jsx-a11y/no-static-element-interactions': [
|
|
221
|
+
'error',
|
|
222
|
+
{
|
|
223
|
+
handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'],
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
// Enforces using semantic DOM elements over the ARIA role property.
|
|
227
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/prefer-tag-over-role.md
|
|
228
|
+
'jsx-a11y/prefer-tag-over-role': 'off',
|
|
229
|
+
// Enforce that elements with ARIA roles must have all required attributes
|
|
230
|
+
// for that role.
|
|
231
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-has-required-aria-props.md
|
|
232
|
+
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
233
|
+
// Enforce that elements with explicit or implicit roles defined contain
|
|
234
|
+
// only aria-* properties supported by that role.
|
|
235
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/role-supports-aria-props.md
|
|
236
|
+
'jsx-a11y/role-supports-aria-props': 'error',
|
|
237
|
+
// only allow <th> to have the "scope" attr
|
|
238
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/scope.md
|
|
239
|
+
'jsx-a11y/scope': 'error',
|
|
240
|
+
// Enforce tabIndex value is not greater than zero.
|
|
241
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/tabindex-no-positive.md
|
|
242
|
+
'jsx-a11y/tabindex-no-positive': 'error',
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
exports.deprecatedReactJsxA11yRules = {
|
|
246
|
+
name: 'airbnb/config/react-jsx-a11y/deprecated',
|
|
247
|
+
rules: {
|
|
248
|
+
// ensure emoji are accessible
|
|
249
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/accessible-emoji.md
|
|
250
|
+
'jsx-a11y/accessible-emoji': 'off',
|
|
251
|
+
// require that JSX labels use "htmlFor"
|
|
252
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/label-has-for.md
|
|
253
|
+
'jsx-a11y/label-has-for': 'off',
|
|
254
|
+
// require onBlur instead of onChange
|
|
255
|
+
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/no-onchange.md
|
|
256
|
+
'jsx-a11y/no-onchange': 'off',
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
exports.default = reactJsxA11yRules;
|
package/dist/rules/react.js
CHANGED
|
@@ -3,9 +3,8 @@ 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
|
+
exports.deprecatedReactRules = void 0;
|
|
6
7
|
const globals_1 = __importDefault(require("globals"));
|
|
7
|
-
const style_1 = __importDefault(require("../rules/style"));
|
|
8
|
-
const dangleRules = style_1.default.rules['no-underscore-dangle'];
|
|
9
8
|
const reactRules = {
|
|
10
9
|
name: 'airbnb/config/react',
|
|
11
10
|
languageOptions: {
|
|
@@ -24,38 +23,6 @@ const reactRules = {
|
|
|
24
23
|
// View link below for react rules documentation
|
|
25
24
|
// https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
|
|
26
25
|
rules: {
|
|
27
|
-
// Allow Redux devtools variable
|
|
28
|
-
'no-underscore-dangle': [
|
|
29
|
-
dangleRules[0],
|
|
30
|
-
Object.assign(Object.assign({}, dangleRules[1]), { allow: [...dangleRules[1].allow, '__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'] }),
|
|
31
|
-
],
|
|
32
|
-
// Specify whether double or single quotes should be used in JSX attributes
|
|
33
|
-
// https://eslint.org/docs/rules/jsx-quotes
|
|
34
|
-
'jsx-quotes': ['error', 'prefer-double'],
|
|
35
|
-
// Class Methods can be used in react
|
|
36
|
-
'class-methods-use-this': [
|
|
37
|
-
'error',
|
|
38
|
-
{
|
|
39
|
-
exceptMethods: [
|
|
40
|
-
'render',
|
|
41
|
-
'getInitialState',
|
|
42
|
-
'getDefaultProps',
|
|
43
|
-
'getChildContext',
|
|
44
|
-
'componentWillMount',
|
|
45
|
-
'UNSAFE_componentWillMount',
|
|
46
|
-
'componentDidMount',
|
|
47
|
-
'componentWillReceiveProps',
|
|
48
|
-
'UNSAFE_componentWillReceiveProps',
|
|
49
|
-
'shouldComponentUpdate',
|
|
50
|
-
'componentWillUpdate',
|
|
51
|
-
'UNSAFE_componentWillUpdate',
|
|
52
|
-
'componentDidUpdate',
|
|
53
|
-
'componentWillUnmount',
|
|
54
|
-
'componentDidCatch',
|
|
55
|
-
'getSnapshotBeforeUpdate',
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
26
|
// Enforces consistent naming for boolean props
|
|
60
27
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
|
|
61
28
|
'react/boolean-prop-naming': 'off',
|
|
@@ -314,17 +281,9 @@ const reactRules = {
|
|
|
314
281
|
// Disallow JSX props spreading
|
|
315
282
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
316
283
|
'react/jsx-props-no-spreading': 'off',
|
|
317
|
-
// Enforce defaultProps declarations alphabetical sorting
|
|
318
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
319
|
-
// @deprecated
|
|
320
|
-
'react/jsx-sort-default-props': 'off',
|
|
321
284
|
// Enforce props alphabetical sorting
|
|
322
285
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
323
286
|
'react/jsx-sort-props': 'off',
|
|
324
|
-
// Enforce spaces before the closing bracket of self-closing JSX elements, Deprecated in favor of jsx-tag-spacing
|
|
325
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
|
|
326
|
-
// @deprecated
|
|
327
|
-
'react/jsx-space-before-closing': 'off',
|
|
328
287
|
// Validate whitespace in and around the JSX opening and closing brackets
|
|
329
288
|
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
|
|
330
289
|
'react/jsx-tag-spacing': [
|
|
@@ -609,4 +568,15 @@ const reactRules = {
|
|
|
609
568
|
'react/void-dom-elements-no-children': 'error',
|
|
610
569
|
},
|
|
611
570
|
};
|
|
571
|
+
exports.deprecatedReactRules = {
|
|
572
|
+
name: 'airbnb/config/react/deprecated',
|
|
573
|
+
rules: {
|
|
574
|
+
// Enforce defaultProps declarations alphabetical sorting
|
|
575
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
576
|
+
'react/jsx-sort-default-props': 'off',
|
|
577
|
+
// Enforce spaces before the closing bracket of self-closing JSX elements, Deprecated in favor of jsx-tag-spacing
|
|
578
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-space-before-closing.md
|
|
579
|
+
'react/jsx-space-before-closing': 'off',
|
|
580
|
+
},
|
|
581
|
+
};
|
|
612
582
|
exports.default = reactRules;
|
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
const eslint_plugin_import_x_1 = __importDefault(require("eslint-plugin-import-x"));
|
|
49
|
+
const eslint_plugin_jsx_a11y_1 = __importDefault(require("eslint-plugin-jsx-a11y"));
|
|
50
|
+
const eslint_plugin_n_1 = __importDefault(require("eslint-plugin-n"));
|
|
51
|
+
const eslint_plugin_react_1 = __importDefault(require("eslint-plugin-react"));
|
|
52
|
+
const eslint_plugin_react_hooks_1 = __importDefault(require("eslint-plugin-react-hooks"));
|
|
53
|
+
const imports_1 = __importStar(require("../rules/imports"));
|
|
54
|
+
const nodeBase_1 = __importStar(require("../rules/node/nodeBase"));
|
|
55
|
+
const nodeGlobals_1 = __importDefault(require("../rules/node/nodeGlobals"));
|
|
56
|
+
const nodeNoUnsupportedFeatures_1 = __importDefault(require("../rules/node/nodeNoUnsupportedFeatures"));
|
|
57
|
+
const nodePromises_1 = __importDefault(require("../rules/node/nodePromises"));
|
|
58
|
+
const react_1 = __importStar(require("../rules/react"));
|
|
59
|
+
const react_hooks_1 = __importDefault(require("../rules/react-hooks"));
|
|
60
|
+
const react_jsx_a11y_1 = __importStar(require("../rules/react-jsx-a11y"));
|
|
61
|
+
const getRulesArray = (prefix, arr) => arr.filter((rule) => rule.startsWith(prefix));
|
|
62
|
+
const checkImportsUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const localRules = getRulesArray('import-x/', Object.keys(imports_1.default.rules));
|
|
64
|
+
const deprecatedLocalRules = getRulesArray('import-x/', Object.keys(imports_1.deprecatedImportsRules.rules));
|
|
65
|
+
const remoteRules = Object.keys(eslint_plugin_import_x_1.default.rules);
|
|
66
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
67
|
+
return true;
|
|
68
|
+
throw new Error('Import X Plugin Updated');
|
|
69
|
+
});
|
|
70
|
+
const checkNodeUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
const localRules = getRulesArray('n/', [
|
|
72
|
+
...Object.keys(nodeBase_1.default.rules),
|
|
73
|
+
...Object.keys(nodeGlobals_1.default.rules),
|
|
74
|
+
...Object.keys(nodePromises_1.default.rules),
|
|
75
|
+
...Object.keys(nodeNoUnsupportedFeatures_1.default.rules),
|
|
76
|
+
]);
|
|
77
|
+
const deprecatedLocalRules = getRulesArray('n/', Object.keys(nodeBase_1.deprecatedNodeBaseRules.rules));
|
|
78
|
+
const remoteRules = eslint_plugin_n_1.default.rules ? Object.keys(eslint_plugin_n_1.default.rules) : [];
|
|
79
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
80
|
+
return true;
|
|
81
|
+
throw new Error('Node Plugin Updated');
|
|
82
|
+
});
|
|
83
|
+
const checkReactUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
+
const localRules = getRulesArray('react/', Object.keys(react_1.default.rules));
|
|
85
|
+
const deprecatedLocalRules = getRulesArray('react/', Object.keys(react_1.deprecatedReactRules.rules));
|
|
86
|
+
const remoteRules = Object.keys(eslint_plugin_react_1.default.rules);
|
|
87
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
88
|
+
return true;
|
|
89
|
+
throw new Error('React Plugin Updated');
|
|
90
|
+
});
|
|
91
|
+
const checkReactJsxA11yUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
92
|
+
const localRules = getRulesArray('jsx-a11y/', Object.keys(react_jsx_a11y_1.default.rules));
|
|
93
|
+
const deprecatedLocalRules = getRulesArray('jsx-a11y/', Object.keys(react_jsx_a11y_1.deprecatedReactJsxA11yRules.rules));
|
|
94
|
+
const remoteRules = eslint_plugin_jsx_a11y_1.default.rules ? Object.keys(eslint_plugin_jsx_a11y_1.default.rules) : [];
|
|
95
|
+
if (localRules.length + deprecatedLocalRules.length === remoteRules.length)
|
|
96
|
+
return true;
|
|
97
|
+
throw new Error('React JSX A11y Plugin Updated');
|
|
98
|
+
});
|
|
99
|
+
const checkReactHooksUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
+
const localRules = getRulesArray('react-hooks/', Object.keys(react_hooks_1.default.rules));
|
|
101
|
+
const remoteRules = Object.keys(eslint_plugin_react_hooks_1.default.rules);
|
|
102
|
+
if (localRules.length === remoteRules.length)
|
|
103
|
+
return true;
|
|
104
|
+
throw new Error('React Hooks Plugin Updated');
|
|
105
|
+
});
|
|
106
|
+
const checkUpdates = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
|
+
yield checkImportsUpdates();
|
|
108
|
+
yield checkNodeUpdates();
|
|
109
|
+
yield checkReactUpdates();
|
|
110
|
+
yield checkReactJsxA11yUpdates();
|
|
111
|
+
yield checkReactHooksUpdates();
|
|
112
|
+
});
|
|
113
|
+
// noinspection JSIgnoredPromiseFromCall
|
|
114
|
+
checkUpdates();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-airbnb-extended",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Eslint Airbnb Config Extended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -38,11 +38,15 @@
|
|
|
38
38
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
39
39
|
"@types/eslint-plugin-jsx-a11y": "^6.10.0",
|
|
40
40
|
"eslint": "^9.24.0",
|
|
41
|
+
"eslint-import-resolver-typescript": "^4.3.1",
|
|
41
42
|
"eslint-plugin-import-x": "^4.10.2",
|
|
42
43
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
44
|
+
"eslint-plugin-n": "^17.17.0",
|
|
43
45
|
"eslint-plugin-react": "^7.37.5",
|
|
44
46
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
47
|
+
"ts-node": "^10.9.2",
|
|
45
48
|
"tsc-alias": "^1.8.14",
|
|
49
|
+
"tsconfig-paths": "^4.2.0",
|
|
46
50
|
"typescript": "^5.8.3",
|
|
47
51
|
"typescript-eslint": "^8.29.1"
|
|
48
52
|
},
|
|
@@ -81,8 +85,10 @@
|
|
|
81
85
|
}
|
|
82
86
|
},
|
|
83
87
|
"scripts": {
|
|
88
|
+
"prebuild": "pnpm check:updates",
|
|
84
89
|
"build": "tsc -b",
|
|
85
90
|
"postbuild": "tsc-alias",
|
|
91
|
+
"check:updates": "ts-node script/checkUpdates.ts",
|
|
86
92
|
"typecheck": "tsc --noEmit"
|
|
87
93
|
}
|
|
88
94
|
}
|