@luxass/eslint-config 4.3.5 → 4.3.7
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 +201 -59
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +33 -24
- package/dist/index.d.ts +33 -24
- package/dist/index.js +22 -22
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
## ✨ Features
|
|
7
7
|
|
|
8
|
-
- Based on [Antfu's ESLint Config](https://github.com/antfu/eslint-config)
|
|
8
|
+
- Based on [Antfu's ESLint Config](https://github.com/antfu/eslint-config) with some modifications
|
|
9
9
|
- Auto fix for formatting (aimed to be used standalone **without** Prettier)
|
|
10
|
-
- Designed to work with TypeScript, JSX, Vue
|
|
10
|
+
- Designed to work with TypeScript, JSX, Vue out-of-box
|
|
11
11
|
- Lints also for json, yaml, toml, markdown
|
|
12
12
|
- Sorted imports, dangling commas
|
|
13
13
|
- Reasonable defaults, best practices, only one-line of config
|
|
@@ -15,44 +15,39 @@
|
|
|
15
15
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
16
16
|
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
17
17
|
- Respects `.gitignore` by default
|
|
18
|
+
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro) support
|
|
18
19
|
- Optional [formatters](#formatters) support for CSS, HTML, etc.
|
|
19
20
|
|
|
20
|
-
##
|
|
21
|
+
## Usage
|
|
21
22
|
|
|
22
|
-
```bash
|
|
23
|
+
```bash
|
|
23
24
|
npm install -D eslint @luxass/eslint-config
|
|
24
25
|
```
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package.json` (recommended):
|
|
27
|
+
And create a `eslint.config.mjs` in your project root:
|
|
29
28
|
|
|
30
29
|
```js
|
|
31
|
-
// eslint.config.
|
|
30
|
+
// eslint.config.mjs
|
|
32
31
|
import luxass from '@luxass/eslint-config'
|
|
33
32
|
|
|
34
33
|
export default luxass()
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
// eslint.config.js
|
|
41
|
-
const luxass = require('@luxass/eslint-config')
|
|
42
|
-
|
|
43
|
-
module.exports = luxass()
|
|
44
|
-
```
|
|
45
|
-
|
|
36
|
+
<details>
|
|
37
|
+
<summary>
|
|
46
38
|
Combined with legacy config:
|
|
39
|
+
</summary>
|
|
40
|
+
|
|
41
|
+
If you still use some configs from the legacy eslintrc format, you can use the [`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package to convert them to the flat config.
|
|
47
42
|
|
|
48
43
|
```js
|
|
49
|
-
// eslint.config.
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
// eslint.config.mjs
|
|
45
|
+
import luxass from '@luxass/eslint-config'
|
|
46
|
+
import { FlatCompat } from '@eslint/eslintrc'
|
|
52
47
|
|
|
53
48
|
const compat = new FlatCompat()
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
export default luxass(
|
|
56
51
|
{
|
|
57
52
|
ignores: [],
|
|
58
53
|
},
|
|
@@ -71,7 +66,22 @@ module.exports = luxass(
|
|
|
71
66
|
|
|
72
67
|
> Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
### Add script for package.json
|
|
72
|
+
|
|
73
|
+
For example:
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"scripts": {
|
|
78
|
+
"lint": "eslint .",
|
|
79
|
+
"lint:fix": "eslint . --fix"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Setup for Visual Studio Code (with auto-fix)
|
|
75
85
|
|
|
76
86
|
Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) and add the following to your `.vscode/settings.json`:
|
|
77
87
|
|
|
@@ -118,14 +128,17 @@ Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=d
|
|
|
118
128
|
"markdown",
|
|
119
129
|
"json",
|
|
120
130
|
"jsonc",
|
|
121
|
-
"yaml"
|
|
131
|
+
"yaml",
|
|
132
|
+
"toml",
|
|
133
|
+
"gql",
|
|
134
|
+
"graphql"
|
|
122
135
|
]
|
|
123
136
|
}
|
|
124
137
|
```
|
|
125
138
|
|
|
126
139
|
## Customization
|
|
127
140
|
|
|
128
|
-
Normally you would only need to import the
|
|
141
|
+
Normally you would only need to import the config and export it:
|
|
129
142
|
|
|
130
143
|
```js
|
|
131
144
|
// eslint.config.js
|
|
@@ -134,46 +147,67 @@ import luxass from '@luxass/eslint-config'
|
|
|
134
147
|
export default luxass()
|
|
135
148
|
```
|
|
136
149
|
|
|
137
|
-
you can
|
|
150
|
+
And that's it! Or you can configure each integration individually, for example:
|
|
138
151
|
|
|
139
152
|
```js
|
|
140
153
|
// eslint.config.js
|
|
141
154
|
import luxass from '@luxass/eslint-config'
|
|
142
155
|
|
|
143
156
|
export default luxass({
|
|
144
|
-
stylistic
|
|
157
|
+
// Enable stylistic formatting rules
|
|
158
|
+
// stylistic: true,
|
|
159
|
+
|
|
160
|
+
// Or customize the stylistic rules
|
|
161
|
+
stylistic: {
|
|
162
|
+
indent: 2, // 4, or 'tab'
|
|
163
|
+
quotes: 'single', // or 'double'
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// TypeScript and Vue are auto-detected, you can also explicitly enable them:
|
|
145
167
|
typescript: true,
|
|
146
168
|
vue: true,
|
|
147
|
-
react: false,
|
|
148
|
-
astro: true,
|
|
149
|
-
unocss: true,
|
|
150
169
|
|
|
151
|
-
//
|
|
170
|
+
// Disable jsonc and yaml support
|
|
171
|
+
jsonc: false,
|
|
172
|
+
yaml: false,
|
|
173
|
+
|
|
174
|
+
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
|
152
175
|
ignores: [
|
|
153
|
-
'**/fixtures'
|
|
176
|
+
'**/fixtures',
|
|
177
|
+
// ...globs
|
|
154
178
|
]
|
|
155
179
|
})
|
|
156
180
|
```
|
|
157
181
|
|
|
158
|
-
The `luxass` function accepts
|
|
182
|
+
The `luxass` factory function also accepts any number of arbitrary custom config overrides:
|
|
159
183
|
|
|
160
184
|
```js
|
|
161
185
|
// eslint.config.js
|
|
162
186
|
import luxass from '@luxass/eslint-config'
|
|
163
187
|
|
|
164
|
-
export default luxass(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
188
|
+
export default luxass(
|
|
189
|
+
{
|
|
190
|
+
// Configures for luxass's config
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
// From the second arguments they are ESLint Flat Configs
|
|
194
|
+
// you can have multiple configs
|
|
195
|
+
{
|
|
196
|
+
files: ['**/*.ts'],
|
|
197
|
+
rules: {},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
rules: {},
|
|
201
|
+
},
|
|
202
|
+
)
|
|
171
203
|
```
|
|
172
204
|
|
|
205
|
+
Going more advanced, you can also import fine-grained configs and compose them as you wish:
|
|
206
|
+
|
|
173
207
|
<details>
|
|
174
208
|
<summary>Advanced Example</summary>
|
|
175
209
|
|
|
176
|
-
We
|
|
210
|
+
We wouldn't recommend using this style in general unless you know exactly what they are doing, as there are shared options between configs and might need extra care to make them consistent.
|
|
177
211
|
|
|
178
212
|
```js
|
|
179
213
|
// eslint.config.js
|
|
@@ -240,6 +274,17 @@ When you want to override rules, or disable them inline, you need to update to t
|
|
|
240
274
|
type foo = { bar: 2 }
|
|
241
275
|
```
|
|
242
276
|
|
|
277
|
+
> [!NOTE]
|
|
278
|
+
> About plugin renaming - it is actually rather a dangrous move that might leading to potential naming collisions, pointed out [here](https://github.com/eslint/eslint/discussions/17766) and [here](https://github.com/prettier/eslint-config-prettier#eslintconfigjs-flat-config-plugin-caveat). As this config also very **personal** and **opinionated**, I ambitiously position this config as the only **"top-level"** config per project, that might pivots the taste of how rules are named.
|
|
279
|
+
>
|
|
280
|
+
> This config cares more about the user-facings DX, and try to ease out the implementation details. For example, users could keep using the semantic `import/order` without ever knowing the underlying plugin has migrated twice to `eslint-plugin-i` and then to `eslint-plugin-import-x`. User are also not forced to migrate to the implicit `i/order` halfway only because we swapped the implementation to a fork.
|
|
281
|
+
>
|
|
282
|
+
> That said, it's probably still not a good idea. You might not want to doing this if you are maintaining your own eslint config.
|
|
283
|
+
>
|
|
284
|
+
> Feel free to open issues if you want to combine this config with some other config presets but faced naming collisions. I am happy to figure out a way to make them work. But at this moment I have no plan to revert the renaming.
|
|
285
|
+
|
|
286
|
+
Since v4.3.0, this preset will automatically rename the plugins also for your custom configs. You can use the original prefix to override the rules directly.
|
|
287
|
+
|
|
243
288
|
### Rules Overrides
|
|
244
289
|
|
|
245
290
|
Certain rules would only be enabled in specific files, for example, `ts/*` rules would only be enabled in `.ts` files and `vue/*` rules would only be enabled in `.vue` files. If you want to override the rules, you need to specify the file extension:
|
|
@@ -249,7 +294,10 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
|
|
|
249
294
|
import luxass from '@luxass/eslint-config'
|
|
250
295
|
|
|
251
296
|
export default luxass(
|
|
252
|
-
{
|
|
297
|
+
{
|
|
298
|
+
vue: true,
|
|
299
|
+
typescript: true
|
|
300
|
+
},
|
|
253
301
|
{
|
|
254
302
|
// Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files
|
|
255
303
|
files: ['**/*.vue'],
|
|
@@ -266,35 +314,66 @@ export default luxass(
|
|
|
266
314
|
)
|
|
267
315
|
```
|
|
268
316
|
|
|
269
|
-
We also provided a `overrides` options to make it easier:
|
|
317
|
+
We also provided a `overrides` options in each integration to make it easier:
|
|
270
318
|
|
|
271
319
|
```js
|
|
272
320
|
// eslint.config.js
|
|
273
321
|
import luxass from '@luxass/eslint-config'
|
|
274
322
|
|
|
275
323
|
export default luxass({
|
|
276
|
-
|
|
277
|
-
|
|
324
|
+
vue: {
|
|
325
|
+
overrides: {
|
|
278
326
|
'vue/operator-linebreak': ['error', 'before'],
|
|
279
327
|
},
|
|
280
|
-
|
|
328
|
+
},
|
|
329
|
+
typescript: {
|
|
330
|
+
overrides: {
|
|
281
331
|
'ts/consistent-type-definitions': ['error', 'interface'],
|
|
282
332
|
},
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
333
|
+
},
|
|
334
|
+
yaml: {
|
|
335
|
+
overrides: {
|
|
336
|
+
// ...
|
|
337
|
+
},
|
|
338
|
+
},
|
|
286
339
|
})
|
|
287
340
|
```
|
|
288
341
|
|
|
342
|
+
### Pipeline
|
|
343
|
+
|
|
344
|
+
Since v4.3.0, the factory function `luxass()` returns a [pipeline object from `eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils#pipe) where you can chain the methods to compose the config even more flexibly.
|
|
345
|
+
|
|
346
|
+
```js
|
|
347
|
+
// eslint.config.js
|
|
348
|
+
import luxass from '@luxass/eslint-config'
|
|
349
|
+
|
|
350
|
+
export default luxass()
|
|
351
|
+
.prepend(
|
|
352
|
+
// some configs before the main config
|
|
353
|
+
)
|
|
354
|
+
// overrides any named configs
|
|
355
|
+
.override(
|
|
356
|
+
'luxass/imports',
|
|
357
|
+
{
|
|
358
|
+
rules: {
|
|
359
|
+
'import/order': ['error', { 'newlines-between': 'always' }],
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
// rename plugin prefixes
|
|
364
|
+
.renamePlugins({
|
|
365
|
+
'old-prefix': 'new-prefix',
|
|
366
|
+
// ...
|
|
367
|
+
})
|
|
368
|
+
// ...
|
|
369
|
+
```
|
|
370
|
+
|
|
289
371
|
### Optional Configs
|
|
290
372
|
|
|
291
373
|
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
292
374
|
|
|
293
375
|
#### Formatters
|
|
294
376
|
|
|
295
|
-
> [!WARNING]
|
|
296
|
-
> Experimental feature, changes might not follow semver.
|
|
297
|
-
|
|
298
377
|
Use external formatters to format files that ESLint cannot handle yet (`.css`, `.html`, etc). Powered by [`eslint-plugin-format`](https://github.com/antfu/eslint-plugin-format).
|
|
299
378
|
|
|
300
379
|
```js
|
|
@@ -313,11 +392,6 @@ export default luxass({
|
|
|
313
392
|
* By default uses Prettier
|
|
314
393
|
*/
|
|
315
394
|
html: true,
|
|
316
|
-
/**
|
|
317
|
-
* Format TOML files
|
|
318
|
-
* Currently only supports dprint
|
|
319
|
-
*/
|
|
320
|
-
toml: 'dprint',
|
|
321
395
|
/**
|
|
322
396
|
* Format Markdown files
|
|
323
397
|
* Supports Prettier and dprint
|
|
@@ -336,7 +410,7 @@ npm i -D eslint-plugin-format
|
|
|
336
410
|
|
|
337
411
|
#### React
|
|
338
412
|
|
|
339
|
-
To enable React support, need to explicitly turn it on:
|
|
413
|
+
To enable React support, you need to explicitly turn it on:
|
|
340
414
|
|
|
341
415
|
```js
|
|
342
416
|
// eslint.config.js
|
|
@@ -371,12 +445,31 @@ export default luxass({
|
|
|
371
445
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
372
446
|
|
|
373
447
|
```bash
|
|
374
|
-
npm i -D eslint-plugin-react eslint-plugin-react-hooks
|
|
448
|
+
npm i -D eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
#### Astro
|
|
452
|
+
|
|
453
|
+
To enable astro support, you need to explicitly turn it on:
|
|
454
|
+
|
|
455
|
+
```js
|
|
456
|
+
// eslint.config.js
|
|
457
|
+
import luxass from '@luxass/eslint-config'
|
|
458
|
+
|
|
459
|
+
export default luxass({
|
|
460
|
+
astro: true,
|
|
461
|
+
})
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
npm i -D eslint-plugin-astro
|
|
375
468
|
```
|
|
376
469
|
|
|
377
470
|
#### UnoCSS
|
|
378
471
|
|
|
379
|
-
To enable UnoCSS support, need to explicitly turn it on:
|
|
472
|
+
To enable UnoCSS support, you need to explicitly turn it on:
|
|
380
473
|
|
|
381
474
|
```js
|
|
382
475
|
// eslint.config.js
|
|
@@ -431,6 +524,55 @@ export default luxass({
|
|
|
431
524
|
})
|
|
432
525
|
```
|
|
433
526
|
|
|
527
|
+
### Editor Specific Disables
|
|
528
|
+
|
|
529
|
+
Some rules are disabled when inside ESLint IDE integrations, namely [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports) [`test/no-focused-tests`](https://github.com/veritem/eslint-plugin-vitest/blob/main/docs/rules/no-focused-tests.md)
|
|
530
|
+
|
|
531
|
+
This is to prevent unused imports from getting removed by the IDE during refactoring to get a better developer experience. Those rules will be applied when you run ESLint in the terminal or [Lint Staged](#lint-staged). If you don't want this behavior, you can disable them:
|
|
532
|
+
|
|
533
|
+
```js
|
|
534
|
+
// eslint.config.js
|
|
535
|
+
import luxass from '@luxass/eslint-config'
|
|
536
|
+
|
|
537
|
+
export default luxass({
|
|
538
|
+
editor: false
|
|
539
|
+
})
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
### Lint Staged
|
|
543
|
+
|
|
544
|
+
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:
|
|
545
|
+
|
|
546
|
+
```json
|
|
547
|
+
{
|
|
548
|
+
"simple-git-hooks": {
|
|
549
|
+
"pre-commit": "pnpm lint-staged"
|
|
550
|
+
},
|
|
551
|
+
"lint-staged": {
|
|
552
|
+
"*": "eslint --fix"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
and then
|
|
558
|
+
|
|
559
|
+
```bash
|
|
560
|
+
npm i -D lint-staged simple-git-hooks
|
|
561
|
+
|
|
562
|
+
// to active the hooks
|
|
563
|
+
npx simple-git-hooks
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
## View what rules are enabled
|
|
567
|
+
|
|
568
|
+
[Antfu](https://github.com/antfu) built a visual tool to help you view what rules are enabled in your project and apply them to what files, [@eslint/config-inspector](https://github.com/eslint/config-inspector)
|
|
569
|
+
|
|
570
|
+
Go to your project root that contains `eslint.config.js` and run:
|
|
571
|
+
|
|
572
|
+
```bash
|
|
573
|
+
npx @eslint/config-inspector
|
|
574
|
+
```
|
|
575
|
+
|
|
434
576
|
## Versioning Policy
|
|
435
577
|
|
|
436
578
|
This project follows [Semantic Versioning](https://semver.org/) for releases. However, since this is just a config and involves opinions and many moving parts, we don't treat rules changes as breaking changes.
|
package/dist/index.cjs
CHANGED
|
@@ -1673,13 +1673,13 @@ async function unocss(options = {}) {
|
|
|
1673
1673
|
return [
|
|
1674
1674
|
{
|
|
1675
1675
|
name: "luxass/unocss/setup",
|
|
1676
|
-
files,
|
|
1677
1676
|
plugins: {
|
|
1678
1677
|
unocss: pluginUnoCSS
|
|
1679
1678
|
}
|
|
1680
1679
|
},
|
|
1681
1680
|
{
|
|
1682
1681
|
name: "luxass/unocss/rules",
|
|
1682
|
+
files,
|
|
1683
1683
|
rules: {
|
|
1684
1684
|
"unocss/order": "warn",
|
|
1685
1685
|
...attributify ? {
|
|
@@ -1756,8 +1756,7 @@ async function nextjs(options = {}) {
|
|
|
1756
1756
|
name: "luxass/nextjs/default-export-override",
|
|
1757
1757
|
files: GLOB_NEXTJS_ROUTES,
|
|
1758
1758
|
rules: {
|
|
1759
|
-
"import/prefer-default-export": "error"
|
|
1760
|
-
"react-refresh/only-export-components": "off"
|
|
1759
|
+
"import/prefer-default-export": "error"
|
|
1761
1760
|
}
|
|
1762
1761
|
},
|
|
1763
1762
|
{
|
|
@@ -1767,11 +1766,7 @@ async function nextjs(options = {}) {
|
|
|
1767
1766
|
"@next/next/no-img-element": "off",
|
|
1768
1767
|
"react/no-unknown-property": ["error", {
|
|
1769
1768
|
ignore: ["tw"]
|
|
1770
|
-
}]
|
|
1771
|
-
"react-refresh/only-export-components": [
|
|
1772
|
-
"warn",
|
|
1773
|
-
{ allowConstantExport: true }
|
|
1774
|
-
]
|
|
1769
|
+
}]
|
|
1775
1770
|
}
|
|
1776
1771
|
}
|
|
1777
1772
|
];
|
|
@@ -1784,13 +1779,14 @@ async function react(options = {}) {
|
|
|
1784
1779
|
a11y = false,
|
|
1785
1780
|
files = [GLOB_JSX, GLOB_TSX],
|
|
1786
1781
|
overrides = {},
|
|
1782
|
+
refresh = true,
|
|
1787
1783
|
typescript: typescript2 = true
|
|
1788
1784
|
} = options;
|
|
1789
1785
|
await ensure([
|
|
1790
1786
|
"eslint-plugin-react",
|
|
1791
1787
|
"eslint-plugin-react-hooks",
|
|
1792
|
-
"eslint-plugin-react-refresh",
|
|
1793
|
-
...
|
|
1788
|
+
...refresh ? ["eslint-plugin-react-refresh"] : [],
|
|
1789
|
+
...a11y ? ["eslint-plugin-jsx-a11y"] : []
|
|
1794
1790
|
]);
|
|
1795
1791
|
const [
|
|
1796
1792
|
pluginReact,
|
|
@@ -1800,7 +1796,7 @@ async function react(options = {}) {
|
|
|
1800
1796
|
] = await Promise.all([
|
|
1801
1797
|
interop(import("eslint-plugin-react")),
|
|
1802
1798
|
interop(import("eslint-plugin-react-hooks")),
|
|
1803
|
-
interop(import("eslint-plugin-react-refresh")),
|
|
1799
|
+
...refresh ? [interop(import("eslint-plugin-react-refresh"))] : [],
|
|
1804
1800
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
1805
1801
|
]);
|
|
1806
1802
|
const isAllowConstantExport = (0, import_local_pkg2.isPackageExists)("vite");
|
|
@@ -1810,7 +1806,7 @@ async function react(options = {}) {
|
|
|
1810
1806
|
plugins: {
|
|
1811
1807
|
"react": pluginReact,
|
|
1812
1808
|
"react-hooks": pluginReactHooks,
|
|
1813
|
-
"react-refresh": pluginReactRefresh,
|
|
1809
|
+
...refresh ? { "react-refresh": pluginReactRefresh } : {},
|
|
1814
1810
|
...a11y ? { "jsx-a11y": pluginA11y } : {}
|
|
1815
1811
|
}
|
|
1816
1812
|
},
|
|
@@ -2039,7 +2035,9 @@ async function react(options = {}) {
|
|
|
2039
2035
|
"react-hooks/exhaustive-deps": "warn",
|
|
2040
2036
|
"react-hooks/rules-of-hooks": "error",
|
|
2041
2037
|
// react refresh
|
|
2042
|
-
|
|
2038
|
+
...refresh ? {
|
|
2039
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }]
|
|
2040
|
+
} : {},
|
|
2043
2041
|
...typescript2 ? {
|
|
2044
2042
|
"react/jsx-no-undef": "off",
|
|
2045
2043
|
"react/prop-type": "off"
|
|
@@ -2174,7 +2172,7 @@ async function tailwindcss(options = {}) {
|
|
|
2174
2172
|
}
|
|
2175
2173
|
},
|
|
2176
2174
|
plugins: {
|
|
2177
|
-
|
|
2175
|
+
tailwindcss: pluginTailwindCSS
|
|
2178
2176
|
}
|
|
2179
2177
|
},
|
|
2180
2178
|
{
|
|
@@ -2182,19 +2180,19 @@ async function tailwindcss(options = {}) {
|
|
|
2182
2180
|
files,
|
|
2183
2181
|
rules: {
|
|
2184
2182
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
|
|
2185
|
-
"
|
|
2183
|
+
"tailwindcss/classnames-order": "warn",
|
|
2186
2184
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
2187
|
-
"
|
|
2185
|
+
"tailwindcss/enforces-negative-arbitrary-values": "warn",
|
|
2188
2186
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
|
|
2189
|
-
"
|
|
2187
|
+
"tailwindcss/enforces-shorthand": "warn",
|
|
2190
2188
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
|
|
2191
|
-
"
|
|
2189
|
+
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
2192
2190
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
|
|
2193
|
-
"
|
|
2191
|
+
"tailwindcss/no-arbitrary-value": "off",
|
|
2194
2192
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
|
|
2195
|
-
"
|
|
2193
|
+
"tailwindcss/no-contradicting-classname": "error",
|
|
2196
2194
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
|
|
2197
|
-
"
|
|
2195
|
+
"tailwindcss/no-custom-classname": "warn",
|
|
2198
2196
|
...overrides
|
|
2199
2197
|
}
|
|
2200
2198
|
}
|
|
@@ -2617,8 +2615,10 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2617
2615
|
}
|
|
2618
2616
|
if (enableReact || enableNextJS) {
|
|
2619
2617
|
configs.push(react({
|
|
2618
|
+
...resolveSubOptions(options, "react"),
|
|
2620
2619
|
overrides: getOverrides(options, "react"),
|
|
2621
|
-
typescript: !!enableTypeScript
|
|
2620
|
+
typescript: !!enableTypeScript,
|
|
2621
|
+
refresh: !enableNextJS
|
|
2622
2622
|
}));
|
|
2623
2623
|
}
|
|
2624
2624
|
if (enableNextJS) {
|
package/dist/index.d.cts
CHANGED
|
@@ -3932,42 +3932,42 @@ interface RuleOptions {
|
|
|
3932
3932
|
* Enforce a consistent and logical order of the Tailwind CSS classnames
|
|
3933
3933
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md
|
|
3934
3934
|
*/
|
|
3935
|
-
'
|
|
3935
|
+
'tailwindcss/classnames-order'?: Linter.RuleEntry<TailwindcssClassnamesOrder>
|
|
3936
3936
|
/**
|
|
3937
3937
|
* Warns about dash prefixed classnames using arbitrary values
|
|
3938
3938
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
3939
3939
|
*/
|
|
3940
|
-
'
|
|
3940
|
+
'tailwindcss/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TailwindcssEnforcesNegativeArbitraryValues>
|
|
3941
3941
|
/**
|
|
3942
3942
|
* Enforces the usage of shorthand Tailwind CSS classnames
|
|
3943
3943
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md
|
|
3944
3944
|
*/
|
|
3945
|
-
'
|
|
3945
|
+
'tailwindcss/enforces-shorthand'?: Linter.RuleEntry<TailwindcssEnforcesShorthand>
|
|
3946
3946
|
/**
|
|
3947
3947
|
* Detect obsolete classnames when upgrading to Tailwind CSS v3
|
|
3948
3948
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md
|
|
3949
3949
|
*/
|
|
3950
|
-
'
|
|
3950
|
+
'tailwindcss/migration-from-tailwind-2'?: Linter.RuleEntry<TailwindcssMigrationFromTailwind2>
|
|
3951
3951
|
/**
|
|
3952
3952
|
* Forbid using arbitrary values in classnames
|
|
3953
3953
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md
|
|
3954
3954
|
*/
|
|
3955
|
-
'
|
|
3955
|
+
'tailwindcss/no-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoArbitraryValue>
|
|
3956
3956
|
/**
|
|
3957
3957
|
* Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5")
|
|
3958
3958
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md
|
|
3959
3959
|
*/
|
|
3960
|
-
'
|
|
3960
|
+
'tailwindcss/no-contradicting-classname'?: Linter.RuleEntry<TailwindcssNoContradictingClassname>
|
|
3961
3961
|
/**
|
|
3962
3962
|
* Detect classnames which do not belong to Tailwind CSS
|
|
3963
3963
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md
|
|
3964
3964
|
*/
|
|
3965
|
-
'
|
|
3965
|
+
'tailwindcss/no-custom-classname'?: Linter.RuleEntry<TailwindcssNoCustomClassname>
|
|
3966
3966
|
/**
|
|
3967
3967
|
* Forbid using arbitrary values in classnames when an equivalent preset exists
|
|
3968
3968
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md
|
|
3969
3969
|
*/
|
|
3970
|
-
'
|
|
3970
|
+
'tailwindcss/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoUnnecessaryArbitraryValue>
|
|
3971
3971
|
/**
|
|
3972
3972
|
* Require or disallow spacing around embedded expressions of template strings
|
|
3973
3973
|
* @see https://eslint.org/docs/latest/rules/template-curly-spacing
|
|
@@ -11253,8 +11253,8 @@ type SwitchColonSpacing = []|[{
|
|
|
11253
11253
|
before?: boolean
|
|
11254
11254
|
after?: boolean
|
|
11255
11255
|
}]
|
|
11256
|
-
// -----
|
|
11257
|
-
type
|
|
11256
|
+
// ----- tailwindcss/classnames-order -----
|
|
11257
|
+
type TailwindcssClassnamesOrder = []|[{
|
|
11258
11258
|
callees?: string[]
|
|
11259
11259
|
ignoredKeys?: string[]
|
|
11260
11260
|
config?: (string | {
|
|
@@ -11264,8 +11264,8 @@ type TailwindClassnamesOrder = []|[{
|
|
|
11264
11264
|
tags?: string[]
|
|
11265
11265
|
[k: string]: unknown | undefined
|
|
11266
11266
|
}]
|
|
11267
|
-
// -----
|
|
11268
|
-
type
|
|
11267
|
+
// ----- tailwindcss/enforces-negative-arbitrary-values -----
|
|
11268
|
+
type TailwindcssEnforcesNegativeArbitraryValues = []|[{
|
|
11269
11269
|
callees?: string[]
|
|
11270
11270
|
ignoredKeys?: string[]
|
|
11271
11271
|
config?: (string | {
|
|
@@ -11274,8 +11274,8 @@ type TailwindEnforcesNegativeArbitraryValues = []|[{
|
|
|
11274
11274
|
tags?: string[]
|
|
11275
11275
|
[k: string]: unknown | undefined
|
|
11276
11276
|
}]
|
|
11277
|
-
// -----
|
|
11278
|
-
type
|
|
11277
|
+
// ----- tailwindcss/enforces-shorthand -----
|
|
11278
|
+
type TailwindcssEnforcesShorthand = []|[{
|
|
11279
11279
|
callees?: string[]
|
|
11280
11280
|
ignoredKeys?: string[]
|
|
11281
11281
|
config?: (string | {
|
|
@@ -11284,8 +11284,8 @@ type TailwindEnforcesShorthand = []|[{
|
|
|
11284
11284
|
tags?: string[]
|
|
11285
11285
|
[k: string]: unknown | undefined
|
|
11286
11286
|
}]
|
|
11287
|
-
// -----
|
|
11288
|
-
type
|
|
11287
|
+
// ----- tailwindcss/migration-from-tailwind-2 -----
|
|
11288
|
+
type TailwindcssMigrationFromTailwind2 = []|[{
|
|
11289
11289
|
callees?: string[]
|
|
11290
11290
|
ignoredKeys?: string[]
|
|
11291
11291
|
config?: (string | {
|
|
@@ -11294,8 +11294,8 @@ type TailwindMigrationFromTailwind2 = []|[{
|
|
|
11294
11294
|
tags?: string[]
|
|
11295
11295
|
[k: string]: unknown | undefined
|
|
11296
11296
|
}]
|
|
11297
|
-
// -----
|
|
11298
|
-
type
|
|
11297
|
+
// ----- tailwindcss/no-arbitrary-value -----
|
|
11298
|
+
type TailwindcssNoArbitraryValue = []|[{
|
|
11299
11299
|
callees?: string[]
|
|
11300
11300
|
ignoredKeys?: string[]
|
|
11301
11301
|
config?: (string | {
|
|
@@ -11304,8 +11304,8 @@ type TailwindNoArbitraryValue = []|[{
|
|
|
11304
11304
|
tags?: string[]
|
|
11305
11305
|
[k: string]: unknown | undefined
|
|
11306
11306
|
}]
|
|
11307
|
-
// -----
|
|
11308
|
-
type
|
|
11307
|
+
// ----- tailwindcss/no-contradicting-classname -----
|
|
11308
|
+
type TailwindcssNoContradictingClassname = []|[{
|
|
11309
11309
|
callees?: string[]
|
|
11310
11310
|
ignoredKeys?: string[]
|
|
11311
11311
|
config?: (string | {
|
|
@@ -11314,8 +11314,8 @@ type TailwindNoContradictingClassname = []|[{
|
|
|
11314
11314
|
tags?: string[]
|
|
11315
11315
|
[k: string]: unknown | undefined
|
|
11316
11316
|
}]
|
|
11317
|
-
// -----
|
|
11318
|
-
type
|
|
11317
|
+
// ----- tailwindcss/no-custom-classname -----
|
|
11318
|
+
type TailwindcssNoCustomClassname = []|[{
|
|
11319
11319
|
callees?: string[]
|
|
11320
11320
|
ignoredKeys?: string[]
|
|
11321
11321
|
config?: (string | {
|
|
@@ -11327,8 +11327,8 @@ type TailwindNoCustomClassname = []|[{
|
|
|
11327
11327
|
whitelist?: string[]
|
|
11328
11328
|
[k: string]: unknown | undefined
|
|
11329
11329
|
}]
|
|
11330
|
-
// -----
|
|
11331
|
-
type
|
|
11330
|
+
// ----- tailwindcss/no-unnecessary-arbitrary-value -----
|
|
11331
|
+
type TailwindcssNoUnnecessaryArbitraryValue = []|[{
|
|
11332
11332
|
callees?: string[]
|
|
11333
11333
|
ignoredKeys?: string[]
|
|
11334
11334
|
config?: (string | {
|
|
@@ -14946,6 +14946,15 @@ interface ReactOptions {
|
|
|
14946
14946
|
* @default false
|
|
14947
14947
|
*/
|
|
14948
14948
|
a11y?: boolean;
|
|
14949
|
+
/**
|
|
14950
|
+
* Enable React Refresh support.
|
|
14951
|
+
*
|
|
14952
|
+
* NOTE:
|
|
14953
|
+
* If you are using NextJS, you should disable this option.
|
|
14954
|
+
*
|
|
14955
|
+
* @default true
|
|
14956
|
+
*/
|
|
14957
|
+
refresh?: boolean;
|
|
14949
14958
|
/**
|
|
14950
14959
|
* Glob patterns for JSX & TSX files.
|
|
14951
14960
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -3932,42 +3932,42 @@ interface RuleOptions {
|
|
|
3932
3932
|
* Enforce a consistent and logical order of the Tailwind CSS classnames
|
|
3933
3933
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md
|
|
3934
3934
|
*/
|
|
3935
|
-
'
|
|
3935
|
+
'tailwindcss/classnames-order'?: Linter.RuleEntry<TailwindcssClassnamesOrder>
|
|
3936
3936
|
/**
|
|
3937
3937
|
* Warns about dash prefixed classnames using arbitrary values
|
|
3938
3938
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
3939
3939
|
*/
|
|
3940
|
-
'
|
|
3940
|
+
'tailwindcss/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TailwindcssEnforcesNegativeArbitraryValues>
|
|
3941
3941
|
/**
|
|
3942
3942
|
* Enforces the usage of shorthand Tailwind CSS classnames
|
|
3943
3943
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md
|
|
3944
3944
|
*/
|
|
3945
|
-
'
|
|
3945
|
+
'tailwindcss/enforces-shorthand'?: Linter.RuleEntry<TailwindcssEnforcesShorthand>
|
|
3946
3946
|
/**
|
|
3947
3947
|
* Detect obsolete classnames when upgrading to Tailwind CSS v3
|
|
3948
3948
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md
|
|
3949
3949
|
*/
|
|
3950
|
-
'
|
|
3950
|
+
'tailwindcss/migration-from-tailwind-2'?: Linter.RuleEntry<TailwindcssMigrationFromTailwind2>
|
|
3951
3951
|
/**
|
|
3952
3952
|
* Forbid using arbitrary values in classnames
|
|
3953
3953
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md
|
|
3954
3954
|
*/
|
|
3955
|
-
'
|
|
3955
|
+
'tailwindcss/no-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoArbitraryValue>
|
|
3956
3956
|
/**
|
|
3957
3957
|
* Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5")
|
|
3958
3958
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md
|
|
3959
3959
|
*/
|
|
3960
|
-
'
|
|
3960
|
+
'tailwindcss/no-contradicting-classname'?: Linter.RuleEntry<TailwindcssNoContradictingClassname>
|
|
3961
3961
|
/**
|
|
3962
3962
|
* Detect classnames which do not belong to Tailwind CSS
|
|
3963
3963
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md
|
|
3964
3964
|
*/
|
|
3965
|
-
'
|
|
3965
|
+
'tailwindcss/no-custom-classname'?: Linter.RuleEntry<TailwindcssNoCustomClassname>
|
|
3966
3966
|
/**
|
|
3967
3967
|
* Forbid using arbitrary values in classnames when an equivalent preset exists
|
|
3968
3968
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md
|
|
3969
3969
|
*/
|
|
3970
|
-
'
|
|
3970
|
+
'tailwindcss/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TailwindcssNoUnnecessaryArbitraryValue>
|
|
3971
3971
|
/**
|
|
3972
3972
|
* Require or disallow spacing around embedded expressions of template strings
|
|
3973
3973
|
* @see https://eslint.org/docs/latest/rules/template-curly-spacing
|
|
@@ -11253,8 +11253,8 @@ type SwitchColonSpacing = []|[{
|
|
|
11253
11253
|
before?: boolean
|
|
11254
11254
|
after?: boolean
|
|
11255
11255
|
}]
|
|
11256
|
-
// -----
|
|
11257
|
-
type
|
|
11256
|
+
// ----- tailwindcss/classnames-order -----
|
|
11257
|
+
type TailwindcssClassnamesOrder = []|[{
|
|
11258
11258
|
callees?: string[]
|
|
11259
11259
|
ignoredKeys?: string[]
|
|
11260
11260
|
config?: (string | {
|
|
@@ -11264,8 +11264,8 @@ type TailwindClassnamesOrder = []|[{
|
|
|
11264
11264
|
tags?: string[]
|
|
11265
11265
|
[k: string]: unknown | undefined
|
|
11266
11266
|
}]
|
|
11267
|
-
// -----
|
|
11268
|
-
type
|
|
11267
|
+
// ----- tailwindcss/enforces-negative-arbitrary-values -----
|
|
11268
|
+
type TailwindcssEnforcesNegativeArbitraryValues = []|[{
|
|
11269
11269
|
callees?: string[]
|
|
11270
11270
|
ignoredKeys?: string[]
|
|
11271
11271
|
config?: (string | {
|
|
@@ -11274,8 +11274,8 @@ type TailwindEnforcesNegativeArbitraryValues = []|[{
|
|
|
11274
11274
|
tags?: string[]
|
|
11275
11275
|
[k: string]: unknown | undefined
|
|
11276
11276
|
}]
|
|
11277
|
-
// -----
|
|
11278
|
-
type
|
|
11277
|
+
// ----- tailwindcss/enforces-shorthand -----
|
|
11278
|
+
type TailwindcssEnforcesShorthand = []|[{
|
|
11279
11279
|
callees?: string[]
|
|
11280
11280
|
ignoredKeys?: string[]
|
|
11281
11281
|
config?: (string | {
|
|
@@ -11284,8 +11284,8 @@ type TailwindEnforcesShorthand = []|[{
|
|
|
11284
11284
|
tags?: string[]
|
|
11285
11285
|
[k: string]: unknown | undefined
|
|
11286
11286
|
}]
|
|
11287
|
-
// -----
|
|
11288
|
-
type
|
|
11287
|
+
// ----- tailwindcss/migration-from-tailwind-2 -----
|
|
11288
|
+
type TailwindcssMigrationFromTailwind2 = []|[{
|
|
11289
11289
|
callees?: string[]
|
|
11290
11290
|
ignoredKeys?: string[]
|
|
11291
11291
|
config?: (string | {
|
|
@@ -11294,8 +11294,8 @@ type TailwindMigrationFromTailwind2 = []|[{
|
|
|
11294
11294
|
tags?: string[]
|
|
11295
11295
|
[k: string]: unknown | undefined
|
|
11296
11296
|
}]
|
|
11297
|
-
// -----
|
|
11298
|
-
type
|
|
11297
|
+
// ----- tailwindcss/no-arbitrary-value -----
|
|
11298
|
+
type TailwindcssNoArbitraryValue = []|[{
|
|
11299
11299
|
callees?: string[]
|
|
11300
11300
|
ignoredKeys?: string[]
|
|
11301
11301
|
config?: (string | {
|
|
@@ -11304,8 +11304,8 @@ type TailwindNoArbitraryValue = []|[{
|
|
|
11304
11304
|
tags?: string[]
|
|
11305
11305
|
[k: string]: unknown | undefined
|
|
11306
11306
|
}]
|
|
11307
|
-
// -----
|
|
11308
|
-
type
|
|
11307
|
+
// ----- tailwindcss/no-contradicting-classname -----
|
|
11308
|
+
type TailwindcssNoContradictingClassname = []|[{
|
|
11309
11309
|
callees?: string[]
|
|
11310
11310
|
ignoredKeys?: string[]
|
|
11311
11311
|
config?: (string | {
|
|
@@ -11314,8 +11314,8 @@ type TailwindNoContradictingClassname = []|[{
|
|
|
11314
11314
|
tags?: string[]
|
|
11315
11315
|
[k: string]: unknown | undefined
|
|
11316
11316
|
}]
|
|
11317
|
-
// -----
|
|
11318
|
-
type
|
|
11317
|
+
// ----- tailwindcss/no-custom-classname -----
|
|
11318
|
+
type TailwindcssNoCustomClassname = []|[{
|
|
11319
11319
|
callees?: string[]
|
|
11320
11320
|
ignoredKeys?: string[]
|
|
11321
11321
|
config?: (string | {
|
|
@@ -11327,8 +11327,8 @@ type TailwindNoCustomClassname = []|[{
|
|
|
11327
11327
|
whitelist?: string[]
|
|
11328
11328
|
[k: string]: unknown | undefined
|
|
11329
11329
|
}]
|
|
11330
|
-
// -----
|
|
11331
|
-
type
|
|
11330
|
+
// ----- tailwindcss/no-unnecessary-arbitrary-value -----
|
|
11331
|
+
type TailwindcssNoUnnecessaryArbitraryValue = []|[{
|
|
11332
11332
|
callees?: string[]
|
|
11333
11333
|
ignoredKeys?: string[]
|
|
11334
11334
|
config?: (string | {
|
|
@@ -14946,6 +14946,15 @@ interface ReactOptions {
|
|
|
14946
14946
|
* @default false
|
|
14947
14947
|
*/
|
|
14948
14948
|
a11y?: boolean;
|
|
14949
|
+
/**
|
|
14950
|
+
* Enable React Refresh support.
|
|
14951
|
+
*
|
|
14952
|
+
* NOTE:
|
|
14953
|
+
* If you are using NextJS, you should disable this option.
|
|
14954
|
+
*
|
|
14955
|
+
* @default true
|
|
14956
|
+
*/
|
|
14957
|
+
refresh?: boolean;
|
|
14949
14958
|
/**
|
|
14950
14959
|
* Glob patterns for JSX & TSX files.
|
|
14951
14960
|
*
|
package/dist/index.js
CHANGED
|
@@ -1578,13 +1578,13 @@ async function unocss(options = {}) {
|
|
|
1578
1578
|
return [
|
|
1579
1579
|
{
|
|
1580
1580
|
name: "luxass/unocss/setup",
|
|
1581
|
-
files,
|
|
1582
1581
|
plugins: {
|
|
1583
1582
|
unocss: pluginUnoCSS
|
|
1584
1583
|
}
|
|
1585
1584
|
},
|
|
1586
1585
|
{
|
|
1587
1586
|
name: "luxass/unocss/rules",
|
|
1587
|
+
files,
|
|
1588
1588
|
rules: {
|
|
1589
1589
|
"unocss/order": "warn",
|
|
1590
1590
|
...attributify ? {
|
|
@@ -1661,8 +1661,7 @@ async function nextjs(options = {}) {
|
|
|
1661
1661
|
name: "luxass/nextjs/default-export-override",
|
|
1662
1662
|
files: GLOB_NEXTJS_ROUTES,
|
|
1663
1663
|
rules: {
|
|
1664
|
-
"import/prefer-default-export": "error"
|
|
1665
|
-
"react-refresh/only-export-components": "off"
|
|
1664
|
+
"import/prefer-default-export": "error"
|
|
1666
1665
|
}
|
|
1667
1666
|
},
|
|
1668
1667
|
{
|
|
@@ -1672,11 +1671,7 @@ async function nextjs(options = {}) {
|
|
|
1672
1671
|
"@next/next/no-img-element": "off",
|
|
1673
1672
|
"react/no-unknown-property": ["error", {
|
|
1674
1673
|
ignore: ["tw"]
|
|
1675
|
-
}]
|
|
1676
|
-
"react-refresh/only-export-components": [
|
|
1677
|
-
"warn",
|
|
1678
|
-
{ allowConstantExport: true }
|
|
1679
|
-
]
|
|
1674
|
+
}]
|
|
1680
1675
|
}
|
|
1681
1676
|
}
|
|
1682
1677
|
];
|
|
@@ -1689,13 +1684,14 @@ async function react(options = {}) {
|
|
|
1689
1684
|
a11y = false,
|
|
1690
1685
|
files = [GLOB_JSX, GLOB_TSX],
|
|
1691
1686
|
overrides = {},
|
|
1687
|
+
refresh = true,
|
|
1692
1688
|
typescript: typescript2 = true
|
|
1693
1689
|
} = options;
|
|
1694
1690
|
await ensure([
|
|
1695
1691
|
"eslint-plugin-react",
|
|
1696
1692
|
"eslint-plugin-react-hooks",
|
|
1697
|
-
"eslint-plugin-react-refresh",
|
|
1698
|
-
...
|
|
1693
|
+
...refresh ? ["eslint-plugin-react-refresh"] : [],
|
|
1694
|
+
...a11y ? ["eslint-plugin-jsx-a11y"] : []
|
|
1699
1695
|
]);
|
|
1700
1696
|
const [
|
|
1701
1697
|
pluginReact,
|
|
@@ -1705,7 +1701,7 @@ async function react(options = {}) {
|
|
|
1705
1701
|
] = await Promise.all([
|
|
1706
1702
|
interop(import("eslint-plugin-react")),
|
|
1707
1703
|
interop(import("eslint-plugin-react-hooks")),
|
|
1708
|
-
interop(import("eslint-plugin-react-refresh")),
|
|
1704
|
+
...refresh ? [interop(import("eslint-plugin-react-refresh"))] : [],
|
|
1709
1705
|
...a11y ? [interop(import("eslint-plugin-jsx-a11y"))] : []
|
|
1710
1706
|
]);
|
|
1711
1707
|
const isAllowConstantExport = isPackageExists2("vite");
|
|
@@ -1715,7 +1711,7 @@ async function react(options = {}) {
|
|
|
1715
1711
|
plugins: {
|
|
1716
1712
|
"react": pluginReact,
|
|
1717
1713
|
"react-hooks": pluginReactHooks,
|
|
1718
|
-
"react-refresh": pluginReactRefresh,
|
|
1714
|
+
...refresh ? { "react-refresh": pluginReactRefresh } : {},
|
|
1719
1715
|
...a11y ? { "jsx-a11y": pluginA11y } : {}
|
|
1720
1716
|
}
|
|
1721
1717
|
},
|
|
@@ -1944,7 +1940,9 @@ async function react(options = {}) {
|
|
|
1944
1940
|
"react-hooks/exhaustive-deps": "warn",
|
|
1945
1941
|
"react-hooks/rules-of-hooks": "error",
|
|
1946
1942
|
// react refresh
|
|
1947
|
-
|
|
1943
|
+
...refresh ? {
|
|
1944
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: isAllowConstantExport }]
|
|
1945
|
+
} : {},
|
|
1948
1946
|
...typescript2 ? {
|
|
1949
1947
|
"react/jsx-no-undef": "off",
|
|
1950
1948
|
"react/prop-type": "off"
|
|
@@ -2079,7 +2077,7 @@ async function tailwindcss(options = {}) {
|
|
|
2079
2077
|
}
|
|
2080
2078
|
},
|
|
2081
2079
|
plugins: {
|
|
2082
|
-
|
|
2080
|
+
tailwindcss: pluginTailwindCSS
|
|
2083
2081
|
}
|
|
2084
2082
|
},
|
|
2085
2083
|
{
|
|
@@ -2087,19 +2085,19 @@ async function tailwindcss(options = {}) {
|
|
|
2087
2085
|
files,
|
|
2088
2086
|
rules: {
|
|
2089
2087
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/classnames-order.md
|
|
2090
|
-
"
|
|
2088
|
+
"tailwindcss/classnames-order": "warn",
|
|
2091
2089
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
2092
|
-
"
|
|
2090
|
+
"tailwindcss/enforces-negative-arbitrary-values": "warn",
|
|
2093
2091
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/enforces-shorthand.md
|
|
2094
|
-
"
|
|
2092
|
+
"tailwindcss/enforces-shorthand": "warn",
|
|
2095
2093
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/migration-from-tailwind-2.md
|
|
2096
|
-
"
|
|
2094
|
+
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
2097
2095
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-arbitrary-value.md
|
|
2098
|
-
"
|
|
2096
|
+
"tailwindcss/no-arbitrary-value": "off",
|
|
2099
2097
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-contradicting-classname.md
|
|
2100
|
-
"
|
|
2098
|
+
"tailwindcss/no-contradicting-classname": "error",
|
|
2101
2099
|
// https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/docs/rules/no-custom-classname.md
|
|
2102
|
-
"
|
|
2100
|
+
"tailwindcss/no-custom-classname": "warn",
|
|
2103
2101
|
...overrides
|
|
2104
2102
|
}
|
|
2105
2103
|
}
|
|
@@ -2522,8 +2520,10 @@ function luxass(options = {}, ...userConfigs) {
|
|
|
2522
2520
|
}
|
|
2523
2521
|
if (enableReact || enableNextJS) {
|
|
2524
2522
|
configs.push(react({
|
|
2523
|
+
...resolveSubOptions(options, "react"),
|
|
2525
2524
|
overrides: getOverrides(options, "react"),
|
|
2526
|
-
typescript: !!enableTypeScript
|
|
2525
|
+
typescript: !!enableTypeScript,
|
|
2526
|
+
refresh: !enableNextJS
|
|
2527
2527
|
}));
|
|
2528
2528
|
}
|
|
2529
2529
|
if (enableNextJS) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luxass/eslint-config",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.7",
|
|
4
4
|
"description": "ESLint config for @luxass",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@stylistic/eslint-plugin-migrate": "^1.7.0",
|
|
137
137
|
"@types/eslint": "^8.56.7",
|
|
138
138
|
"@types/estree": "^1.0.5",
|
|
139
|
-
"@types/node": "^
|
|
139
|
+
"@types/node": "^20.12.5",
|
|
140
140
|
"@typescript-eslint/rule-tester": "^7.5.0",
|
|
141
141
|
"@unocss/eslint-plugin": "^0.59.0",
|
|
142
142
|
"astro-eslint-parser": "^0.17.0",
|