@pob/eslint-config-typescript-react 56.1.0 → 57.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -57
- package/lib/index.js +99 -29
- package/lib/plugins/jsx-a11y.js +5 -0
- package/lib/plugins/react-hooks.js +9 -0
- package/lib/plugins/react.js +184 -0
- package/package.json +8 -8
- package/lib/.eslintrc.json +0 -4
- package/lib/app.js +0 -5
- package/lib/react-native-web.js +0 -25
- package/lib/react-native.js +0 -21
- package/lib/rules/jsx-a11y.js +0 -6
- package/lib/rules/react-hooks.js +0 -10
- package/lib/rules/react.js +0 -185
package/CHANGELOG.md
CHANGED
|
@@ -3,74 +3,27 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [
|
|
7
|
-
## [51.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-10-03)
|
|
6
|
+
## [57.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v57.0.0...v57.1.0) (2024-08-11)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* disable react/no-unescaped-entities ([5a41c9f](https://github.com/christophehurpeau/eslint-config-pob/commit/5a41c9fdf8e22adc10ad22961deeb4f1e51d3832))
|
|
12
|
-
* fix react/function-component-definition rule and enable func-names ([e656eba](https://github.com/christophehurpeau/eslint-config-pob/commit/e656ebaba4639a0eb547ef11dc9d3fbf32aec60e))
|
|
13
|
-
## [51.1.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-10-18)
|
|
14
|
-
## [51.1.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-10-19)
|
|
15
|
-
## [51.2.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-12-10)
|
|
16
|
-
## [51.2.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-12-14)
|
|
17
|
-
## [52.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-12-28)
|
|
18
|
-
|
|
19
|
-
### ⚠ BREAKING CHANGES
|
|
20
|
-
|
|
21
|
-
* change import/extensions to ignorePackages
|
|
22
|
-
|
|
23
|
-
### Features
|
|
24
|
-
|
|
25
|
-
* change import/extensions to ignorePackages ([1833642](https://github.com/christophehurpeau/eslint-config-pob/commit/183364280552d484acd37bbf3b9816d88c1f6bfe))
|
|
26
|
-
## [52.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-12-28)
|
|
27
|
-
|
|
28
|
-
### Reverts
|
|
29
|
-
|
|
30
|
-
* Revert "feat!: change import/extensions to ignorePackages" ([22d14bc](https://github.com/christophehurpeau/eslint-config-pob/commit/22d14bc6d6f94cae03a547cf53d939f6c1c756a7))
|
|
31
|
-
## [53.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2023-12-28)
|
|
32
|
-
|
|
33
|
-
### ⚠ BREAKING CHANGES
|
|
34
|
-
|
|
35
|
-
* feat: change import/extensions to ignorePackages
|
|
8
|
+
Version bump for dependency: @pob/eslint-config
|
|
9
|
+
Version bump for dependency: @pob/eslint-config-typescript
|
|
36
10
|
|
|
37
|
-
### Reverts
|
|
38
11
|
|
|
39
|
-
|
|
40
|
-
## [54.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-02-17)
|
|
41
|
-
## [54.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-02-24)
|
|
42
|
-
## [54.0.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-07)
|
|
43
|
-
## [55.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-20)
|
|
12
|
+
## [57.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.1.0...v57.0.0) (2024-08-11)
|
|
44
13
|
|
|
45
14
|
### ⚠ BREAKING CHANGES
|
|
46
15
|
|
|
47
|
-
*
|
|
48
|
-
|
|
49
|
-
### Features
|
|
50
|
-
|
|
51
|
-
* remove config eslint-config-airbnb as dependency ([05cd865](https://github.com/christophehurpeau/eslint-config-pob/commit/05cd86511db14e0ec7c4df1ede633eaf65b9b37b))
|
|
52
|
-
## [55.0.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-21)
|
|
53
|
-
## [55.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-21)
|
|
54
|
-
## [55.2.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-21)
|
|
55
|
-
## [55.2.1](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-04-21)
|
|
56
|
-
## [55.3.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-05-05)
|
|
16
|
+
* use flat config
|
|
57
17
|
|
|
58
18
|
### Features
|
|
59
19
|
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
20
|
+
* use flat config ([b0bda47](https://github.com/christophehurpeau/eslint-config-pob/commit/b0bda47976ec40a30679988c603d425f9b75346f))
|
|
63
21
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### ⚠ BREAKING CHANGES
|
|
68
|
-
|
|
69
|
-
* use standard quotes
|
|
22
|
+
Version bump for dependency: @pob/eslint-config
|
|
23
|
+
Version bump for dependency: @pob/eslint-config-typescript
|
|
24
|
+
Version bump for dependency: @pob/eslint-plugin
|
|
70
25
|
|
|
71
|
-
### Features
|
|
72
26
|
|
|
73
|
-
* use standard quotes ([0083d81](https://github.com/christophehurpeau/eslint-config-pob/commit/0083d816bbe4e320eabe3c23a8d4edaa561df8a3))
|
|
74
27
|
## [56.1.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v56.0.0...v56.1.0) (2024-07-27)
|
|
75
28
|
|
|
76
29
|
### Features
|
|
@@ -603,7 +556,7 @@ Version bump for dependency: eslint-config
|
|
|
603
556
|
|
|
604
557
|
### BREAKING CHANGES
|
|
605
558
|
|
|
606
|
-
* **deps:** requires eslint-plugin-unicorn 34 and enable new rules
|
|
559
|
+
* **deps:** requires eslint-plugin-unicorn 34 and enable new rules
|
|
607
560
|
* requires new min supported node versions
|
|
608
561
|
|
|
609
562
|
|
package/lib/index.js
CHANGED
|
@@ -1,33 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
import baseTypescriptPobConfig, {
|
|
2
|
+
extensions,
|
|
3
|
+
} from "@pob/eslint-config-typescript";
|
|
4
|
+
import pobPlugin from "@pob/eslint-plugin";
|
|
5
|
+
import jsxA11yConfigs from "./plugins/jsx-a11y.js";
|
|
6
|
+
import reactHooksConfigs from "./plugins/react-hooks.js";
|
|
7
|
+
import reactConfigs from "./plugins/react.js";
|
|
2
8
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"plugin:@pob/react",
|
|
6
|
-
...["./rules/react", "./rules/react-hooks", "./rules/jsx-a11y"].map(
|
|
7
|
-
require.resolve,
|
|
8
|
-
),
|
|
9
|
-
],
|
|
9
|
+
export default (url) => {
|
|
10
|
+
const { compat, configs } = baseTypescriptPobConfig(url);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const recommended = [
|
|
13
|
+
...configs.node,
|
|
14
|
+
...[
|
|
15
|
+
pobPlugin.configs.react,
|
|
16
|
+
...compat.config({
|
|
17
|
+
settings: {
|
|
18
|
+
"import/resolver": {
|
|
19
|
+
node: {
|
|
20
|
+
extensions: [
|
|
21
|
+
".mjs",
|
|
22
|
+
".js",
|
|
23
|
+
".json",
|
|
24
|
+
".ts",
|
|
25
|
+
".tsx",
|
|
26
|
+
".d.ts",
|
|
27
|
+
".d.tsx",
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
"import/extensions": [
|
|
34
|
+
"error",
|
|
35
|
+
"ignorePackages",
|
|
36
|
+
{
|
|
37
|
+
js: "ignorePackages",
|
|
38
|
+
cjs: "ignorePackages",
|
|
39
|
+
mjs: "ignorePackages",
|
|
40
|
+
cts: "ignorePackages",
|
|
41
|
+
mts: "ignorePackages",
|
|
42
|
+
ts: "never",
|
|
43
|
+
tsx: "never",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
"react/jsx-filename-extension": ["error", { extensions: ["tsx"] }],
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
...reactConfigs(compat),
|
|
50
|
+
...reactHooksConfigs(compat),
|
|
51
|
+
...jsxA11yConfigs(compat),
|
|
52
|
+
].map((config) => ({
|
|
53
|
+
...config,
|
|
54
|
+
files: [`**/*.${extensions}`],
|
|
55
|
+
})),
|
|
56
|
+
];
|
|
57
|
+
return {
|
|
58
|
+
compat,
|
|
59
|
+
configs: {
|
|
60
|
+
recommended,
|
|
61
|
+
|
|
62
|
+
allowUnsafe: configs.allowUnsafe,
|
|
63
|
+
app: configs.app,
|
|
18
64
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
65
|
+
"react-native": [
|
|
66
|
+
...recommended,
|
|
67
|
+
...compat.config({
|
|
68
|
+
settings: {
|
|
69
|
+
"import/resolver": {
|
|
70
|
+
node: {
|
|
71
|
+
extensions: [".js", ".ios.js", ".android.js"],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
"react-native-web": [
|
|
79
|
+
...recommended,
|
|
80
|
+
...compat.config({
|
|
81
|
+
settings: {
|
|
82
|
+
"import/resolver": {
|
|
83
|
+
node: {
|
|
84
|
+
extensions: [".js", ".web.js"],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
rules: {
|
|
89
|
+
"import/no-unresolved": [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
ignore: [
|
|
93
|
+
// allow react-native as it is replaced by react-native-web and typed by @types/react-native. react-native lib does not need to be installed in that case
|
|
94
|
+
"react-native",
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
};
|
|
33
103
|
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export default (compat) =>
|
|
2
|
+
compat.config({
|
|
3
|
+
extends: ["plugin:react/recommended", "plugin:react/jsx-runtime"],
|
|
4
|
+
|
|
5
|
+
rules: {
|
|
6
|
+
// https://github.com/airbnb/javascript/issues/2829
|
|
7
|
+
"func-names": "error",
|
|
8
|
+
|
|
9
|
+
// Enforce event handler naming conventions in JSX
|
|
10
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
11
|
+
// 'react/jsx-handler-names': [
|
|
12
|
+
// 'error',
|
|
13
|
+
// {
|
|
14
|
+
// eventHandlerPrefix: 'handle',
|
|
15
|
+
// eventHandlerPropPrefix: 'on',
|
|
16
|
+
// },
|
|
17
|
+
// ],
|
|
18
|
+
|
|
19
|
+
// Prevent direct mutation of this.state
|
|
20
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
21
|
+
"react/no-direct-mutation-state": "error",
|
|
22
|
+
|
|
23
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
24
|
+
"react/button-has-type": "error",
|
|
25
|
+
|
|
26
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
27
|
+
"react/destructuring-assignment": [
|
|
28
|
+
"error",
|
|
29
|
+
"always",
|
|
30
|
+
{ ignoreClassFields: false, destructureInSignature: "always" },
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
34
|
+
"react/display-name": "off",
|
|
35
|
+
|
|
36
|
+
"react/function-component-definition": [
|
|
37
|
+
"error",
|
|
38
|
+
{
|
|
39
|
+
namedComponents: ["function-declaration"],
|
|
40
|
+
// https://github.com/airbnb/javascript/issues/2829
|
|
41
|
+
unnamedComponents: ["function-expression"],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
|
|
45
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
46
|
+
"react/hook-use-state": "error",
|
|
47
|
+
|
|
48
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
49
|
+
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
50
|
+
|
|
51
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
52
|
+
"react/jsx-curly-brace-presence": [
|
|
53
|
+
"error",
|
|
54
|
+
{ props: "never", children: "never" },
|
|
55
|
+
],
|
|
56
|
+
|
|
57
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
58
|
+
"react/jsx-curly-newline": "off",
|
|
59
|
+
|
|
60
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
61
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
62
|
+
|
|
63
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
|
|
64
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
65
|
+
|
|
66
|
+
// Prevent usage of `javascript:` URLs
|
|
67
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
68
|
+
"react/jsx-no-script-url": [
|
|
69
|
+
"error",
|
|
70
|
+
[
|
|
71
|
+
{
|
|
72
|
+
name: "Link",
|
|
73
|
+
props: ["to"],
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
],
|
|
77
|
+
|
|
78
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
79
|
+
"react/jsx-no-undef": "error",
|
|
80
|
+
|
|
81
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
82
|
+
"react/jsx-no-useless-fragment": "error",
|
|
83
|
+
|
|
84
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
85
|
+
"react/jsx-pascal-case": [
|
|
86
|
+
"error",
|
|
87
|
+
{
|
|
88
|
+
allowAllCaps: true,
|
|
89
|
+
ignore: [],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
93
|
+
"react/jsx-sort-props": [
|
|
94
|
+
"error",
|
|
95
|
+
{
|
|
96
|
+
noSortAlphabetically: true,
|
|
97
|
+
reservedFirst: true,
|
|
98
|
+
shorthandFirst: true,
|
|
99
|
+
callbacksLast: true,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
|
|
103
|
+
"react/no-arrow-function-lifecycle": "error",
|
|
104
|
+
|
|
105
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
106
|
+
"react/no-array-index-key": "error",
|
|
107
|
+
|
|
108
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
|
|
109
|
+
"react/no-invalid-html-attribute": "error",
|
|
110
|
+
|
|
111
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
|
|
112
|
+
"react/no-namespace": "error",
|
|
113
|
+
|
|
114
|
+
// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
|
|
115
|
+
"react/no-unescaped-entities": "off",
|
|
116
|
+
|
|
117
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
|
|
118
|
+
"react/no-unstable-nested-components": "error",
|
|
119
|
+
|
|
120
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
|
|
121
|
+
"react/prefer-exact-props": "error",
|
|
122
|
+
|
|
123
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
124
|
+
"react/prefer-es6-class": ["error", "always"],
|
|
125
|
+
|
|
126
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
127
|
+
"react/prefer-stateless-function": [
|
|
128
|
+
"error",
|
|
129
|
+
{ ignorePureComponents: true },
|
|
130
|
+
],
|
|
131
|
+
|
|
132
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
133
|
+
"react/self-closing-comp": "error",
|
|
134
|
+
|
|
135
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
136
|
+
"react/sort-comp": [
|
|
137
|
+
"error",
|
|
138
|
+
{
|
|
139
|
+
order: [
|
|
140
|
+
"static-variables",
|
|
141
|
+
"static-methods",
|
|
142
|
+
"instance-variables",
|
|
143
|
+
"lifecycle",
|
|
144
|
+
"getters",
|
|
145
|
+
"setters",
|
|
146
|
+
"instance-methods",
|
|
147
|
+
"/^(on|handle).+$/",
|
|
148
|
+
"everything-else",
|
|
149
|
+
"rendering",
|
|
150
|
+
],
|
|
151
|
+
groups: {
|
|
152
|
+
lifecycle: [
|
|
153
|
+
"state",
|
|
154
|
+
"constructor",
|
|
155
|
+
"getDerivedStateFromProps",
|
|
156
|
+
"componentWillMount",
|
|
157
|
+
"UNSAFE_componentWillMount",
|
|
158
|
+
"componentDidMount",
|
|
159
|
+
"componentWillReceiveProps",
|
|
160
|
+
"UNSAFE_componentWillReceiveProps",
|
|
161
|
+
"shouldComponentUpdate",
|
|
162
|
+
"componentWillUpdate",
|
|
163
|
+
"UNSAFE_componentWillUpdate",
|
|
164
|
+
"getSnapshotBeforeUpdate",
|
|
165
|
+
"componentDidUpdate",
|
|
166
|
+
"componentDidCatch",
|
|
167
|
+
"componentWillUnmount",
|
|
168
|
+
],
|
|
169
|
+
rendering: ["/^render.+$/", "render"],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
|
|
174
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
175
|
+
"react/sort-prop-types": [
|
|
176
|
+
"error",
|
|
177
|
+
{
|
|
178
|
+
noSortAlphabetically: true,
|
|
179
|
+
requiredFirst: false,
|
|
180
|
+
callbacksLast: true,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/eslint-config-typescript-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "57.1.0",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "@pob/eslint-config-typescript-react"
|
|
12
12
|
},
|
|
13
13
|
"homepage": "https://github.com/christophehurpeau/eslint-config-pob",
|
|
14
|
-
"type": "
|
|
14
|
+
"type": "module",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=18.12.0"
|
|
17
17
|
},
|
|
@@ -19,9 +19,6 @@
|
|
|
19
19
|
"main": "./lib/index.js",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./lib/index.js",
|
|
22
|
-
"./app": "./lib/app.js",
|
|
23
|
-
"./react-native": "./lib/react-native.js",
|
|
24
|
-
"./react-native-web": "./lib/react-native-web.js",
|
|
25
22
|
"./package.json": "./package.json"
|
|
26
23
|
},
|
|
27
24
|
"publishConfig": {
|
|
@@ -32,7 +29,7 @@
|
|
|
32
29
|
],
|
|
33
30
|
"scripts": {
|
|
34
31
|
"lint": "yarn run lint:eslint",
|
|
35
|
-
"lint:eslint": "yarn ../.. run eslint --
|
|
32
|
+
"lint:eslint": "yarn ../.. run eslint --quiet @pob/eslint-config-typescript-react"
|
|
36
33
|
},
|
|
37
34
|
"pob": {},
|
|
38
35
|
"prettier": "@pob/root/prettier-config",
|
|
@@ -40,7 +37,9 @@
|
|
|
40
37
|
"eslint": "^8.56.0"
|
|
41
38
|
},
|
|
42
39
|
"dependencies": {
|
|
43
|
-
"@pob/eslint-config": "
|
|
40
|
+
"@pob/eslint-config": "57.1.0",
|
|
41
|
+
"@pob/eslint-config-typescript": "57.1.0",
|
|
42
|
+
"@pob/eslint-plugin": "57.0.0",
|
|
44
43
|
"eslint-plugin-import": "2.29.1",
|
|
45
44
|
"eslint-plugin-jsx-a11y": "6.8.0",
|
|
46
45
|
"eslint-plugin-react": "7.34.1",
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
49
|
"@types/react": "18.3.3",
|
|
51
|
-
"react": "18.3.1"
|
|
50
|
+
"react": "18.3.1",
|
|
51
|
+
"typescript": "5.5.4"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/lib/.eslintrc.json
DELETED
package/lib/app.js
DELETED
package/lib/react-native-web.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ["./react-native"].map(require.resolve),
|
|
5
|
-
|
|
6
|
-
settings: {
|
|
7
|
-
"import/resolver": {
|
|
8
|
-
node: {
|
|
9
|
-
extensions: [".js", ".web.js"],
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
rules: {
|
|
15
|
-
"import/no-unresolved": [
|
|
16
|
-
"error",
|
|
17
|
-
{
|
|
18
|
-
ignore: [
|
|
19
|
-
// allow react-native as it is replaced by react-native-web and typed by @types/react-native. react-native lib does not need to be installed in that case
|
|
20
|
-
"react-native",
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
};
|
package/lib/react-native.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ["."].map(require.resolve),
|
|
5
|
-
|
|
6
|
-
env: {
|
|
7
|
-
browser: true,
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
globals: {
|
|
11
|
-
__DEV__: true,
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
settings: {
|
|
15
|
-
"import/resolver": {
|
|
16
|
-
node: {
|
|
17
|
-
extensions: [".js", ".ios.js", ".android.js"],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
package/lib/rules/jsx-a11y.js
DELETED
package/lib/rules/react-hooks.js
DELETED
package/lib/rules/react.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
extends: ["plugin:react/recommended", "plugin:react/jsx-runtime"],
|
|
5
|
-
|
|
6
|
-
rules: {
|
|
7
|
-
// https://github.com/airbnb/javascript/issues/2829
|
|
8
|
-
"func-names": "error",
|
|
9
|
-
|
|
10
|
-
// Enforce event handler naming conventions in JSX
|
|
11
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
12
|
-
// 'react/jsx-handler-names': [
|
|
13
|
-
// 'error',
|
|
14
|
-
// {
|
|
15
|
-
// eventHandlerPrefix: 'handle',
|
|
16
|
-
// eventHandlerPropPrefix: 'on',
|
|
17
|
-
// },
|
|
18
|
-
// ],
|
|
19
|
-
|
|
20
|
-
// Prevent direct mutation of this.state
|
|
21
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
22
|
-
"react/no-direct-mutation-state": "error",
|
|
23
|
-
|
|
24
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
|
|
25
|
-
"react/button-has-type": "error",
|
|
26
|
-
|
|
27
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
28
|
-
"react/destructuring-assignment": [
|
|
29
|
-
"error",
|
|
30
|
-
"always",
|
|
31
|
-
{ ignoreClassFields: false, destructureInSignature: "always" },
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/display-name.md
|
|
35
|
-
"react/display-name": "off",
|
|
36
|
-
|
|
37
|
-
"react/function-component-definition": [
|
|
38
|
-
"error",
|
|
39
|
-
{
|
|
40
|
-
namedComponents: ["function-declaration"],
|
|
41
|
-
// https://github.com/airbnb/javascript/issues/2829
|
|
42
|
-
unnamedComponents: ["function-expression"],
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
|
|
46
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
|
|
47
|
-
"react/hook-use-state": "error",
|
|
48
|
-
|
|
49
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
50
|
-
"react/jsx-boolean-value": ["error", "never", { always: [] }],
|
|
51
|
-
|
|
52
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
53
|
-
"react/jsx-curly-brace-presence": [
|
|
54
|
-
"error",
|
|
55
|
-
{ props: "never", children: "never" },
|
|
56
|
-
],
|
|
57
|
-
|
|
58
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
59
|
-
"react/jsx-curly-newline": "off",
|
|
60
|
-
|
|
61
|
-
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
62
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
63
|
-
|
|
64
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
|
|
65
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
66
|
-
|
|
67
|
-
// Prevent usage of `javascript:` URLs
|
|
68
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
69
|
-
"react/jsx-no-script-url": [
|
|
70
|
-
"error",
|
|
71
|
-
[
|
|
72
|
-
{
|
|
73
|
-
name: "Link",
|
|
74
|
-
props: ["to"],
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
],
|
|
78
|
-
|
|
79
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
80
|
-
"react/jsx-no-undef": "error",
|
|
81
|
-
|
|
82
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
83
|
-
"react/jsx-no-useless-fragment": "error",
|
|
84
|
-
|
|
85
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
86
|
-
"react/jsx-pascal-case": [
|
|
87
|
-
"error",
|
|
88
|
-
{
|
|
89
|
-
allowAllCaps: true,
|
|
90
|
-
ignore: [],
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
94
|
-
"react/jsx-sort-props": [
|
|
95
|
-
"error",
|
|
96
|
-
{
|
|
97
|
-
noSortAlphabetically: true,
|
|
98
|
-
reservedFirst: true,
|
|
99
|
-
shorthandFirst: true,
|
|
100
|
-
callbacksLast: true,
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
|
|
104
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
105
|
-
|
|
106
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
107
|
-
"react/no-array-index-key": "error",
|
|
108
|
-
|
|
109
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
|
|
110
|
-
"react/no-invalid-html-attribute": "error",
|
|
111
|
-
|
|
112
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
|
|
113
|
-
"react/no-namespace": "error",
|
|
114
|
-
|
|
115
|
-
// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
|
|
116
|
-
"react/no-unescaped-entities": "off",
|
|
117
|
-
|
|
118
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
|
|
119
|
-
"react/no-unstable-nested-components": "error",
|
|
120
|
-
|
|
121
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
|
|
122
|
-
"react/prefer-exact-props": "error",
|
|
123
|
-
|
|
124
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
125
|
-
"react/prefer-es6-class": ["error", "always"],
|
|
126
|
-
|
|
127
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
128
|
-
"react/prefer-stateless-function": [
|
|
129
|
-
"error",
|
|
130
|
-
{ ignorePureComponents: true },
|
|
131
|
-
],
|
|
132
|
-
|
|
133
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
134
|
-
"react/self-closing-comp": "error",
|
|
135
|
-
|
|
136
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
137
|
-
"react/sort-comp": [
|
|
138
|
-
"error",
|
|
139
|
-
{
|
|
140
|
-
order: [
|
|
141
|
-
"static-variables",
|
|
142
|
-
"static-methods",
|
|
143
|
-
"instance-variables",
|
|
144
|
-
"lifecycle",
|
|
145
|
-
"getters",
|
|
146
|
-
"setters",
|
|
147
|
-
"instance-methods",
|
|
148
|
-
"/^(on|handle).+$/",
|
|
149
|
-
"everything-else",
|
|
150
|
-
"rendering",
|
|
151
|
-
],
|
|
152
|
-
groups: {
|
|
153
|
-
lifecycle: [
|
|
154
|
-
"state",
|
|
155
|
-
"constructor",
|
|
156
|
-
"getDerivedStateFromProps",
|
|
157
|
-
"componentWillMount",
|
|
158
|
-
"UNSAFE_componentWillMount",
|
|
159
|
-
"componentDidMount",
|
|
160
|
-
"componentWillReceiveProps",
|
|
161
|
-
"UNSAFE_componentWillReceiveProps",
|
|
162
|
-
"shouldComponentUpdate",
|
|
163
|
-
"componentWillUpdate",
|
|
164
|
-
"UNSAFE_componentWillUpdate",
|
|
165
|
-
"getSnapshotBeforeUpdate",
|
|
166
|
-
"componentDidUpdate",
|
|
167
|
-
"componentDidCatch",
|
|
168
|
-
"componentWillUnmount",
|
|
169
|
-
],
|
|
170
|
-
rendering: ["/^render.+$/", "render"],
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
|
|
175
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
176
|
-
"react/sort-prop-types": [
|
|
177
|
-
"error",
|
|
178
|
-
{
|
|
179
|
-
noSortAlphabetically: true,
|
|
180
|
-
requiredFirst: false,
|
|
181
|
-
callbacksLast: true,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
},
|
|
185
|
-
};
|