@pob/eslint-config-typescript-react 54.0.2 → 55.0.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 +14 -0
- package/lib/index.js +3 -8
- package/lib/rules/jsx-a11y.js +6 -0
- package/lib/rules/react-hooks.js +10 -0
- package/lib/rules/react.js +111 -44
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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
|
+
## [55.0.0](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.2...v55.0.0) (2024-04-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* remove config eslint-config-airbnb as dependency
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* remove config eslint-config-airbnb as dependency ([5fc0e37](https://github.com/christophehurpeau/eslint-config-pob/commit/5fc0e378d61343d3a0f0ea8b994183d60353a3a0))
|
|
16
|
+
|
|
17
|
+
Version bump for dependency: eslint-config
|
|
18
|
+
|
|
19
|
+
|
|
6
20
|
## [54.0.2](https://github.com/christophehurpeau/eslint-config-pob/compare/v54.0.1...v54.0.2) (2024-04-07)
|
|
7
21
|
|
|
8
22
|
Note: no notable changes
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
extends: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'eslint-config-airbnb/rules/react-hooks',
|
|
8
|
-
'@pob/eslint-config/prettier', // reapply prettier
|
|
9
|
-
'@pob/eslint-config/rules/expert', // reapply expert: eslint-config-airbnb/rules/react modifies no-underscore-dangle
|
|
10
|
-
'./rules/react',
|
|
11
|
-
].map(require.resolve),
|
|
4
|
+
extends: ['./rules/react', './rules/react-hooks', './rules/jsx-a11y'].map(
|
|
5
|
+
require.resolve,
|
|
6
|
+
),
|
|
12
7
|
|
|
13
8
|
settings: {
|
|
14
9
|
'import/resolver': {
|
package/lib/rules/react.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
extends: ['plugin:react/jsx-runtime'],
|
|
4
|
+
extends: ['plugin:react/recommended', 'plugin:react/jsx-runtime'],
|
|
5
5
|
|
|
6
6
|
rules: {
|
|
7
|
-
/* added rules */
|
|
8
|
-
|
|
9
7
|
// https://github.com/airbnb/javascript/issues/2829
|
|
10
8
|
'func-names': 'error',
|
|
11
9
|
|
|
@@ -23,41 +21,123 @@ module.exports = {
|
|
|
23
21
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
|
|
24
22
|
'react/no-direct-mutation-state': 'error',
|
|
25
23
|
|
|
26
|
-
// https://github.com/
|
|
27
|
-
'react/
|
|
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': [
|
|
28
38
|
'error',
|
|
29
39
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
callbacksLast: true,
|
|
40
|
+
namedComponents: ['function-declaration'],
|
|
41
|
+
// https://github.com/airbnb/javascript/issues/2829
|
|
42
|
+
unnamedComponents: ['function-expression'],
|
|
34
43
|
},
|
|
35
44
|
],
|
|
36
45
|
|
|
37
|
-
// https://github.com/
|
|
38
|
-
'react/
|
|
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': [
|
|
39
60
|
'error',
|
|
40
61
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
callbacksLast: true,
|
|
62
|
+
multiline: 'consistent',
|
|
63
|
+
singleline: 'consistent',
|
|
44
64
|
},
|
|
45
65
|
],
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
68
|
+
'react/jsx-fragments': ['error', 'syntax'],
|
|
69
|
+
|
|
70
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/e2eaadae316f9506d163812a09424eb42698470a/docs/rules/jsx-no-constructed-context-values.md
|
|
71
|
+
'react/jsx-no-constructed-context-values': 'error',
|
|
72
|
+
|
|
73
|
+
// Prevent usage of `javascript:` URLs
|
|
74
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
|
|
75
|
+
'react/jsx-no-script-url': [
|
|
76
|
+
'error',
|
|
77
|
+
[
|
|
78
|
+
{
|
|
79
|
+
name: 'Link',
|
|
80
|
+
props: ['to'],
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
],
|
|
84
|
+
|
|
85
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
86
|
+
'react/jsx-no-undef': 'error',
|
|
87
|
+
|
|
88
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
|
|
89
|
+
'react/jsx-no-useless-fragment': 'error',
|
|
90
|
+
|
|
91
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
92
|
+
'react/jsx-pascal-case': [
|
|
48
93
|
'error',
|
|
49
94
|
{
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
unnamedComponents: ['function-expression'],
|
|
95
|
+
allowAllCaps: true,
|
|
96
|
+
ignore: [],
|
|
53
97
|
},
|
|
54
98
|
],
|
|
99
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
100
|
+
'react/jsx-sort-props': [
|
|
101
|
+
'error',
|
|
102
|
+
{
|
|
103
|
+
noSortAlphabetically: true,
|
|
104
|
+
reservedFirst: true,
|
|
105
|
+
shorthandFirst: true,
|
|
106
|
+
callbacksLast: true,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-arrow-function-lifecycle.md
|
|
110
|
+
'react/no-arrow-function-lifecycle': 'error',
|
|
111
|
+
|
|
112
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
|
|
113
|
+
'react/no-array-index-key': 'error',
|
|
55
114
|
|
|
56
|
-
|
|
115
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/21e01b61af7a38fc86d94f27eb66cda8054582ed/docs/rules/no-invalid-html-attribute.md
|
|
116
|
+
'react/no-invalid-html-attribute': 'error',
|
|
117
|
+
|
|
118
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/no-namespace.md
|
|
119
|
+
'react/no-namespace': 'error',
|
|
120
|
+
|
|
121
|
+
// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
|
|
122
|
+
'react/no-unescaped-entities': 'off',
|
|
123
|
+
|
|
124
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/c2a790a3472eea0f6de984bdc3ee2a62197417fb/docs/rules/no-unstable-nested-components.md
|
|
125
|
+
'react/no-unstable-nested-components': 'error',
|
|
126
|
+
|
|
127
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/8785c169c25b09b33c95655bf508cf46263bc53f/docs/rules/prefer-exact-props.md
|
|
128
|
+
'react/prefer-exact-props': 'error',
|
|
129
|
+
|
|
130
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
|
|
131
|
+
'react/prefer-es6-class': ['error', 'always'],
|
|
132
|
+
|
|
133
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
|
|
134
|
+
'react/prefer-stateless-function': [
|
|
135
|
+
'error',
|
|
136
|
+
{ ignorePureComponents: true },
|
|
137
|
+
],
|
|
57
138
|
|
|
58
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/
|
|
59
|
-
|
|
60
|
-
'react/jsx-no-duplicate-props': 'error',
|
|
139
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
|
|
140
|
+
'react/self-closing-comp': 'error',
|
|
61
141
|
|
|
62
142
|
// https://github.com/yannickcr/eslint-plugin-react/blob/843d71a432baf0f01f598d7cf1eea75ad6896e4b/docs/rules/sort-comp.md
|
|
63
143
|
'react/sort-comp': [
|
|
@@ -98,27 +178,14 @@ module.exports = {
|
|
|
98
178
|
},
|
|
99
179
|
],
|
|
100
180
|
|
|
101
|
-
//
|
|
102
|
-
'react/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
'react/require-default-props': 'off',
|
|
111
|
-
|
|
112
|
-
// disable force destructuring for state and props
|
|
113
|
-
'react/destructuring-assignment': 'off',
|
|
114
|
-
|
|
115
|
-
// project should use babel-plugin-transform-react-remove-prop-types
|
|
116
|
-
'react/forbid-foreign-prop-types': 'off',
|
|
117
|
-
|
|
118
|
-
// allow props spreading
|
|
119
|
-
'react/jsx-props-no-spreading': 'off',
|
|
120
|
-
|
|
121
|
-
// entities does not need to be escaped as color syntaxing makes it clear when it's a body or it's a property.
|
|
122
|
-
'react/no-unescaped-entities': 'off',
|
|
181
|
+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
182
|
+
'react/sort-prop-types': [
|
|
183
|
+
'error',
|
|
184
|
+
{
|
|
185
|
+
noSortAlphabetically: true,
|
|
186
|
+
requiredFirst: false,
|
|
187
|
+
callbacksLast: true,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
123
190
|
},
|
|
124
191
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/eslint-config-typescript-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "55.0.0",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"eslint": "^8.56.0",
|
|
41
41
|
"eslint-plugin-import": "^2.29.1",
|
|
42
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
43
|
-
"eslint-plugin-react": "^7.
|
|
44
|
-
"eslint-plugin-react-hooks": "^4.
|
|
42
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
43
|
+
"eslint-plugin-react": "^7.34.1",
|
|
44
|
+
"eslint-plugin-react-hooks": "^4.6.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependenciesMeta": {
|
|
47
47
|
"eslint-plugin-import": {
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@pob/eslint-config": "
|
|
62
|
-
"eslint-
|
|
63
|
-
"eslint-plugin-
|
|
64
|
-
"eslint-plugin-
|
|
65
|
-
"eslint-plugin-react": "
|
|
66
|
-
"eslint-plugin-react-hooks": "^4.3.0"
|
|
61
|
+
"@pob/eslint-config": "55.0.0",
|
|
62
|
+
"eslint-plugin-import": "2.29.1",
|
|
63
|
+
"eslint-plugin-jsx-a11y": "6.8.0",
|
|
64
|
+
"eslint-plugin-react": "7.34.1",
|
|
65
|
+
"eslint-plugin-react-hooks": "4.6.0"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
|
-
"@types/react": "18.2.
|
|
68
|
+
"@types/react": "18.2.79",
|
|
69
|
+
"react": "18.2.0"
|
|
70
70
|
}
|
|
71
71
|
}
|