@nihalgonsalves/esconfig 0.13.6 → 0.14.1
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/.oxlintrc.json +284 -0
- package/README.md +16 -18
- package/eslint.config.react-shared.js +19 -77
- package/package.json +21 -22
- package/eslint.config.shared.d.ts +0 -5
- package/eslint.config.shared.js +0 -227
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"categories": {
|
|
4
|
+
"correctness": "error",
|
|
5
|
+
"suspicious": "error",
|
|
6
|
+
"perf": "error"
|
|
7
|
+
},
|
|
8
|
+
"env": {
|
|
9
|
+
"builtin": true
|
|
10
|
+
},
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": ["**/*.config.*"],
|
|
14
|
+
"rules": {
|
|
15
|
+
"import/no-default-export": "off"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"plugins": ["typescript", "import", "unicorn"],
|
|
20
|
+
"rules": {
|
|
21
|
+
// 2026-02-16 migration from eslint skipped 15 unsupported rules
|
|
22
|
+
// - import/no-extraneous-dependencies: [
|
|
23
|
+
// "error",
|
|
24
|
+
// {
|
|
25
|
+
// devDependencies: [
|
|
26
|
+
// "test/**",
|
|
27
|
+
// "tests/**",
|
|
28
|
+
// "spec/**",
|
|
29
|
+
// "**/__tests__/**",
|
|
30
|
+
// "**/__mocks__/**",
|
|
31
|
+
// "test.{js,jsx}",
|
|
32
|
+
// "test.{ts,tsx}",
|
|
33
|
+
// "test-*.{js,jsx}",
|
|
34
|
+
// "test-*.{ts,tsx}",
|
|
35
|
+
// "**/*{.,_}{test,spec}.{js,jsx}",
|
|
36
|
+
// "**/*{.,_}{test,spec}.{ts,tsx}",
|
|
37
|
+
// "**/*.config.{js,ts,cjs,mjs,cts,mts}",
|
|
38
|
+
// "**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)",
|
|
39
|
+
// ],
|
|
40
|
+
// optionalDependencies: false,
|
|
41
|
+
// },
|
|
42
|
+
// ],
|
|
43
|
+
// - no-octal
|
|
44
|
+
// - object-shorthand
|
|
45
|
+
// - typescript/dot-notation
|
|
46
|
+
// - typescript/method-signature-style
|
|
47
|
+
// - typescript/naming-convention
|
|
48
|
+
// - typescript/no-unnecessary-type-conversion
|
|
49
|
+
// - typescript/no-unnecessary-type-parameters
|
|
50
|
+
// - typescript/no-useless-default-assignment
|
|
51
|
+
// - typescript/prefer-find
|
|
52
|
+
// - typescript/prefer-regexp-exec
|
|
53
|
+
// - typescript/prefer-string-starts-ends-with
|
|
54
|
+
"arrow-body-style": "error",
|
|
55
|
+
"class-methods-use-this": "error",
|
|
56
|
+
"default-param-last": ["error"],
|
|
57
|
+
"for-direction": "error",
|
|
58
|
+
"func-style": ["error", "expression"],
|
|
59
|
+
"import/extensions": [
|
|
60
|
+
"error",
|
|
61
|
+
"ignorePackages",
|
|
62
|
+
{
|
|
63
|
+
"js": "never",
|
|
64
|
+
"jsx": "never",
|
|
65
|
+
"mjs": "never",
|
|
66
|
+
"ts": "never",
|
|
67
|
+
"tsx": "never"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"import/no-default-export": ["error"],
|
|
71
|
+
"import/no-duplicates": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
"prefer-inline": true
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"no-array-constructor": "error",
|
|
78
|
+
"no-async-promise-executor": "error",
|
|
79
|
+
"no-case-declarations": "error",
|
|
80
|
+
"no-compare-neg-zero": "error",
|
|
81
|
+
"no-cond-assign": "error",
|
|
82
|
+
"no-constant-binary-expression": "error",
|
|
83
|
+
"no-constant-condition": "error",
|
|
84
|
+
"no-control-regex": "error",
|
|
85
|
+
"no-debugger": "error",
|
|
86
|
+
"no-delete-var": "error",
|
|
87
|
+
"no-dupe-else-if": "error",
|
|
88
|
+
"no-duplicate-case": "error",
|
|
89
|
+
"no-empty": "error",
|
|
90
|
+
"no-empty-character-class": "error",
|
|
91
|
+
"no-empty-function": "error",
|
|
92
|
+
"no-empty-pattern": "error",
|
|
93
|
+
"no-empty-static-block": "error",
|
|
94
|
+
"no-ex-assign": "error",
|
|
95
|
+
"no-extra-boolean-cast": "error",
|
|
96
|
+
"no-fallthrough": "error",
|
|
97
|
+
"no-global-assign": "error",
|
|
98
|
+
"no-invalid-regexp": "error",
|
|
99
|
+
"no-irregular-whitespace": "error",
|
|
100
|
+
"no-loop-func": ["error"],
|
|
101
|
+
"no-loss-of-precision": "error",
|
|
102
|
+
"no-misleading-character-class": "error",
|
|
103
|
+
"no-nonoctal-decimal-escape": "error",
|
|
104
|
+
"no-prototype-builtins": "error",
|
|
105
|
+
"no-regex-spaces": "error",
|
|
106
|
+
"no-self-assign": "error",
|
|
107
|
+
"no-shadow": ["error"],
|
|
108
|
+
"no-shadow-restricted-names": "error",
|
|
109
|
+
"no-sparse-arrays": "error",
|
|
110
|
+
"no-unsafe-finally": "error",
|
|
111
|
+
"no-unsafe-optional-chaining": "error",
|
|
112
|
+
"no-unused-expressions": [
|
|
113
|
+
"error",
|
|
114
|
+
{
|
|
115
|
+
"allowShortCircuit": false,
|
|
116
|
+
"allowTaggedTemplates": false,
|
|
117
|
+
"allowTernary": false,
|
|
118
|
+
"enforceForJSX": false
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"no-unused-labels": "error",
|
|
122
|
+
"no-unused-private-class-members": "error",
|
|
123
|
+
"no-unused-vars": [
|
|
124
|
+
"error",
|
|
125
|
+
{
|
|
126
|
+
"args": "after-used",
|
|
127
|
+
"argsIgnorePattern": "^_",
|
|
128
|
+
"ignoreRestSiblings": true,
|
|
129
|
+
"vars": "all"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"no-use-before-define": [
|
|
133
|
+
"error",
|
|
134
|
+
{
|
|
135
|
+
"classes": true,
|
|
136
|
+
"functions": true,
|
|
137
|
+
"variables": true
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"no-useless-backreference": "error",
|
|
141
|
+
"no-useless-catch": "error",
|
|
142
|
+
"no-useless-constructor": "error",
|
|
143
|
+
"no-useless-escape": "error",
|
|
144
|
+
"no-useless-rename": "error",
|
|
145
|
+
"no-var": "error",
|
|
146
|
+
"prefer-const": "error",
|
|
147
|
+
"prefer-rest-params": "error",
|
|
148
|
+
"prefer-spread": "error",
|
|
149
|
+
"require-yield": "error",
|
|
150
|
+
"typescript/adjacent-overload-signatures": "error",
|
|
151
|
+
"typescript/array-type": "error",
|
|
152
|
+
"typescript/await-thenable": "error",
|
|
153
|
+
"typescript/ban-ts-comment": [
|
|
154
|
+
"error",
|
|
155
|
+
{
|
|
156
|
+
"ts-check": false,
|
|
157
|
+
"ts-expect-error": "allow-with-description",
|
|
158
|
+
"ts-ignore": true,
|
|
159
|
+
"ts-nocheck": true
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"typescript/ban-tslint-comment": "error",
|
|
163
|
+
"typescript/class-literal-property-style": "error",
|
|
164
|
+
"typescript/consistent-generic-constructors": "error",
|
|
165
|
+
"typescript/consistent-indexed-object-style": "error",
|
|
166
|
+
"typescript/consistent-type-assertions": "error",
|
|
167
|
+
"typescript/consistent-type-definitions": ["error", "type"],
|
|
168
|
+
"typescript/consistent-type-imports": [
|
|
169
|
+
"error",
|
|
170
|
+
{
|
|
171
|
+
"fixStyle": "inline-type-imports"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"typescript/no-array-delete": "error",
|
|
175
|
+
"typescript/no-base-to-string": "error",
|
|
176
|
+
"typescript/no-confusing-non-null-assertion": "error",
|
|
177
|
+
"typescript/no-confusing-void-expression": "error",
|
|
178
|
+
"typescript/no-deprecated": "error",
|
|
179
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
180
|
+
"typescript/no-duplicate-type-constituents": "error",
|
|
181
|
+
"typescript/no-dynamic-delete": "error",
|
|
182
|
+
"typescript/no-empty-object-type": "error",
|
|
183
|
+
"typescript/no-explicit-any": "error",
|
|
184
|
+
"typescript/no-extra-non-null-assertion": "error",
|
|
185
|
+
"typescript/no-extraneous-class": "error",
|
|
186
|
+
"typescript/no-floating-promises": "error",
|
|
187
|
+
"typescript/no-for-in-array": "error",
|
|
188
|
+
"typescript/no-implied-eval": "error",
|
|
189
|
+
"typescript/no-import-type-side-effects": "error",
|
|
190
|
+
"typescript/no-inferrable-types": "error",
|
|
191
|
+
"typescript/no-invalid-void-type": "error",
|
|
192
|
+
"typescript/no-meaningless-void-operator": "error",
|
|
193
|
+
"typescript/no-misused-new": "error",
|
|
194
|
+
"typescript/no-misused-promises": "error",
|
|
195
|
+
"typescript/no-misused-spread": "error",
|
|
196
|
+
"typescript/no-mixed-enums": "error",
|
|
197
|
+
"typescript/no-namespace": "error",
|
|
198
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
199
|
+
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
200
|
+
"typescript/no-non-null-assertion": "error",
|
|
201
|
+
"typescript/no-redundant-type-constituents": "error",
|
|
202
|
+
"typescript/no-require-imports": "error",
|
|
203
|
+
"typescript/no-this-alias": "error",
|
|
204
|
+
"typescript/no-unnecessary-boolean-literal-compare": "error",
|
|
205
|
+
"typescript/no-unnecessary-condition": "error",
|
|
206
|
+
"typescript/no-unnecessary-template-expression": "error",
|
|
207
|
+
"typescript/no-unnecessary-type-arguments": "error",
|
|
208
|
+
"typescript/no-unnecessary-type-assertion": "error",
|
|
209
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
210
|
+
"typescript/no-unsafe-argument": "error",
|
|
211
|
+
"typescript/no-unsafe-assignment": "error",
|
|
212
|
+
"typescript/no-unsafe-call": "error",
|
|
213
|
+
"typescript/no-unsafe-declaration-merging": "error",
|
|
214
|
+
"typescript/no-unsafe-enum-comparison": "error",
|
|
215
|
+
"typescript/no-unsafe-function-type": "error",
|
|
216
|
+
"typescript/no-unsafe-member-access": "error",
|
|
217
|
+
"typescript/no-unsafe-return": "error",
|
|
218
|
+
"typescript/no-unsafe-unary-minus": "error",
|
|
219
|
+
"typescript/no-wrapper-object-types": "error",
|
|
220
|
+
"typescript/non-nullable-type-assertion-style": "error",
|
|
221
|
+
"typescript/only-throw-error": "error",
|
|
222
|
+
"typescript/prefer-as-const": "error",
|
|
223
|
+
"typescript/prefer-enum-initializers": "error",
|
|
224
|
+
"typescript/prefer-for-of": "error",
|
|
225
|
+
"typescript/prefer-function-type": "error",
|
|
226
|
+
"typescript/prefer-includes": "error",
|
|
227
|
+
"typescript/prefer-literal-enum-member": "error",
|
|
228
|
+
"typescript/prefer-namespace-keyword": "error",
|
|
229
|
+
"typescript/prefer-nullish-coalescing": [
|
|
230
|
+
"error",
|
|
231
|
+
{
|
|
232
|
+
"ignorePrimitives": {
|
|
233
|
+
"boolean": true,
|
|
234
|
+
"string": true
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"typescript/prefer-optional-chain": "error",
|
|
239
|
+
"typescript/prefer-promise-reject-errors": "error",
|
|
240
|
+
"typescript/prefer-reduce-type-parameter": "error",
|
|
241
|
+
"typescript/prefer-return-this-type": "error",
|
|
242
|
+
"typescript/promise-function-async": "error",
|
|
243
|
+
"typescript/related-getter-setter-pairs": "error",
|
|
244
|
+
"typescript/require-array-sort-compare": "error",
|
|
245
|
+
"typescript/restrict-plus-operands": [
|
|
246
|
+
"error",
|
|
247
|
+
{
|
|
248
|
+
"allowAny": false,
|
|
249
|
+
"allowBoolean": false,
|
|
250
|
+
"allowNullish": false,
|
|
251
|
+
"allowNumberAndString": false,
|
|
252
|
+
"allowRegExp": false
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"typescript/restrict-template-expressions": [
|
|
256
|
+
"error",
|
|
257
|
+
{
|
|
258
|
+
"allowNumber": true
|
|
259
|
+
}
|
|
260
|
+
],
|
|
261
|
+
"typescript/return-await": ["error", "error-handling-correctness-only"],
|
|
262
|
+
"typescript/strict-boolean-expressions": [
|
|
263
|
+
"error",
|
|
264
|
+
{
|
|
265
|
+
"allowNullableBoolean": true,
|
|
266
|
+
"allowNullableString": true
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"typescript/switch-exhaustiveness-check": [
|
|
270
|
+
"error",
|
|
271
|
+
{
|
|
272
|
+
"allowDefaultCaseForExhaustiveSwitch": true,
|
|
273
|
+
"considerDefaultExhaustiveForUnions": false,
|
|
274
|
+
"requireDefaultForNonUnion": true
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"typescript/triple-slash-reference": "error",
|
|
278
|
+
"typescript/unbound-method": "error",
|
|
279
|
+
"typescript/unified-signatures": "error",
|
|
280
|
+
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
281
|
+
"use-isnan": "error",
|
|
282
|
+
"valid-typeof": "error"
|
|
283
|
+
}
|
|
284
|
+
}
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# esconfig
|
|
2
2
|
|
|
3
|
-
Shared ECMAScript Config (
|
|
3
|
+
Shared ECMAScript Config (TypeScript, oxlint, oxfmt, optional eslint)
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
1. Install
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
pnpm add -D @nihalgonsalves/esconfig typescript
|
|
10
|
+
pnpm add -D @nihalgonsalves/esconfig typescript oxlint oxlint-tsgolint oxfmt
|
|
11
|
+
# optionally for react:
|
|
12
|
+
pnpm add -D eslint
|
|
11
13
|
```
|
|
12
14
|
|
|
13
15
|
2. `tsconfig.json`
|
|
@@ -23,21 +25,17 @@ Shared ECMAScript Config (TS, Lint, Prettier)
|
|
|
23
25
|
}
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
3. `
|
|
28
|
+
3. copy [`.oxlintrc.json`](./.oxlintrc.json)
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
import tseslint from "typescript-eslint";
|
|
30
|
-
|
|
31
|
-
import sharedConfig from "@nihalgonsalves/esconfig/eslint.config.shared";
|
|
30
|
+
4. `.oxlintrc.json`
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"extends": ["node_modules/@nihalgonsalves/esconfig/.oxlintrc.json"]
|
|
35
|
+
}
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
5. If you're using React, `eslint.config.js`:
|
|
41
39
|
|
|
42
40
|
```js
|
|
43
41
|
import tseslint from "typescript-eslint";
|
|
@@ -51,17 +49,17 @@ Shared ECMAScript Config (TS, Lint, Prettier)
|
|
|
51
49
|
);
|
|
52
50
|
```
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
6. `package.json`
|
|
55
53
|
|
|
56
54
|
```json
|
|
57
55
|
{
|
|
58
56
|
"scripts": {
|
|
59
57
|
"build": "tsc",
|
|
60
|
-
"lint": "eslint ./src/",
|
|
61
|
-
"format": "
|
|
62
|
-
"format:check": "
|
|
58
|
+
"lint": "oxlint --type-aware --report-unused-disable-directives-severity=error && eslint ./src/",
|
|
59
|
+
"format": "oxfmt",
|
|
60
|
+
"format:check": "oxfmt --check"
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
```
|
|
66
64
|
|
|
67
|
-
|
|
65
|
+
7. Done! Don't forget to run `build`, `lint` and `format:check` in your CI workflow.
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import vitest from "@vitest/eslint-plugin";
|
|
2
|
-
import { defineConfig } from "eslint/config";
|
|
3
2
|
import prettierConfig from "eslint-config-prettier";
|
|
4
3
|
import jestDom from "eslint-plugin-jest-dom";
|
|
5
4
|
// @ts-expect-error no types
|
|
6
5
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
7
6
|
import react from "eslint-plugin-react";
|
|
8
|
-
import reactCompiler from "eslint-plugin-react-compiler";
|
|
9
7
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
10
|
-
import
|
|
8
|
+
import { configs as storybookConfigs } from "eslint-plugin-storybook";
|
|
11
9
|
import testingLibrary from "eslint-plugin-testing-library";
|
|
12
|
-
|
|
13
|
-
import sharedConfig from "./eslint.config.shared.js";
|
|
10
|
+
import { defineConfig } from "eslint/config";
|
|
14
11
|
|
|
15
12
|
export default defineConfig(
|
|
16
|
-
...sharedConfig,
|
|
17
13
|
{
|
|
18
14
|
ignores: [
|
|
19
15
|
// https://github.com/storybookjs/eslint-plugin-storybook?tab=readme-ov-file#installation
|
|
@@ -21,9 +17,9 @@ export default defineConfig(
|
|
|
21
17
|
],
|
|
22
18
|
},
|
|
23
19
|
// @ts-expect-error wrong types
|
|
24
|
-
react.configs.flat
|
|
20
|
+
react.configs.flat["recommended-latest"],
|
|
25
21
|
react.configs.flat["jsx-runtime"],
|
|
26
|
-
|
|
22
|
+
reactHooks.configs["recommended-latest"],
|
|
27
23
|
{
|
|
28
24
|
plugins: {
|
|
29
25
|
"react-hooks": reactHooks,
|
|
@@ -42,8 +38,7 @@ export default defineConfig(
|
|
|
42
38
|
},
|
|
43
39
|
{
|
|
44
40
|
name: "location",
|
|
45
|
-
message:
|
|
46
|
-
"useLocation from your router package, or access window.location",
|
|
41
|
+
message: "useLocation from your router package, or access window.location",
|
|
47
42
|
},
|
|
48
43
|
],
|
|
49
44
|
"no-restricted-imports": [
|
|
@@ -127,10 +122,7 @@ export default defineConfig(
|
|
|
127
122
|
"react/no-multi-comp": "off",
|
|
128
123
|
"react/no-set-state": "off",
|
|
129
124
|
"react/prefer-es6-class": ["error", "always"],
|
|
130
|
-
"react/prefer-stateless-function": [
|
|
131
|
-
"error",
|
|
132
|
-
{ ignorePureComponents: true },
|
|
133
|
-
],
|
|
125
|
+
"react/prefer-stateless-function": ["error", { ignorePureComponents: true }],
|
|
134
126
|
// TypeScript
|
|
135
127
|
"react/prop-types": ["off"],
|
|
136
128
|
"react/require-render-return": "error",
|
|
@@ -187,10 +179,7 @@ export default defineConfig(
|
|
|
187
179
|
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
188
180
|
"react/jsx-equals-spacing": ["error", "never"],
|
|
189
181
|
"react/jsx-indent": ["error", 2],
|
|
190
|
-
"react/jsx-filename-extension": [
|
|
191
|
-
"error",
|
|
192
|
-
{ extensions: [".jsx", ".tsx"] },
|
|
193
|
-
],
|
|
182
|
+
"react/jsx-filename-extension": ["error", { extensions: [".jsx", ".tsx"] }],
|
|
194
183
|
"react/require-optimization": ["off", { allowDecorators: [] }],
|
|
195
184
|
"react/forbid-component-props": ["off", { forbid: [] }],
|
|
196
185
|
"react/forbid-elements": ["off", { forbid: [] }],
|
|
@@ -204,16 +193,10 @@ export default defineConfig(
|
|
|
204
193
|
"react/style-prop-object": "error",
|
|
205
194
|
"react/no-array-index-key": "error",
|
|
206
195
|
"react/void-dom-elements-no-children": "error",
|
|
207
|
-
"react/default-props-match-prop-types": [
|
|
208
|
-
"error",
|
|
209
|
-
{ allowRequiredDefaults: false },
|
|
210
|
-
],
|
|
196
|
+
"react/default-props-match-prop-types": ["error", { allowRequiredDefaults: false }],
|
|
211
197
|
"react/no-redundant-should-component-update": "error",
|
|
212
198
|
"react/no-unused-state": "error",
|
|
213
|
-
"react/jsx-curly-brace-presence": [
|
|
214
|
-
"error",
|
|
215
|
-
{ props: "never", children: "never" },
|
|
216
|
-
],
|
|
199
|
+
"react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
|
|
217
200
|
"react/destructuring-assignment": ["error", "always"],
|
|
218
201
|
"react/no-access-state-in-setstate": "error",
|
|
219
202
|
"react/button-has-type": [
|
|
@@ -295,15 +278,7 @@ export default defineConfig(
|
|
|
295
278
|
{
|
|
296
279
|
labelAttributes: ["label"],
|
|
297
280
|
controlComponents: [],
|
|
298
|
-
ignoreElements: [
|
|
299
|
-
"audio",
|
|
300
|
-
"canvas",
|
|
301
|
-
"embed",
|
|
302
|
-
"input",
|
|
303
|
-
"textarea",
|
|
304
|
-
"tr",
|
|
305
|
-
"video",
|
|
306
|
-
],
|
|
281
|
+
ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
|
|
307
282
|
ignoreRoles: [
|
|
308
283
|
"grid",
|
|
309
284
|
"listbox",
|
|
@@ -361,37 +336,14 @@ export default defineConfig(
|
|
|
361
336
|
"jsx-a11y/no-noninteractive-element-interactions": [
|
|
362
337
|
"error",
|
|
363
338
|
{
|
|
364
|
-
handlers: [
|
|
365
|
-
"onClick",
|
|
366
|
-
"onMouseDown",
|
|
367
|
-
"onMouseUp",
|
|
368
|
-
"onKeyPress",
|
|
369
|
-
"onKeyDown",
|
|
370
|
-
"onKeyUp",
|
|
371
|
-
],
|
|
339
|
+
handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
|
|
372
340
|
},
|
|
373
341
|
],
|
|
374
342
|
"jsx-a11y/no-noninteractive-element-to-interactive-role": [
|
|
375
343
|
"error",
|
|
376
344
|
{
|
|
377
|
-
ul: [
|
|
378
|
-
|
|
379
|
-
"menu",
|
|
380
|
-
"menubar",
|
|
381
|
-
"radiogroup",
|
|
382
|
-
"tablist",
|
|
383
|
-
"tree",
|
|
384
|
-
"treegrid",
|
|
385
|
-
],
|
|
386
|
-
ol: [
|
|
387
|
-
"listbox",
|
|
388
|
-
"menu",
|
|
389
|
-
"menubar",
|
|
390
|
-
"radiogroup",
|
|
391
|
-
"tablist",
|
|
392
|
-
"tree",
|
|
393
|
-
"treegrid",
|
|
394
|
-
],
|
|
345
|
+
ul: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
|
|
346
|
+
ol: ["listbox", "menu", "menubar", "radiogroup", "tablist", "tree", "treegrid"],
|
|
395
347
|
li: ["menuitem", "option", "row", "tab", "treeitem"],
|
|
396
348
|
table: ["grid"],
|
|
397
349
|
td: ["gridcell"],
|
|
@@ -414,14 +366,7 @@ export default defineConfig(
|
|
|
414
366
|
"jsx-a11y/no-static-element-interactions": [
|
|
415
367
|
"error",
|
|
416
368
|
{
|
|
417
|
-
handlers: [
|
|
418
|
-
"onClick",
|
|
419
|
-
"onMouseDown",
|
|
420
|
-
"onMouseUp",
|
|
421
|
-
"onKeyPress",
|
|
422
|
-
"onKeyDown",
|
|
423
|
-
"onKeyUp",
|
|
424
|
-
],
|
|
369
|
+
handlers: ["onClick", "onMouseDown", "onMouseUp", "onKeyPress", "onKeyDown", "onKeyUp"],
|
|
425
370
|
},
|
|
426
371
|
],
|
|
427
372
|
"jsx-a11y/role-has-required-aria-props": "error",
|
|
@@ -430,9 +375,9 @@ export default defineConfig(
|
|
|
430
375
|
"jsx-a11y/tabindex-no-positive": "error",
|
|
431
376
|
},
|
|
432
377
|
},
|
|
433
|
-
...
|
|
434
|
-
...
|
|
435
|
-
...
|
|
378
|
+
...storybookConfigs["flat/recommended"],
|
|
379
|
+
...storybookConfigs["flat/addon-interactions"],
|
|
380
|
+
...storybookConfigs["flat/csf-strict"],
|
|
436
381
|
{
|
|
437
382
|
files: [
|
|
438
383
|
"**/.storybook/**/*",
|
|
@@ -446,10 +391,7 @@ export default defineConfig(
|
|
|
446
391
|
],
|
|
447
392
|
rules: {
|
|
448
393
|
"vitest/consistent-test-filename": "error",
|
|
449
|
-
"vitest/consistent-test-it": [
|
|
450
|
-
"error",
|
|
451
|
-
{ fn: "it", withinDescribe: "it" },
|
|
452
|
-
],
|
|
394
|
+
"vitest/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
453
395
|
"vitest/no-focused-tests": "error",
|
|
454
396
|
"vitest/no-test-prefixes": "error",
|
|
455
397
|
"vitest/padding-around-after-all-blocks": "error",
|
|
@@ -483,6 +425,6 @@ export default defineConfig(
|
|
|
483
425
|
"import/no-default-export": "off",
|
|
484
426
|
},
|
|
485
427
|
},
|
|
486
|
-
...
|
|
428
|
+
...storybookConfigs.recommended.overrides,
|
|
487
429
|
prettierConfig,
|
|
488
430
|
);
|
package/package.json
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nihalgonsalves/esconfig",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared ECMAScript Config (
|
|
5
|
-
"
|
|
3
|
+
"version": "0.14.1",
|
|
4
|
+
"description": "Shared ECMAScript Config (TypeScript, oxlint, oxfmt, eslint)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Nihal Gonsalves <nihal@nihalgonsalves.com>",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+ssh://git@github.com/nihalgonsalves/esconfig.git"
|
|
9
10
|
},
|
|
10
|
-
"author": "Nihal Gonsalves <nihal@nihalgonsalves.com>",
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"type": "module",
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"provenance": true
|
|
15
|
-
},
|
|
16
11
|
"files": [
|
|
17
|
-
"
|
|
18
|
-
"
|
|
12
|
+
".oxlintrc.json",
|
|
13
|
+
".oxfmt.json",
|
|
19
14
|
"eslint.config.react-shared.js",
|
|
20
15
|
"eslint.config.react-shared.d.ts",
|
|
21
16
|
"tsconfig.shared.json"
|
|
22
17
|
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"main": "index.js",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"provenance": true
|
|
22
|
+
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@eslint/js": "^9.39.2",
|
|
25
24
|
"@vitest/eslint-plugin": "^1.6.9",
|
|
26
25
|
"eslint-config-prettier": "^10.1.8",
|
|
27
|
-
"eslint-plugin-import": "^2.32.0",
|
|
28
26
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
29
27
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
30
28
|
"eslint-plugin-react": "^7.37.5",
|
|
31
|
-
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
32
29
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
33
30
|
"eslint-plugin-storybook": "^10.2.8",
|
|
34
|
-
"eslint-plugin-testing-library": "^7.15.4"
|
|
35
|
-
"typescript-eslint": "^8.55.0"
|
|
31
|
+
"eslint-plugin-testing-library": "^7.15.4"
|
|
36
32
|
},
|
|
37
33
|
"devDependencies": {
|
|
38
34
|
"@commitlint/cli": "^20.4.1",
|
|
@@ -41,18 +37,21 @@
|
|
|
41
37
|
"eslint": "^9.39.2",
|
|
42
38
|
"knip": "^5.83.1",
|
|
43
39
|
"lefthook": "^2.1.1",
|
|
44
|
-
"
|
|
40
|
+
"oxfmt": "^0.33.0",
|
|
41
|
+
"oxlint": "^1.48.0",
|
|
42
|
+
"oxlint-tsgolint": "^0.14.0",
|
|
45
43
|
"typescript": "^5.9.3"
|
|
46
44
|
},
|
|
47
45
|
"peerDependencies": {
|
|
48
46
|
"eslint": "^9.39.2",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
47
|
+
"oxlint": "^1.48.0",
|
|
48
|
+
"oxlint-tsgolint": "^0.14.0",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
52
|
"typecheck": "tsc --noEmit",
|
|
54
|
-
"lint": "
|
|
55
|
-
"format": "
|
|
56
|
-
"format:check": "
|
|
53
|
+
"lint": "oxlint --type-aware --report-unused-disable-directives-severity=error && knip",
|
|
54
|
+
"format": "oxfmt",
|
|
55
|
+
"format:check": "oxfmt --check"
|
|
57
56
|
}
|
|
58
57
|
}
|
package/eslint.config.shared.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
import { defineConfig } from "eslint/config";
|
|
3
|
-
import prettierConfig from "eslint-config-prettier";
|
|
4
|
-
import importPlugin from "eslint-plugin-import";
|
|
5
|
-
import tseslint from "typescript-eslint";
|
|
6
|
-
|
|
7
|
-
export default defineConfig(
|
|
8
|
-
js.configs.recommended,
|
|
9
|
-
// @ts-expect-error nullability
|
|
10
|
-
{
|
|
11
|
-
// extract only the rules, because this config otherwise applies only to
|
|
12
|
-
// TypeScript extensions, which causes problems with checkJs
|
|
13
|
-
rules: tseslint.configs.eslintRecommended.rules,
|
|
14
|
-
},
|
|
15
|
-
...tseslint.configs.strictTypeChecked,
|
|
16
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
17
|
-
{
|
|
18
|
-
languageOptions: {
|
|
19
|
-
parserOptions: {
|
|
20
|
-
projectService: true,
|
|
21
|
-
warnOnUnsupportedTypeScriptVersion: false,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
plugins: {
|
|
25
|
-
import: importPlugin,
|
|
26
|
-
},
|
|
27
|
-
rules: {
|
|
28
|
-
"@typescript-eslint/naming-convention": [
|
|
29
|
-
"error",
|
|
30
|
-
{
|
|
31
|
-
selector: "variable",
|
|
32
|
-
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
selector: "function",
|
|
36
|
-
format: ["camelCase", "PascalCase"],
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
selector: "typeLike",
|
|
40
|
-
format: ["PascalCase"],
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
"@typescript-eslint/class-methods-use-this": "error",
|
|
44
|
-
"@typescript-eslint/default-param-last": ["error"],
|
|
45
|
-
"@typescript-eslint/no-loop-func": ["error"],
|
|
46
|
-
"@typescript-eslint/no-shadow": ["error"],
|
|
47
|
-
"@typescript-eslint/no-unused-expressions": [
|
|
48
|
-
"error",
|
|
49
|
-
{
|
|
50
|
-
allowShortCircuit: false,
|
|
51
|
-
allowTernary: false,
|
|
52
|
-
allowTaggedTemplates: false,
|
|
53
|
-
enforceForJSX: false,
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
"@typescript-eslint/no-unused-vars": [
|
|
57
|
-
"error",
|
|
58
|
-
{
|
|
59
|
-
vars: "all",
|
|
60
|
-
args: "after-used",
|
|
61
|
-
ignoreRestSiblings: true,
|
|
62
|
-
argsIgnorePattern: "^_",
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
"@typescript-eslint/no-use-before-define": [
|
|
66
|
-
"error",
|
|
67
|
-
{
|
|
68
|
-
functions: true,
|
|
69
|
-
classes: true,
|
|
70
|
-
variables: true,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
"import/extensions": [
|
|
74
|
-
"error",
|
|
75
|
-
"ignorePackages",
|
|
76
|
-
{
|
|
77
|
-
js: "never",
|
|
78
|
-
mjs: "never",
|
|
79
|
-
jsx: "never",
|
|
80
|
-
ts: "never",
|
|
81
|
-
tsx: "never",
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
"import/no-extraneous-dependencies": [
|
|
85
|
-
"error",
|
|
86
|
-
{
|
|
87
|
-
devDependencies: [
|
|
88
|
-
"test/**",
|
|
89
|
-
"tests/**",
|
|
90
|
-
"spec/**",
|
|
91
|
-
"**/__tests__/**",
|
|
92
|
-
"**/__mocks__/**",
|
|
93
|
-
"test.{js,jsx}",
|
|
94
|
-
"test.{ts,tsx}",
|
|
95
|
-
"test-*.{js,jsx}",
|
|
96
|
-
"test-*.{ts,tsx}",
|
|
97
|
-
"**/*{.,_}{test,spec}.{js,jsx}",
|
|
98
|
-
"**/*{.,_}{test,spec}.{ts,tsx}",
|
|
99
|
-
"**/*.config.{js,ts,cjs,mjs,cts,mts}",
|
|
100
|
-
"**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)",
|
|
101
|
-
],
|
|
102
|
-
optionalDependencies: false,
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
"import/no-default-export": ["error"],
|
|
106
|
-
"import/order": [
|
|
107
|
-
"error",
|
|
108
|
-
{
|
|
109
|
-
pathGroups: [
|
|
110
|
-
{
|
|
111
|
-
pattern: "@nihalgonsalves/**",
|
|
112
|
-
group: "internal",
|
|
113
|
-
position: "after",
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
pathGroupsExcludedImportTypes: ["builtin"],
|
|
117
|
-
groups: [
|
|
118
|
-
"builtin",
|
|
119
|
-
"external",
|
|
120
|
-
"internal",
|
|
121
|
-
"unknown",
|
|
122
|
-
"parent",
|
|
123
|
-
"sibling",
|
|
124
|
-
"index",
|
|
125
|
-
],
|
|
126
|
-
"newlines-between": "always",
|
|
127
|
-
alphabetize: { order: "asc" },
|
|
128
|
-
},
|
|
129
|
-
],
|
|
130
|
-
"import/no-duplicates": ["error", { "prefer-inline": true }],
|
|
131
|
-
"import/no-unresolved": "off",
|
|
132
|
-
"func-style": ["error", "expression"],
|
|
133
|
-
"arrow-body-style": "error",
|
|
134
|
-
"object-shorthand": "error",
|
|
135
|
-
"no-useless-rename": "error",
|
|
136
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
137
|
-
"error",
|
|
138
|
-
{ fixStyle: "inline-type-imports" },
|
|
139
|
-
],
|
|
140
|
-
"@typescript-eslint/consistent-type-exports": [
|
|
141
|
-
"error",
|
|
142
|
-
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
143
|
-
],
|
|
144
|
-
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
145
|
-
"@typescript-eslint/ban-ts-comment": [
|
|
146
|
-
"error",
|
|
147
|
-
{
|
|
148
|
-
"ts-expect-error": "allow-with-description",
|
|
149
|
-
"ts-ignore": true,
|
|
150
|
-
"ts-nocheck": true,
|
|
151
|
-
"ts-check": false,
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
"@typescript-eslint/consistent-type-assertions": [
|
|
155
|
-
"error",
|
|
156
|
-
{
|
|
157
|
-
assertionStyle: "never",
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
"@typescript-eslint/prefer-nullish-coalescing": [
|
|
161
|
-
"error",
|
|
162
|
-
{ ignorePrimitives: { boolean: true, string: true } },
|
|
163
|
-
],
|
|
164
|
-
"@typescript-eslint/strict-boolean-expressions": [
|
|
165
|
-
"error",
|
|
166
|
-
{ allowNullableBoolean: true, allowNullableString: true },
|
|
167
|
-
],
|
|
168
|
-
"@typescript-eslint/restrict-template-expressions": [
|
|
169
|
-
"error",
|
|
170
|
-
{ allowNumber: true },
|
|
171
|
-
],
|
|
172
|
-
"@typescript-eslint/promise-function-async": "error",
|
|
173
|
-
"@typescript-eslint/method-signature-style": "error",
|
|
174
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
175
|
-
"@typescript-eslint/require-array-sort-compare": "error",
|
|
176
|
-
"@typescript-eslint/switch-exhaustiveness-check": [
|
|
177
|
-
"error",
|
|
178
|
-
{
|
|
179
|
-
allowDefaultCaseForExhaustiveSwitch: true,
|
|
180
|
-
requireDefaultForNonUnion: true,
|
|
181
|
-
considerDefaultExhaustiveForUnions: false,
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
"@typescript-eslint/require-await": "off",
|
|
185
|
-
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
186
|
-
"@typescript-eslint/consistent-return": "error",
|
|
187
|
-
},
|
|
188
|
-
settings: {
|
|
189
|
-
"import/extensions": [
|
|
190
|
-
".cjs",
|
|
191
|
-
".mjs",
|
|
192
|
-
".js",
|
|
193
|
-
".jsx",
|
|
194
|
-
".cts",
|
|
195
|
-
".mts",
|
|
196
|
-
".ts",
|
|
197
|
-
".tsx",
|
|
198
|
-
],
|
|
199
|
-
"import/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
200
|
-
"import/parsers": {
|
|
201
|
-
"@typescript-eslint/parser": [".cts", ".mts", ".ts", ".tsx"],
|
|
202
|
-
},
|
|
203
|
-
"import/resolver": {
|
|
204
|
-
node: {
|
|
205
|
-
extensions: [
|
|
206
|
-
".cjs",
|
|
207
|
-
".mjs",
|
|
208
|
-
".js",
|
|
209
|
-
".jsx",
|
|
210
|
-
".cts",
|
|
211
|
-
".mts",
|
|
212
|
-
".ts",
|
|
213
|
-
".tsx",
|
|
214
|
-
],
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
files: ["**/*.config.*"],
|
|
221
|
-
rules: {
|
|
222
|
-
"import/no-default-export": "off",
|
|
223
|
-
},
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
prettierConfig,
|
|
227
|
-
);
|