@luxass/eslint-config 4.2.1 → 4.2.2
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 +35 -35
- package/dist/{chunk-CJ3ZUYUJ.mjs → chunk-5TJETBJG.mjs} +1 -1
- package/dist/{chunk-Z7F6QSYQ.mjs → chunk-IASQD7KX.mjs} +31 -7
- package/dist/{chunk-C67L5T23.mjs → chunk-JUFHDXTH.mjs} +2 -0
- package/dist/{chunk-RDZJT36Z.mjs → chunk-QMGT2Z63.mjs} +1 -1
- package/dist/configs/formatters.cjs +1 -1
- package/dist/configs/formatters.mjs +2 -2
- package/dist/configs/index.cjs +34 -8
- package/dist/configs/index.mjs +4 -4
- package/dist/configs/stylistic.cjs +1 -1
- package/dist/configs/stylistic.mjs +1 -1
- package/dist/configs/typescript.cjs +31 -7
- package/dist/configs/typescript.mjs +1 -1
- package/dist/configs/vue.cjs +2 -0
- package/dist/configs/vue.mjs +1 -1
- package/dist/index.cjs +34 -8
- package/dist/index.mjs +4 -4
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -29,28 +29,28 @@ With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package
|
|
|
29
29
|
|
|
30
30
|
```js
|
|
31
31
|
// eslint.config.js
|
|
32
|
-
import luxass from "@luxass/eslint-config"
|
|
32
|
+
import luxass from "@luxass/eslint-config"
|
|
33
33
|
|
|
34
|
-
export default luxass()
|
|
34
|
+
export default luxass()
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
With CJS:
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
40
|
// eslint.config.js
|
|
41
|
-
const luxass = require("@luxass/eslint-config").default
|
|
41
|
+
const luxass = require("@luxass/eslint-config").default
|
|
42
42
|
|
|
43
|
-
module.exports = luxass()
|
|
43
|
+
module.exports = luxass()
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
Combined with legacy config:
|
|
47
47
|
|
|
48
48
|
```js
|
|
49
49
|
// eslint.config.js
|
|
50
|
-
const luxass = require("@luxass/eslint-config").default
|
|
51
|
-
const { FlatCompat } = require("@eslint/eslintrc")
|
|
50
|
+
const luxass = require("@luxass/eslint-config").default
|
|
51
|
+
const { FlatCompat } = require("@eslint/eslintrc")
|
|
52
52
|
|
|
53
|
-
const compat = new FlatCompat()
|
|
53
|
+
const compat = new FlatCompat()
|
|
54
54
|
|
|
55
55
|
module.exports = luxass(
|
|
56
56
|
{
|
|
@@ -66,7 +66,7 @@ module.exports = luxass(
|
|
|
66
66
|
})
|
|
67
67
|
|
|
68
68
|
// Other flat configs...
|
|
69
|
-
)
|
|
69
|
+
)
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
|
@@ -129,16 +129,16 @@ Normally you would only need to import the `luxass` preset:
|
|
|
129
129
|
|
|
130
130
|
```js
|
|
131
131
|
// eslint.config.js
|
|
132
|
-
import luxass from "@luxass/eslint-config"
|
|
132
|
+
import luxass from "@luxass/eslint-config"
|
|
133
133
|
|
|
134
|
-
export default luxass()
|
|
134
|
+
export default luxass()
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
you can also configure each `config` individually:
|
|
138
138
|
|
|
139
139
|
```js
|
|
140
140
|
// eslint.config.js
|
|
141
|
-
import luxass from "@luxass/eslint-config"
|
|
141
|
+
import luxass from "@luxass/eslint-config"
|
|
142
142
|
|
|
143
143
|
export default luxass({
|
|
144
144
|
stylistic: true,
|
|
@@ -150,16 +150,16 @@ export default luxass({
|
|
|
150
150
|
|
|
151
151
|
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead.
|
|
152
152
|
ignores: [
|
|
153
|
-
"
|
|
153
|
+
"**/fixtures"
|
|
154
154
|
]
|
|
155
|
-
})
|
|
155
|
+
})
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
The `luxass` function accepts an arbitrary number of `flat configs` overrides:
|
|
159
159
|
|
|
160
160
|
```js
|
|
161
161
|
// eslint.config.js
|
|
162
|
-
import luxass from "@luxass/eslint-config"
|
|
162
|
+
import luxass from "@luxass/eslint-config"
|
|
163
163
|
|
|
164
164
|
export default luxass({
|
|
165
165
|
// configuration points for my config
|
|
@@ -167,7 +167,7 @@ export default luxass({
|
|
|
167
167
|
rules: {}
|
|
168
168
|
}, {
|
|
169
169
|
rules: {}
|
|
170
|
-
})
|
|
170
|
+
})
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
<details>
|
|
@@ -193,9 +193,9 @@ import {
|
|
|
193
193
|
unicorn,
|
|
194
194
|
vue,
|
|
195
195
|
yaml,
|
|
196
|
-
} from "@luxass/eslint-config/configs"
|
|
196
|
+
} from "@luxass/eslint-config/configs"
|
|
197
197
|
|
|
198
|
-
import { combine } from "@luxass/eslint-config"
|
|
198
|
+
import { combine } from "@luxass/eslint-config"
|
|
199
199
|
|
|
200
200
|
export default combine(
|
|
201
201
|
ignores(),
|
|
@@ -211,7 +211,7 @@ export default combine(
|
|
|
211
211
|
jsonc(),
|
|
212
212
|
yaml(),
|
|
213
213
|
markdown(),
|
|
214
|
-
)
|
|
214
|
+
)
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
</details>
|
|
@@ -247,7 +247,7 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
|
|
|
247
247
|
|
|
248
248
|
```js
|
|
249
249
|
// eslint.config.js
|
|
250
|
-
import luxass from "@luxass/eslint-config"
|
|
250
|
+
import luxass from "@luxass/eslint-config"
|
|
251
251
|
|
|
252
252
|
export default luxass(
|
|
253
253
|
{ vue: true, typescript: true },
|
|
@@ -264,14 +264,14 @@ export default luxass(
|
|
|
264
264
|
"style/semi": ["error", "never"],
|
|
265
265
|
},
|
|
266
266
|
}
|
|
267
|
-
)
|
|
267
|
+
)
|
|
268
268
|
```
|
|
269
269
|
|
|
270
270
|
We also provided a `overrides` options to make it easier:
|
|
271
271
|
|
|
272
272
|
```js
|
|
273
273
|
// eslint.config.js
|
|
274
|
-
import luxass from "@luxass/eslint-config"
|
|
274
|
+
import luxass from "@luxass/eslint-config"
|
|
275
275
|
|
|
276
276
|
export default luxass({
|
|
277
277
|
overrides: {
|
|
@@ -284,7 +284,7 @@ export default luxass({
|
|
|
284
284
|
yaml: {},
|
|
285
285
|
// ...
|
|
286
286
|
}
|
|
287
|
-
})
|
|
287
|
+
})
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
### Optional Configs
|
|
@@ -300,7 +300,7 @@ Use external formatters to format files that ESLint cannot handle yet (`.css`, `
|
|
|
300
300
|
|
|
301
301
|
```js
|
|
302
302
|
// eslint.config.js
|
|
303
|
-
import luxass from "@luxass/eslint-config"
|
|
303
|
+
import luxass from "@luxass/eslint-config"
|
|
304
304
|
|
|
305
305
|
export default luxass({
|
|
306
306
|
formatters: {
|
|
@@ -326,7 +326,7 @@ export default luxass({
|
|
|
326
326
|
*/
|
|
327
327
|
markdown: "prettier"
|
|
328
328
|
}
|
|
329
|
-
})
|
|
329
|
+
})
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -341,11 +341,11 @@ To enable React support, need to explicitly turn it on:
|
|
|
341
341
|
|
|
342
342
|
```js
|
|
343
343
|
// eslint.config.js
|
|
344
|
-
import luxass from "@luxass/eslint-config"
|
|
344
|
+
import luxass from "@luxass/eslint-config"
|
|
345
345
|
|
|
346
346
|
export default luxass({
|
|
347
347
|
react: true,
|
|
348
|
-
})
|
|
348
|
+
})
|
|
349
349
|
```
|
|
350
350
|
|
|
351
351
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -362,11 +362,11 @@ Next.JS also enables React support.
|
|
|
362
362
|
|
|
363
363
|
```js
|
|
364
364
|
// eslint.config.js
|
|
365
|
-
import luxass from "@luxass/eslint-config"
|
|
365
|
+
import luxass from "@luxass/eslint-config"
|
|
366
366
|
|
|
367
367
|
export default luxass({
|
|
368
368
|
nextjs: true,
|
|
369
|
-
})
|
|
369
|
+
})
|
|
370
370
|
```
|
|
371
371
|
|
|
372
372
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -381,11 +381,11 @@ To enable UnoCSS support, need to explicitly turn it on:
|
|
|
381
381
|
|
|
382
382
|
```js
|
|
383
383
|
// eslint.config.js
|
|
384
|
-
import luxass from "@luxass/eslint-config"
|
|
384
|
+
import luxass from "@luxass/eslint-config"
|
|
385
385
|
|
|
386
386
|
export default luxass({
|
|
387
387
|
unocss: true,
|
|
388
|
-
})
|
|
388
|
+
})
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -400,11 +400,11 @@ To enable TailwindCSS support, need to explicitly turn it on:
|
|
|
400
400
|
|
|
401
401
|
```js
|
|
402
402
|
// eslint.config.js
|
|
403
|
-
import luxass from "@luxass/eslint-config"
|
|
403
|
+
import luxass from "@luxass/eslint-config"
|
|
404
404
|
|
|
405
405
|
export default luxass({
|
|
406
406
|
tailwindcss: true,
|
|
407
|
-
})
|
|
407
|
+
})
|
|
408
408
|
```
|
|
409
409
|
|
|
410
410
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
@@ -431,7 +431,7 @@ const objectWantedToSort = {
|
|
|
431
431
|
a: 2,
|
|
432
432
|
b: 1,
|
|
433
433
|
c: 3,
|
|
434
|
-
}
|
|
434
|
+
}
|
|
435
435
|
/* eslint perfectionist/sort-objects: "off" */
|
|
436
436
|
```
|
|
437
437
|
|
|
@@ -441,13 +441,13 @@ You can optionally enable the [type aware rules](https://typescript-eslint.io/li
|
|
|
441
441
|
|
|
442
442
|
```js
|
|
443
443
|
// eslint.config.js
|
|
444
|
-
import luxass from "@luxass/eslint-config"
|
|
444
|
+
import luxass from "@luxass/eslint-config"
|
|
445
445
|
|
|
446
446
|
export default luxass({
|
|
447
447
|
typescript: {
|
|
448
448
|
tsconfigPath: "tsconfig.json",
|
|
449
449
|
},
|
|
450
|
-
})
|
|
450
|
+
})
|
|
451
451
|
```
|
|
452
452
|
|
|
453
453
|
## Versioning Policy
|
|
@@ -19,6 +19,13 @@ async function typescript(options = {}) {
|
|
|
19
19
|
overrides = {},
|
|
20
20
|
parserOptions = {}
|
|
21
21
|
} = options ?? {};
|
|
22
|
+
const files = options.files ?? [
|
|
23
|
+
GLOB_SRC,
|
|
24
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
25
|
+
];
|
|
26
|
+
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
27
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
28
|
+
const isTypeAware = !!tsconfigPath;
|
|
22
29
|
const typeAwareRules = {
|
|
23
30
|
"dot-notation": "off",
|
|
24
31
|
"no-implied-eval": "off",
|
|
@@ -40,12 +47,6 @@ async function typescript(options = {}) {
|
|
|
40
47
|
"ts/restrict-template-expressions": "error",
|
|
41
48
|
"ts/unbound-method": "error"
|
|
42
49
|
};
|
|
43
|
-
const files = options.files ?? [
|
|
44
|
-
GLOB_SRC,
|
|
45
|
-
...exts.map((ext) => `**/*.${ext}`)
|
|
46
|
-
];
|
|
47
|
-
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
48
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
49
50
|
const [
|
|
50
51
|
pluginTs,
|
|
51
52
|
parserTs
|
|
@@ -53,6 +54,25 @@ async function typescript(options = {}) {
|
|
|
53
54
|
interop(import("@typescript-eslint/eslint-plugin")),
|
|
54
55
|
interop(import("@typescript-eslint/parser"))
|
|
55
56
|
]);
|
|
57
|
+
function makeParser(typeAware, files2, ignores) {
|
|
58
|
+
return {
|
|
59
|
+
files: files2,
|
|
60
|
+
...ignores ? { ignores } : {},
|
|
61
|
+
name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`,
|
|
62
|
+
languageOptions: {
|
|
63
|
+
parser: parserTs,
|
|
64
|
+
parserOptions: {
|
|
65
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
66
|
+
sourceType: "module",
|
|
67
|
+
...typeAware ? {
|
|
68
|
+
project: tsconfigPath,
|
|
69
|
+
tsconfigRootDir: process.cwd()
|
|
70
|
+
} : {},
|
|
71
|
+
...parserOptions
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
56
76
|
return [
|
|
57
77
|
{
|
|
58
78
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -62,6 +82,10 @@ async function typescript(options = {}) {
|
|
|
62
82
|
ts: pluginTs
|
|
63
83
|
}
|
|
64
84
|
},
|
|
85
|
+
...isTypeAware ? [
|
|
86
|
+
makeParser(true, filesTypeAware),
|
|
87
|
+
makeParser(false, files, filesTypeAware)
|
|
88
|
+
] : [makeParser(false, files)],
|
|
65
89
|
{
|
|
66
90
|
name: "luxass:typescript:rules",
|
|
67
91
|
files,
|
|
@@ -161,7 +185,7 @@ async function typescript(options = {}) {
|
|
|
161
185
|
}
|
|
162
186
|
},
|
|
163
187
|
{
|
|
164
|
-
name: "
|
|
188
|
+
name: "antfu:typescript:rules-type-aware",
|
|
165
189
|
files: filesTypeAware,
|
|
166
190
|
rules: {
|
|
167
191
|
...tsconfigPath ? typeAwareRules : {},
|
|
@@ -79,6 +79,8 @@ async function vue(options = {}) {
|
|
|
79
79
|
],
|
|
80
80
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
81
81
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
82
|
+
// this is deprecated
|
|
83
|
+
"vue/component-tags-order": "off",
|
|
82
84
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
83
85
|
"vue/define-macros-order": [
|
|
84
86
|
"error",
|
package/dist/configs/index.cjs
CHANGED
|
@@ -1035,7 +1035,7 @@ var StylisticConfigDefaults = {
|
|
|
1035
1035
|
indent: 2,
|
|
1036
1036
|
jsx: true,
|
|
1037
1037
|
quotes: "double",
|
|
1038
|
-
semi:
|
|
1038
|
+
semi: false
|
|
1039
1039
|
};
|
|
1040
1040
|
async function stylistic(options = {}) {
|
|
1041
1041
|
const {
|
|
@@ -1087,6 +1087,13 @@ async function typescript(options = {}) {
|
|
|
1087
1087
|
overrides = {},
|
|
1088
1088
|
parserOptions = {}
|
|
1089
1089
|
} = options ?? {};
|
|
1090
|
+
const files = options.files ?? [
|
|
1091
|
+
GLOB_SRC,
|
|
1092
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
1093
|
+
];
|
|
1094
|
+
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
1095
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1096
|
+
const isTypeAware = !!tsconfigPath;
|
|
1090
1097
|
const typeAwareRules = {
|
|
1091
1098
|
"dot-notation": "off",
|
|
1092
1099
|
"no-implied-eval": "off",
|
|
@@ -1108,12 +1115,6 @@ async function typescript(options = {}) {
|
|
|
1108
1115
|
"ts/restrict-template-expressions": "error",
|
|
1109
1116
|
"ts/unbound-method": "error"
|
|
1110
1117
|
};
|
|
1111
|
-
const files = options.files ?? [
|
|
1112
|
-
GLOB_SRC,
|
|
1113
|
-
...exts.map((ext) => `**/*.${ext}`)
|
|
1114
|
-
];
|
|
1115
|
-
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
1116
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1117
1118
|
const [
|
|
1118
1119
|
pluginTs,
|
|
1119
1120
|
parserTs
|
|
@@ -1121,6 +1122,25 @@ async function typescript(options = {}) {
|
|
|
1121
1122
|
interop(import("@typescript-eslint/eslint-plugin")),
|
|
1122
1123
|
interop(import("@typescript-eslint/parser"))
|
|
1123
1124
|
]);
|
|
1125
|
+
function makeParser(typeAware, files2, ignores2) {
|
|
1126
|
+
return {
|
|
1127
|
+
files: files2,
|
|
1128
|
+
...ignores2 ? { ignores: ignores2 } : {},
|
|
1129
|
+
name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`,
|
|
1130
|
+
languageOptions: {
|
|
1131
|
+
parser: parserTs,
|
|
1132
|
+
parserOptions: {
|
|
1133
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
1134
|
+
sourceType: "module",
|
|
1135
|
+
...typeAware ? {
|
|
1136
|
+
project: tsconfigPath,
|
|
1137
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
1138
|
+
} : {},
|
|
1139
|
+
...parserOptions
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1124
1144
|
return [
|
|
1125
1145
|
{
|
|
1126
1146
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1130,6 +1150,10 @@ async function typescript(options = {}) {
|
|
|
1130
1150
|
ts: pluginTs
|
|
1131
1151
|
}
|
|
1132
1152
|
},
|
|
1153
|
+
...isTypeAware ? [
|
|
1154
|
+
makeParser(true, filesTypeAware),
|
|
1155
|
+
makeParser(false, files, filesTypeAware)
|
|
1156
|
+
] : [makeParser(false, files)],
|
|
1133
1157
|
{
|
|
1134
1158
|
name: "luxass:typescript:rules",
|
|
1135
1159
|
files,
|
|
@@ -1229,7 +1253,7 @@ async function typescript(options = {}) {
|
|
|
1229
1253
|
}
|
|
1230
1254
|
},
|
|
1231
1255
|
{
|
|
1232
|
-
name: "
|
|
1256
|
+
name: "antfu:typescript:rules-type-aware",
|
|
1233
1257
|
files: filesTypeAware,
|
|
1234
1258
|
rules: {
|
|
1235
1259
|
...tsconfigPath ? typeAwareRules : {},
|
|
@@ -1344,6 +1368,8 @@ async function vue(options = {}) {
|
|
|
1344
1368
|
],
|
|
1345
1369
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1346
1370
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1371
|
+
// this is deprecated
|
|
1372
|
+
"vue/component-tags-order": "off",
|
|
1347
1373
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1348
1374
|
"vue/define-macros-order": [
|
|
1349
1375
|
"error",
|
package/dist/configs/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "../chunk-KJ7ZCBK4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
vue
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-JUFHDXTH.mjs";
|
|
8
8
|
import {
|
|
9
9
|
yaml
|
|
10
10
|
} from "../chunk-WOYZWHPM.mjs";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
import "../chunk-WDSV2EFG.mjs";
|
|
22
22
|
import {
|
|
23
23
|
typescript
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-IASQD7KX.mjs";
|
|
25
25
|
import {
|
|
26
26
|
unicorn
|
|
27
27
|
} from "../chunk-RVSUTDCE.mjs";
|
|
@@ -57,10 +57,10 @@ import {
|
|
|
57
57
|
} from "../chunk-DAJA5AV3.mjs";
|
|
58
58
|
import {
|
|
59
59
|
formatters
|
|
60
|
-
} from "../chunk-
|
|
60
|
+
} from "../chunk-5TJETBJG.mjs";
|
|
61
61
|
import {
|
|
62
62
|
stylistic
|
|
63
|
-
} from "../chunk-
|
|
63
|
+
} from "../chunk-QMGT2Z63.mjs";
|
|
64
64
|
import "../chunk-4YBQZLPS.mjs";
|
|
65
65
|
import {
|
|
66
66
|
ignores
|
|
@@ -90,6 +90,13 @@ async function typescript(options = {}) {
|
|
|
90
90
|
overrides = {},
|
|
91
91
|
parserOptions = {}
|
|
92
92
|
} = options ?? {};
|
|
93
|
+
const files = options.files ?? [
|
|
94
|
+
GLOB_SRC,
|
|
95
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
96
|
+
];
|
|
97
|
+
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
98
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
99
|
+
const isTypeAware = !!tsconfigPath;
|
|
93
100
|
const typeAwareRules = {
|
|
94
101
|
"dot-notation": "off",
|
|
95
102
|
"no-implied-eval": "off",
|
|
@@ -111,12 +118,6 @@ async function typescript(options = {}) {
|
|
|
111
118
|
"ts/restrict-template-expressions": "error",
|
|
112
119
|
"ts/unbound-method": "error"
|
|
113
120
|
};
|
|
114
|
-
const files = options.files ?? [
|
|
115
|
-
GLOB_SRC,
|
|
116
|
-
...exts.map((ext) => `**/*.${ext}`)
|
|
117
|
-
];
|
|
118
|
-
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
119
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
120
121
|
const [
|
|
121
122
|
pluginTs,
|
|
122
123
|
parserTs
|
|
@@ -124,6 +125,25 @@ async function typescript(options = {}) {
|
|
|
124
125
|
interop(import("@typescript-eslint/eslint-plugin")),
|
|
125
126
|
interop(import("@typescript-eslint/parser"))
|
|
126
127
|
]);
|
|
128
|
+
function makeParser(typeAware, files2, ignores) {
|
|
129
|
+
return {
|
|
130
|
+
files: files2,
|
|
131
|
+
...ignores ? { ignores } : {},
|
|
132
|
+
name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`,
|
|
133
|
+
languageOptions: {
|
|
134
|
+
parser: parserTs,
|
|
135
|
+
parserOptions: {
|
|
136
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
137
|
+
sourceType: "module",
|
|
138
|
+
...typeAware ? {
|
|
139
|
+
project: tsconfigPath,
|
|
140
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
141
|
+
} : {},
|
|
142
|
+
...parserOptions
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
127
147
|
return [
|
|
128
148
|
{
|
|
129
149
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -133,6 +153,10 @@ async function typescript(options = {}) {
|
|
|
133
153
|
ts: pluginTs
|
|
134
154
|
}
|
|
135
155
|
},
|
|
156
|
+
...isTypeAware ? [
|
|
157
|
+
makeParser(true, filesTypeAware),
|
|
158
|
+
makeParser(false, files, filesTypeAware)
|
|
159
|
+
] : [makeParser(false, files)],
|
|
136
160
|
{
|
|
137
161
|
name: "luxass:typescript:rules",
|
|
138
162
|
files,
|
|
@@ -232,7 +256,7 @@ async function typescript(options = {}) {
|
|
|
232
256
|
}
|
|
233
257
|
},
|
|
234
258
|
{
|
|
235
|
-
name: "
|
|
259
|
+
name: "antfu:typescript:rules-type-aware",
|
|
236
260
|
files: filesTypeAware,
|
|
237
261
|
rules: {
|
|
238
262
|
...tsconfigPath ? typeAwareRules : {},
|
package/dist/configs/vue.cjs
CHANGED
|
@@ -165,6 +165,8 @@ async function vue(options = {}) {
|
|
|
165
165
|
],
|
|
166
166
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
167
167
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
168
|
+
// this is deprecated
|
|
169
|
+
"vue/component-tags-order": "off",
|
|
168
170
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
169
171
|
"vue/define-macros-order": [
|
|
170
172
|
"error",
|
package/dist/configs/vue.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1056,7 +1056,7 @@ var StylisticConfigDefaults = {
|
|
|
1056
1056
|
indent: 2,
|
|
1057
1057
|
jsx: true,
|
|
1058
1058
|
quotes: "double",
|
|
1059
|
-
semi:
|
|
1059
|
+
semi: false
|
|
1060
1060
|
};
|
|
1061
1061
|
async function stylistic(options = {}) {
|
|
1062
1062
|
const {
|
|
@@ -1108,6 +1108,13 @@ async function typescript(options = {}) {
|
|
|
1108
1108
|
overrides = {},
|
|
1109
1109
|
parserOptions = {}
|
|
1110
1110
|
} = options ?? {};
|
|
1111
|
+
const files = options.files ?? [
|
|
1112
|
+
GLOB_SRC,
|
|
1113
|
+
...exts.map((ext) => `**/*.${ext}`)
|
|
1114
|
+
];
|
|
1115
|
+
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
1116
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1117
|
+
const isTypeAware = !!tsconfigPath;
|
|
1111
1118
|
const typeAwareRules = {
|
|
1112
1119
|
"dot-notation": "off",
|
|
1113
1120
|
"no-implied-eval": "off",
|
|
@@ -1129,12 +1136,6 @@ async function typescript(options = {}) {
|
|
|
1129
1136
|
"ts/restrict-template-expressions": "error",
|
|
1130
1137
|
"ts/unbound-method": "error"
|
|
1131
1138
|
};
|
|
1132
|
-
const files = options.files ?? [
|
|
1133
|
-
GLOB_SRC,
|
|
1134
|
-
...exts.map((ext) => `**/*.${ext}`)
|
|
1135
|
-
];
|
|
1136
|
-
const filesTypeAware = options.typeAwareFileS ?? [GLOB_TS, GLOB_TSX];
|
|
1137
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1138
1139
|
const [
|
|
1139
1140
|
pluginTs,
|
|
1140
1141
|
parserTs
|
|
@@ -1142,6 +1143,25 @@ async function typescript(options = {}) {
|
|
|
1142
1143
|
interop(import("@typescript-eslint/eslint-plugin")),
|
|
1143
1144
|
interop(import("@typescript-eslint/parser"))
|
|
1144
1145
|
]);
|
|
1146
|
+
function makeParser(typeAware, files2, ignores2) {
|
|
1147
|
+
return {
|
|
1148
|
+
files: files2,
|
|
1149
|
+
...ignores2 ? { ignores: ignores2 } : {},
|
|
1150
|
+
name: `antfu:typescript:${typeAware ? "type-aware-parser" : "parser"}`,
|
|
1151
|
+
languageOptions: {
|
|
1152
|
+
parser: parserTs,
|
|
1153
|
+
parserOptions: {
|
|
1154
|
+
extraFileExtensions: exts.map((ext) => `.${ext}`),
|
|
1155
|
+
sourceType: "module",
|
|
1156
|
+
...typeAware ? {
|
|
1157
|
+
project: tsconfigPath,
|
|
1158
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
1159
|
+
} : {},
|
|
1160
|
+
...parserOptions
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1145
1165
|
return [
|
|
1146
1166
|
{
|
|
1147
1167
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1151,6 +1171,10 @@ async function typescript(options = {}) {
|
|
|
1151
1171
|
ts: pluginTs
|
|
1152
1172
|
}
|
|
1153
1173
|
},
|
|
1174
|
+
...isTypeAware ? [
|
|
1175
|
+
makeParser(true, filesTypeAware),
|
|
1176
|
+
makeParser(false, files, filesTypeAware)
|
|
1177
|
+
] : [makeParser(false, files)],
|
|
1154
1178
|
{
|
|
1155
1179
|
name: "luxass:typescript:rules",
|
|
1156
1180
|
files,
|
|
@@ -1250,7 +1274,7 @@ async function typescript(options = {}) {
|
|
|
1250
1274
|
}
|
|
1251
1275
|
},
|
|
1252
1276
|
{
|
|
1253
|
-
name: "
|
|
1277
|
+
name: "antfu:typescript:rules-type-aware",
|
|
1254
1278
|
files: filesTypeAware,
|
|
1255
1279
|
rules: {
|
|
1256
1280
|
...tsconfigPath ? typeAwareRules : {},
|
|
@@ -1365,6 +1389,8 @@ async function vue(options = {}) {
|
|
|
1365
1389
|
],
|
|
1366
1390
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1367
1391
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1392
|
+
// this is deprecated
|
|
1393
|
+
"vue/component-tags-order": "off",
|
|
1368
1394
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1369
1395
|
"vue/define-macros-order": [
|
|
1370
1396
|
"error",
|
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-KJ7ZCBK4.mjs";
|
|
11
11
|
import {
|
|
12
12
|
vue
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JUFHDXTH.mjs";
|
|
14
14
|
import {
|
|
15
15
|
yaml
|
|
16
16
|
} from "./chunk-WOYZWHPM.mjs";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import "./chunk-WDSV2EFG.mjs";
|
|
28
28
|
import {
|
|
29
29
|
typescript
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IASQD7KX.mjs";
|
|
31
31
|
import {
|
|
32
32
|
unicorn
|
|
33
33
|
} from "./chunk-RVSUTDCE.mjs";
|
|
@@ -63,10 +63,10 @@ import {
|
|
|
63
63
|
} from "./chunk-DAJA5AV3.mjs";
|
|
64
64
|
import {
|
|
65
65
|
formatters
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-5TJETBJG.mjs";
|
|
67
67
|
import {
|
|
68
68
|
stylistic
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-QMGT2Z63.mjs";
|
|
70
70
|
import {
|
|
71
71
|
combine,
|
|
72
72
|
getOverrides,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxass/eslint-config",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.2",
|
|
4
4
|
"description": "ESLint config for @luxass",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"email": "lucasnrgaard@gmail.com",
|
|
9
9
|
"url": "https://luxass.dev"
|
|
10
10
|
},
|
|
11
|
-
"packageManager": "pnpm@8.14.
|
|
11
|
+
"packageManager": "pnpm@8.14.1",
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -126,31 +126,31 @@
|
|
|
126
126
|
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
127
127
|
"@antfu/install-pkg": "^0.3.1",
|
|
128
128
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
|
|
129
|
-
"@eslint-types/jsdoc": "^
|
|
130
|
-
"@eslint-types/typescript-eslint": "^6.
|
|
129
|
+
"@eslint-types/jsdoc": "^48.0.2",
|
|
130
|
+
"@eslint-types/typescript-eslint": "^6.18.1",
|
|
131
131
|
"@eslint-types/unicorn": "^50.0.1",
|
|
132
|
-
"@stylistic/eslint-plugin": "^1.5.
|
|
133
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
134
|
-
"@typescript-eslint/parser": "^6.
|
|
132
|
+
"@stylistic/eslint-plugin": "^1.5.4",
|
|
133
|
+
"@typescript-eslint/eslint-plugin": "^6.19.0",
|
|
134
|
+
"@typescript-eslint/parser": "^6.19.0",
|
|
135
135
|
"eslint-config-flat-gitignore": "^0.1.2",
|
|
136
136
|
"eslint-merge-processors": "^0.1.0",
|
|
137
137
|
"eslint-parser-plain": "^0.1.0",
|
|
138
138
|
"eslint-plugin-antfu": "^2.1.1",
|
|
139
|
-
"eslint-plugin-astro": "^0.31.
|
|
139
|
+
"eslint-plugin-astro": "^0.31.3",
|
|
140
140
|
"eslint-plugin-i": "^2.29.1",
|
|
141
141
|
"eslint-plugin-jsdoc": "^48.0.2",
|
|
142
|
-
"eslint-plugin-jsonc": "^2.
|
|
142
|
+
"eslint-plugin-jsonc": "^2.12.2",
|
|
143
143
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
144
144
|
"eslint-plugin-markdown": "^3.0.1",
|
|
145
145
|
"eslint-plugin-n": "^16.6.2",
|
|
146
146
|
"eslint-plugin-perfectionist": "^2.5.0",
|
|
147
147
|
"eslint-plugin-sort-keys": "^2.3.5",
|
|
148
|
-
"eslint-plugin-toml": "^0.
|
|
148
|
+
"eslint-plugin-toml": "^0.9.2",
|
|
149
149
|
"eslint-plugin-unicorn": "^50.0.1",
|
|
150
150
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
151
151
|
"eslint-plugin-vitest": "^0.3.20",
|
|
152
|
-
"eslint-plugin-vue": "^9.
|
|
153
|
-
"eslint-plugin-yml": "^1.
|
|
152
|
+
"eslint-plugin-vue": "^9.20.1",
|
|
153
|
+
"eslint-plugin-yml": "^1.12.2",
|
|
154
154
|
"eslint-processor-vue-blocks": "^0.1.1",
|
|
155
155
|
"globals": "^13.24.0",
|
|
156
156
|
"jsonc-eslint-parser": "^2.4.0",
|
|
@@ -163,14 +163,14 @@
|
|
|
163
163
|
},
|
|
164
164
|
"devDependencies": {
|
|
165
165
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
166
|
-
"@next/eslint-plugin-next": "^14.0
|
|
167
|
-
"@stylistic/eslint-plugin-migrate": "^1.5.
|
|
168
|
-
"@types/eslint": "^8.56.
|
|
166
|
+
"@next/eslint-plugin-next": "^14.1.0",
|
|
167
|
+
"@stylistic/eslint-plugin-migrate": "^1.5.4",
|
|
168
|
+
"@types/eslint": "^8.56.2",
|
|
169
169
|
"@types/estree": "^1.0.5",
|
|
170
170
|
"@types/node": "^18.17.19",
|
|
171
171
|
"@types/prompts": "^2.4.9",
|
|
172
|
-
"@typescript-eslint/rule-tester": "^6.
|
|
173
|
-
"@typescript-eslint/utils": "^6.
|
|
172
|
+
"@typescript-eslint/rule-tester": "^6.19.0",
|
|
173
|
+
"@typescript-eslint/utils": "^6.19.0",
|
|
174
174
|
"@unocss/eslint-plugin": "^0.58.3",
|
|
175
175
|
"eslint": "^8.56.0",
|
|
176
176
|
"eslint-plugin-format": "^0.1.0",
|
|
@@ -178,13 +178,13 @@
|
|
|
178
178
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
179
179
|
"eslint-plugin-react-refresh": "^0.4.5",
|
|
180
180
|
"eslint-plugin-solid": "^0.13.1",
|
|
181
|
-
"eslint-plugin-tailwindcss": "^3.
|
|
182
|
-
"eslint-plugin-vuejs-accessibility": "^2.2.
|
|
181
|
+
"eslint-plugin-tailwindcss": "^3.14.0",
|
|
182
|
+
"eslint-plugin-vuejs-accessibility": "^2.2.1",
|
|
183
183
|
"lint-staged": "^15.2.0",
|
|
184
184
|
"simple-git-hooks": "^2.9.0",
|
|
185
185
|
"tsup": "^8.0.1",
|
|
186
186
|
"typescript": "^5.3.3",
|
|
187
|
-
"vitest": "^1.1
|
|
187
|
+
"vitest": "^1.2.1"
|
|
188
188
|
},
|
|
189
189
|
"simple-git-hooks": {
|
|
190
190
|
"pre-commit": "pnpm lint-staged"
|