@perfective/eslint-config-react 0.15.1 → 0.17.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/LICENSE +1 -1
- package/README.adoc +66 -46
- package/README.md +60 -52
- package/config/jsx-a11y/jsx-a11y-config.d.ts +2 -0
- package/config/jsx-a11y/jsx-a11y-config.js +81 -0
- package/config/perfective-eslint-react-config.d.ts +7 -0
- package/config/perfective-eslint-react-config.js +24 -0
- package/config/react/jsx.d.ts +1 -0
- package/config/react/jsx.js +88 -0
- package/config/react/react-config.d.ts +2 -0
- package/config/react/react-config.js +139 -0
- package/config/react-hooks/react-hooks-config.d.ts +2 -0
- package/config/react-hooks/react-hooks-config.js +14 -0
- package/config/react-perf/react-perf-config.d.ts +2 -0
- package/config/react-perf/react-perf-config.js +14 -0
- package/config/testing-library/index.d.ts +1 -0
- package/config/testing-library/index.js +1 -0
- package/config/testing-library/testing-library-config.d.ts +8 -0
- package/config/testing-library/testing-library-config.js +14 -0
- package/config/typescript-eslint/index.d.ts +1 -0
- package/config/typescript-eslint/index.js +1 -0
- package/{rules/eslint-config → config/typescript-eslint}/rules/typescript-eslint.d.ts +5 -1
- package/config/typescript-eslint/rules/typescript-eslint.js +11 -0
- package/config/unicorn/index.d.ts +1 -0
- package/config/unicorn/index.js +1 -0
- package/{rules/eslint-config → config/unicorn}/rules/unicorn.d.ts +4 -1
- package/config/unicorn/rules/unicorn.js +9 -0
- package/index.d.ts +1 -0
- package/index.js +1 -58
- package/package.json +30 -12
- package/testing-library/package.json +13 -0
- package/typescript-eslint/package.json +13 -0
- package/unicorn/package.json +13 -0
- package/rules/eslint-config/index.js +0 -15
- package/rules/eslint-config/rules/typescript-eslint.js +0 -17
- package/rules/eslint-config/rules/unicorn.js +0 -7
- package/rules/jsx-a11y/index.js +0 -79
- package/rules/react/index.js +0 -158
- package/rules/react/jsx.js +0 -90
- package/rules/react-hooks/index.js +0 -10
- package/rules/react-hooks-ssr/index.js +0 -9
- package/rules/react-perf/index.js +0 -12
- package/rules.d.ts +0 -3
- package/rules.js +0 -14
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import reactPerfPlugin from 'eslint-plugin-react-perf';
|
|
2
|
+
export function reactPerfConfig() {
|
|
3
|
+
return {
|
|
4
|
+
plugins: {
|
|
5
|
+
'react-perf': reactPerfPlugin
|
|
6
|
+
},
|
|
7
|
+
rules: {
|
|
8
|
+
'react-perf/jsx-no-jsx-as-prop': 'error',
|
|
9
|
+
'react-perf/jsx-no-new-array-as-prop': 'error',
|
|
10
|
+
'react-perf/jsx-no-new-function-as-prop': 'error',
|
|
11
|
+
'react-perf/jsx-no-new-object-as-prop': 'error'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { testingLibraryConfig } from './testing-library-config';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { testingLibraryConfig } from "./testing-library-config.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
import { Glob } from '@perfective/eslint-config';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a flat config for `eslint-plugin-testing-library` for a given list of files globs.
|
|
5
|
+
*
|
|
6
|
+
* @since v0.17.0
|
|
7
|
+
*/
|
|
8
|
+
export declare function testingLibraryConfig(files?: Glob[]): Linter.Config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jestFiles } from '@perfective/eslint-config';
|
|
2
|
+
import { testingLibraryConfig as perfectiveTestingLibraryConfig } from '@perfective/eslint-config/testing-library';
|
|
3
|
+
export function testingLibraryConfig(files = jestFiles) {
|
|
4
|
+
const config = perfectiveTestingLibraryConfig(files);
|
|
5
|
+
return {
|
|
6
|
+
files: config.files,
|
|
7
|
+
plugins: config.plugins,
|
|
8
|
+
rules: Object.assign(Object.assign({}, config.rules), {
|
|
9
|
+
'testing-library/no-unnecessary-act': ['error', {
|
|
10
|
+
isStrict: true
|
|
11
|
+
}]
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { typescriptEslintNamingConvention } from './rules/typescript-eslint';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { typescriptEslintNamingConvention } from "./rules/typescript-eslint.js";
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { TypescriptEslintNamingConvention } from '@perfective/eslint-config/
|
|
1
|
+
import { TypescriptEslintNamingConvention } from '@perfective/eslint-config/typescript-eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a React-compatible configuration with the given extensions
|
|
4
|
+
* for the `@typescript-eslint/naming-convention` rule.
|
|
5
|
+
*/
|
|
2
6
|
export declare function typescriptEslintNamingConvention(extensions?: TypescriptEslintNamingConvention[]): TypescriptEslintNamingConvention[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { typescriptEslintNamingConvention as typescriptEslintNamingConventionDefaults } from '@perfective/eslint-config/typescript-eslint';
|
|
2
|
+
export function typescriptEslintNamingConvention(extensions = []) {
|
|
3
|
+
return typescriptEslintNamingConventionDefaults([{
|
|
4
|
+
selector: ['variable'],
|
|
5
|
+
modifiers: ['const'],
|
|
6
|
+
format: ['strictCamelCase', 'StrictPascalCase']
|
|
7
|
+
}, {
|
|
8
|
+
selector: ['function'],
|
|
9
|
+
format: ['strictCamelCase', 'StrictPascalCase']
|
|
10
|
+
}].concat(extensions));
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { unicornPreventAbbreviations } from './rules/unicorn';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { unicornPreventAbbreviations } from "./rules/unicorn.js";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { UnicornPreventAbbreviationReplacements, UnicornPreventAbbreviations } from '@perfective/eslint-config/
|
|
1
|
+
import { UnicornPreventAbbreviationReplacements, UnicornPreventAbbreviations } from '@perfective/eslint-config/unicorn';
|
|
2
|
+
/**
|
|
3
|
+
* Adds React-specific abbreviations for the `unicorn/prevent-abbreviations` rule.
|
|
4
|
+
*/
|
|
2
5
|
export declare function unicornPreventAbbreviations(replacements?: UnicornPreventAbbreviationReplacements, options?: Partial<Pick<UnicornPreventAbbreviations, 'checkProperties'>>): UnicornPreventAbbreviations;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { unicornPreventAbbreviations as unicornPreventAbbreviationsDefaults } from '@perfective/eslint-config/unicorn';
|
|
2
|
+
export function unicornPreventAbbreviations(replacements = {}, options = {}) {
|
|
3
|
+
return unicornPreventAbbreviationsDefaults(Object.assign({
|
|
4
|
+
prop: false,
|
|
5
|
+
props: false,
|
|
6
|
+
ref: false,
|
|
7
|
+
refs: false
|
|
8
|
+
}, replacements), options);
|
|
9
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { perfectiveEslintReactConfig } from './config/perfective-eslint-react-config';
|
package/index.js
CHANGED
|
@@ -1,58 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const config_1 = require("@perfective/eslint-config/config");
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: [
|
|
5
|
-
'@perfective/eslint-config',
|
|
6
|
-
],
|
|
7
|
-
overrides: [
|
|
8
|
-
{
|
|
9
|
-
files: ['*.ts', '*.tsx'],
|
|
10
|
-
env: {
|
|
11
|
-
browser: true,
|
|
12
|
-
commonjs: true,
|
|
13
|
-
es6: true,
|
|
14
|
-
jest: true,
|
|
15
|
-
node: true,
|
|
16
|
-
},
|
|
17
|
-
parserOptions: {
|
|
18
|
-
ecmaVersion: 2018,
|
|
19
|
-
sourceType: 'module',
|
|
20
|
-
ecmaFeatures: {
|
|
21
|
-
jsx: true,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
extends: [
|
|
25
|
-
'./rules/eslint-config',
|
|
26
|
-
'./rules/jsx-a11y',
|
|
27
|
-
'./rules/react',
|
|
28
|
-
'./rules/react-hooks',
|
|
29
|
-
'./rules/react-hooks-ssr',
|
|
30
|
-
'./rules/react-perf',
|
|
31
|
-
],
|
|
32
|
-
settings: {
|
|
33
|
-
react: {
|
|
34
|
-
version: 'detect',
|
|
35
|
-
createClass: 'createReactClass',
|
|
36
|
-
pragma: 'React',
|
|
37
|
-
fragment: 'Fragment',
|
|
38
|
-
},
|
|
39
|
-
propWrapperFunctions: [
|
|
40
|
-
'exactPropTypes',
|
|
41
|
-
],
|
|
42
|
-
linkComponents: [],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
files: ['*.tsx', '*.jsx'],
|
|
47
|
-
rules: {
|
|
48
|
-
'prefer-arrow/prefer-arrow-functions': 'off',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
files: ['*.@(spec|test).[jt]s?(x)'],
|
|
53
|
-
rules: Object.assign({}, (0, config_1.optionalRule)('testing-library/no-unnecessary-act', ['error', {
|
|
54
|
-
isStrict: true,
|
|
55
|
-
}])),
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
1
|
+
export { perfectiveEslintReactConfig } from "./config/perfective-eslint-react-config.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perfective/eslint-config-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "ESLint shareable rules configuration for React",
|
|
5
5
|
"keywords": ["react", "code quality", "code standard", "code style", "eslint", "eslint-config", "lint", "perfective", "typescript"],
|
|
6
6
|
"author": "Andrey Mikheychik <a.mikheychik@gmail.com>",
|
|
@@ -9,24 +9,42 @@
|
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/perfective/eslint-config-react.git"
|
|
11
11
|
},
|
|
12
|
+
"type": "module",
|
|
12
13
|
"license": "MIT",
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@perfective/eslint-config": "~0.
|
|
15
|
+
"@perfective/eslint-config": "~0.34.1"
|
|
15
16
|
},
|
|
16
17
|
"peerDependencies": {
|
|
17
|
-
"eslint
|
|
18
|
-
"eslint-plugin-
|
|
19
|
-
"eslint-plugin-react
|
|
20
|
-
"eslint-plugin-react-hooks
|
|
21
|
-
"eslint-plugin-react-perf": "^3.3.
|
|
18
|
+
"eslint": "^9.39.2",
|
|
19
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
20
|
+
"eslint-plugin-react": "^7.37.5",
|
|
21
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
22
|
+
"eslint-plugin-react-perf": "^3.3.3",
|
|
23
|
+
"globals": "^17.0.0"
|
|
22
24
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
"main": "./index.js",
|
|
25
|
+
"module": "./index.js",
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
27
|
"directories": {
|
|
28
28
|
"lib": "./"
|
|
29
29
|
},
|
|
30
|
-
"files": ["
|
|
30
|
+
"files": ["**/package.json", "**/*.js", "**/*.d.ts"],
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./index.d.ts",
|
|
34
|
+
"import": "./index.js"
|
|
35
|
+
},
|
|
36
|
+
"./testing-library": {
|
|
37
|
+
"import": "./config/testing-library/index.js",
|
|
38
|
+
"types": "./config/testing-library/index.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./typescript-eslint": {
|
|
41
|
+
"import": "./config/typescript-eslint/index.js",
|
|
42
|
+
"types": "./config/typescript-eslint/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./unicorn": {
|
|
45
|
+
"import": "./config/unicorn/index.js",
|
|
46
|
+
"types": "./config/unicorn/index.d.ts"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
31
49
|
"scripts": {}
|
|
32
50
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@perfective/eslint-config-react/testing-library",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"module": "../config/testing-library/index.js",
|
|
5
|
+
"types": "../config/testing-library/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "../config/testing-library/index.d.ts",
|
|
9
|
+
"import": "../config/testing-library/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@perfective/eslint-config-react/typescript-eslint",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"module": "../config/typescript-eslint/index.js",
|
|
5
|
+
"types": "../config/typescript-eslint/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "../config/typescript-eslint/index.d.ts",
|
|
9
|
+
"import": "../config/typescript-eslint/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@perfective/eslint-config-react/unicorn",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"module": "../config/unicorn/index.js",
|
|
5
|
+
"types": "../config/unicorn/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "../config/unicorn/index.d.ts",
|
|
9
|
+
"import": "../config/unicorn/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false
|
|
13
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const typescript_eslint_1 = require("./rules/typescript-eslint");
|
|
3
|
-
const unicorn_1 = require("./rules/unicorn");
|
|
4
|
-
module.exports = {
|
|
5
|
-
rules: {
|
|
6
|
-
'@stylistic/ts/indent': ['warn', 4, {
|
|
7
|
-
SwitchCase: 1,
|
|
8
|
-
ignoredNodes: [
|
|
9
|
-
'TSTypeParameterInstantiation',
|
|
10
|
-
],
|
|
11
|
-
}],
|
|
12
|
-
'@typescript-eslint/naming-convention': ['error', ...(0, typescript_eslint_1.typescriptEslintNamingConvention)()],
|
|
13
|
-
'unicorn/prevent-abbreviations': ['warn', (0, unicorn_1.unicornPreventAbbreviations)()],
|
|
14
|
-
},
|
|
15
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typescriptEslintNamingConvention = typescriptEslintNamingConvention;
|
|
4
|
-
const rules_1 = require("@perfective/eslint-config/rules");
|
|
5
|
-
function typescriptEslintNamingConvention(extensions = []) {
|
|
6
|
-
return (0, rules_1.typescriptEslintNamingConvention)([
|
|
7
|
-
{
|
|
8
|
-
selector: ['variable'],
|
|
9
|
-
modifiers: ['const'],
|
|
10
|
-
format: ['strictCamelCase', 'StrictPascalCase'],
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
selector: ['function'],
|
|
14
|
-
format: ['strictCamelCase', 'StrictPascalCase'],
|
|
15
|
-
},
|
|
16
|
-
].concat(extensions));
|
|
17
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unicornPreventAbbreviations = unicornPreventAbbreviations;
|
|
4
|
-
const rules_1 = require("@perfective/eslint-config/rules");
|
|
5
|
-
function unicornPreventAbbreviations(replacements = {}, options = {}) {
|
|
6
|
-
return (0, rules_1.unicornPreventAbbreviations)(Object.assign({ prop: false, props: false, ref: false, refs: false }, replacements), options);
|
|
7
|
-
}
|
package/rules/jsx-a11y/index.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
plugins: [
|
|
4
|
-
'jsx-a11y',
|
|
5
|
-
],
|
|
6
|
-
rules: {
|
|
7
|
-
'jsx-a11y/accessible-emoji': 'error',
|
|
8
|
-
'jsx-a11y/alt-text': 'error',
|
|
9
|
-
'jsx-a11y/anchor-has-content': ['error', {
|
|
10
|
-
components: [],
|
|
11
|
-
}],
|
|
12
|
-
'jsx-a11y/anchor-is-valid': ['error', {
|
|
13
|
-
components: [],
|
|
14
|
-
specialLink: [],
|
|
15
|
-
aspects: ['noHref', 'invalidHref', 'preferButton'],
|
|
16
|
-
}],
|
|
17
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
18
|
-
'jsx-a11y/aria-props': 'error',
|
|
19
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
20
|
-
'jsx-a11y/aria-role': ['error', {
|
|
21
|
-
allowedInvalidRoles: [],
|
|
22
|
-
ignoreNonDOM: false,
|
|
23
|
-
}],
|
|
24
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
25
|
-
'jsx-a11y/autocomplete-valid': ['error', {
|
|
26
|
-
inputComponents: [],
|
|
27
|
-
}],
|
|
28
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
29
|
-
'jsx-a11y/heading-has-content': ['error', {
|
|
30
|
-
components: [],
|
|
31
|
-
}],
|
|
32
|
-
'jsx-a11y/html-has-lang': 'error',
|
|
33
|
-
'jsx-a11y/iframe-has-title': 'error',
|
|
34
|
-
'jsx-a11y/img-redundant-alt': ['error', {
|
|
35
|
-
components: [],
|
|
36
|
-
words: [],
|
|
37
|
-
}],
|
|
38
|
-
'jsx-a11y/interactive-supports-focus': ['error', {
|
|
39
|
-
tabbable: [],
|
|
40
|
-
}],
|
|
41
|
-
'jsx-a11y/label-has-associated-control': ['error', {
|
|
42
|
-
labelComponents: [],
|
|
43
|
-
labelAttributes: [],
|
|
44
|
-
controlComponents: [],
|
|
45
|
-
assert: 'either',
|
|
46
|
-
depth: 2,
|
|
47
|
-
}],
|
|
48
|
-
'jsx-a11y/lang': 'error',
|
|
49
|
-
'jsx-a11y/media-has-caption': ['error', {
|
|
50
|
-
audio: [],
|
|
51
|
-
video: [],
|
|
52
|
-
track: [],
|
|
53
|
-
}],
|
|
54
|
-
'jsx-a11y/mouse-events-have-key-events': ['error', {
|
|
55
|
-
hoverInHandlers: ['onMouseOver'],
|
|
56
|
-
hoverOutHandlers: ['onMouseOut'],
|
|
57
|
-
}],
|
|
58
|
-
'jsx-a11y/no-access-key': 'error',
|
|
59
|
-
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
|
60
|
-
'jsx-a11y/no-autofocus': ['error', {
|
|
61
|
-
ignoreNonDOM: false,
|
|
62
|
-
}],
|
|
63
|
-
'jsx-a11y/no-distracting-elements': 'error',
|
|
64
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'error',
|
|
65
|
-
'jsx-a11y/no-noninteractive-element-interactions': 'error',
|
|
66
|
-
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
|
|
67
|
-
'jsx-a11y/no-noninteractive-tabindex': 'error',
|
|
68
|
-
'jsx-a11y/no-onchange': 'error',
|
|
69
|
-
'jsx-a11y/no-redundant-roles': ['error', {
|
|
70
|
-
nav: ['navigation'],
|
|
71
|
-
}],
|
|
72
|
-
'jsx-a11y/no-static-element-interactions': 'error',
|
|
73
|
-
'jsx-a11y/prefer-tag-over-role': 'error',
|
|
74
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
75
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
76
|
-
'jsx-a11y/scope': 'error',
|
|
77
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
78
|
-
},
|
|
79
|
-
};
|
package/rules/react/index.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
plugins: [
|
|
4
|
-
'react',
|
|
5
|
-
],
|
|
6
|
-
extends: [
|
|
7
|
-
'./jsx',
|
|
8
|
-
],
|
|
9
|
-
rules: {
|
|
10
|
-
'react/boolean-prop-naming': ['error', {
|
|
11
|
-
propTypeNames: ['bool'],
|
|
12
|
-
rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
|
|
13
|
-
validateNested: true,
|
|
14
|
-
}],
|
|
15
|
-
'react/button-has-type': ['error', {
|
|
16
|
-
button: true,
|
|
17
|
-
submit: true,
|
|
18
|
-
reset: true,
|
|
19
|
-
}],
|
|
20
|
-
'react/checked-requires-onchange-or-readonly': 'error',
|
|
21
|
-
'react/default-props-match-prop-types': 'error',
|
|
22
|
-
'react/destructuring-assignment': ['error', 'never'],
|
|
23
|
-
'react/display-name': ['error', {
|
|
24
|
-
checkContextObjects: true,
|
|
25
|
-
ignoreTranspilerName: false,
|
|
26
|
-
}],
|
|
27
|
-
'react/forbid-component-props': 'error',
|
|
28
|
-
'react/forbid-dom-props': ['error', {
|
|
29
|
-
forbid: [],
|
|
30
|
-
}],
|
|
31
|
-
'react/forbid-elements': ['error', {
|
|
32
|
-
forbid: [],
|
|
33
|
-
}],
|
|
34
|
-
'react/forbid-foreign-prop-types': 'error',
|
|
35
|
-
'react/forbid-prop-types': ['error', {
|
|
36
|
-
forbid: ['any', 'array', 'object'],
|
|
37
|
-
checkContextTypes: true,
|
|
38
|
-
checkChildContextTypes: true,
|
|
39
|
-
}],
|
|
40
|
-
'react/function-component-definition': ['warn', {
|
|
41
|
-
namedComponents: 'function-declaration',
|
|
42
|
-
unnamedComponents: 'function-expression',
|
|
43
|
-
}],
|
|
44
|
-
'react/hook-use-state': ['error', {
|
|
45
|
-
allowDestructuredState: false,
|
|
46
|
-
}],
|
|
47
|
-
'react/iframe-missing-sandbox': 'error',
|
|
48
|
-
'react/no-access-state-in-setstate': 'error',
|
|
49
|
-
'react/no-adjacent-inline-elements': 'error',
|
|
50
|
-
'react/no-array-index-key': 'error',
|
|
51
|
-
'react/no-arrow-function-lifecycle': 'warn',
|
|
52
|
-
'react/no-children-prop': ['error', {
|
|
53
|
-
allowFunctions: false,
|
|
54
|
-
}],
|
|
55
|
-
'react/no-danger': 'error',
|
|
56
|
-
'react/no-danger-with-children': 'error',
|
|
57
|
-
'react/no-deprecated': 'error',
|
|
58
|
-
'react/no-did-mount-set-state': ['error', 'disallow-in-func'],
|
|
59
|
-
'react/no-did-update-set-state': ['error', 'disallow-in-func'],
|
|
60
|
-
'react/no-direct-mutation-state': 'error',
|
|
61
|
-
'react/no-find-dom-node': 'error',
|
|
62
|
-
'react/no-invalid-html-attribute': 'warn',
|
|
63
|
-
'react/no-is-mounted': 'error',
|
|
64
|
-
'react/no-multi-comp': ['error', {
|
|
65
|
-
ignoreStateless: false,
|
|
66
|
-
}],
|
|
67
|
-
'react/no-namespace': 'error',
|
|
68
|
-
'react/no-object-type-as-default-prop': 'error',
|
|
69
|
-
'react/no-redundant-should-component-update': 'error',
|
|
70
|
-
'react/no-render-return-value': 'error',
|
|
71
|
-
'react/no-set-state': 'off',
|
|
72
|
-
'react/no-string-refs': ['error', {
|
|
73
|
-
noTemplateLiterals: true,
|
|
74
|
-
}],
|
|
75
|
-
'react/no-this-in-sfc': 'error',
|
|
76
|
-
'react/no-typos': 'error',
|
|
77
|
-
'react/no-unescaped-entities': ['error', {
|
|
78
|
-
forbid: ['>', '}'],
|
|
79
|
-
}],
|
|
80
|
-
'react/no-unknown-property': ['warn', {
|
|
81
|
-
ignore: [],
|
|
82
|
-
requireDataLowercase: true,
|
|
83
|
-
}],
|
|
84
|
-
'react/no-unsafe': 'error',
|
|
85
|
-
'react/no-unstable-nested-components': ['error', {
|
|
86
|
-
allowAsProps: false,
|
|
87
|
-
}],
|
|
88
|
-
'react/no-unused-prop-types': 'error',
|
|
89
|
-
'react/no-unused-state': 'error',
|
|
90
|
-
'react/no-will-update-set-state': ['error', 'disallow-in-func'],
|
|
91
|
-
'react/prefer-es6-class': ['error', 'always'],
|
|
92
|
-
'react/prefer-exact-props': 'off',
|
|
93
|
-
'react/prefer-read-only-props': 'warn',
|
|
94
|
-
'react/prefer-stateless-function': 'off',
|
|
95
|
-
'react/prop-types': 'error',
|
|
96
|
-
'react/react-in-jsx-scope': 'error',
|
|
97
|
-
'react/require-default-props': 'error',
|
|
98
|
-
'react/require-optimization': ['error', {
|
|
99
|
-
allowDecorators: [],
|
|
100
|
-
}],
|
|
101
|
-
'react/require-render-return': 'error',
|
|
102
|
-
'react/self-closing-comp': ['warn', {
|
|
103
|
-
component: true,
|
|
104
|
-
html: true,
|
|
105
|
-
}],
|
|
106
|
-
'react/sort-comp': ['error', {
|
|
107
|
-
order: [
|
|
108
|
-
'static-methods',
|
|
109
|
-
'lifecycle',
|
|
110
|
-
'everything-else',
|
|
111
|
-
'render',
|
|
112
|
-
],
|
|
113
|
-
groups: {
|
|
114
|
-
lifecycle: [
|
|
115
|
-
'displayName',
|
|
116
|
-
'propTypes',
|
|
117
|
-
'contextTypes',
|
|
118
|
-
'childContextTypes',
|
|
119
|
-
'mixins',
|
|
120
|
-
'statics',
|
|
121
|
-
'defaultProps',
|
|
122
|
-
'constructor',
|
|
123
|
-
'getDefaultProps',
|
|
124
|
-
'state',
|
|
125
|
-
'getInitialState',
|
|
126
|
-
'getChildContext',
|
|
127
|
-
'getDerivedStateFromProps',
|
|
128
|
-
'componentWillMount',
|
|
129
|
-
'UNSAFE_componentWillMount',
|
|
130
|
-
'componentDidMount',
|
|
131
|
-
'componentWillReceiveProps',
|
|
132
|
-
'UNSAFE_componentWillReceiveProps',
|
|
133
|
-
'shouldComponentUpdate',
|
|
134
|
-
'componentWillUpdate',
|
|
135
|
-
'UNSAFE_componentWillUpdate',
|
|
136
|
-
'getSnapshotBeforeUpdate',
|
|
137
|
-
'componentDidUpdate',
|
|
138
|
-
'componentDidCatch',
|
|
139
|
-
'componentWillUnmount',
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
}],
|
|
143
|
-
'react/sort-default-props': ['error', {
|
|
144
|
-
ignoreCase: false,
|
|
145
|
-
}],
|
|
146
|
-
'react/sort-prop-types': ['error', {
|
|
147
|
-
ignoreCase: false,
|
|
148
|
-
callbacksLast: true,
|
|
149
|
-
requiredFirst: true,
|
|
150
|
-
sortShapeProp: true,
|
|
151
|
-
noSortAlphabetically: false,
|
|
152
|
-
}],
|
|
153
|
-
'react/state-in-constructor': ['error', 'always'],
|
|
154
|
-
'react/static-property-placement': ['error', 'static public field'],
|
|
155
|
-
'react/style-prop-object': 'error',
|
|
156
|
-
'react/void-dom-elements-no-children': 'error',
|
|
157
|
-
},
|
|
158
|
-
};
|
package/rules/react/jsx.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
module.exports = {
|
|
3
|
-
rules: {
|
|
4
|
-
'react/jsx-boolean-value': ['warn', 'always'],
|
|
5
|
-
'react/jsx-child-element-spacing': 'off',
|
|
6
|
-
'react/jsx-closing-bracket-location': 'off',
|
|
7
|
-
'react/jsx-closing-tag-location': 'off',
|
|
8
|
-
'react/jsx-curly-brace-presence': 'off',
|
|
9
|
-
'react/jsx-curly-newline': 'off',
|
|
10
|
-
'react/jsx-curly-spacing': 'off',
|
|
11
|
-
'react/jsx-equals-spacing': 'off',
|
|
12
|
-
'react/jsx-filename-extension': ['error', {
|
|
13
|
-
allow: 'always',
|
|
14
|
-
extensions: ['.jsx', '.tsx'],
|
|
15
|
-
ignoreFilesWithoutCode: false,
|
|
16
|
-
}],
|
|
17
|
-
'react/jsx-first-prop-new-line': 'off',
|
|
18
|
-
'react/jsx-fragments': ['warn', 'element'],
|
|
19
|
-
'react/jsx-handler-names': ['error', {
|
|
20
|
-
eventHandlerPrefix: 'handle',
|
|
21
|
-
eventHandlerPropPrefix: 'on',
|
|
22
|
-
checkLocalVariables: true,
|
|
23
|
-
checkInlineFunction: true,
|
|
24
|
-
}],
|
|
25
|
-
'react/jsx-indent': 'off',
|
|
26
|
-
'react/jsx-indent-props': 'off',
|
|
27
|
-
'react/jsx-key': ['error', {
|
|
28
|
-
checkFragmentShorthand: true,
|
|
29
|
-
checkKeyMustBeforeSpread: true,
|
|
30
|
-
warnOnDuplicates: true,
|
|
31
|
-
}],
|
|
32
|
-
'react/jsx-max-depth': ['error', {
|
|
33
|
-
max: 4,
|
|
34
|
-
}],
|
|
35
|
-
'react/jsx-max-props-per-line': 'off',
|
|
36
|
-
'react/jsx-newline': 'off',
|
|
37
|
-
'react/jsx-no-bind': ['error', {
|
|
38
|
-
ignoreDOMComponents: false,
|
|
39
|
-
ignoreRefs: false,
|
|
40
|
-
allowArrowFunctions: false,
|
|
41
|
-
allowFunctions: false,
|
|
42
|
-
}],
|
|
43
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
44
|
-
'react/jsx-no-constructed-context-values': 'error',
|
|
45
|
-
'react/jsx-no-duplicate-props': ['error', {
|
|
46
|
-
ignoreCase: true,
|
|
47
|
-
}],
|
|
48
|
-
'react/jsx-no-leaked-render': ['warn', {
|
|
49
|
-
validStrategies: ['ternary'],
|
|
50
|
-
}],
|
|
51
|
-
'react/jsx-no-literals': ['error', {
|
|
52
|
-
noStrings: false,
|
|
53
|
-
allowedStrings: [],
|
|
54
|
-
ignoreProps: true,
|
|
55
|
-
noAttributeStrings: false,
|
|
56
|
-
}],
|
|
57
|
-
'react/jsx-no-script-url': ['error', {
|
|
58
|
-
includeFromSettings: false,
|
|
59
|
-
}],
|
|
60
|
-
'react/jsx-no-target-blank': ['warn', {
|
|
61
|
-
allowReferrer: false,
|
|
62
|
-
enforceDynamicLinks: 'always',
|
|
63
|
-
forms: true,
|
|
64
|
-
links: true,
|
|
65
|
-
warnOnSpreadAttributes: true,
|
|
66
|
-
}],
|
|
67
|
-
'react/jsx-no-undef': ['error', {
|
|
68
|
-
allowGlobals: false,
|
|
69
|
-
}],
|
|
70
|
-
'react/jsx-no-useless-fragment': ['warn', {
|
|
71
|
-
allowExpressions: true,
|
|
72
|
-
}],
|
|
73
|
-
'react/jsx-one-expression-per-line': 'off',
|
|
74
|
-
'react/jsx-pascal-case': 'off',
|
|
75
|
-
'react/jsx-props-no-multi-spaces': 'off',
|
|
76
|
-
'react/jsx-props-no-spreading': ['error', {
|
|
77
|
-
html: 'enforce',
|
|
78
|
-
custom: 'enforce',
|
|
79
|
-
explicitSpread: 'enforce',
|
|
80
|
-
exceptions: [],
|
|
81
|
-
}],
|
|
82
|
-
'react/jsx-sort-default-props': 'off',
|
|
83
|
-
'react/jsx-sort-props': 'off',
|
|
84
|
-
'react/jsx-space-before-closing': 'off',
|
|
85
|
-
'react/jsx-tag-spacing': 'off',
|
|
86
|
-
'react/jsx-uses-react': 'error',
|
|
87
|
-
'react/jsx-uses-vars': 'error',
|
|
88
|
-
'react/jsx-wrap-multilines': 'off',
|
|
89
|
-
},
|
|
90
|
-
};
|