@standard-config/eslint 1.5.3 → 1.6.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/README.md +38 -2
- package/dist/index-C8CpEqE5.d.mts +20 -0
- package/dist/index-C8CpEqE5.d.mts.map +1 -0
- package/dist/index.d.mts +16 -17
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +24 -312
- package/dist/index.mjs.map +1 -1
- package/dist/rules-react-P9sQTBnm.mjs +384 -0
- package/dist/rules-react-P9sQTBnm.mjs.map +1 -0
- package/dist/utilities.d.mts +68 -0
- package/dist/utilities.d.mts.map +1 -0
- package/dist/utilities.mjs +89 -0
- package/dist/utilities.mjs.map +1 -0
- package/package.json +16 -8
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# @standard-config/eslint
|
|
6
6
|
|
|
7
|
-
TypeScript-first ESLint config designed to complement [**@standard-config/oxlint**](https://github.com/standard-config/oxlint).
|
|
7
|
+
TypeScript-first ESLint config designed to complement [**@standard-config/oxlint**](https://github.com/standard-config/oxlint). Focuses primarily on stylistic and React-related rules not available in Oxlint.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ export default defineConfig();
|
|
|
28
28
|
|
|
29
29
|
### React
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
The React-related rules included with Standard Config are off by default. You can enable them by setting `react: true` at the root of your config.
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
34
|
import { defineConfig } from '@standard-config/eslint';
|
|
@@ -38,6 +38,42 @@ export default defineConfig({
|
|
|
38
38
|
});
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
### Skipping ESLint
|
|
42
|
+
|
|
43
|
+
Standard Config comes with a set of utilities that can translate this config to Oxlint, eliminating the need to run ESLint. This relies on Oxlint’s experimental [JS Plugins](https://oxc.rs/docs/guide/usage/linter/js-plugins.html) support.
|
|
44
|
+
|
|
45
|
+
In your `oxlint.config.ts`:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { getOxlintConfigs } from '@standard-config/eslint/utilities';
|
|
49
|
+
import { defineConfig } from '@standard-config/oxlint';
|
|
50
|
+
|
|
51
|
+
const { configBase, configConfigFiles } = getOxlintConfigs({
|
|
52
|
+
// Optional, as above
|
|
53
|
+
react: true,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Merge `configBase` at the root of your config, as it defines
|
|
57
|
+
// all supported third-party rules from this config, including
|
|
58
|
+
// the resolved `jsPlugins`
|
|
59
|
+
export default defineConfig(configBase, {
|
|
60
|
+
react: true,
|
|
61
|
+
rules: {
|
|
62
|
+
// Example override
|
|
63
|
+
'react-js/function-component-definition': 'off',
|
|
64
|
+
},
|
|
65
|
+
overrides: [
|
|
66
|
+
{
|
|
67
|
+
// `configConfigFiles` is an optional override entry
|
|
68
|
+
// intended for config files other than `**/*.config.ts`
|
|
69
|
+
// (those are already covered by `configBase`)
|
|
70
|
+
files: ['config/**/*.ts'],
|
|
71
|
+
...configConfigFiles,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
41
77
|
## Related
|
|
42
78
|
|
|
43
79
|
- [**@standard-config/oxlint**](https://github.com/standard-config/oxlint)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import { Linter } from "eslint";
|
|
3
|
+
|
|
4
|
+
//#region src/types/index.d.ts
|
|
5
|
+
type LinterConfigEntry = Omit<Linter.Config, 'files'>;
|
|
6
|
+
type LinterConfigRuleEntry = Linter.RuleSeverity | [Linter.RuleSeverity, ...unknown[]];
|
|
7
|
+
type LinterConfigRules = Record<string, LinterConfigRuleEntry>;
|
|
8
|
+
type InfiniteLinterConfig = Parameters<typeof defineConfig>[number];
|
|
9
|
+
type StandardConfig = Exclude<InfiniteLinterConfig, unknown[]> & {
|
|
10
|
+
/**
|
|
11
|
+
* Enable React-specific rules.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
react?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type InfiniteLinterConfigs = [StandardConfig, ...InfiniteLinterConfig[]];
|
|
17
|
+
type StandardConfigArray = InfiniteLinterConfig[] | InfiniteLinterConfigs | [InfiniteLinterConfigs, ...InfiniteLinterConfig[]];
|
|
18
|
+
//#endregion
|
|
19
|
+
export { StandardConfigArray as i, LinterConfigRules as n, StandardConfig as r, LinterConfigEntry as t };
|
|
20
|
+
//# sourceMappingURL=index-C8CpEqE5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-C8CpEqE5.d.mts","names":["Linter","defineConfig","eslintDefineConfig","LinterConfigEntry","Config","Omit","LinterConfigRuleEntry","RuleSeverity","LinterConfigRules","Record","InfiniteLinterConfig","Parameters","StandardConfig","Exclude","react","InfiniteLinterConfigs","StandardConfigArray"],"sources":["../src/types/index.d.ts"],"mappings":";;;;KAGYG,iBAAAA,GAAoBE,IAAAA,CAAKL,MAAAA,CAAOI,MAAAA;AAAAA,KAEvCE,qBAAAA,GACFN,MAAAA,CAAOO,YAAAA,IACNP,MAAAA,CAAOO,YAAAA;AAAAA,KAECC,iBAAAA,GAAoBC,MAAAA,SAAeH,qBAAAA;AAAAA,KAE1CI,oBAAAA,GAAuBC,UAAAA,QAAkBT,YAAAA;AAAAA,KAElCU,cAAAA,GAAiBC,OAAAA,CAAQH,oBAAAA;EARX;;;;EAazBI,KAAAA;AAAAA;AAAAA,KAGIC,qBAAAA,IAAyBH,cAAAA,KAAmBF,oBAAAA;AAAAA,KAErCM,mBAAAA,GACTN,oBAAAA,KACAK,qBAAAA,IACCA,qBAAAA,KAA0BL,oBAAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as StandardConfigArray, t as LinterConfigEntry } from "./index-C8CpEqE5.mjs";
|
|
2
|
+
import { Config } from "eslint/config";
|
|
3
3
|
|
|
4
|
-
//#region src/types/index.d.ts
|
|
5
|
-
type LinterConfigEntry = Omit<Linter.Config, 'files'>;
|
|
6
|
-
type InfiniteLinterConfig = Parameters<typeof defineConfig$1>[number];
|
|
7
|
-
type StandardConfig = Exclude<InfiniteLinterConfig, ReadonlyArray<unknown>> & {
|
|
8
|
-
/**
|
|
9
|
-
* Enable React-specific rules.
|
|
10
|
-
* @default false
|
|
11
|
-
*/
|
|
12
|
-
react?: boolean;
|
|
13
|
-
};
|
|
14
|
-
type InfiniteLinterConfigs = [StandardConfig, ...InfiniteLinterConfig[]];
|
|
15
|
-
type StandardConfigArray = InfiniteLinterConfig[] | InfiniteLinterConfigs | [InfiniteLinterConfigs, ...InfiniteLinterConfig[]];
|
|
16
|
-
//#endregion
|
|
17
4
|
//#region src/config-base/index.d.ts
|
|
18
5
|
/**
|
|
6
|
+
* Primary config entry.
|
|
7
|
+
*
|
|
19
8
|
* This config is intentionally limited to rules not supported by Oxlint
|
|
20
|
-
* and
|
|
9
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
21
10
|
*/
|
|
22
11
|
declare const config: LinterConfigEntry;
|
|
23
12
|
//#endregion
|
|
24
13
|
//#region src/config-config-files/index.d.ts
|
|
14
|
+
/**
|
|
15
|
+
* Optional config entry containing rules that target config files. Intended for
|
|
16
|
+
* explicit overrides.
|
|
17
|
+
*
|
|
18
|
+
* This config is intentionally limited to rules not supported by Oxlint
|
|
19
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
20
|
+
*/
|
|
25
21
|
declare const config$1: LinterConfigEntry;
|
|
26
22
|
//#endregion
|
|
27
23
|
//#region src/config-react/index.d.ts
|
|
28
24
|
/**
|
|
25
|
+
* Optional config entry containing rules that target `*.tsx` files. Intended
|
|
26
|
+
* for explicit overrides.
|
|
27
|
+
*
|
|
29
28
|
* This config is intentionally limited to rules not supported by Oxlint
|
|
30
|
-
* and
|
|
29
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
31
30
|
*/
|
|
32
31
|
declare const config$2: LinterConfigEntry;
|
|
33
32
|
//#endregion
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/config-base/index.ts","../src/config-config-files/index.ts","../src/config-react/index.ts","../src/define-config/index.ts"],"mappings":";;;;;;;AAA6D;;;cAcvD,MAAA,EAAQ,iBAAA;;;;;;AAd+C;;;;cCWvD,QAAA,EAAQ,iBAAA;;;;;;ADX+C;;;;cEoBvD,QAAA,EAAQ,iBAAA;;;;;AFpB+C;iBGWrC,YAAA,CAAA,GACpB,OAAA,EAAS,mBAAA,GACV,MAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { c as rules$2, i as rules$6, l as rules$1, n as rules$8, o as rules$4, r as rules$7, s as rules$3, t as rules$5, u as rules } from "./rules-react-P9sQTBnm.mjs";
|
|
1
2
|
import pluginStylistic from "@stylistic/eslint-plugin";
|
|
2
3
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
3
4
|
import tseslint from "typescript-eslint";
|
|
@@ -12,14 +13,15 @@ import path from "node:path";
|
|
|
12
13
|
|
|
13
14
|
//#region src/config-base/index.ts
|
|
14
15
|
/**
|
|
16
|
+
* Primary config entry.
|
|
17
|
+
*
|
|
15
18
|
* This config is intentionally limited to rules not supported by Oxlint
|
|
16
|
-
* and
|
|
19
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
17
20
|
*/
|
|
18
21
|
const config = {
|
|
19
22
|
name: "Base Config",
|
|
20
23
|
plugins: {
|
|
21
24
|
"@stylistic": pluginStylistic,
|
|
22
|
-
"@typescript-eslint": tseslint.plugin,
|
|
23
25
|
"perfectionist": pluginPerfectionist
|
|
24
26
|
},
|
|
25
27
|
languageOptions: {
|
|
@@ -34,259 +36,35 @@ const config = {
|
|
|
34
36
|
reportUnusedInlineConfigs: "error"
|
|
35
37
|
},
|
|
36
38
|
rules: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"never",
|
|
41
|
-
{ considerPropertyDescriptor: true }
|
|
42
|
-
],
|
|
43
|
-
"@stylistic/lines-between-class-members": [
|
|
44
|
-
"error",
|
|
45
|
-
"always",
|
|
46
|
-
{ exceptAfterSingleLine: true }
|
|
47
|
-
],
|
|
48
|
-
"@stylistic/padding-line-between-statements": [
|
|
49
|
-
"error",
|
|
50
|
-
{
|
|
51
|
-
blankLine: "always",
|
|
52
|
-
next: "*",
|
|
53
|
-
prev: [
|
|
54
|
-
"block-like",
|
|
55
|
-
"directive",
|
|
56
|
-
"export",
|
|
57
|
-
"function",
|
|
58
|
-
"import",
|
|
59
|
-
"interface",
|
|
60
|
-
"type"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
blankLine: "always",
|
|
65
|
-
next: [
|
|
66
|
-
"block-like",
|
|
67
|
-
"directive",
|
|
68
|
-
"export",
|
|
69
|
-
"function",
|
|
70
|
-
"import",
|
|
71
|
-
"interface",
|
|
72
|
-
"type"
|
|
73
|
-
],
|
|
74
|
-
prev: "*"
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
blankLine: "always",
|
|
78
|
-
next: "*",
|
|
79
|
-
prev: ["case", "default"]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
blankLine: "never",
|
|
83
|
-
next: "directive",
|
|
84
|
-
prev: "directive"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
blankLine: "any",
|
|
88
|
-
next: "export",
|
|
89
|
-
prev: "export"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
blankLine: "never",
|
|
93
|
-
next: ["function", "function-overload"],
|
|
94
|
-
prev: "function-overload"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
blankLine: "never",
|
|
98
|
-
next: "import",
|
|
99
|
-
prev: "import"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
blankLine: "any",
|
|
103
|
-
next: "interface",
|
|
104
|
-
prev: "interface"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
blankLine: "any",
|
|
108
|
-
next: "type",
|
|
109
|
-
prev: "type"
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"@stylistic/spaced-comment": [
|
|
113
|
-
"error",
|
|
114
|
-
"always",
|
|
115
|
-
{
|
|
116
|
-
block: { balanced: true },
|
|
117
|
-
line: { markers: ["/"] }
|
|
118
|
-
}
|
|
119
|
-
],
|
|
120
|
-
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
121
|
-
"@typescript-eslint/no-useless-default-assignment": "error",
|
|
122
|
-
"@typescript-eslint/prefer-readonly": "error",
|
|
123
|
-
"perfectionist/sort-array-includes": ["error", { type: "natural" }],
|
|
124
|
-
"perfectionist/sort-classes": ["error", {
|
|
125
|
-
groups: ["property", "constructor"],
|
|
126
|
-
type: "natural"
|
|
127
|
-
}],
|
|
128
|
-
"perfectionist/sort-exports": ["error", { type: "natural" }],
|
|
129
|
-
"perfectionist/sort-imports": ["error", {
|
|
130
|
-
customGroups: [{
|
|
131
|
-
groupName: "mock-side-effect",
|
|
132
|
-
elementNamePattern: "^.*/_*(mocks)_*/.*$",
|
|
133
|
-
selector: "side-effect"
|
|
134
|
-
}, {
|
|
135
|
-
groupName: "mock",
|
|
136
|
-
elementNamePattern: "^.*/_*(mocks)_*/.*$",
|
|
137
|
-
selector: "import"
|
|
138
|
-
}],
|
|
139
|
-
groups: [
|
|
140
|
-
"mock-side-effect",
|
|
141
|
-
"mock",
|
|
142
|
-
["type-builtin", "type-external"],
|
|
143
|
-
"type-internal",
|
|
144
|
-
[
|
|
145
|
-
"type-parent",
|
|
146
|
-
"type-sibling",
|
|
147
|
-
"type-index"
|
|
148
|
-
],
|
|
149
|
-
["value-builtin", "value-external"],
|
|
150
|
-
"value-internal",
|
|
151
|
-
[
|
|
152
|
-
"value-parent",
|
|
153
|
-
"value-sibling",
|
|
154
|
-
"value-index"
|
|
155
|
-
],
|
|
156
|
-
"unknown",
|
|
157
|
-
"style",
|
|
158
|
-
"side-effect",
|
|
159
|
-
"side-effect-style"
|
|
160
|
-
],
|
|
161
|
-
internalPattern: ["^(#|@/).*"],
|
|
162
|
-
newlinesBetween: 0,
|
|
163
|
-
sortSideEffects: true,
|
|
164
|
-
type: "natural"
|
|
165
|
-
}],
|
|
166
|
-
"perfectionist/sort-interfaces": ["error", {
|
|
167
|
-
groups: [
|
|
168
|
-
"index-signature",
|
|
169
|
-
"unknown",
|
|
170
|
-
"method"
|
|
171
|
-
],
|
|
172
|
-
type: "natural"
|
|
173
|
-
}],
|
|
174
|
-
"perfectionist/sort-intersection-types": ["error", { type: "natural" }],
|
|
175
|
-
"perfectionist/sort-named-exports": ["error", { type: "natural" }],
|
|
176
|
-
"perfectionist/sort-named-imports": ["error", { type: "natural" }],
|
|
177
|
-
"perfectionist/sort-object-types": ["error", {
|
|
178
|
-
groups: [
|
|
179
|
-
"index-signature",
|
|
180
|
-
"unknown",
|
|
181
|
-
"method"
|
|
182
|
-
],
|
|
183
|
-
type: "natural"
|
|
184
|
-
}],
|
|
185
|
-
"perfectionist/sort-objects": [
|
|
186
|
-
"error",
|
|
187
|
-
{
|
|
188
|
-
type: "natural",
|
|
189
|
-
useConfigurationIf: { objectType: "destructured" }
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
type: "unsorted",
|
|
193
|
-
useConfigurationIf: { objectType: "non-destructured" }
|
|
194
|
-
}
|
|
195
|
-
],
|
|
196
|
-
"perfectionist/sort-union-types": ["error", {
|
|
197
|
-
customGroups: [
|
|
198
|
-
{
|
|
199
|
-
groupName: "false",
|
|
200
|
-
elementNamePattern: "^false$"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
groupName: "never",
|
|
204
|
-
elementNamePattern: "^never$"
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
groupName: "react",
|
|
208
|
-
elementNamePattern: "^react.+"
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
|
-
groups: [
|
|
212
|
-
"react",
|
|
213
|
-
"unknown",
|
|
214
|
-
"tuple",
|
|
215
|
-
"false",
|
|
216
|
-
"nullish",
|
|
217
|
-
"never"
|
|
218
|
-
],
|
|
219
|
-
type: "natural"
|
|
220
|
-
}]
|
|
39
|
+
...rules,
|
|
40
|
+
...rules$1,
|
|
41
|
+
...rules$2
|
|
221
42
|
}
|
|
222
43
|
};
|
|
223
44
|
|
|
224
45
|
//#endregion
|
|
225
46
|
//#region src/config-config-files/index.ts
|
|
47
|
+
/**
|
|
48
|
+
* Optional config entry containing rules that target config files. Intended for
|
|
49
|
+
* explicit overrides.
|
|
50
|
+
*
|
|
51
|
+
* This config is intentionally limited to rules not supported by Oxlint
|
|
52
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
53
|
+
*/
|
|
226
54
|
const config$1 = {
|
|
227
55
|
name: "Config Files",
|
|
228
56
|
plugins: { perfectionist: pluginPerfectionist },
|
|
229
|
-
rules: {
|
|
230
|
-
customGroups: [
|
|
231
|
-
{
|
|
232
|
-
groupName: "extends",
|
|
233
|
-
elementNamePattern: "^extends$"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
groupName: "files",
|
|
237
|
-
elementNamePattern: "^files$"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
groupName: "ignores",
|
|
241
|
-
elementNamePattern: "^(ignores|ignorePatterns)$"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
groupName: "name",
|
|
245
|
-
elementNamePattern: "^(name|groupName)$"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
groupName: "overrides",
|
|
249
|
-
elementNamePattern: "^overrides$"
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
groupName: "parser",
|
|
253
|
-
elementNamePattern: "^parser$"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
groupName: "plugins",
|
|
257
|
-
elementNamePattern: "^plugins$"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
groupName: "rules",
|
|
261
|
-
elementNamePattern: "^rules$"
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
groupName: "test",
|
|
265
|
-
elementNamePattern: "^(test|tests)$"
|
|
266
|
-
}
|
|
267
|
-
],
|
|
268
|
-
groups: [
|
|
269
|
-
"name",
|
|
270
|
-
"files",
|
|
271
|
-
"extends",
|
|
272
|
-
"ignores",
|
|
273
|
-
"plugins",
|
|
274
|
-
"parser",
|
|
275
|
-
"test",
|
|
276
|
-
"unknown",
|
|
277
|
-
"rules",
|
|
278
|
-
"overrides"
|
|
279
|
-
],
|
|
280
|
-
newlinesBetween: 0,
|
|
281
|
-
type: "natural"
|
|
282
|
-
}] }
|
|
57
|
+
rules: { ...rules$3 }
|
|
283
58
|
};
|
|
284
59
|
|
|
285
60
|
//#endregion
|
|
286
61
|
//#region src/config-react/index.ts
|
|
287
62
|
/**
|
|
63
|
+
* Optional config entry containing rules that target `*.tsx` files. Intended
|
|
64
|
+
* for explicit overrides.
|
|
65
|
+
*
|
|
288
66
|
* This config is intentionally limited to rules not supported by Oxlint
|
|
289
|
-
* and
|
|
67
|
+
* and stylistic rules outside of Prettier’s scope.
|
|
290
68
|
*/
|
|
291
69
|
const config$2 = {
|
|
292
70
|
name: "React",
|
|
@@ -299,77 +77,11 @@ const config$2 = {
|
|
|
299
77
|
},
|
|
300
78
|
settings: { react: { version: "detect" } },
|
|
301
79
|
rules: {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
groupName: "callback",
|
|
310
|
-
elementNamePattern: "^on.+"
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
groupName: "children",
|
|
314
|
-
elementNamePattern: "^children$"
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
groupName: "key",
|
|
318
|
-
elementNamePattern: "^key$"
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
groupName: "ref",
|
|
322
|
-
elementNamePattern: "^ref$"
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
groupName: "unsafe",
|
|
326
|
-
elementNamePattern: "^dangerously.+"
|
|
327
|
-
}
|
|
328
|
-
],
|
|
329
|
-
groups: [
|
|
330
|
-
"key",
|
|
331
|
-
"ref",
|
|
332
|
-
"as",
|
|
333
|
-
"unknown",
|
|
334
|
-
"shorthand-prop",
|
|
335
|
-
"callback",
|
|
336
|
-
"children",
|
|
337
|
-
"unsafe"
|
|
338
|
-
],
|
|
339
|
-
type: "unsorted"
|
|
340
|
-
}],
|
|
341
|
-
"react-naming-convention/component-name": "error",
|
|
342
|
-
"react-naming-convention/context-name": "error",
|
|
343
|
-
"react-naming-convention/ref-name": "error",
|
|
344
|
-
"react-naming-convention/use-state": "error",
|
|
345
|
-
"react-x/jsx-dollar": "error",
|
|
346
|
-
"react-x/jsx-key-before-spread": "error",
|
|
347
|
-
"react-x/jsx-no-iife": "error",
|
|
348
|
-
"react-x/no-access-state-in-setstate": "error",
|
|
349
|
-
"react-x/no-class-component": "error",
|
|
350
|
-
"react-x/no-context-provider": "error",
|
|
351
|
-
"react-x/no-default-props": "error",
|
|
352
|
-
"react-x/no-duplicate-key": "error",
|
|
353
|
-
"react-x/no-forward-ref": "error",
|
|
354
|
-
"react-x/no-implicit-key": "error",
|
|
355
|
-
"react-x/no-leaked-conditional-rendering": "error",
|
|
356
|
-
"react-x/no-misused-capture-owner-stack": "error",
|
|
357
|
-
"react-x/no-nested-component-definitions": "error",
|
|
358
|
-
"react-x/no-nested-lazy-component-declarations": "error",
|
|
359
|
-
"react-x/no-prop-types": "error",
|
|
360
|
-
"react-x/no-unnecessary-use-callback": "error",
|
|
361
|
-
"react-x/no-unnecessary-use-memo": "error",
|
|
362
|
-
"react-x/no-unstable-context-value": "error",
|
|
363
|
-
"react-x/no-unstable-default-props": "error",
|
|
364
|
-
"react-x/no-use-context": "error",
|
|
365
|
-
"react-x/prefer-destructuring-assignment": "error",
|
|
366
|
-
"react-x/prefer-use-state-lazy-initialization": "error",
|
|
367
|
-
"react/function-component-definition": ["error", {
|
|
368
|
-
namedComponents: ["arrow-function", "function-declaration"],
|
|
369
|
-
unnamedComponents: "arrow-function"
|
|
370
|
-
}],
|
|
371
|
-
"react/no-adjacent-inline-elements": "error",
|
|
372
|
-
...Object.fromEntries(Object.keys(pluginReactHooks.configs.flat["recommended-latest"].rules).filter((rule) => !["react-hooks/exhaustive-deps", "react-hooks/rules-of-hooks"].includes(rule)).map((rule) => [rule, "error"]))
|
|
80
|
+
...rules$4,
|
|
81
|
+
...rules$5,
|
|
82
|
+
...rules$6,
|
|
83
|
+
...rules$7,
|
|
84
|
+
...rules$8
|
|
373
85
|
}
|
|
374
86
|
};
|
|
375
87
|
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["config","config","config","eslintDefineConfig","configIgnores","configBase","configConfigFiles","configReact"],"sources":["../src/config-base/index.ts","../src/config-config-files/index.ts","../src/config-react/index.ts","../src/config-ignores/index.ts","../src/define-config/index.ts"],"sourcesContent":["import type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginStylistic from '@stylistic/eslint-plugin';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\nimport tseslint from 'typescript-eslint';\n\n/**\n * This config is intentionally limited to rules not supported by Oxlint\n * and formatting options not supported by Prettier.\n */\nconst config: LinterConfigEntry = {\n\tname: 'Base Config',\n\tplugins: {\n\t\t'@stylistic': pluginStylistic,\n\t\t'@typescript-eslint': tseslint.plugin,\n\t\t'perfectionist': pluginPerfectionist,\n\t},\n\tlanguageOptions: {\n\t\tparser: tseslint.parser,\n\t\tparserOptions: {\n\t\t\tprojectService: true,\n\t\t\twarnOnUnsupportedTypeScriptVersion: false,\n\t\t},\n\t},\n\tlinterOptions: {\n\t\treportUnusedDisableDirectives: 'error',\n\t\treportUnusedInlineConfigs: 'error',\n\t},\n\trules: {\n\t\t/* oxlint-disable-next-line unicorn/no-useless-spread */\n\t\t...{\n\t\t\t'camelcase': ['error', { properties: 'always' }],\n\t\t\t'func-name-matching': [\n\t\t\t\t'error',\n\t\t\t\t'never',\n\t\t\t\t{ considerPropertyDescriptor: true },\n\t\t\t],\n\t\t},\n\t\t'@stylistic/lines-between-class-members': [\n\t\t\t'error',\n\t\t\t'always',\n\t\t\t{ exceptAfterSingleLine: true },\n\t\t],\n\t\t'@stylistic/padding-line-between-statements': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tblankLine: 'always',\n\t\t\t\tnext: '*',\n\t\t\t\tprev: [\n\t\t\t\t\t'block-like',\n\t\t\t\t\t'directive',\n\t\t\t\t\t'export',\n\t\t\t\t\t'function',\n\t\t\t\t\t'import',\n\t\t\t\t\t'interface',\n\t\t\t\t\t'type',\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'always',\n\t\t\t\tnext: [\n\t\t\t\t\t'block-like',\n\t\t\t\t\t'directive',\n\t\t\t\t\t'export',\n\t\t\t\t\t'function',\n\t\t\t\t\t'import',\n\t\t\t\t\t'interface',\n\t\t\t\t\t'type',\n\t\t\t\t],\n\t\t\t\tprev: '*',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'always',\n\t\t\t\tnext: '*',\n\t\t\t\tprev: ['case', 'default'],\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'never',\n\t\t\t\tnext: 'directive',\n\t\t\t\tprev: 'directive',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'any',\n\t\t\t\tnext: 'export',\n\t\t\t\tprev: 'export',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'never',\n\t\t\t\tnext: ['function', 'function-overload'],\n\t\t\t\tprev: 'function-overload',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'never',\n\t\t\t\tnext: 'import',\n\t\t\t\tprev: 'import',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'any',\n\t\t\t\tnext: 'interface',\n\t\t\t\tprev: 'interface',\n\t\t\t},\n\t\t\t{\n\t\t\t\tblankLine: 'any',\n\t\t\t\tnext: 'type',\n\t\t\t\tprev: 'type',\n\t\t\t},\n\t\t],\n\t\t'@stylistic/spaced-comment': [\n\t\t\t'error',\n\t\t\t'always',\n\t\t\t{\n\t\t\t\tblock: {\n\t\t\t\t\tbalanced: true,\n\t\t\t\t},\n\t\t\t\tline: {\n\t\t\t\t\tmarkers: ['/'],\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t'@typescript-eslint/no-unnecessary-qualifier': 'error',\n\t\t'@typescript-eslint/no-useless-default-assignment': 'error',\n\t\t'@typescript-eslint/prefer-readonly': 'error',\n\t\t'perfectionist/sort-array-includes': ['error', { type: 'natural' }],\n\t\t'perfectionist/sort-classes': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tgroups: ['property', 'constructor'],\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t\t'perfectionist/sort-exports': ['error', { type: 'natural' }],\n\t\t'perfectionist/sort-imports': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tcustomGroups: [\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'mock-side-effect',\n\t\t\t\t\t\telementNamePattern: '^.*/_*(mocks)_*/.*$',\n\t\t\t\t\t\tselector: 'side-effect',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'mock',\n\t\t\t\t\t\telementNamePattern: '^.*/_*(mocks)_*/.*$',\n\t\t\t\t\t\tselector: 'import',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tgroups: [\n\t\t\t\t\t'mock-side-effect',\n\t\t\t\t\t'mock',\n\t\t\t\t\t['type-builtin', 'type-external'],\n\t\t\t\t\t'type-internal',\n\t\t\t\t\t['type-parent', 'type-sibling', 'type-index'],\n\t\t\t\t\t['value-builtin', 'value-external'],\n\t\t\t\t\t'value-internal',\n\t\t\t\t\t['value-parent', 'value-sibling', 'value-index'],\n\t\t\t\t\t'unknown',\n\t\t\t\t\t'style',\n\t\t\t\t\t'side-effect',\n\t\t\t\t\t'side-effect-style',\n\t\t\t\t],\n\t\t\t\tinternalPattern: ['^(#|@/).*'],\n\t\t\t\tnewlinesBetween: 0,\n\t\t\t\tsortSideEffects: true,\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t\t'perfectionist/sort-interfaces': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tgroups: ['index-signature', 'unknown', 'method'],\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t\t'perfectionist/sort-intersection-types': ['error', { type: 'natural' }],\n\t\t'perfectionist/sort-named-exports': ['error', { type: 'natural' }],\n\t\t'perfectionist/sort-named-imports': ['error', { type: 'natural' }],\n\t\t'perfectionist/sort-object-types': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tgroups: ['index-signature', 'unknown', 'method'],\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t\t'perfectionist/sort-objects': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\ttype: 'natural',\n\t\t\t\tuseConfigurationIf: {\n\t\t\t\t\tobjectType: 'destructured',\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'unsorted',\n\t\t\t\tuseConfigurationIf: {\n\t\t\t\t\tobjectType: 'non-destructured',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t'perfectionist/sort-union-types': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tcustomGroups: [\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'false',\n\t\t\t\t\t\telementNamePattern: '^false$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'never',\n\t\t\t\t\t\telementNamePattern: '^never$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'react',\n\t\t\t\t\t\telementNamePattern: '^react.+',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tgroups: [\n\t\t\t\t\t'react',\n\t\t\t\t\t'unknown',\n\t\t\t\t\t'tuple',\n\t\t\t\t\t'false',\n\t\t\t\t\t'nullish',\n\t\t\t\t\t'never',\n\t\t\t\t],\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t},\n};\n\nexport default config;\n","import type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\n\nconst config: LinterConfigEntry = {\n\tname: 'Config Files',\n\tplugins: {\n\t\tperfectionist: pluginPerfectionist,\n\t},\n\trules: {\n\t\t'perfectionist/sort-objects': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tcustomGroups: [\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'extends',\n\t\t\t\t\t\telementNamePattern: '^extends$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'files',\n\t\t\t\t\t\telementNamePattern: '^files$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'ignores',\n\t\t\t\t\t\telementNamePattern: '^(ignores|ignorePatterns)$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'name',\n\t\t\t\t\t\telementNamePattern: '^(name|groupName)$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'overrides',\n\t\t\t\t\t\telementNamePattern: '^overrides$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'parser',\n\t\t\t\t\t\telementNamePattern: '^parser$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'plugins',\n\t\t\t\t\t\telementNamePattern: '^plugins$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'rules',\n\t\t\t\t\t\telementNamePattern: '^rules$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'test',\n\t\t\t\t\t\telementNamePattern: '^(test|tests)$',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tgroups: [\n\t\t\t\t\t'name',\n\t\t\t\t\t'files',\n\t\t\t\t\t'extends',\n\t\t\t\t\t'ignores',\n\t\t\t\t\t'plugins',\n\t\t\t\t\t'parser',\n\t\t\t\t\t'test',\n\t\t\t\t\t'unknown',\n\t\t\t\t\t'rules',\n\t\t\t\t\t'overrides',\n\t\t\t\t],\n\t\t\t\tnewlinesBetween: 0,\n\t\t\t\ttype: 'natural',\n\t\t\t},\n\t\t],\n\t},\n};\n\nexport default config;\n","import type { ESLint } from 'eslint';\nimport type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\nimport pluginReact from 'eslint-plugin-react';\nimport pluginReactHooks from 'eslint-plugin-react-hooks';\nimport pluginReactNamingConvention from 'eslint-plugin-react-naming-convention';\nimport pluginReactX from 'eslint-plugin-react-x';\n\n/**\n * This config is intentionally limited to rules not supported by Oxlint\n * and formatting options not supported by Prettier.\n */\nconst config: LinterConfigEntry = {\n\tname: 'React',\n\tplugins: {\n\t\t'perfectionist': pluginPerfectionist,\n\t\t'react': pluginReact,\n\t\t'react-hooks': pluginReactHooks as ESLint.Plugin,\n\t\t'react-naming-convention': pluginReactNamingConvention,\n\t\t'react-x': pluginReactX,\n\t},\n\tsettings: {\n\t\treact: {\n\t\t\tversion: 'detect',\n\t\t},\n\t},\n\trules: {\n\t\t'perfectionist/sort-jsx-props': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tcustomGroups: [\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'as',\n\t\t\t\t\t\telementNamePattern: '^as$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'callback',\n\t\t\t\t\t\telementNamePattern: '^on.+',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'children',\n\t\t\t\t\t\telementNamePattern: '^children$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'key',\n\t\t\t\t\t\telementNamePattern: '^key$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'ref',\n\t\t\t\t\t\telementNamePattern: '^ref$',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tgroupName: 'unsafe',\n\t\t\t\t\t\telementNamePattern: '^dangerously.+',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tgroups: [\n\t\t\t\t\t'key',\n\t\t\t\t\t'ref',\n\t\t\t\t\t'as',\n\t\t\t\t\t'unknown',\n\t\t\t\t\t'shorthand-prop',\n\t\t\t\t\t'callback',\n\t\t\t\t\t'children',\n\t\t\t\t\t'unsafe',\n\t\t\t\t],\n\t\t\t\ttype: 'unsorted',\n\t\t\t},\n\t\t],\n\t\t'react-naming-convention/component-name': 'error',\n\t\t'react-naming-convention/context-name': 'error',\n\t\t'react-naming-convention/ref-name': 'error',\n\t\t'react-naming-convention/use-state': 'error',\n\t\t'react-x/jsx-dollar': 'error',\n\t\t'react-x/jsx-key-before-spread': 'error',\n\t\t'react-x/jsx-no-iife': 'error',\n\t\t'react-x/no-access-state-in-setstate': 'error',\n\t\t'react-x/no-class-component': 'error',\n\t\t'react-x/no-context-provider': 'error',\n\t\t'react-x/no-default-props': 'error',\n\t\t'react-x/no-duplicate-key': 'error',\n\t\t'react-x/no-forward-ref': 'error',\n\t\t'react-x/no-implicit-key': 'error',\n\t\t'react-x/no-leaked-conditional-rendering': 'error',\n\t\t'react-x/no-misused-capture-owner-stack': 'error',\n\t\t'react-x/no-nested-component-definitions': 'error',\n\t\t'react-x/no-nested-lazy-component-declarations': 'error',\n\t\t'react-x/no-prop-types': 'error',\n\t\t'react-x/no-unnecessary-use-callback': 'error',\n\t\t'react-x/no-unnecessary-use-memo': 'error',\n\t\t'react-x/no-unstable-context-value': 'error',\n\t\t'react-x/no-unstable-default-props': 'error',\n\t\t'react-x/no-use-context': 'error',\n\t\t'react-x/prefer-destructuring-assignment': 'error',\n\t\t'react-x/prefer-use-state-lazy-initialization': 'error',\n\t\t'react/function-component-definition': [\n\t\t\t'error',\n\t\t\t{\n\t\t\t\tnamedComponents: ['arrow-function', 'function-declaration'],\n\t\t\t\tunnamedComponents: 'arrow-function',\n\t\t\t},\n\t\t],\n\t\t'react/no-adjacent-inline-elements': 'error',\n\n\t\t// Enforce all `react-hooks` rules as errors\n\t\t...Object.fromEntries(\n\t\t\tObject.keys(\n\t\t\t\tpluginReactHooks.configs.flat['recommended-latest'].rules\n\t\t\t)\n\t\t\t\t.filter(\n\t\t\t\t\t(rule) =>\n\t\t\t\t\t\t![\n\t\t\t\t\t\t\t'react-hooks/exhaustive-deps',\n\t\t\t\t\t\t\t'react-hooks/rules-of-hooks',\n\t\t\t\t\t\t].includes(rule)\n\t\t\t\t)\n\t\t\t\t.map((rule) => [rule, 'error'])\n\t\t),\n\t},\n};\n\nexport default config;\n","import type { LinterConfigEntry } from '../types/index.d.ts';\nimport { includeIgnoreFile } from '@eslint/compat';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve('.gitignore');\nconst configExists = fs.existsSync(configPath);\n\nconst config: LinterConfigEntry = configExists\n\t? includeIgnoreFile(configPath, '.gitignore')\n\t: {};\n\nexport default config;\n","import type { Config } from 'eslint/config';\nimport type { StandardConfig, StandardConfigArray } from '../types/index.d.ts';\nimport { defineConfig as eslintDefineConfig } from 'eslint/config';\nimport configBase from '../config-base/index.ts';\nimport configConfigFiles from '../config-config-files/index.ts';\nimport configIgnores from '../config-ignores/index.ts';\nimport configReact from '../config-react/index.ts';\n\n/**\n * Combine Standard Config with optional additional config.\n */\nexport default function defineConfig(\n\t...configs: StandardConfigArray\n): Config[] {\n\treturn eslintDefineConfig({\n\t\tname: 'Standard Config',\n\t\tfiles: ['**/*.{ts,tsx,cts,mts}'],\n\t\textends: [\n\t\t\tconfigIgnores,\n\t\t\tconfigBase,\n\t\t\t{\n\t\t\t\tfiles: ['**/*.config.{ts,cts,mts}'],\n\t\t\t\t...configConfigFiles,\n\t\t\t},\n\t\t\t...normalizeExtensionConfigs(configs),\n\t\t],\n\t});\n}\n\nfunction normalizeExtensionConfigs(configs: StandardConfigArray) {\n\tconst configArray = configs.flat();\n\tconst extensions: Array<Config | Config[]> = [];\n\n\tif (configArray.length === 0) {\n\t\treturn extensions;\n\t}\n\n\tif ((configArray[0] as StandardConfig).react) {\n\t\textensions.push({\n\t\t\tfiles: ['**/*.tsx'],\n\t\t\t...configReact,\n\t\t});\n\t}\n\n\textensions.push(\n\t\teslintDefineConfig(\n\t\t\t// Ensure `react` doesn’t break the expected config structure\n\t\t\tconfigArray.map((configEntry) => {\n\t\t\t\tif (Array.isArray(configEntry)) {\n\t\t\t\t\treturn configEntry;\n\t\t\t\t}\n\n\t\t\t\t/* oxlint-disable-next-line eslint/no-unused-vars */\n\t\t\t\tconst { react, ...config } = configEntry as StandardConfig;\n\t\t\t\treturn config;\n\t\t\t})\n\t\t)\n\t);\n\n\treturn extensions;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AASA,MAAM,SAA4B;CACjC,MAAM;CACN,SAAS;EACR,cAAc;EACd,sBAAsB,SAAS;EAC/B,iBAAiB;EACjB;CACD,iBAAiB;EAChB,QAAQ,SAAS;EACjB,eAAe;GACd,gBAAgB;GAChB,oCAAoC;GACpC;EACD;CACD,eAAe;EACd,+BAA+B;EAC/B,2BAA2B;EAC3B;CACD,OAAO;EAGL,aAAa,CAAC,SAAS,EAAE,YAAY,UAAU,CAAC;EAChD,sBAAsB;GACrB;GACA;GACA,EAAE,4BAA4B,MAAM;GACpC;EAEF,0CAA0C;GACzC;GACA;GACA,EAAE,uBAAuB,MAAM;GAC/B;EACD,8CAA8C;GAC7C;GACA;IACC,WAAW;IACX,MAAM;IACN,MAAM;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD;GACD;IACC,WAAW;IACX,MAAM;KACL;KACA;KACA;KACA;KACA;KACA;KACA;KACA;IACD,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM,CAAC,QAAQ,UAAU;IACzB;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM,CAAC,YAAY,oBAAoB;IACvC,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM;IACN;GACD;IACC,WAAW;IACX,MAAM;IACN,MAAM;IACN;GACD;EACD,6BAA6B;GAC5B;GACA;GACA;IACC,OAAO,EACN,UAAU,MACV;IACD,MAAM,EACL,SAAS,CAAC,IAAI,EACd;IACD;GACD;EACD,+CAA+C;EAC/C,oDAAoD;EACpD,sCAAsC;EACtC,qCAAqC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;EACnE,8BAA8B,CAC7B,SACA;GACC,QAAQ,CAAC,YAAY,cAAc;GACnC,MAAM;GACN,CACD;EACD,8BAA8B,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;EAC5D,8BAA8B,CAC7B,SACA;GACC,cAAc,CACb;IACC,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,EACD;IACC,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,CACD;GACD,QAAQ;IACP;IACA;IACA,CAAC,gBAAgB,gBAAgB;IACjC;IACA;KAAC;KAAe;KAAgB;KAAa;IAC7C,CAAC,iBAAiB,iBAAiB;IACnC;IACA;KAAC;KAAgB;KAAiB;KAAc;IAChD;IACA;IACA;IACA;IACA;GACD,iBAAiB,CAAC,YAAY;GAC9B,iBAAiB;GACjB,iBAAiB;GACjB,MAAM;GACN,CACD;EACD,iCAAiC,CAChC,SACA;GACC,QAAQ;IAAC;IAAmB;IAAW;IAAS;GAChD,MAAM;GACN,CACD;EACD,yCAAyC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;EACvE,oCAAoC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;EAClE,oCAAoC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;EAClE,mCAAmC,CAClC,SACA;GACC,QAAQ;IAAC;IAAmB;IAAW;IAAS;GAChD,MAAM;GACN,CACD;EACD,8BAA8B;GAC7B;GACA;IACC,MAAM;IACN,oBAAoB,EACnB,YAAY,gBACZ;IACD;GACD;IACC,MAAM;IACN,oBAAoB,EACnB,YAAY,oBACZ;IACD;GACD;EACD,kCAAkC,CACjC,SACA;GACC,cAAc;IACb;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;GACD,QAAQ;IACP;IACA;IACA;IACA;IACA;IACA;IACA;GACD,MAAM;GACN,CACD;EACD;CACD;;;;AC/ND,MAAMA,WAA4B;CACjC,MAAM;CACN,SAAS,EACR,eAAe,qBACf;CACD,OAAO,EACN,8BAA8B,CAC7B,SACA;EACC,cAAc;GACb;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;EACD,QAAQ;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACD,iBAAiB;EACjB,MAAM;EACN,CACD,EACD;CACD;;;;;;;;ACvDD,MAAMC,WAA4B;CACjC,MAAM;CACN,SAAS;EACR,iBAAiB;EACjB,SAAS;EACT,eAAe;EACf,2BAA2B;EAC3B,WAAW;EACX;CACD,UAAU,EACT,OAAO,EACN,SAAS,UACT,EACD;CACD,OAAO;EACN,gCAAgC,CAC/B,SACA;GACC,cAAc;IACb;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;KACC,WAAW;KACX,oBAAoB;KACpB;IACD;GACD,QAAQ;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,MAAM;GACN,CACD;EACD,0CAA0C;EAC1C,wCAAwC;EACxC,oCAAoC;EACpC,qCAAqC;EACrC,sBAAsB;EACtB,iCAAiC;EACjC,uBAAuB;EACvB,uCAAuC;EACvC,8BAA8B;EAC9B,+BAA+B;EAC/B,4BAA4B;EAC5B,4BAA4B;EAC5B,0BAA0B;EAC1B,2BAA2B;EAC3B,2CAA2C;EAC3C,0CAA0C;EAC1C,2CAA2C;EAC3C,iDAAiD;EACjD,yBAAyB;EACzB,uCAAuC;EACvC,mCAAmC;EACnC,qCAAqC;EACrC,qCAAqC;EACrC,0BAA0B;EAC1B,2CAA2C;EAC3C,gDAAgD;EAChD,uCAAuC,CACtC,SACA;GACC,iBAAiB,CAAC,kBAAkB,uBAAuB;GAC3D,mBAAmB;GACnB,CACD;EACD,qCAAqC;EAGrC,GAAG,OAAO,YACT,OAAO,KACN,iBAAiB,QAAQ,KAAK,sBAAsB,MACpD,CACC,QACC,SACA,CAAC,CACA,+BACA,6BACA,CAAC,SAAS,KAAK,CACjB,CACA,KAAK,SAAS,CAAC,MAAM,QAAQ,CAAC,CAChC;EACD;CACD;;;;AClHD,MAAM,aAAa,KAAK,QAAQ,aAAa;AAG7C,MAAMC,WAFe,GAAG,WAAW,WAAW,GAG3C,kBAAkB,YAAY,aAAa,GAC3C,EAAE;;;;;;;ACCL,SAAwB,aACvB,GAAG,SACQ;AACX,QAAOC,eAAmB;EACzB,MAAM;EACN,OAAO,CAAC,wBAAwB;EAChC,SAAS;GACRC;GACAC;GACA;IACC,OAAO,CAAC,2BAA2B;IACnC,GAAGC;IACH;GACD,GAAG,0BAA0B,QAAQ;GACrC;EACD,CAAC;;AAGH,SAAS,0BAA0B,SAA8B;CAChE,MAAM,cAAc,QAAQ,MAAM;CAClC,MAAM,aAAuC,EAAE;AAE/C,KAAI,YAAY,WAAW,EAC1B,QAAO;AAGR,KAAK,YAAY,GAAsB,MACtC,YAAW,KAAK;EACf,OAAO,CAAC,WAAW;EACnB,GAAGC;EACH,CAAC;AAGH,YAAW,KACVJ,eAEC,YAAY,KAAK,gBAAgB;AAChC,MAAI,MAAM,QAAQ,YAAY,CAC7B,QAAO;EAIR,MAAM,EAAE,OAAO,GAAG,WAAW;AAC7B,SAAO;GACN,CACF,CACD;AAED,QAAO"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["rulesCore","rulesPerfectionist","rulesStylistic","config","rulesPerfectionist","config","rulesPerfectionist","rulesReact","rulesReactHooks","rulesReactNamingConvention","rulesReactX","config","eslintDefineConfig","configIgnores","configBase","configConfigFiles","configReact"],"sources":["../src/config-base/index.ts","../src/config-config-files/index.ts","../src/config-react/index.ts","../src/config-ignores/index.ts","../src/define-config/index.ts"],"sourcesContent":["import type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginStylistic from '@stylistic/eslint-plugin';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\nimport tseslint from 'typescript-eslint';\nimport rulesCore from './rules-core.ts';\nimport rulesPerfectionist from './rules-perfectionist.ts';\nimport rulesStylistic from './rules-stylistic.ts';\n\n/**\n * Primary config entry.\n *\n * This config is intentionally limited to rules not supported by Oxlint\n * and stylistic rules outside of Prettier’s scope.\n */\nconst config: LinterConfigEntry = {\n\tname: 'Base Config',\n\tplugins: {\n\t\t'@stylistic': pluginStylistic,\n\t\t'perfectionist': pluginPerfectionist,\n\t},\n\tlanguageOptions: {\n\t\tparser: tseslint.parser,\n\t\tparserOptions: {\n\t\t\tprojectService: true,\n\t\t\twarnOnUnsupportedTypeScriptVersion: false,\n\t\t},\n\t},\n\tlinterOptions: {\n\t\treportUnusedDisableDirectives: 'error',\n\t\treportUnusedInlineConfigs: 'error',\n\t},\n\trules: {\n\t\t...rulesCore,\n\t\t...rulesPerfectionist,\n\t\t...rulesStylistic,\n\t},\n};\n\nexport default config;\n","import type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\nimport rulesPerfectionist from './rules-perfectionist.ts';\n\n/**\n * Optional config entry containing rules that target config files. Intended for\n * explicit overrides.\n *\n * This config is intentionally limited to rules not supported by Oxlint\n * and stylistic rules outside of Prettier’s scope.\n */\nconst config: LinterConfigEntry = {\n\tname: 'Config Files',\n\tplugins: {\n\t\tperfectionist: pluginPerfectionist,\n\t},\n\trules: {\n\t\t...rulesPerfectionist,\n\t},\n};\n\nexport default config;\n","import type { ESLint } from 'eslint';\nimport type { LinterConfigEntry } from '../types/index.d.ts';\nimport pluginPerfectionist from 'eslint-plugin-perfectionist';\nimport pluginReact from 'eslint-plugin-react';\nimport pluginReactHooks from 'eslint-plugin-react-hooks';\nimport pluginReactNamingConvention from 'eslint-plugin-react-naming-convention';\nimport pluginReactX from 'eslint-plugin-react-x';\nimport rulesPerfectionist from './rules-perfectionist.ts';\nimport rulesReactHooks from './rules-react-hooks.ts';\nimport rulesReactNamingConvention from './rules-react-naming-convention.ts';\nimport rulesReactX from './rules-react-x.ts';\nimport rulesReact from './rules-react.ts';\n\n/**\n * Optional config entry containing rules that target `*.tsx` files. Intended\n * for explicit overrides.\n *\n * This config is intentionally limited to rules not supported by Oxlint\n * and stylistic rules outside of Prettier’s scope.\n */\nconst config: LinterConfigEntry = {\n\tname: 'React',\n\tplugins: {\n\t\t'perfectionist': pluginPerfectionist,\n\t\t'react': pluginReact,\n\t\t'react-hooks': pluginReactHooks as ESLint.Plugin,\n\t\t'react-naming-convention': pluginReactNamingConvention,\n\t\t'react-x': pluginReactX,\n\t},\n\tsettings: {\n\t\treact: {\n\t\t\tversion: 'detect',\n\t\t},\n\t},\n\trules: {\n\t\t...rulesPerfectionist,\n\t\t...rulesReact,\n\t\t...rulesReactHooks,\n\t\t...rulesReactNamingConvention,\n\t\t...rulesReactX,\n\t},\n};\n\nexport default config;\n","import type { LinterConfigEntry } from '../types/index.d.ts';\nimport { includeIgnoreFile } from '@eslint/compat';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst configPath = path.resolve('.gitignore');\nconst configExists = fs.existsSync(configPath);\n\nconst config: LinterConfigEntry = configExists\n\t? includeIgnoreFile(configPath, '.gitignore')\n\t: {};\n\nexport default config;\n","import type { Config } from 'eslint/config';\nimport type { StandardConfig, StandardConfigArray } from '../types/index.d.ts';\nimport { defineConfig as eslintDefineConfig } from 'eslint/config';\nimport configBase from '../config-base/index.ts';\nimport configConfigFiles from '../config-config-files/index.ts';\nimport configIgnores from '../config-ignores/index.ts';\nimport configReact from '../config-react/index.ts';\n\n/**\n * Combine Standard Config with optional additional config.\n */\nexport default function defineConfig(\n\t...configs: StandardConfigArray\n): Config[] {\n\treturn eslintDefineConfig({\n\t\tname: 'Standard Config',\n\t\tfiles: ['**/*.{ts,tsx,cts,mts}'],\n\t\textends: [\n\t\t\tconfigIgnores,\n\t\t\tconfigBase,\n\t\t\t{\n\t\t\t\tfiles: ['**/*.config.{ts,cts,mts}'],\n\t\t\t\t...configConfigFiles,\n\t\t\t},\n\t\t\t...normalizeExtensionConfigs(configs),\n\t\t],\n\t});\n}\n\nfunction normalizeExtensionConfigs(configs: StandardConfigArray) {\n\tconst configArray = configs.flat();\n\tconst extensions: Array<Config | Config[]> = [];\n\n\tif (configArray.length === 0) {\n\t\treturn extensions;\n\t}\n\n\tif ((configArray[0] as StandardConfig).react) {\n\t\textensions.push({\n\t\t\tfiles: ['**/*.tsx'],\n\t\t\t...configReact,\n\t\t});\n\t}\n\n\textensions.push(\n\t\teslintDefineConfig(\n\t\t\t// Ensure `react` doesn’t break the expected config structure\n\t\t\tconfigArray.map((configEntry) => {\n\t\t\t\tif (Array.isArray(configEntry)) {\n\t\t\t\t\treturn configEntry;\n\t\t\t\t}\n\n\t\t\t\t/* oxlint-disable-next-line eslint/no-unused-vars */\n\t\t\t\tconst { react, ...config } = configEntry as StandardConfig;\n\t\t\t\treturn config;\n\t\t\t})\n\t\t)\n\t);\n\n\treturn extensions;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA,MAAM,SAA4B;CACjC,MAAM;CACN,SAAS;EACR,cAAc;EACd,iBAAiB;EACjB;CACD,iBAAiB;EAChB,QAAQ,SAAS;EACjB,eAAe;GACd,gBAAgB;GAChB,oCAAoC;GACpC;EACD;CACD,eAAe;EACd,+BAA+B;EAC/B,2BAA2B;EAC3B;CACD,OAAO;EACN,GAAGA;EACH,GAAGC;EACH,GAAGC;EACH;CACD;;;;;;;;;;;ACzBD,MAAMC,WAA4B;CACjC,MAAM;CACN,SAAS,EACR,eAAe,qBACf;CACD,OAAO,EACN,GAAGC,SACH;CACD;;;;;;;;;;;ACCD,MAAMC,WAA4B;CACjC,MAAM;CACN,SAAS;EACR,iBAAiB;EACjB,SAAS;EACT,eAAe;EACf,2BAA2B;EAC3B,WAAW;EACX;CACD,UAAU,EACT,OAAO,EACN,SAAS,UACT,EACD;CACD,OAAO;EACN,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH,GAAGC;EACH;CACD;;;;ACpCD,MAAM,aAAa,KAAK,QAAQ,aAAa;AAG7C,MAAMC,WAFe,GAAG,WAAW,WAAW,GAG3C,kBAAkB,YAAY,aAAa,GAC3C,EAAE;;;;;;;ACCL,SAAwB,aACvB,GAAG,SACQ;AACX,QAAOC,eAAmB;EACzB,MAAM;EACN,OAAO,CAAC,wBAAwB;EAChC,SAAS;GACRC;GACAC;GACA;IACC,OAAO,CAAC,2BAA2B;IACnC,GAAGC;IACH;GACD,GAAG,0BAA0B,QAAQ;GACrC;EACD,CAAC;;AAGH,SAAS,0BAA0B,SAA8B;CAChE,MAAM,cAAc,QAAQ,MAAM;CAClC,MAAM,aAAuC,EAAE;AAE/C,KAAI,YAAY,WAAW,EAC1B,QAAO;AAGR,KAAK,YAAY,GAAsB,MACtC,YAAW,KAAK;EACf,OAAO,CAAC,WAAW;EACnB,GAAGC;EACH,CAAC;AAGH,YAAW,KACVJ,eAEC,YAAY,KAAK,gBAAgB;AAChC,MAAI,MAAM,QAAQ,YAAY,CAC7B,QAAO;EAIR,MAAM,EAAE,OAAO,GAAG,WAAW;AAC7B,SAAO;GACN,CACF,CACD;AAED,QAAO"}
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import pluginReactHooks from "eslint-plugin-react-hooks";
|
|
2
|
+
|
|
3
|
+
//#region src/config-base/rules-core.ts
|
|
4
|
+
const rules$8 = {
|
|
5
|
+
"camelcase": ["error", { properties: "always" }],
|
|
6
|
+
"func-name-matching": [
|
|
7
|
+
"error",
|
|
8
|
+
"never",
|
|
9
|
+
{ considerPropertyDescriptor: true }
|
|
10
|
+
]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/config-base/rules-perfectionist.ts
|
|
15
|
+
const rules$7 = {
|
|
16
|
+
"perfectionist/sort-array-includes": ["error", { type: "natural" }],
|
|
17
|
+
"perfectionist/sort-classes": ["error", {
|
|
18
|
+
groups: ["property", "constructor"],
|
|
19
|
+
type: "natural"
|
|
20
|
+
}],
|
|
21
|
+
"perfectionist/sort-exports": ["error", { type: "natural" }],
|
|
22
|
+
"perfectionist/sort-imports": ["error", {
|
|
23
|
+
customGroups: [{
|
|
24
|
+
groupName: "mock-side-effect",
|
|
25
|
+
elementNamePattern: "^.*/_*(mocks)_*/.*$",
|
|
26
|
+
selector: "side-effect"
|
|
27
|
+
}, {
|
|
28
|
+
groupName: "mock",
|
|
29
|
+
elementNamePattern: "^.*/_*(mocks)_*/.*$",
|
|
30
|
+
selector: "import"
|
|
31
|
+
}],
|
|
32
|
+
groups: [
|
|
33
|
+
"mock-side-effect",
|
|
34
|
+
"mock",
|
|
35
|
+
["type-builtin", "type-external"],
|
|
36
|
+
"type-internal",
|
|
37
|
+
[
|
|
38
|
+
"type-parent",
|
|
39
|
+
"type-sibling",
|
|
40
|
+
"type-index"
|
|
41
|
+
],
|
|
42
|
+
["value-builtin", "value-external"],
|
|
43
|
+
"value-internal",
|
|
44
|
+
[
|
|
45
|
+
"value-parent",
|
|
46
|
+
"value-sibling",
|
|
47
|
+
"value-index"
|
|
48
|
+
],
|
|
49
|
+
"unknown",
|
|
50
|
+
"style",
|
|
51
|
+
"side-effect",
|
|
52
|
+
"side-effect-style"
|
|
53
|
+
],
|
|
54
|
+
internalPattern: ["^(#|@/).*"],
|
|
55
|
+
newlinesBetween: 0,
|
|
56
|
+
sortSideEffects: true,
|
|
57
|
+
type: "natural"
|
|
58
|
+
}],
|
|
59
|
+
"perfectionist/sort-interfaces": ["error", {
|
|
60
|
+
groups: [
|
|
61
|
+
"index-signature",
|
|
62
|
+
"unknown",
|
|
63
|
+
"method"
|
|
64
|
+
],
|
|
65
|
+
type: "natural"
|
|
66
|
+
}],
|
|
67
|
+
"perfectionist/sort-intersection-types": ["error", { type: "natural" }],
|
|
68
|
+
"perfectionist/sort-named-exports": ["error", { type: "natural" }],
|
|
69
|
+
"perfectionist/sort-named-imports": ["error", { type: "natural" }],
|
|
70
|
+
"perfectionist/sort-object-types": ["error", {
|
|
71
|
+
groups: [
|
|
72
|
+
"index-signature",
|
|
73
|
+
"unknown",
|
|
74
|
+
"method"
|
|
75
|
+
],
|
|
76
|
+
type: "natural"
|
|
77
|
+
}],
|
|
78
|
+
"perfectionist/sort-objects": [
|
|
79
|
+
"error",
|
|
80
|
+
{
|
|
81
|
+
type: "natural",
|
|
82
|
+
useConfigurationIf: { objectType: "destructured" }
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
type: "unsorted",
|
|
86
|
+
useConfigurationIf: { objectType: "non-destructured" }
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"perfectionist/sort-union-types": ["error", {
|
|
90
|
+
customGroups: [
|
|
91
|
+
{
|
|
92
|
+
groupName: "false",
|
|
93
|
+
elementNamePattern: "^false$"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
groupName: "never",
|
|
97
|
+
elementNamePattern: "^never$"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
groupName: "react",
|
|
101
|
+
elementNamePattern: "^react.+"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
groups: [
|
|
105
|
+
"react",
|
|
106
|
+
"unknown",
|
|
107
|
+
"tuple",
|
|
108
|
+
"false",
|
|
109
|
+
"nullish",
|
|
110
|
+
"never"
|
|
111
|
+
],
|
|
112
|
+
type: "natural"
|
|
113
|
+
}]
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/config-base/rules-stylistic.ts
|
|
118
|
+
const rules$6 = {
|
|
119
|
+
"@stylistic/lines-between-class-members": [
|
|
120
|
+
"error",
|
|
121
|
+
"always",
|
|
122
|
+
{ exceptAfterSingleLine: true }
|
|
123
|
+
],
|
|
124
|
+
"@stylistic/padding-line-between-statements": [
|
|
125
|
+
"error",
|
|
126
|
+
{
|
|
127
|
+
blankLine: "always",
|
|
128
|
+
next: "*",
|
|
129
|
+
prev: [
|
|
130
|
+
"block-like",
|
|
131
|
+
"directive",
|
|
132
|
+
"export",
|
|
133
|
+
"function",
|
|
134
|
+
"import",
|
|
135
|
+
"interface",
|
|
136
|
+
"type"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
blankLine: "always",
|
|
141
|
+
next: [
|
|
142
|
+
"block-like",
|
|
143
|
+
"directive",
|
|
144
|
+
"export",
|
|
145
|
+
"function",
|
|
146
|
+
"import",
|
|
147
|
+
"interface",
|
|
148
|
+
"type"
|
|
149
|
+
],
|
|
150
|
+
prev: "*"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
blankLine: "always",
|
|
154
|
+
next: "*",
|
|
155
|
+
prev: ["case", "default"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
blankLine: "never",
|
|
159
|
+
next: "directive",
|
|
160
|
+
prev: "directive"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
blankLine: "any",
|
|
164
|
+
next: "export",
|
|
165
|
+
prev: "export"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
blankLine: "never",
|
|
169
|
+
next: ["function", "function-overload"],
|
|
170
|
+
prev: "function-overload"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
blankLine: "never",
|
|
174
|
+
next: "import",
|
|
175
|
+
prev: "import"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
blankLine: "any",
|
|
179
|
+
next: "interface",
|
|
180
|
+
prev: "interface"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
blankLine: "any",
|
|
184
|
+
next: "type",
|
|
185
|
+
prev: "type"
|
|
186
|
+
}
|
|
187
|
+
],
|
|
188
|
+
"@stylistic/spaced-comment": [
|
|
189
|
+
"error",
|
|
190
|
+
"always",
|
|
191
|
+
{
|
|
192
|
+
block: { balanced: true },
|
|
193
|
+
line: { markers: ["/"] }
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/config-config-files/rules-perfectionist.ts
|
|
200
|
+
const rules$5 = { "perfectionist/sort-objects": ["error", {
|
|
201
|
+
customGroups: [
|
|
202
|
+
{
|
|
203
|
+
groupName: "extends",
|
|
204
|
+
elementNamePattern: "^extends$"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
groupName: "files",
|
|
208
|
+
elementNamePattern: "^files$"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
groupName: "ignores",
|
|
212
|
+
elementNamePattern: "^(ignores|ignorePatterns)$"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
groupName: "name",
|
|
216
|
+
elementNamePattern: "^(name|groupName)$"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
groupName: "overrides",
|
|
220
|
+
elementNamePattern: "^overrides$"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
groupName: "parser",
|
|
224
|
+
elementNamePattern: "^parser$"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
groupName: "plugins",
|
|
228
|
+
elementNamePattern: "^plugins$"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
groupName: "rules",
|
|
232
|
+
elementNamePattern: "^rules$"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
groupName: "test",
|
|
236
|
+
elementNamePattern: "^(test|tests)$"
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
groups: [
|
|
240
|
+
"name",
|
|
241
|
+
"files",
|
|
242
|
+
"extends",
|
|
243
|
+
"ignores",
|
|
244
|
+
"plugins",
|
|
245
|
+
"parser",
|
|
246
|
+
"test",
|
|
247
|
+
"unknown",
|
|
248
|
+
"rules",
|
|
249
|
+
"overrides"
|
|
250
|
+
],
|
|
251
|
+
newlinesBetween: 0,
|
|
252
|
+
type: "natural"
|
|
253
|
+
}] };
|
|
254
|
+
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/config-react/rules-perfectionist.ts
|
|
257
|
+
const rules$4 = { "perfectionist/sort-jsx-props": ["error", {
|
|
258
|
+
customGroups: [
|
|
259
|
+
{
|
|
260
|
+
groupName: "as",
|
|
261
|
+
elementNamePattern: "^as$"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
groupName: "callback",
|
|
265
|
+
elementNamePattern: "^on.+"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
groupName: "children",
|
|
269
|
+
elementNamePattern: "^children$"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
groupName: "key",
|
|
273
|
+
elementNamePattern: "^key$"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
groupName: "ref",
|
|
277
|
+
elementNamePattern: "^ref$"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
groupName: "unsafe",
|
|
281
|
+
elementNamePattern: "^dangerously.+"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
groups: [
|
|
285
|
+
"key",
|
|
286
|
+
"ref",
|
|
287
|
+
"as",
|
|
288
|
+
"unknown",
|
|
289
|
+
"shorthand-prop",
|
|
290
|
+
"callback",
|
|
291
|
+
"children",
|
|
292
|
+
"unsafe"
|
|
293
|
+
],
|
|
294
|
+
type: "unsorted"
|
|
295
|
+
}] };
|
|
296
|
+
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/transform-rules/index.ts
|
|
299
|
+
/**
|
|
300
|
+
* Modify a set of ESLint rules.
|
|
301
|
+
*
|
|
302
|
+
* @deprecated Not covered by semver.
|
|
303
|
+
*/
|
|
304
|
+
function transformRules(rules, options) {
|
|
305
|
+
if (!rules) return {};
|
|
306
|
+
const { omit, prefix, severity } = options;
|
|
307
|
+
const omittedRules = new Set(omit);
|
|
308
|
+
const transformedRules = {};
|
|
309
|
+
for (const [ruleName, ruleConfig] of Object.entries(rules)) {
|
|
310
|
+
if (omittedRules.has(ruleName)) continue;
|
|
311
|
+
if (!Array.isArray(ruleConfig)) {
|
|
312
|
+
transformedRules[ruleName] = severity ?? ruleConfig ?? "off";
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const [ruleSeverity, ...ruleOptions] = ruleConfig;
|
|
316
|
+
transformedRules[ruleName] = [severity ?? ruleSeverity, ...ruleOptions];
|
|
317
|
+
}
|
|
318
|
+
return typeof prefix === "string" ? prefixRules(transformedRules, prefix) : transformedRules;
|
|
319
|
+
}
|
|
320
|
+
function prefixRules(rules, prefix) {
|
|
321
|
+
const prefixedRules = {};
|
|
322
|
+
for (const [ruleName, ruleConfig] of Object.entries(rules)) {
|
|
323
|
+
const name = ruleName.replace(/^.*?\//, "");
|
|
324
|
+
prefixedRules[`${prefix}/${name}`] = ruleConfig;
|
|
325
|
+
}
|
|
326
|
+
return prefixedRules;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
//#endregion
|
|
330
|
+
//#region src/config-react/rules-react-hooks.ts
|
|
331
|
+
const rules$3 = transformRules(pluginReactHooks.configs.flat["recommended-latest"].rules, {
|
|
332
|
+
omit: ["react-hooks/exhaustive-deps", "react-hooks/rules-of-hooks"],
|
|
333
|
+
severity: "error"
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/config-react/rules-react-naming-convention.ts
|
|
338
|
+
const rules$2 = {
|
|
339
|
+
"react-naming-convention/component-name": "error",
|
|
340
|
+
"react-naming-convention/context-name": "error",
|
|
341
|
+
"react-naming-convention/ref-name": "error",
|
|
342
|
+
"react-naming-convention/use-state": "error"
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/config-react/rules-react-x.ts
|
|
347
|
+
const rules$1 = {
|
|
348
|
+
"react-x/jsx-dollar": "error",
|
|
349
|
+
"react-x/jsx-key-before-spread": "error",
|
|
350
|
+
"react-x/jsx-no-iife": "error",
|
|
351
|
+
"react-x/no-access-state-in-setstate": "error",
|
|
352
|
+
"react-x/no-class-component": "error",
|
|
353
|
+
"react-x/no-context-provider": "error",
|
|
354
|
+
"react-x/no-default-props": "error",
|
|
355
|
+
"react-x/no-duplicate-key": "error",
|
|
356
|
+
"react-x/no-forward-ref": "error",
|
|
357
|
+
"react-x/no-implicit-key": "error",
|
|
358
|
+
"react-x/no-leaked-conditional-rendering": "error",
|
|
359
|
+
"react-x/no-misused-capture-owner-stack": "error",
|
|
360
|
+
"react-x/no-nested-component-definitions": "error",
|
|
361
|
+
"react-x/no-nested-lazy-component-declarations": "error",
|
|
362
|
+
"react-x/no-prop-types": "error",
|
|
363
|
+
"react-x/no-unnecessary-use-callback": "error",
|
|
364
|
+
"react-x/no-unnecessary-use-memo": "error",
|
|
365
|
+
"react-x/no-unstable-context-value": "error",
|
|
366
|
+
"react-x/no-unstable-default-props": "error",
|
|
367
|
+
"react-x/no-use-context": "error",
|
|
368
|
+
"react-x/prefer-destructuring-assignment": "error",
|
|
369
|
+
"react-x/prefer-use-state-lazy-initialization": "error"
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/config-react/rules-react.ts
|
|
374
|
+
const rules = {
|
|
375
|
+
"react/function-component-definition": ["error", {
|
|
376
|
+
namedComponents: ["arrow-function", "function-declaration"],
|
|
377
|
+
unnamedComponents: "arrow-function"
|
|
378
|
+
}],
|
|
379
|
+
"react/no-adjacent-inline-elements": "error"
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
//#endregion
|
|
383
|
+
export { transformRules as a, rules$6 as c, rules$3 as i, rules$7 as l, rules$1 as n, rules$4 as o, rules$2 as r, rules$5 as s, rules as t, rules$8 as u };
|
|
384
|
+
//# sourceMappingURL=rules-react-P9sQTBnm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-react-P9sQTBnm.mjs","names":["rules","rules","rules","rules","rules","rules","rules","rules"],"sources":["../src/config-base/rules-core.ts","../src/config-base/rules-perfectionist.ts","../src/config-base/rules-stylistic.ts","../src/config-config-files/rules-perfectionist.ts","../src/config-react/rules-perfectionist.ts","../src/transform-rules/index.ts","../src/config-react/rules-react-hooks.ts","../src/config-react/rules-react-naming-convention.ts","../src/config-react/rules-react-x.ts","../src/config-react/rules-react.ts"],"sourcesContent":["import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'camelcase': ['error', { properties: 'always' }],\n\t'func-name-matching': [\n\t\t'error',\n\t\t'never',\n\t\t{ considerPropertyDescriptor: true },\n\t],\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'perfectionist/sort-array-includes': ['error', { type: 'natural' }],\n\t'perfectionist/sort-classes': [\n\t\t'error',\n\t\t{\n\t\t\tgroups: ['property', 'constructor'],\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n\t'perfectionist/sort-exports': ['error', { type: 'natural' }],\n\t'perfectionist/sort-imports': [\n\t\t'error',\n\t\t{\n\t\t\tcustomGroups: [\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'mock-side-effect',\n\t\t\t\t\telementNamePattern: '^.*/_*(mocks)_*/.*$',\n\t\t\t\t\tselector: 'side-effect',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'mock',\n\t\t\t\t\telementNamePattern: '^.*/_*(mocks)_*/.*$',\n\t\t\t\t\tselector: 'import',\n\t\t\t\t},\n\t\t\t],\n\t\t\tgroups: [\n\t\t\t\t'mock-side-effect',\n\t\t\t\t'mock',\n\t\t\t\t['type-builtin', 'type-external'],\n\t\t\t\t'type-internal',\n\t\t\t\t['type-parent', 'type-sibling', 'type-index'],\n\t\t\t\t['value-builtin', 'value-external'],\n\t\t\t\t'value-internal',\n\t\t\t\t['value-parent', 'value-sibling', 'value-index'],\n\t\t\t\t'unknown',\n\t\t\t\t'style',\n\t\t\t\t'side-effect',\n\t\t\t\t'side-effect-style',\n\t\t\t],\n\t\t\tinternalPattern: ['^(#|@/).*'],\n\t\t\tnewlinesBetween: 0,\n\t\t\tsortSideEffects: true,\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n\t'perfectionist/sort-interfaces': [\n\t\t'error',\n\t\t{\n\t\t\tgroups: ['index-signature', 'unknown', 'method'],\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n\t'perfectionist/sort-intersection-types': ['error', { type: 'natural' }],\n\t'perfectionist/sort-named-exports': ['error', { type: 'natural' }],\n\t'perfectionist/sort-named-imports': ['error', { type: 'natural' }],\n\t'perfectionist/sort-object-types': [\n\t\t'error',\n\t\t{\n\t\t\tgroups: ['index-signature', 'unknown', 'method'],\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n\t'perfectionist/sort-objects': [\n\t\t'error',\n\t\t{\n\t\t\ttype: 'natural',\n\t\t\tuseConfigurationIf: {\n\t\t\t\tobjectType: 'destructured',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'unsorted',\n\t\t\tuseConfigurationIf: {\n\t\t\t\tobjectType: 'non-destructured',\n\t\t\t},\n\t\t},\n\t],\n\t'perfectionist/sort-union-types': [\n\t\t'error',\n\t\t{\n\t\t\tcustomGroups: [\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'false',\n\t\t\t\t\telementNamePattern: '^false$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'never',\n\t\t\t\t\telementNamePattern: '^never$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'react',\n\t\t\t\t\telementNamePattern: '^react.+',\n\t\t\t\t},\n\t\t\t],\n\t\t\tgroups: ['react', 'unknown', 'tuple', 'false', 'nullish', 'never'],\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'@stylistic/lines-between-class-members': [\n\t\t'error',\n\t\t'always',\n\t\t{ exceptAfterSingleLine: true },\n\t],\n\t'@stylistic/padding-line-between-statements': [\n\t\t'error',\n\t\t{\n\t\t\tblankLine: 'always',\n\t\t\tnext: '*',\n\t\t\tprev: [\n\t\t\t\t'block-like',\n\t\t\t\t'directive',\n\t\t\t\t'export',\n\t\t\t\t'function',\n\t\t\t\t'import',\n\t\t\t\t'interface',\n\t\t\t\t'type',\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tblankLine: 'always',\n\t\t\tnext: [\n\t\t\t\t'block-like',\n\t\t\t\t'directive',\n\t\t\t\t'export',\n\t\t\t\t'function',\n\t\t\t\t'import',\n\t\t\t\t'interface',\n\t\t\t\t'type',\n\t\t\t],\n\t\t\tprev: '*',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'always',\n\t\t\tnext: '*',\n\t\t\tprev: ['case', 'default'],\n\t\t},\n\t\t{\n\t\t\tblankLine: 'never',\n\t\t\tnext: 'directive',\n\t\t\tprev: 'directive',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'any',\n\t\t\tnext: 'export',\n\t\t\tprev: 'export',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'never',\n\t\t\tnext: ['function', 'function-overload'],\n\t\t\tprev: 'function-overload',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'never',\n\t\t\tnext: 'import',\n\t\t\tprev: 'import',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'any',\n\t\t\tnext: 'interface',\n\t\t\tprev: 'interface',\n\t\t},\n\t\t{\n\t\t\tblankLine: 'any',\n\t\t\tnext: 'type',\n\t\t\tprev: 'type',\n\t\t},\n\t],\n\t'@stylistic/spaced-comment': [\n\t\t'error',\n\t\t'always',\n\t\t{\n\t\t\tblock: {\n\t\t\t\tbalanced: true,\n\t\t\t},\n\t\t\tline: {\n\t\t\t\tmarkers: ['/'],\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'perfectionist/sort-objects': [\n\t\t'error',\n\t\t{\n\t\t\tcustomGroups: [\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'extends',\n\t\t\t\t\telementNamePattern: '^extends$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'files',\n\t\t\t\t\telementNamePattern: '^files$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'ignores',\n\t\t\t\t\telementNamePattern: '^(ignores|ignorePatterns)$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'name',\n\t\t\t\t\telementNamePattern: '^(name|groupName)$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'overrides',\n\t\t\t\t\telementNamePattern: '^overrides$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'parser',\n\t\t\t\t\telementNamePattern: '^parser$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'plugins',\n\t\t\t\t\telementNamePattern: '^plugins$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'rules',\n\t\t\t\t\telementNamePattern: '^rules$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'test',\n\t\t\t\t\telementNamePattern: '^(test|tests)$',\n\t\t\t\t},\n\t\t\t],\n\t\t\tgroups: [\n\t\t\t\t'name',\n\t\t\t\t'files',\n\t\t\t\t'extends',\n\t\t\t\t'ignores',\n\t\t\t\t'plugins',\n\t\t\t\t'parser',\n\t\t\t\t'test',\n\t\t\t\t'unknown',\n\t\t\t\t'rules',\n\t\t\t\t'overrides',\n\t\t\t],\n\t\t\tnewlinesBetween: 0,\n\t\t\ttype: 'natural',\n\t\t},\n\t],\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'perfectionist/sort-jsx-props': [\n\t\t'error',\n\t\t{\n\t\t\tcustomGroups: [\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'as',\n\t\t\t\t\telementNamePattern: '^as$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'callback',\n\t\t\t\t\telementNamePattern: '^on.+',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'children',\n\t\t\t\t\telementNamePattern: '^children$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'key',\n\t\t\t\t\telementNamePattern: '^key$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'ref',\n\t\t\t\t\telementNamePattern: '^ref$',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tgroupName: 'unsafe',\n\t\t\t\t\telementNamePattern: '^dangerously.+',\n\t\t\t\t},\n\t\t\t],\n\t\t\tgroups: [\n\t\t\t\t'key',\n\t\t\t\t'ref',\n\t\t\t\t'as',\n\t\t\t\t'unknown',\n\t\t\t\t'shorthand-prop',\n\t\t\t\t'callback',\n\t\t\t\t'children',\n\t\t\t\t'unsafe',\n\t\t\t],\n\t\t\ttype: 'unsorted',\n\t\t},\n\t],\n};\n\nexport default rules;\n","import type { Linter } from 'eslint';\nimport type { LinterConfigRules } from '../types/index.d.ts';\n\n/**\n * Modify a set of ESLint rules.\n *\n * @deprecated Not covered by semver.\n */\nexport default function transformRules(\n\trules: Linter.Config['rules'],\n\toptions: {\n\t\tomit?: ReadonlyArray<string>;\n\t\tprefix?: string;\n\t\tseverity?: Linter.StringSeverity;\n\t}\n): LinterConfigRules {\n\tif (!rules) {\n\t\treturn {};\n\t}\n\n\tconst { omit, prefix, severity } = options;\n\tconst omittedRules = new Set(omit);\n\n\tconst transformedRules: LinterConfigRules = {};\n\n\tfor (const [ruleName, ruleConfig] of Object.entries(rules)) {\n\t\tif (omittedRules.has(ruleName)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!Array.isArray(ruleConfig)) {\n\t\t\ttransformedRules[ruleName] = severity ?? ruleConfig ?? 'off';\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [ruleSeverity, ...ruleOptions] = ruleConfig;\n\n\t\ttransformedRules[ruleName] = [severity ?? ruleSeverity, ...ruleOptions];\n\t}\n\n\treturn typeof prefix === 'string'\n\t\t? prefixRules(transformedRules, prefix)\n\t\t: transformedRules;\n}\n\nfunction prefixRules(rules: LinterConfigRules, prefix: string) {\n\tconst prefixedRules: LinterConfigRules = {};\n\n\tfor (const [ruleName, ruleConfig] of Object.entries(rules)) {\n\t\tconst name = ruleName.replace(/^.*?\\//, '');\n\n\t\tprefixedRules[`${prefix}/${name}`] = ruleConfig;\n\t}\n\n\treturn prefixedRules;\n}\n","import type { LinterConfigRules } from '../types/index.d.ts';\nimport pluginReactHooks from 'eslint-plugin-react-hooks';\nimport transformRules from '../transform-rules/index.ts';\n\nconst rules: LinterConfigRules = transformRules(\n\tpluginReactHooks.configs.flat['recommended-latest'].rules,\n\t{\n\t\tomit: [\n\t\t\t/* prettier-ignore */\n\t\t\t'react-hooks/exhaustive-deps',\n\t\t\t'react-hooks/rules-of-hooks',\n\t\t],\n\t\tseverity: 'error',\n\t}\n);\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'react-naming-convention/component-name': 'error',\n\t'react-naming-convention/context-name': 'error',\n\t'react-naming-convention/ref-name': 'error',\n\t'react-naming-convention/use-state': 'error',\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'react-x/jsx-dollar': 'error',\n\t'react-x/jsx-key-before-spread': 'error',\n\t'react-x/jsx-no-iife': 'error',\n\t'react-x/no-access-state-in-setstate': 'error',\n\t'react-x/no-class-component': 'error',\n\t'react-x/no-context-provider': 'error',\n\t'react-x/no-default-props': 'error',\n\t'react-x/no-duplicate-key': 'error',\n\t'react-x/no-forward-ref': 'error',\n\t'react-x/no-implicit-key': 'error',\n\t'react-x/no-leaked-conditional-rendering': 'error',\n\t'react-x/no-misused-capture-owner-stack': 'error',\n\t'react-x/no-nested-component-definitions': 'error',\n\t'react-x/no-nested-lazy-component-declarations': 'error',\n\t'react-x/no-prop-types': 'error',\n\t'react-x/no-unnecessary-use-callback': 'error',\n\t'react-x/no-unnecessary-use-memo': 'error',\n\t'react-x/no-unstable-context-value': 'error',\n\t'react-x/no-unstable-default-props': 'error',\n\t'react-x/no-use-context': 'error',\n\t'react-x/prefer-destructuring-assignment': 'error',\n\t'react-x/prefer-use-state-lazy-initialization': 'error',\n};\n\nexport default rules;\n","import type { LinterConfigRules } from '../types/index.d.ts';\n\nconst rules: LinterConfigRules = {\n\t'react/function-component-definition': [\n\t\t'error',\n\t\t{\n\t\t\tnamedComponents: ['arrow-function', 'function-declaration'],\n\t\t\tunnamedComponents: 'arrow-function',\n\t\t},\n\t],\n\t'react/no-adjacent-inline-elements': 'error',\n};\n\nexport default rules;\n"],"mappings":";;;AAEA,MAAMA,UAA2B;CAChC,aAAa,CAAC,SAAS,EAAE,YAAY,UAAU,CAAC;CAChD,sBAAsB;EACrB;EACA;EACA,EAAE,4BAA4B,MAAM;EACpC;CACD;;;;ACPD,MAAMC,UAA2B;CAChC,qCAAqC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;CACnE,8BAA8B,CAC7B,SACA;EACC,QAAQ,CAAC,YAAY,cAAc;EACnC,MAAM;EACN,CACD;CACD,8BAA8B,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;CAC5D,8BAA8B,CAC7B,SACA;EACC,cAAc,CACb;GACC,WAAW;GACX,oBAAoB;GACpB,UAAU;GACV,EACD;GACC,WAAW;GACX,oBAAoB;GACpB,UAAU;GACV,CACD;EACD,QAAQ;GACP;GACA;GACA,CAAC,gBAAgB,gBAAgB;GACjC;GACA;IAAC;IAAe;IAAgB;IAAa;GAC7C,CAAC,iBAAiB,iBAAiB;GACnC;GACA;IAAC;IAAgB;IAAiB;IAAc;GAChD;GACA;GACA;GACA;GACA;EACD,iBAAiB,CAAC,YAAY;EAC9B,iBAAiB;EACjB,iBAAiB;EACjB,MAAM;EACN,CACD;CACD,iCAAiC,CAChC,SACA;EACC,QAAQ;GAAC;GAAmB;GAAW;GAAS;EAChD,MAAM;EACN,CACD;CACD,yCAAyC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;CACvE,oCAAoC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;CAClE,oCAAoC,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC;CAClE,mCAAmC,CAClC,SACA;EACC,QAAQ;GAAC;GAAmB;GAAW;GAAS;EAChD,MAAM;EACN,CACD;CACD,8BAA8B;EAC7B;EACA;GACC,MAAM;GACN,oBAAoB,EACnB,YAAY,gBACZ;GACD;EACD;GACC,MAAM;GACN,oBAAoB,EACnB,YAAY,oBACZ;GACD;EACD;CACD,kCAAkC,CACjC,SACA;EACC,cAAc;GACb;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;IACC,WAAW;IACX,oBAAoB;IACpB;GACD;EACD,QAAQ;GAAC;GAAS;GAAW;GAAS;GAAS;GAAW;GAAQ;EAClE,MAAM;EACN,CACD;CACD;;;;AClGD,MAAMC,UAA2B;CAChC,0CAA0C;EACzC;EACA;EACA,EAAE,uBAAuB,MAAM;EAC/B;CACD,8CAA8C;EAC7C;EACA;GACC,WAAW;GACX,MAAM;GACN,MAAM;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD;EACD;GACC,WAAW;GACX,MAAM;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACD,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM,CAAC,QAAQ,UAAU;GACzB;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM,CAAC,YAAY,oBAAoB;GACvC,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM;GACN;EACD;GACC,WAAW;GACX,MAAM;GACN,MAAM;GACN;EACD;CACD,6BAA6B;EAC5B;EACA;EACA;GACC,OAAO,EACN,UAAU,MACV;GACD,MAAM,EACL,SAAS,CAAC,IAAI,EACd;GACD;EACD;CACD;;;;AClFD,MAAMC,UAA2B,EAChC,8BAA8B,CAC7B,SACA;CACC,cAAc;EACb;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;CACD,QAAQ;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,iBAAiB;CACjB,MAAM;CACN,CACD,EACD;;;;AC1DD,MAAMC,UAA2B,EAChC,gCAAgC,CAC/B,SACA;CACC,cAAc;EACb;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;GACC,WAAW;GACX,oBAAoB;GACpB;EACD;CACD,QAAQ;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM;CACN,CACD,EACD;;;;;;;;;ACrCD,SAAwB,eACvB,OACA,SAKoB;AACpB,KAAI,CAAC,MACJ,QAAO,EAAE;CAGV,MAAM,EAAE,MAAM,QAAQ,aAAa;CACnC,MAAM,eAAe,IAAI,IAAI,KAAK;CAElC,MAAM,mBAAsC,EAAE;AAE9C,MAAK,MAAM,CAAC,UAAU,eAAe,OAAO,QAAQ,MAAM,EAAE;AAC3D,MAAI,aAAa,IAAI,SAAS,CAC7B;AAGD,MAAI,CAAC,MAAM,QAAQ,WAAW,EAAE;AAC/B,oBAAiB,YAAY,YAAY,cAAc;AACvD;;EAGD,MAAM,CAAC,cAAc,GAAG,eAAe;AAEvC,mBAAiB,YAAY,CAAC,YAAY,cAAc,GAAG,YAAY;;AAGxE,QAAO,OAAO,WAAW,WACtB,YAAY,kBAAkB,OAAO,GACrC;;AAGJ,SAAS,YAAY,OAA0B,QAAgB;CAC9D,MAAM,gBAAmC,EAAE;AAE3C,MAAK,MAAM,CAAC,UAAU,eAAe,OAAO,QAAQ,MAAM,EAAE;EAC3D,MAAM,OAAO,SAAS,QAAQ,UAAU,GAAG;AAE3C,gBAAc,GAAG,OAAO,GAAG,UAAU;;AAGtC,QAAO;;;;;AClDR,MAAMC,UAA2B,eAChC,iBAAiB,QAAQ,KAAK,sBAAsB,OACpD;CACC,MAAM,CAEL,+BACA,6BACA;CACD,UAAU;CACV,CACD;;;;ACZD,MAAMC,UAA2B;CAChC,0CAA0C;CAC1C,wCAAwC;CACxC,oCAAoC;CACpC,qCAAqC;CACrC;;;;ACLD,MAAMC,UAA2B;CAChC,sBAAsB;CACtB,iCAAiC;CACjC,uBAAuB;CACvB,uCAAuC;CACvC,8BAA8B;CAC9B,+BAA+B;CAC/B,4BAA4B;CAC5B,4BAA4B;CAC5B,0BAA0B;CAC1B,2BAA2B;CAC3B,2CAA2C;CAC3C,0CAA0C;CAC1C,2CAA2C;CAC3C,iDAAiD;CACjD,yBAAyB;CACzB,uCAAuC;CACvC,mCAAmC;CACnC,qCAAqC;CACrC,qCAAqC;CACrC,0BAA0B;CAC1B,2CAA2C;CAC3C,gDAAgD;CAChD;;;;ACvBD,MAAM,QAA2B;CAChC,uCAAuC,CACtC,SACA;EACC,iBAAiB,CAAC,kBAAkB,uBAAuB;EAC3D,mBAAmB;EACnB,CACD;CACD,qCAAqC;CACrC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { n as LinterConfigRules, r as StandardConfig } from "./index-C8CpEqE5.mjs";
|
|
2
|
+
import { Linter } from "eslint";
|
|
3
|
+
import { ExternalPluginEntry, OxlintConfig, OxlintOverride } from "oxlint";
|
|
4
|
+
|
|
5
|
+
//#region src/get-oxlint-configs/types.d.ts
|
|
6
|
+
type OxlintOverrideEntry = Pick<OxlintOverride, 'rules'>;
|
|
7
|
+
type OxlintConfigEntriesOptions = Pick<StandardConfig, 'react'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Enable stylistic rules.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
stylistic?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type OxlintConfigEntries = {
|
|
15
|
+
/**
|
|
16
|
+
* Primary config defining base rules and JS plugins shared across all
|
|
17
|
+
* configs. Meant to be merged with the root config.
|
|
18
|
+
*/
|
|
19
|
+
configBase: OxlintConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Optional override entry containing stylistic rules that target config
|
|
22
|
+
* files. Intended for explicit overrides, as `configBase` already includes
|
|
23
|
+
* these rules when `stylistic` is enabled.
|
|
24
|
+
*/
|
|
25
|
+
configConfigFiles: OxlintOverrideEntry;
|
|
26
|
+
/**
|
|
27
|
+
* Optional override entry containing rules that target `*.tsx` files.
|
|
28
|
+
* Intended for explicit overrides, as `configBase` already includes these
|
|
29
|
+
* rules when `react` is enabled.
|
|
30
|
+
*/
|
|
31
|
+
configReact: OxlintOverrideEntry;
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/get-oxlint-configs/index.d.ts
|
|
35
|
+
/**
|
|
36
|
+
* Translate Standard Config’s own ESLint config to Oxlint config entries.
|
|
37
|
+
* Relies on Oxlint’s experimental `jsPlugins` support.
|
|
38
|
+
*/
|
|
39
|
+
declare function getOxlintConfigs({
|
|
40
|
+
react,
|
|
41
|
+
stylistic
|
|
42
|
+
}?: OxlintConfigEntriesOptions): OxlintConfigEntries;
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/transform-plugin/types.d.ts
|
|
45
|
+
type OxlintPluginEntry = Exclude<ExternalPluginEntry, string>;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/transform-plugin/index.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* Resolve an external plugin specifier.
|
|
50
|
+
*
|
|
51
|
+
* @deprecated Not covered by semver.
|
|
52
|
+
*/
|
|
53
|
+
declare function transformPlugin(name: string, specifier: string): OxlintPluginEntry;
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/transform-rules/index.d.ts
|
|
56
|
+
/**
|
|
57
|
+
* Modify a set of ESLint rules.
|
|
58
|
+
*
|
|
59
|
+
* @deprecated Not covered by semver.
|
|
60
|
+
*/
|
|
61
|
+
declare function transformRules(rules: Linter.Config['rules'], options: {
|
|
62
|
+
omit?: ReadonlyArray<string>;
|
|
63
|
+
prefix?: string;
|
|
64
|
+
severity?: Linter.StringSeverity;
|
|
65
|
+
}): LinterConfigRules;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { getOxlintConfigs, transformPlugin, transformRules };
|
|
68
|
+
//# sourceMappingURL=utilities.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.d.mts","names":["OxlintConfig","OxlintOverride","StandardConfig","OxlintOverrideEntry","Pick","OxlintConfigEntriesOptions","stylistic","OxlintConfigEntries","configBase","configConfigFiles","configReact","ExternalPluginEntry","OxlintPluginEntry","Exclude"],"sources":["../src/get-oxlint-configs/types.d.ts","../src/get-oxlint-configs/index.ts","../src/transform-plugin/types.d.ts","../src/transform-plugin/index.ts","../src/transform-rules/index.ts"],"mappings":";;;;;KAGYG,mBAAAA,GAAsBC,IAAAA,CAAKH,cAAAA;AAAAA,KAE3BI,0BAAAA,GAA6BD,IAAAA,CAAKF,cAAAA;EAFf;;;;EAO9BI,SAAAA;AAAAA;AAAAA,KAGWC,mBAAAA;;;;;EAKXC,UAAAA,EAAYR,YAAAA;EALb;;;;;EAWCS,iBAAAA,EAAmBN,mBAAAA;;;;;;EAMnBO,WAAAA,EAAaP,mBAAAA;AAAAA;;;;;;;iBCAU,gBAAA,CAAA;EACvB,KAAA;EACA;AAAA,IACE,0BAAA,GAAkC,mBAAA;;;KC/BzBS,iBAAAA,GAAoBC,OAAAA,CAAQF,mBAAAA;;;;;;;AFCxC;iBGKwB,eAAA,CACvB,IAAA,UACA,SAAA,WACE,iBAAA;;;;;;AHRH;;iBIKwB,cAAA,CACvB,KAAA,EAAO,MAAA,CAAO,MAAA,WACd,OAAA;EACC,IAAA,GAAO,aAAA;EACP,MAAA;EACA,QAAA,GAAW,MAAA,CAAO,cAAA;AAAA,IAEjB,iBAAA"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { a as transformRules, c as rules$2, i as rules$5, l as rules$1, n as rules$7, o as rules$8, r as rules$6, s as rules$3, t as rules$4, u as rules } from "./rules-react-P9sQTBnm.mjs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
|
|
4
|
+
//#region src/transform-plugin/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolve an external plugin specifier.
|
|
7
|
+
*
|
|
8
|
+
* @deprecated Not covered by semver.
|
|
9
|
+
*/
|
|
10
|
+
function transformPlugin(name, specifier) {
|
|
11
|
+
try {
|
|
12
|
+
specifier = fileURLToPath(import.meta.resolve(specifier));
|
|
13
|
+
} catch {}
|
|
14
|
+
return {
|
|
15
|
+
name,
|
|
16
|
+
specifier
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/get-oxlint-configs/index.ts
|
|
22
|
+
const PREFIX_ESLINT = "eslint";
|
|
23
|
+
const PREFIX_PERFECTIONIST = "perfectionist";
|
|
24
|
+
const PREFIX_REACT = "react-js";
|
|
25
|
+
const PREFIX_REACT_HOOKS = "react-hooks-js";
|
|
26
|
+
const PREFIX_REACT_NAMING_CONVENTION = "react-naming-convention";
|
|
27
|
+
const PREFIX_REACT_X = "react-x";
|
|
28
|
+
const PREFIX_STYLISTIC = "stylistic";
|
|
29
|
+
/**
|
|
30
|
+
* Translate Standard Config’s own ESLint config to Oxlint config entries.
|
|
31
|
+
* Relies on Oxlint’s experimental `jsPlugins` support.
|
|
32
|
+
*/
|
|
33
|
+
function getOxlintConfigs({ react = false, stylistic = true } = {}) {
|
|
34
|
+
const configBase = { rules: transformRules(rules, { prefix: PREFIX_ESLINT }) };
|
|
35
|
+
const configConfigFiles = {};
|
|
36
|
+
const configReact = {};
|
|
37
|
+
if (stylistic) {
|
|
38
|
+
configBase.jsPlugins = [transformPlugin(PREFIX_STYLISTIC, "@stylistic/eslint-plugin"), transformPlugin(PREFIX_PERFECTIONIST, "eslint-plugin-perfectionist")];
|
|
39
|
+
configBase.rules = {
|
|
40
|
+
...configBase.rules,
|
|
41
|
+
...transformRules(rules$1, {
|
|
42
|
+
prefix: PREFIX_PERFECTIONIST,
|
|
43
|
+
omit: ["perfectionist/sort-classes"]
|
|
44
|
+
}),
|
|
45
|
+
...transformRules(rules$2, { prefix: PREFIX_STYLISTIC })
|
|
46
|
+
};
|
|
47
|
+
configConfigFiles.rules = { ...transformRules(rules$3, { prefix: PREFIX_PERFECTIONIST }) };
|
|
48
|
+
configBase.overrides = [{
|
|
49
|
+
files: ["**/*.config.{ts,cts,mts}"],
|
|
50
|
+
...configConfigFiles
|
|
51
|
+
}];
|
|
52
|
+
}
|
|
53
|
+
if (react) {
|
|
54
|
+
configBase.settings = { react: { version: "19.2.4" } };
|
|
55
|
+
configBase.jsPlugins = [
|
|
56
|
+
...configBase.jsPlugins ?? [],
|
|
57
|
+
transformPlugin(PREFIX_REACT, "eslint-plugin-react"),
|
|
58
|
+
transformPlugin(PREFIX_REACT_HOOKS, "eslint-plugin-react-hooks"),
|
|
59
|
+
transformPlugin(PREFIX_REACT_NAMING_CONVENTION, "eslint-plugin-react-naming-convention"),
|
|
60
|
+
transformPlugin(PREFIX_REACT_X, "eslint-plugin-react-x")
|
|
61
|
+
];
|
|
62
|
+
configReact.rules = {
|
|
63
|
+
...transformRules(rules$4, { prefix: PREFIX_REACT }),
|
|
64
|
+
...transformRules(rules$5, { prefix: PREFIX_REACT_HOOKS }),
|
|
65
|
+
...transformRules(rules$6, { prefix: PREFIX_REACT_NAMING_CONVENTION }),
|
|
66
|
+
...transformRules(rules$7, {
|
|
67
|
+
prefix: PREFIX_REACT_X,
|
|
68
|
+
omit: ["react-x/no-implicit-key", "react-x/no-leaked-conditional-rendering"]
|
|
69
|
+
})
|
|
70
|
+
};
|
|
71
|
+
if (stylistic) configReact.rules = {
|
|
72
|
+
...configReact.rules,
|
|
73
|
+
...transformRules(rules$8, { prefix: PREFIX_PERFECTIONIST })
|
|
74
|
+
};
|
|
75
|
+
configBase.overrides = [...configBase.overrides ?? [], {
|
|
76
|
+
files: ["**/*.tsx"],
|
|
77
|
+
...configReact
|
|
78
|
+
}];
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
configBase,
|
|
82
|
+
configConfigFiles,
|
|
83
|
+
configReact
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { getOxlintConfigs, transformPlugin, transformRules };
|
|
89
|
+
//# sourceMappingURL=utilities.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilities.mjs","names":["configBaseRulesCore","configBaseRulesPerfectionist","configBaseRulesStylistic","configConfigFilesRulesPerfectionist","configReactRulesReact","configReactRulesReactHooks","configReactRulesReactNamingConvention","configReactRulesReactX","configReactRulesPerfectionist"],"sources":["../src/transform-plugin/index.ts","../src/get-oxlint-configs/index.ts"],"sourcesContent":["import type { OxlintPluginEntry } from './types.d.ts';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Resolve an external plugin specifier.\n *\n * @deprecated Not covered by semver.\n */\nexport default function transformPlugin(\n\tname: string,\n\tspecifier: string\n): OxlintPluginEntry {\n\ttry {\n\t\t/* oxlint-disable-next-line eslint/no-param-reassign */\n\t\tspecifier = fileURLToPath(import.meta.resolve(specifier));\n\t} catch {}\n\n\treturn { name, specifier };\n}\n","import type { OxlintConfig } from 'oxlint';\nimport type {\n\tOxlintConfigEntries,\n\tOxlintConfigEntriesOptions,\n\tOxlintOverrideEntry,\n} from './types.d.ts';\nimport configBaseRulesCore from '../config-base/rules-core.ts';\nimport configBaseRulesPerfectionist from '../config-base/rules-perfectionist.ts';\nimport configBaseRulesStylistic from '../config-base/rules-stylistic.ts';\nimport configConfigFilesRulesPerfectionist from '../config-config-files/rules-perfectionist.ts';\nimport configReactRulesPerfectionist from '../config-react/rules-perfectionist.ts';\nimport configReactRulesReactHooks from '../config-react/rules-react-hooks.ts';\nimport configReactRulesReactNamingConvention from '../config-react/rules-react-naming-convention.ts';\nimport configReactRulesReactX from '../config-react/rules-react-x.ts';\nimport configReactRulesReact from '../config-react/rules-react.ts';\nimport transformPlugin from '../transform-plugin/index.ts';\nimport transformRules from '../transform-rules/index.ts';\n\nconst PREFIX_ESLINT = 'eslint';\nconst PREFIX_PERFECTIONIST = 'perfectionist';\nconst PREFIX_REACT = 'react-js';\nconst PREFIX_REACT_HOOKS = 'react-hooks-js';\nconst PREFIX_REACT_NAMING_CONVENTION = 'react-naming-convention';\nconst PREFIX_REACT_X = 'react-x';\nconst PREFIX_STYLISTIC = 'stylistic';\n\n/**\n * Translate Standard Config’s own ESLint config to Oxlint config entries.\n * Relies on Oxlint’s experimental `jsPlugins` support.\n */\nexport default function getOxlintConfigs({\n\treact = false,\n\tstylistic = true,\n}: OxlintConfigEntriesOptions = {}): OxlintConfigEntries {\n\tconst configBase: OxlintConfig = {\n\t\trules: transformRules(configBaseRulesCore, {\n\t\t\tprefix: PREFIX_ESLINT,\n\t\t}),\n\t};\n\n\tconst configConfigFiles: OxlintOverrideEntry = {};\n\tconst configReact: OxlintOverrideEntry = {};\n\n\tif (stylistic) {\n\t\tconfigBase.jsPlugins = [\n\t\t\ttransformPlugin(PREFIX_STYLISTIC, '@stylistic/eslint-plugin'),\n\t\t\ttransformPlugin(\n\t\t\t\tPREFIX_PERFECTIONIST,\n\t\t\t\t'eslint-plugin-perfectionist'\n\t\t\t),\n\t\t];\n\n\t\tconfigBase.rules = {\n\t\t\t...configBase.rules,\n\t\t\t...transformRules(configBaseRulesPerfectionist, {\n\t\t\t\tprefix: PREFIX_PERFECTIONIST,\n\t\t\t\tomit: [\n\t\t\t\t\t// Crashes Oxlint at the moment\n\t\t\t\t\t'perfectionist/sort-classes',\n\t\t\t\t],\n\t\t\t}),\n\t\t\t...transformRules(configBaseRulesStylistic, {\n\t\t\t\tprefix: PREFIX_STYLISTIC,\n\t\t\t}),\n\t\t};\n\n\t\tconfigConfigFiles.rules = {\n\t\t\t...transformRules(configConfigFilesRulesPerfectionist, {\n\t\t\t\tprefix: PREFIX_PERFECTIONIST,\n\t\t\t}),\n\t\t};\n\n\t\tconfigBase.overrides = [\n\t\t\t{\n\t\t\t\tfiles: ['**/*.config.{ts,cts,mts}'],\n\t\t\t\t...configConfigFiles,\n\t\t\t},\n\t\t];\n\t}\n\n\tif (react) {\n\t\tconfigBase.settings = {\n\t\t\treact: {\n\t\t\t\t// Oxlint doesn’t support `detect`\n\t\t\t\tversion: '19.2.4',\n\t\t\t},\n\t\t};\n\n\t\tconfigBase.jsPlugins = [\n\t\t\t...(configBase.jsPlugins ?? []),\n\t\t\ttransformPlugin(PREFIX_REACT, 'eslint-plugin-react'),\n\t\t\ttransformPlugin(PREFIX_REACT_HOOKS, 'eslint-plugin-react-hooks'),\n\t\t\ttransformPlugin(\n\t\t\t\tPREFIX_REACT_NAMING_CONVENTION,\n\t\t\t\t'eslint-plugin-react-naming-convention'\n\t\t\t),\n\t\t\ttransformPlugin(PREFIX_REACT_X, 'eslint-plugin-react-x'),\n\t\t];\n\n\t\tconfigReact.rules = {\n\t\t\t...transformRules(configReactRulesReact, {\n\t\t\t\tprefix: PREFIX_REACT,\n\t\t\t}),\n\t\t\t...transformRules(configReactRulesReactHooks, {\n\t\t\t\tprefix: PREFIX_REACT_HOOKS,\n\t\t\t}),\n\t\t\t...transformRules(configReactRulesReactNamingConvention, {\n\t\t\t\tprefix: PREFIX_REACT_NAMING_CONVENTION,\n\t\t\t}),\n\t\t\t...transformRules(configReactRulesReactX, {\n\t\t\t\tprefix: PREFIX_REACT_X,\n\t\t\t\tomit: [\n\t\t\t\t\t// Oxlint doesn’t support type-aware rules\n\t\t\t\t\t'react-x/no-implicit-key',\n\t\t\t\t\t'react-x/no-leaked-conditional-rendering',\n\t\t\t\t],\n\t\t\t}),\n\t\t};\n\n\t\tif (stylistic) {\n\t\t\tconfigReact.rules = {\n\t\t\t\t...configReact.rules,\n\t\t\t\t...transformRules(configReactRulesPerfectionist, {\n\t\t\t\t\tprefix: PREFIX_PERFECTIONIST,\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\n\t\tconfigBase.overrides = [\n\t\t\t...(configBase.overrides ?? []),\n\t\t\t{\n\t\t\t\tfiles: ['**/*.tsx'],\n\t\t\t\t...configReact,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn {\n\t\tconfigBase,\n\t\tconfigConfigFiles,\n\t\tconfigReact,\n\t};\n}\n"],"mappings":";;;;;;;;;AAQA,SAAwB,gBACvB,MACA,WACoB;AACpB,KAAI;AAEH,cAAY,cAAc,OAAO,KAAK,QAAQ,UAAU,CAAC;SAClD;AAER,QAAO;EAAE;EAAM;EAAW;;;;;ACC3B,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,eAAe;AACrB,MAAM,qBAAqB;AAC3B,MAAM,iCAAiC;AACvC,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;;;;;AAMzB,SAAwB,iBAAiB,EACxC,QAAQ,OACR,YAAY,SACmB,EAAE,EAAuB;CACxD,MAAM,aAA2B,EAChC,OAAO,eAAeA,OAAqB,EAC1C,QAAQ,eACR,CAAC,EACF;CAED,MAAM,oBAAyC,EAAE;CACjD,MAAM,cAAmC,EAAE;AAE3C,KAAI,WAAW;AACd,aAAW,YAAY,CACtB,gBAAgB,kBAAkB,2BAA2B,EAC7D,gBACC,sBACA,8BACA,CACD;AAED,aAAW,QAAQ;GAClB,GAAG,WAAW;GACd,GAAG,eAAeC,SAA8B;IAC/C,QAAQ;IACR,MAAM,CAEL,6BACA;IACD,CAAC;GACF,GAAG,eAAeC,SAA0B,EAC3C,QAAQ,kBACR,CAAC;GACF;AAED,oBAAkB,QAAQ,EACzB,GAAG,eAAeC,SAAqC,EACtD,QAAQ,sBACR,CAAC,EACF;AAED,aAAW,YAAY,CACtB;GACC,OAAO,CAAC,2BAA2B;GACnC,GAAG;GACH,CACD;;AAGF,KAAI,OAAO;AACV,aAAW,WAAW,EACrB,OAAO,EAEN,SAAS,UACT,EACD;AAED,aAAW,YAAY;GACtB,GAAI,WAAW,aAAa,EAAE;GAC9B,gBAAgB,cAAc,sBAAsB;GACpD,gBAAgB,oBAAoB,4BAA4B;GAChE,gBACC,gCACA,wCACA;GACD,gBAAgB,gBAAgB,wBAAwB;GACxD;AAED,cAAY,QAAQ;GACnB,GAAG,eAAeC,SAAuB,EACxC,QAAQ,cACR,CAAC;GACF,GAAG,eAAeC,SAA4B,EAC7C,QAAQ,oBACR,CAAC;GACF,GAAG,eAAeC,SAAuC,EACxD,QAAQ,gCACR,CAAC;GACF,GAAG,eAAeC,SAAwB;IACzC,QAAQ;IACR,MAAM,CAEL,2BACA,0CACA;IACD,CAAC;GACF;AAED,MAAI,UACH,aAAY,QAAQ;GACnB,GAAG,YAAY;GACf,GAAG,eAAeC,SAA+B,EAChD,QAAQ,sBACR,CAAC;GACF;AAGF,aAAW,YAAY,CACtB,GAAI,WAAW,aAAa,EAAE,EAC9B;GACC,OAAO,CAAC,WAAW;GACnB,GAAG;GACH,CACD;;AAGF,QAAO;EACN;EACA;EACA;EACA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@standard-config/eslint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "TypeScript-first ESLint config designed to complement Oxlint",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -28,8 +28,16 @@
|
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
30
|
"sideEffects": false,
|
|
31
|
-
"exports":
|
|
32
|
-
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"import": "./dist/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./utilities": {
|
|
37
|
+
"types": "./dist/utilities.d.mts",
|
|
38
|
+
"import": "./dist/utilities.mjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
33
41
|
"engines": {
|
|
34
42
|
"node": ">=20"
|
|
35
43
|
},
|
|
@@ -41,10 +49,10 @@
|
|
|
41
49
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
42
50
|
"eslint-plugin-react-naming-convention": "^2.13.0",
|
|
43
51
|
"eslint-plugin-react-x": "^2.13.0",
|
|
44
|
-
"typescript-eslint": "^8.56.
|
|
52
|
+
"typescript-eslint": "^8.56.1"
|
|
45
53
|
},
|
|
46
54
|
"peerDependencies": {
|
|
47
|
-
"@standard-config/oxlint": "
|
|
55
|
+
"@standard-config/oxlint": ">=1.2.2",
|
|
48
56
|
"eslint": ">=9",
|
|
49
57
|
"typescript": ">=5"
|
|
50
58
|
},
|
|
@@ -54,7 +62,7 @@
|
|
|
54
62
|
}
|
|
55
63
|
},
|
|
56
64
|
"devDependencies": {
|
|
57
|
-
"@standard-config/oxlint": "^1.2.
|
|
65
|
+
"@standard-config/oxlint": "^1.2.2",
|
|
58
66
|
"@standard-config/prettier": "^1.9.1",
|
|
59
67
|
"@standard-config/tsconfig": "^2.0.2",
|
|
60
68
|
"@types/node": "^22.19.11",
|
|
@@ -62,8 +70,8 @@
|
|
|
62
70
|
"eslint": "^9.39.3",
|
|
63
71
|
"husky": "^9.1.7",
|
|
64
72
|
"jiti": "^2.6.1",
|
|
65
|
-
"oxlint": "^1.
|
|
66
|
-
"oxlint-tsgolint": "^0.
|
|
73
|
+
"oxlint": "^1.50.0",
|
|
74
|
+
"oxlint-tsgolint": "^0.15.0",
|
|
67
75
|
"prettier": "^3.8.1",
|
|
68
76
|
"publint": "^0.3.17",
|
|
69
77
|
"react": "^19.2.4",
|