@pob/eslint-config-typescript-react 67.8.0 → 67.9.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/lib/index.js +80 -34
- package/oxlint/react-native-web.json +14 -0
- package/oxlint/react-native.json +14 -0
- package/oxlint/react.json +138 -0
- package/package.json +9 -3
package/lib/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import basePobConfig, {
|
|
1
|
+
import basePobConfig, {
|
|
2
|
+
createOxlintConfigs,
|
|
3
|
+
isOxlintConfigExtended,
|
|
4
|
+
tsExtensions,
|
|
5
|
+
} from "@pob/eslint-config";
|
|
2
6
|
import pobPlugin from "@pob/eslint-plugin";
|
|
3
7
|
import { createNodeResolver } from "eslint-plugin-import-x";
|
|
8
|
+
import oxlintReactNativeWebConfig from "../oxlint/react-native-web.json" with { type: "json" };
|
|
9
|
+
import oxlintReactNativeConfig from "../oxlint/react-native.json" with { type: "json" };
|
|
10
|
+
import oxlintReactConfig from "../oxlint/react.json" with { type: "json" };
|
|
4
11
|
import importPluginOverrideConfig from "./plugins/import.js";
|
|
5
12
|
import jsxA11yConfigs from "./plugins/jsx-a11y.js";
|
|
6
13
|
import reactHooksConfigs from "./plugins/react-hooks.js";
|
|
@@ -10,6 +17,34 @@ export { apply, applyTs } from "@pob/eslint-config";
|
|
|
10
17
|
|
|
11
18
|
const { configs } = basePobConfig;
|
|
12
19
|
|
|
20
|
+
// react.json is extended by React projects, once regenerated by pob: until
|
|
21
|
+
// then its rules stay in eslint, and import-x/extensions is re-enabled with
|
|
22
|
+
// the react options after the oxlint turn-off of @pob/eslint-config.
|
|
23
|
+
const oxlintReact = isOxlintConfigExtended(
|
|
24
|
+
"@pob/eslint-config-typescript-react/oxlint/react.json",
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
// react-native.json and react-native-web.json replace the import-x/extensions
|
|
28
|
+
// options of the matching configs, extended after react.json
|
|
29
|
+
const oxlintReactNative =
|
|
30
|
+
oxlintReact &&
|
|
31
|
+
isOxlintConfigExtended(
|
|
32
|
+
"@pob/eslint-config-typescript-react/oxlint/react-native.json",
|
|
33
|
+
);
|
|
34
|
+
const oxlintReactNativeWeb =
|
|
35
|
+
oxlintReact &&
|
|
36
|
+
isOxlintConfigExtended(
|
|
37
|
+
"@pob/eslint-config-typescript-react/oxlint/react-native-web.json",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// turns off the rules of react.json, and those of @pob/eslint-config again as
|
|
41
|
+
// the react configs re-enable import-x/extensions
|
|
42
|
+
const oxlintReactConfigs = createOxlintConfigs([
|
|
43
|
+
oxlintReactConfig,
|
|
44
|
+
...(oxlintReactNative ? [oxlintReactNativeConfig] : []),
|
|
45
|
+
...(oxlintReactNativeWeb ? [oxlintReactNativeWebConfig] : []),
|
|
46
|
+
]);
|
|
47
|
+
|
|
13
48
|
/**
|
|
14
49
|
* @param {import("typescript-eslint").ConfigArray} base
|
|
15
50
|
* @returns {import("typescript-eslint").ConfigArray}
|
|
@@ -63,6 +98,7 @@ const createConfig = (base) => [
|
|
|
63
98
|
...config,
|
|
64
99
|
files: [`**/*.${tsExtensions}`],
|
|
65
100
|
})),
|
|
101
|
+
...(oxlintReact ? oxlintReactConfigs : []),
|
|
66
102
|
];
|
|
67
103
|
|
|
68
104
|
/**
|
|
@@ -80,6 +116,10 @@ export default {
|
|
|
80
116
|
|
|
81
117
|
monorepo: configs.monorepo,
|
|
82
118
|
|
|
119
|
+
// for projects extending react.json from a nested .oxlintrc.json, like
|
|
120
|
+
// this repo's test-lint: apply it last on the same files
|
|
121
|
+
oxlint: oxlintReactConfigs,
|
|
122
|
+
|
|
83
123
|
"react-native": [
|
|
84
124
|
{
|
|
85
125
|
settings: {
|
|
@@ -100,24 +140,26 @@ export default {
|
|
|
100
140
|
}),
|
|
101
141
|
],
|
|
102
142
|
},
|
|
103
|
-
rules:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
143
|
+
rules: oxlintReactNative
|
|
144
|
+
? {}
|
|
145
|
+
: {
|
|
146
|
+
"import-x/extensions": [
|
|
147
|
+
"error",
|
|
148
|
+
"always",
|
|
149
|
+
{
|
|
150
|
+
ignorePackages: true,
|
|
151
|
+
pattern: {
|
|
152
|
+
js: "always",
|
|
153
|
+
cjs: "always",
|
|
154
|
+
mjs: "always",
|
|
155
|
+
cts: "always",
|
|
156
|
+
mts: "always",
|
|
157
|
+
ts: "never",
|
|
158
|
+
tsx: "never",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
118
162
|
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
163
|
},
|
|
122
164
|
],
|
|
123
165
|
|
|
@@ -140,22 +182,26 @@ export default {
|
|
|
140
182
|
],
|
|
141
183
|
},
|
|
142
184
|
rules: {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
185
|
+
...(oxlintReactNativeWeb
|
|
186
|
+
? {}
|
|
187
|
+
: {
|
|
188
|
+
"import-x/extensions": [
|
|
189
|
+
"error",
|
|
190
|
+
"always",
|
|
191
|
+
{
|
|
192
|
+
ignorePackages: true,
|
|
193
|
+
pattern: {
|
|
194
|
+
js: "always",
|
|
195
|
+
cjs: "always",
|
|
196
|
+
mjs: "always",
|
|
197
|
+
cts: "always",
|
|
198
|
+
mts: "never",
|
|
199
|
+
ts: "never",
|
|
200
|
+
tsx: "never",
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
}),
|
|
159
205
|
"import-x/no-unresolved": [
|
|
160
206
|
"error",
|
|
161
207
|
{
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": ["react", "jsx-a11y"],
|
|
3
|
+
"overrides": [
|
|
4
|
+
{
|
|
5
|
+
"files": ["**/*.{ts,cts,mts,tsx}"],
|
|
6
|
+
"rules": {
|
|
7
|
+
"func-names": "error",
|
|
8
|
+
"import/extensions": [
|
|
9
|
+
"error",
|
|
10
|
+
"ignorePackages",
|
|
11
|
+
{ "pattern": { "ts": "never", "tsx": "never" } }
|
|
12
|
+
],
|
|
13
|
+
"jsx_a11y/alt-text": "error",
|
|
14
|
+
"jsx_a11y/anchor-has-content": "error",
|
|
15
|
+
"jsx_a11y/anchor-is-valid": "error",
|
|
16
|
+
"jsx_a11y/aria-activedescendant-has-tabindex": "error",
|
|
17
|
+
"jsx_a11y/aria-props": "error",
|
|
18
|
+
"jsx_a11y/aria-proptypes": "error",
|
|
19
|
+
"jsx_a11y/aria-role": "error",
|
|
20
|
+
"jsx_a11y/aria-unsupported-elements": "error",
|
|
21
|
+
"jsx_a11y/autocomplete-valid": "error",
|
|
22
|
+
"jsx_a11y/click-events-have-key-events": "error",
|
|
23
|
+
"jsx_a11y/heading-has-content": "error",
|
|
24
|
+
"jsx_a11y/html-has-lang": "error",
|
|
25
|
+
"jsx_a11y/iframe-has-title": "error",
|
|
26
|
+
"jsx_a11y/img-redundant-alt": "error",
|
|
27
|
+
"jsx_a11y/interactive-supports-focus": [
|
|
28
|
+
"error",
|
|
29
|
+
{
|
|
30
|
+
"tabbable": [
|
|
31
|
+
"button",
|
|
32
|
+
"checkbox",
|
|
33
|
+
"link",
|
|
34
|
+
"progressbar",
|
|
35
|
+
"searchbox",
|
|
36
|
+
"slider",
|
|
37
|
+
"spinbutton",
|
|
38
|
+
"switch",
|
|
39
|
+
"textbox"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"jsx_a11y/label-has-associated-control": "error",
|
|
44
|
+
"jsx_a11y/media-has-caption": "error",
|
|
45
|
+
"jsx_a11y/mouse-events-have-key-events": "error",
|
|
46
|
+
"jsx_a11y/no-access-key": "error",
|
|
47
|
+
"jsx_a11y/no-autofocus": "error",
|
|
48
|
+
"jsx_a11y/no-distracting-elements": "error",
|
|
49
|
+
"jsx_a11y/no-interactive-element-to-noninteractive-role": "error",
|
|
50
|
+
"jsx_a11y/no-noninteractive-element-interactions": "error",
|
|
51
|
+
"jsx_a11y/no-noninteractive-element-to-interactive-role": "error",
|
|
52
|
+
"jsx_a11y/no-noninteractive-tabindex": "error",
|
|
53
|
+
"jsx_a11y/no-redundant-roles": "error",
|
|
54
|
+
"jsx_a11y/no-static-element-interactions": [
|
|
55
|
+
"error",
|
|
56
|
+
{
|
|
57
|
+
"handlers": [
|
|
58
|
+
"onFocus",
|
|
59
|
+
"onBlur",
|
|
60
|
+
"onKeyDown",
|
|
61
|
+
"onKeyPress",
|
|
62
|
+
"onKeyUp",
|
|
63
|
+
"onClick",
|
|
64
|
+
"onContextMenu",
|
|
65
|
+
"onDblClick",
|
|
66
|
+
"onDoubleClick",
|
|
67
|
+
"onDrag",
|
|
68
|
+
"onDragEnd",
|
|
69
|
+
"onDragEnter",
|
|
70
|
+
"onDragExit",
|
|
71
|
+
"onDragLeave",
|
|
72
|
+
"onDragOver",
|
|
73
|
+
"onDragStart",
|
|
74
|
+
"onDrop",
|
|
75
|
+
"onMouseDown",
|
|
76
|
+
"onMouseEnter",
|
|
77
|
+
"onMouseLeave",
|
|
78
|
+
"onMouseMove",
|
|
79
|
+
"onMouseOut",
|
|
80
|
+
"onMouseOver",
|
|
81
|
+
"onMouseUp"
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"jsx_a11y/role-has-required-aria-props": "error",
|
|
86
|
+
"jsx_a11y/role-supports-aria-props": "error",
|
|
87
|
+
"jsx_a11y/scope": "error",
|
|
88
|
+
"jsx_a11y/tabindex-no-positive": "error",
|
|
89
|
+
"react/button-has-type": "error",
|
|
90
|
+
"react/exhaustive-deps": "error",
|
|
91
|
+
"react/function-component-definition": [
|
|
92
|
+
"error",
|
|
93
|
+
{
|
|
94
|
+
"namedComponents": ["function-declaration"],
|
|
95
|
+
"unnamedComponents": ["function-expression"]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"react/hook-use-state": "error",
|
|
99
|
+
"react/jsx-boolean-value": ["error", "never", { "always": [] }],
|
|
100
|
+
"react/jsx-curly-brace-presence": [
|
|
101
|
+
"error",
|
|
102
|
+
{ "children": "never", "props": "never" }
|
|
103
|
+
],
|
|
104
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
105
|
+
"react/jsx-key": "error",
|
|
106
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
107
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
108
|
+
"react/jsx-no-duplicate-props": "error",
|
|
109
|
+
"react/jsx-no-script-url": [
|
|
110
|
+
"error",
|
|
111
|
+
[{ "name": "Link", "props": ["to"] }]
|
|
112
|
+
],
|
|
113
|
+
"react/jsx-no-target-blank": "error",
|
|
114
|
+
"react/jsx-no-undef": "error",
|
|
115
|
+
"react/jsx-no-useless-fragment": "error",
|
|
116
|
+
"react/jsx-pascal-case": [
|
|
117
|
+
"error",
|
|
118
|
+
{ "allowAllCaps": true, "ignore": [] }
|
|
119
|
+
],
|
|
120
|
+
"react/no-array-index-key": "error",
|
|
121
|
+
"react/no-children-prop": "error",
|
|
122
|
+
"react/no-danger-with-children": "error",
|
|
123
|
+
"react/no-direct-mutation-state": "error",
|
|
124
|
+
"react/no-find-dom-node": "error",
|
|
125
|
+
"react/no-is-mounted": "error",
|
|
126
|
+
"react/no-namespace": "error",
|
|
127
|
+
"react/no-render-return-value": "error",
|
|
128
|
+
"react/no-string-refs": "error",
|
|
129
|
+
"react/no-unknown-property": "error",
|
|
130
|
+
"react/no-unstable-nested-components": "error",
|
|
131
|
+
"react/prefer-es6-class": ["error", "always"],
|
|
132
|
+
"react/require-render-return": "error",
|
|
133
|
+
"react/rules-of-hooks": "error",
|
|
134
|
+
"react/self-closing-comp": "error"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pob/eslint-config-typescript-react",
|
|
3
|
-
"version": "67.
|
|
3
|
+
"version": "67.9.0",
|
|
4
4
|
"description": "eslint config files",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/christophehurpeau/pob",
|
|
@@ -15,13 +15,19 @@
|
|
|
15
15
|
"directory": "@pob/eslint-config-typescript-react"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"lib"
|
|
18
|
+
"lib",
|
|
19
|
+
"oxlint/react-native-web.json",
|
|
20
|
+
"oxlint/react-native.json",
|
|
21
|
+
"oxlint/react.json"
|
|
19
22
|
],
|
|
20
23
|
"type": "module",
|
|
21
24
|
"sideEffects": false,
|
|
22
25
|
"main": "./lib/index.js",
|
|
23
26
|
"exports": {
|
|
24
27
|
".": "./lib/index.js",
|
|
28
|
+
"./oxlint/react.json": "./oxlint/react.json",
|
|
29
|
+
"./oxlint/react-native.json": "./oxlint/react-native.json",
|
|
30
|
+
"./oxlint/react-native-web.json": "./oxlint/react-native-web.json",
|
|
25
31
|
"./package.json": "./package.json"
|
|
26
32
|
},
|
|
27
33
|
"publishConfig": {
|
|
@@ -32,7 +38,7 @@
|
|
|
32
38
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
33
39
|
"eslint-plugin-react": "7.37.5",
|
|
34
40
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
35
|
-
"@pob/eslint-config": "67.
|
|
41
|
+
"@pob/eslint-config": "67.9.0",
|
|
36
42
|
"@pob/eslint-plugin": "66.4.0"
|
|
37
43
|
},
|
|
38
44
|
"devDependencies": {
|