@pob/eslint-config-typescript-react 67.8.0 → 67.10.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 CHANGED
@@ -1,6 +1,13 @@
1
- import basePobConfig, { tsExtensions } from "@pob/eslint-config";
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
- "import-x/extensions": [
105
- "error",
106
- "always",
107
- {
108
- ignorePackages: true,
109
- pattern: {
110
- js: "always",
111
- cjs: "always",
112
- mjs: "always",
113
- cts: "always",
114
- mts: "always",
115
- ts: "never",
116
- tsx: "never",
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
- "import-x/extensions": [
144
- "error",
145
- "always",
146
- {
147
- ignorePackages: true,
148
- pattern: {
149
- js: "always",
150
- cjs: "always",
151
- mjs: "always",
152
- cts: "always",
153
- mts: "never",
154
- ts: "never",
155
- tsx: "never",
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,14 @@
1
+ {
2
+ "overrides": [
3
+ {
4
+ "files": ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}"],
5
+ "rules": {
6
+ "import/extensions": [
7
+ "error",
8
+ "ignorePackages",
9
+ { "pattern": { "mts": "never", "ts": "never", "tsx": "never" } }
10
+ ]
11
+ }
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "overrides": [
3
+ {
4
+ "files": ["**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}"],
5
+ "rules": {
6
+ "import/extensions": [
7
+ "error",
8
+ "ignorePackages",
9
+ { "pattern": { "ts": "never", "tsx": "never" } }
10
+ ]
11
+ }
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,140 @@
1
+ {
2
+ "plugins": ["react", "jsx-a11y"],
3
+ "overrides": [
4
+ {
5
+ "files": ["**/*.{ts,cts,mts,tsx}"],
6
+ "rules": {
7
+ "@pob/react-function-component-return-react-node": "error",
8
+ "@pob/react-named-import": "error",
9
+ "func-names": "error",
10
+ "import/extensions": [
11
+ "error",
12
+ "ignorePackages",
13
+ { "pattern": { "ts": "never", "tsx": "never" } }
14
+ ],
15
+ "jsx_a11y/alt-text": "error",
16
+ "jsx_a11y/anchor-has-content": "error",
17
+ "jsx_a11y/anchor-is-valid": "error",
18
+ "jsx_a11y/aria-activedescendant-has-tabindex": "error",
19
+ "jsx_a11y/aria-props": "error",
20
+ "jsx_a11y/aria-proptypes": "error",
21
+ "jsx_a11y/aria-role": "error",
22
+ "jsx_a11y/aria-unsupported-elements": "error",
23
+ "jsx_a11y/autocomplete-valid": "error",
24
+ "jsx_a11y/click-events-have-key-events": "error",
25
+ "jsx_a11y/heading-has-content": "error",
26
+ "jsx_a11y/html-has-lang": "error",
27
+ "jsx_a11y/iframe-has-title": "error",
28
+ "jsx_a11y/img-redundant-alt": "error",
29
+ "jsx_a11y/interactive-supports-focus": [
30
+ "error",
31
+ {
32
+ "tabbable": [
33
+ "button",
34
+ "checkbox",
35
+ "link",
36
+ "progressbar",
37
+ "searchbox",
38
+ "slider",
39
+ "spinbutton",
40
+ "switch",
41
+ "textbox"
42
+ ]
43
+ }
44
+ ],
45
+ "jsx_a11y/label-has-associated-control": "error",
46
+ "jsx_a11y/media-has-caption": "error",
47
+ "jsx_a11y/mouse-events-have-key-events": "error",
48
+ "jsx_a11y/no-access-key": "error",
49
+ "jsx_a11y/no-autofocus": "error",
50
+ "jsx_a11y/no-distracting-elements": "error",
51
+ "jsx_a11y/no-interactive-element-to-noninteractive-role": "error",
52
+ "jsx_a11y/no-noninteractive-element-interactions": "error",
53
+ "jsx_a11y/no-noninteractive-element-to-interactive-role": "error",
54
+ "jsx_a11y/no-noninteractive-tabindex": "error",
55
+ "jsx_a11y/no-redundant-roles": "error",
56
+ "jsx_a11y/no-static-element-interactions": [
57
+ "error",
58
+ {
59
+ "handlers": [
60
+ "onFocus",
61
+ "onBlur",
62
+ "onKeyDown",
63
+ "onKeyPress",
64
+ "onKeyUp",
65
+ "onClick",
66
+ "onContextMenu",
67
+ "onDblClick",
68
+ "onDoubleClick",
69
+ "onDrag",
70
+ "onDragEnd",
71
+ "onDragEnter",
72
+ "onDragExit",
73
+ "onDragLeave",
74
+ "onDragOver",
75
+ "onDragStart",
76
+ "onDrop",
77
+ "onMouseDown",
78
+ "onMouseEnter",
79
+ "onMouseLeave",
80
+ "onMouseMove",
81
+ "onMouseOut",
82
+ "onMouseOver",
83
+ "onMouseUp"
84
+ ]
85
+ }
86
+ ],
87
+ "jsx_a11y/role-has-required-aria-props": "error",
88
+ "jsx_a11y/role-supports-aria-props": "error",
89
+ "jsx_a11y/scope": "error",
90
+ "jsx_a11y/tabindex-no-positive": "error",
91
+ "react/button-has-type": "error",
92
+ "react/exhaustive-deps": "error",
93
+ "react/function-component-definition": [
94
+ "error",
95
+ {
96
+ "namedComponents": ["function-declaration"],
97
+ "unnamedComponents": ["function-expression"]
98
+ }
99
+ ],
100
+ "react/hook-use-state": "error",
101
+ "react/jsx-boolean-value": ["error", "never", { "always": [] }],
102
+ "react/jsx-curly-brace-presence": [
103
+ "error",
104
+ { "children": "never", "props": "never" }
105
+ ],
106
+ "react/jsx-fragments": ["error", "syntax"],
107
+ "react/jsx-key": "error",
108
+ "react/jsx-no-comment-textnodes": "error",
109
+ "react/jsx-no-constructed-context-values": "error",
110
+ "react/jsx-no-duplicate-props": "error",
111
+ "react/jsx-no-script-url": [
112
+ "error",
113
+ [{ "name": "Link", "props": ["to"] }]
114
+ ],
115
+ "react/jsx-no-target-blank": "error",
116
+ "react/jsx-no-undef": "error",
117
+ "react/jsx-no-useless-fragment": "error",
118
+ "react/jsx-pascal-case": [
119
+ "error",
120
+ { "allowAllCaps": true, "ignore": [] }
121
+ ],
122
+ "react/no-array-index-key": "error",
123
+ "react/no-children-prop": "error",
124
+ "react/no-danger-with-children": "error",
125
+ "react/no-direct-mutation-state": "error",
126
+ "react/no-find-dom-node": "error",
127
+ "react/no-is-mounted": "error",
128
+ "react/no-namespace": "error",
129
+ "react/no-render-return-value": "error",
130
+ "react/no-string-refs": "error",
131
+ "react/no-unknown-property": "error",
132
+ "react/no-unstable-nested-components": "error",
133
+ "react/prefer-es6-class": ["error", "always"],
134
+ "react/require-render-return": "error",
135
+ "react/rules-of-hooks": "error",
136
+ "react/self-closing-comp": "error"
137
+ }
138
+ }
139
+ ]
140
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-config-typescript-react",
3
- "version": "67.8.0",
3
+ "version": "67.10.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,8 +38,8 @@
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.8.0",
36
- "@pob/eslint-plugin": "66.4.0"
41
+ "@pob/eslint-plugin": "66.4.0",
42
+ "@pob/eslint-config": "67.10.0"
37
43
  },
38
44
  "devDependencies": {
39
45
  "@types/node": "24.13.3",