@infernodesign/eslint-config 1.16.0 → 1.17.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 +159 -106
- package/dist/cli.js +20 -7
- package/dist/constants-DjBrEP6N.js +5 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +238 -113
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @infernodesign/eslint-config
|
|
2
2
|
|
|
3
|
-
Shared ESLint flat config presets for Inferno Design projects.
|
|
3
|
+
Shared ESLint flat config presets for Inferno Design projects. Orignally forked from [Antfu's eslint-config](https://github.com/antfu/eslint-config).
|
|
4
4
|
|
|
5
5
|
- Autofix for formatting (aimed to be used standalone **without** Prettier)
|
|
6
6
|
- Reasonable best practices and only one line of config.
|
|
7
7
|
- Designed to work with TypeScript, JSX, Vue, JSON, YAML, Toml, Markdown, etc. Out-of-box.
|
|
8
8
|
- Uses the [ESLint Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) for easy compilation.
|
|
9
|
-
- Optional [React](#react), [Next.js](#nextjs), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Solid](#solid) support.
|
|
9
|
+
- Optional [React](#react), [Next.js](#nextjs), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro), [Storybook](#storybook), [Solid](#solid) support, [TailwindCSS](#tailwindcss) support.
|
|
10
10
|
- Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc.
|
|
11
11
|
- **Style principle**: Minimal for reading, stable for diff, consistent
|
|
12
12
|
- Sorted imports, dangling commas
|
|
@@ -22,7 +22,7 @@ Shared ESLint flat config presets for Inferno Design projects.
|
|
|
22
22
|
We provided a CLI tool to help you set up your project, or migrate from the legacy config to the new flat config with one command.
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
25
|
+
npx @infernodesign/eslint-config@latest
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
### Manual Install
|
|
@@ -30,16 +30,16 @@ bunx @infernodesign/eslint-config@latest
|
|
|
30
30
|
If you prefer to set up manually:
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
|
|
33
|
+
npm i -D eslint @infernodesign/eslint-config
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
And create `eslint.config.mjs` in your project root:
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
39
|
// eslint.config.mjs
|
|
40
|
-
import {
|
|
40
|
+
import { config } from '@infernodesign/eslint-config'
|
|
41
41
|
|
|
42
|
-
export default
|
|
42
|
+
export default config()
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
<details>
|
|
@@ -52,11 +52,11 @@ If you still use some configs from the legacy eslintrc format, you can use the [
|
|
|
52
52
|
```js
|
|
53
53
|
// eslint.config.mjs
|
|
54
54
|
import { FlatCompat } from '@eslint/eslintrc'
|
|
55
|
-
import {
|
|
55
|
+
import { config } from '@infernodesign/eslint-config'
|
|
56
56
|
|
|
57
57
|
const compat = new FlatCompat()
|
|
58
58
|
|
|
59
|
-
export default
|
|
59
|
+
export default config(
|
|
60
60
|
{
|
|
61
61
|
ignores: [],
|
|
62
62
|
},
|
|
@@ -159,18 +159,18 @@ Normally you only need to import the `antfu` preset:
|
|
|
159
159
|
|
|
160
160
|
```js
|
|
161
161
|
// eslint.config.js
|
|
162
|
-
import {
|
|
162
|
+
import { config } from '@infernodesign/eslint-config'
|
|
163
163
|
|
|
164
|
-
export default
|
|
164
|
+
export default config()
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
And that's it! Or you can configure each integration individually, for example:
|
|
168
168
|
|
|
169
169
|
```js
|
|
170
170
|
// eslint.config.js
|
|
171
|
-
import {
|
|
171
|
+
import { config } from '@infernodesign/eslint-config'
|
|
172
172
|
|
|
173
|
-
export default
|
|
173
|
+
export default config( {
|
|
174
174
|
// Type of the project. 'lib' for libraries, the default is 'app'
|
|
175
175
|
type: 'lib',
|
|
176
176
|
|
|
@@ -212,9 +212,9 @@ The `antfu` factory function also accepts any number of arbitrary custom config
|
|
|
212
212
|
|
|
213
213
|
```js
|
|
214
214
|
// eslint.config.js
|
|
215
|
-
import {
|
|
215
|
+
import { config } from '@infernodesign/eslint-config'
|
|
216
216
|
|
|
217
|
-
export default
|
|
217
|
+
export default config(
|
|
218
218
|
{
|
|
219
219
|
// Configures for antfu's config
|
|
220
220
|
},
|
|
@@ -292,17 +292,20 @@ Check out the [configs](https://github.com/antfu/eslint-config/blob/main/src/con
|
|
|
292
292
|
|
|
293
293
|
Since flat config requires us to explicitly provide the plugin names (instead of the mandatory convention from npm package name), we renamed some plugins to make the overall scope more consistent and easier to write.
|
|
294
294
|
|
|
295
|
-
| New Prefix
|
|
296
|
-
|
|
|
297
|
-
| `import
|
|
298
|
-
| `nextjs
|
|
299
|
-
| `node
|
|
300
|
-
| `
|
|
301
|
-
| `
|
|
302
|
-
| `
|
|
303
|
-
| `
|
|
304
|
-
| `
|
|
305
|
-
| `
|
|
295
|
+
| New Prefix | Original Prefix | Source Plugin |
|
|
296
|
+
| ------------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
297
|
+
| `import` | `import-lite` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
|
|
298
|
+
| `nextjs` | `@next/next` | [@next/eslint-plugin-next](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next) |
|
|
299
|
+
| `node` | `n` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
|
|
300
|
+
| `react` | `@eslint-react` | [@eslint-react/eslint-plugin](https://github.com/eslint-react/eslint-plugin) |
|
|
301
|
+
| `react-dom` | `@eslint-react/dom` | [@eslint-react/eslint-plugin](https://github.com/eslint-react/eslint-plugin) |
|
|
302
|
+
| `react-hooks-extra` | `@eslint-react/hooks-extra` | [@eslint-react/eslint-plugin](https://github.com/eslint-react/eslint-plugin) |
|
|
303
|
+
| `react-naming-convention` | `@eslint-react/naming-convention` | [@eslint-react/eslint-plugin](https://github.com/eslint-react/eslint-plugin) |
|
|
304
|
+
| `style` | `@stylistic` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
305
|
+
| `tailwindcss/*` | `better-tailwindcss/*` | [eslint-plugin-better-tailwindcss](https://github.com/unjs/eslint-plugin-better-tailwindcss) |
|
|
306
|
+
| `test` | `vitest` | [@vitest/eslint-plugin](https://github.com/vitest-dev/eslint-plugin-vitest) |
|
|
307
|
+
| `ts` | `@typescript-eslint` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
308
|
+
| `yaml` | `yml` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
|
|
306
309
|
|
|
307
310
|
When you want to override rules, or disable them inline, you need to update to the new prefix:
|
|
308
311
|
|
|
@@ -317,9 +320,9 @@ type foo = { bar: 2 }
|
|
|
317
320
|
If you really want to use the original prefix, you can revert the plugin renaming by:
|
|
318
321
|
|
|
319
322
|
```ts
|
|
320
|
-
import {
|
|
323
|
+
import { config } from '@infernodesign/eslint-config'
|
|
321
324
|
|
|
322
|
-
export default
|
|
325
|
+
export default config()
|
|
323
326
|
.renamePlugins( {
|
|
324
327
|
node: 'n',
|
|
325
328
|
ts: '@typescript-eslint',
|
|
@@ -334,9 +337,9 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
|
|
|
334
337
|
|
|
335
338
|
```js
|
|
336
339
|
// eslint.config.js
|
|
337
|
-
import {
|
|
340
|
+
import { config } from '@infernodesign/eslint-config'
|
|
338
341
|
|
|
339
|
-
export default
|
|
342
|
+
export default config(
|
|
340
343
|
{
|
|
341
344
|
typescript: true,
|
|
342
345
|
vue: true
|
|
@@ -361,9 +364,9 @@ We also provided the `overrides` options in each integration to make it easier:
|
|
|
361
364
|
|
|
362
365
|
```js
|
|
363
366
|
// eslint.config.js
|
|
364
|
-
import {
|
|
367
|
+
import { config } from '@infernodesign/eslint-config'
|
|
365
368
|
|
|
366
|
-
export default
|
|
369
|
+
export default config( {
|
|
367
370
|
typescript: {
|
|
368
371
|
overrides: {
|
|
369
372
|
'ts/consistent-type-definitions': [ 'error', 'interface' ],
|
|
@@ -384,19 +387,19 @@ export default inferno( {
|
|
|
384
387
|
|
|
385
388
|
### Config Composer
|
|
386
389
|
|
|
387
|
-
Since v2.10.0, the factory function `
|
|
390
|
+
Since v2.10.0, the factory function `config()` returns a [`FlatConfigComposer` object from `eslint-flat-config-utils`](https://github.com/antfu/eslint-flat-config-utils#composer) where you can chain the methods to compose the config even more flexibly.
|
|
388
391
|
|
|
389
392
|
```js
|
|
390
393
|
// eslint.config.js
|
|
391
|
-
import {
|
|
394
|
+
import { config } from '@infernodesign/eslint-config'
|
|
392
395
|
|
|
393
|
-
export default
|
|
396
|
+
export default config()
|
|
394
397
|
.prepend(
|
|
395
398
|
// some configs before the main config
|
|
396
399
|
)
|
|
397
400
|
// overrides any named configs
|
|
398
401
|
.override(
|
|
399
|
-
'
|
|
402
|
+
'config/stylistic/rules',
|
|
400
403
|
{
|
|
401
404
|
rules: {
|
|
402
405
|
'style/generator-star-spacing': [ 'error', { after: true, before: false } ],
|
|
@@ -411,70 +414,38 @@ export default inferno()
|
|
|
411
414
|
// ...
|
|
412
415
|
```
|
|
413
416
|
|
|
414
|
-
###
|
|
415
|
-
|
|
416
|
-
Vue support is detected automatically by checking if `vue` is installed in your project. You can also explicitly enable/disable it:
|
|
417
|
-
|
|
418
|
-
```js
|
|
419
|
-
// eslint.config.js
|
|
420
|
-
import { inferno } from '@infernodesign/eslint-config'
|
|
421
|
-
|
|
422
|
-
export default inferno( {
|
|
423
|
-
vue: true
|
|
424
|
-
} )
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
#### Vue 2
|
|
428
|
-
|
|
429
|
-
We have limited support for Vue 2 (as it's already [reached EOL](https://v2.vuejs.org/eol/)). If you are still using Vue 2, you can configure it manually by setting `vueVersion` to `2`:
|
|
430
|
-
|
|
431
|
-
```js
|
|
432
|
-
// eslint.config.js
|
|
433
|
-
import { inferno } from '@infernodesign/eslint-config'
|
|
434
|
-
|
|
435
|
-
export default inferno( {
|
|
436
|
-
vue: {
|
|
437
|
-
vueVersion: 2
|
|
438
|
-
},
|
|
439
|
-
} )
|
|
440
|
-
```
|
|
417
|
+
### Optional Configs
|
|
441
418
|
|
|
442
|
-
|
|
419
|
+
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
443
420
|
|
|
444
|
-
####
|
|
421
|
+
#### Astro
|
|
445
422
|
|
|
446
|
-
To enable
|
|
423
|
+
To enable astro support, you need to explicitly turn it on:
|
|
447
424
|
|
|
448
425
|
```js
|
|
449
426
|
// eslint.config.js
|
|
450
|
-
import {
|
|
427
|
+
import { config } from '@infernodesign/eslint-config'
|
|
451
428
|
|
|
452
|
-
export default
|
|
453
|
-
|
|
454
|
-
a11y: true
|
|
455
|
-
},
|
|
429
|
+
export default config( {
|
|
430
|
+
astro: true,
|
|
456
431
|
} )
|
|
457
432
|
```
|
|
458
433
|
|
|
459
434
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
460
435
|
|
|
461
436
|
```bash
|
|
462
|
-
npm i -D eslint-plugin-
|
|
437
|
+
npm i -D eslint-plugin-astro
|
|
463
438
|
```
|
|
464
439
|
|
|
465
|
-
### Optional Configs
|
|
466
|
-
|
|
467
|
-
We provide some optional configs for specific use cases, that we don't include their dependencies by default.
|
|
468
|
-
|
|
469
440
|
#### Formatters
|
|
470
441
|
|
|
471
442
|
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).
|
|
472
443
|
|
|
473
444
|
```js
|
|
474
445
|
// eslint.config.js
|
|
475
|
-
import {
|
|
446
|
+
import { config } from '@infernodesign/eslint-config'
|
|
476
447
|
|
|
477
|
-
export default
|
|
448
|
+
export default config( {
|
|
478
449
|
formatters: {
|
|
479
450
|
/**
|
|
480
451
|
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
|
|
@@ -508,9 +479,9 @@ To enable React support, you need to explicitly turn it on:
|
|
|
508
479
|
|
|
509
480
|
```js
|
|
510
481
|
// eslint.config.js
|
|
511
|
-
import {
|
|
482
|
+
import { config } from '@infernodesign/eslint-config'
|
|
512
483
|
|
|
513
|
-
export default
|
|
484
|
+
export default config( {
|
|
514
485
|
react: true,
|
|
515
486
|
} )
|
|
516
487
|
```
|
|
@@ -527,13 +498,27 @@ To enable Next.js support, you need to explicitly turn it on:
|
|
|
527
498
|
|
|
528
499
|
```js
|
|
529
500
|
// eslint.config.js
|
|
530
|
-
import {
|
|
501
|
+
import { config } from '@infernodesign/eslint-config'
|
|
531
502
|
|
|
532
|
-
export default
|
|
503
|
+
export default config( {
|
|
533
504
|
nextjs: true,
|
|
534
505
|
} )
|
|
535
506
|
```
|
|
536
507
|
|
|
508
|
+
To configure Next.js, you can pass an object with the following options:
|
|
509
|
+
|
|
510
|
+
```js
|
|
511
|
+
// eslint.config.js
|
|
512
|
+
import { config } from '@infernodesign/eslint-config'
|
|
513
|
+
|
|
514
|
+
export default config( {
|
|
515
|
+
nextjs: {
|
|
516
|
+
// Specify the root directory for Next.js. Defaults to the cwd() of the Node.js process.
|
|
517
|
+
rootDir: 'src',
|
|
518
|
+
},
|
|
519
|
+
} )
|
|
520
|
+
```
|
|
521
|
+
|
|
537
522
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
538
523
|
|
|
539
524
|
```bash
|
|
@@ -546,9 +531,9 @@ To enable storybook support, you need to explicitly turn it on:
|
|
|
546
531
|
|
|
547
532
|
```js
|
|
548
533
|
// eslint.config.js
|
|
549
|
-
import {
|
|
534
|
+
import { config } from '@infernodesign/eslint-config'
|
|
550
535
|
|
|
551
|
-
export default
|
|
536
|
+
export default config( {
|
|
552
537
|
storybook: true,
|
|
553
538
|
} )
|
|
554
539
|
```
|
|
@@ -565,9 +550,9 @@ To enable svelte support, you need to explicitly turn it on:
|
|
|
565
550
|
|
|
566
551
|
```js
|
|
567
552
|
// eslint.config.js
|
|
568
|
-
import {
|
|
553
|
+
import { config } from '@infernodesign/eslint-config'
|
|
569
554
|
|
|
570
|
-
export default
|
|
555
|
+
export default config( {
|
|
571
556
|
svelte: true,
|
|
572
557
|
} )
|
|
573
558
|
```
|
|
@@ -578,42 +563,59 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
|
|
|
578
563
|
npm i -D eslint-plugin-svelte
|
|
579
564
|
```
|
|
580
565
|
|
|
581
|
-
####
|
|
566
|
+
#### Solid
|
|
582
567
|
|
|
583
|
-
To enable
|
|
568
|
+
To enable Solid support, you need to explicitly turn it on:
|
|
584
569
|
|
|
585
570
|
```js
|
|
586
571
|
// eslint.config.js
|
|
587
|
-
import {
|
|
572
|
+
import { config } from '@infernodesign/eslint-config'
|
|
588
573
|
|
|
589
|
-
export default
|
|
590
|
-
|
|
574
|
+
export default config( {
|
|
575
|
+
solid: true,
|
|
591
576
|
} )
|
|
592
577
|
```
|
|
593
578
|
|
|
594
579
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
595
580
|
|
|
596
581
|
```bash
|
|
597
|
-
npm i -D eslint-plugin-
|
|
582
|
+
npm i -D eslint-plugin-solid
|
|
598
583
|
```
|
|
599
584
|
|
|
600
|
-
####
|
|
585
|
+
#### TailwindCSS
|
|
601
586
|
|
|
602
|
-
To enable
|
|
587
|
+
To enable TailwindCSS support, you need to explicitly turn it on:
|
|
603
588
|
|
|
604
589
|
```js
|
|
605
590
|
// eslint.config.js
|
|
606
|
-
import {
|
|
591
|
+
import { config } from '@infernodesign/eslint-config'
|
|
607
592
|
|
|
608
|
-
export default
|
|
609
|
-
|
|
593
|
+
export default config( {
|
|
594
|
+
tailwindcss: true,
|
|
595
|
+
} )
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
To configure the TailwindCSS support, you can pass an object with the following options:
|
|
599
|
+
|
|
600
|
+
```js
|
|
601
|
+
// eslint.config.js
|
|
602
|
+
import { config } from '@infernodesign/eslint-config'
|
|
603
|
+
|
|
604
|
+
export default config( {
|
|
605
|
+
tailwindcss: {
|
|
606
|
+
// Enable component class detection
|
|
607
|
+
detectComponentClasses: true,
|
|
608
|
+
// Specify the entry point for Tailwind CSS
|
|
609
|
+
// If not provided, the config will try to find the `global.css` or `globals.css` file in the project.
|
|
610
|
+
entryPoint: 'src/styles/globals.css',
|
|
611
|
+
},
|
|
610
612
|
} )
|
|
611
613
|
```
|
|
612
614
|
|
|
613
615
|
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
614
616
|
|
|
615
617
|
```bash
|
|
616
|
-
npm i -D eslint-plugin-
|
|
618
|
+
npm i -D eslint-plugin-better-tailwindcss
|
|
617
619
|
```
|
|
618
620
|
|
|
619
621
|
#### UnoCSS
|
|
@@ -622,9 +624,9 @@ To enable UnoCSS support, you need to explicitly turn it on:
|
|
|
622
624
|
|
|
623
625
|
```js
|
|
624
626
|
// eslint.config.js
|
|
625
|
-
import {
|
|
627
|
+
import { config } from '@infernodesign/eslint-config'
|
|
626
628
|
|
|
627
|
-
export default
|
|
629
|
+
export default config( {
|
|
628
630
|
unocss: true,
|
|
629
631
|
} )
|
|
630
632
|
```
|
|
@@ -635,6 +637,57 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
|
|
|
635
637
|
npm i -D @unocss/eslint-plugin
|
|
636
638
|
```
|
|
637
639
|
|
|
640
|
+
### Vue
|
|
641
|
+
|
|
642
|
+
Vue support is detected automatically by checking if `vue` is installed in your project. You can also explicitly enable/disable it:
|
|
643
|
+
|
|
644
|
+
```js
|
|
645
|
+
// eslint.config.js
|
|
646
|
+
import { config } from '@infernodesign/eslint-config'
|
|
647
|
+
|
|
648
|
+
export default config( {
|
|
649
|
+
vue: true
|
|
650
|
+
} )
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
#### Vue 2
|
|
654
|
+
|
|
655
|
+
We have limited support for Vue 2 (as it's already [reached EOL](https://v2.vuejs.org/eol/)). If you are still using Vue 2, you can configure it manually by setting `vueVersion` to `2`:
|
|
656
|
+
|
|
657
|
+
```js
|
|
658
|
+
// eslint.config.js
|
|
659
|
+
import { config } from '@infernodesign/eslint-config'
|
|
660
|
+
|
|
661
|
+
export default config( {
|
|
662
|
+
vue: {
|
|
663
|
+
vueVersion: 2
|
|
664
|
+
},
|
|
665
|
+
} )
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
As it's in maintenance mode, we only accept bug fixes for Vue 2. It might also be removed in the future when `eslint-plugin-vue` drops support for Vue 2. We recommend upgrading to Vue 3 if possible.
|
|
669
|
+
|
|
670
|
+
#### Vue Accessibility
|
|
671
|
+
|
|
672
|
+
To enable Vue accessibility support, you need to explicitly turn it on:
|
|
673
|
+
|
|
674
|
+
```js
|
|
675
|
+
// eslint.config.js
|
|
676
|
+
import { config } from '@infernodesign/eslint-config'
|
|
677
|
+
|
|
678
|
+
export default config( {
|
|
679
|
+
vue: {
|
|
680
|
+
a11y: true
|
|
681
|
+
},
|
|
682
|
+
} )
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
686
|
+
|
|
687
|
+
```bash
|
|
688
|
+
npm i -D eslint-plugin-vuejs-accessibility
|
|
689
|
+
```
|
|
690
|
+
|
|
638
691
|
### Optional Rules
|
|
639
692
|
|
|
640
693
|
This config also provides some optional plugins/rules for extended usage.
|
|
@@ -679,9 +732,9 @@ You can optionally enable the [type aware rules](https://typescript-eslint.io/li
|
|
|
679
732
|
|
|
680
733
|
```js
|
|
681
734
|
// eslint.config.js
|
|
682
|
-
import {
|
|
735
|
+
import { config } from '@infernodesign/eslint-config'
|
|
683
736
|
|
|
684
|
-
export default
|
|
737
|
+
export default config( {
|
|
685
738
|
typescript: {
|
|
686
739
|
tsconfigPath: 'tsconfig.json',
|
|
687
740
|
},
|
|
@@ -702,9 +755,9 @@ This is to prevent unused imports from getting removed by the editor during refa
|
|
|
702
755
|
|
|
703
756
|
```js
|
|
704
757
|
// eslint.config.js
|
|
705
|
-
import {
|
|
758
|
+
import { config } from '@infernodesign/eslint-config'
|
|
706
759
|
|
|
707
|
-
export default
|
|
760
|
+
export default config( {
|
|
708
761
|
isInEditor: false
|
|
709
762
|
} )
|
|
710
763
|
```
|
|
@@ -716,7 +769,7 @@ If you want to apply lint and auto-fix before every commit, you can add the foll
|
|
|
716
769
|
```json
|
|
717
770
|
{
|
|
718
771
|
"simple-git-hooks": {
|
|
719
|
-
"pre-commit": "
|
|
772
|
+
"pre-commit": "npx lint-staged"
|
|
720
773
|
},
|
|
721
774
|
"lint-staged": {
|
|
722
775
|
"*": "eslint --fix"
|
|
@@ -771,9 +824,9 @@ You can opt-in to the [`formatters`](#formatters) feature to format your CSS. No
|
|
|
771
824
|
If you want to disable the opinionated rules, you can disable them with:
|
|
772
825
|
|
|
773
826
|
```ts
|
|
774
|
-
import {
|
|
827
|
+
import { config } from '@infernodesign/eslint-config'
|
|
775
828
|
|
|
776
|
-
export default
|
|
829
|
+
export default config( {
|
|
777
830
|
lessOpinionated: true
|
|
778
831
|
} )
|
|
779
832
|
```
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as PACKAGE_NAME } from "./constants-DjBrEP6N.js";
|
|
1
2
|
import fs from "node:fs/promises";
|
|
2
3
|
import fs$1 from "node:fs";
|
|
3
4
|
import path from "node:path";
|
|
@@ -8,7 +9,7 @@ import parse from "parse-gitignore";
|
|
|
8
9
|
import { execSync } from "node:child_process";
|
|
9
10
|
|
|
10
11
|
//#region package.json
|
|
11
|
-
var version = "1.
|
|
12
|
+
var version = "1.17.0";
|
|
12
13
|
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/cli/constants.ts
|
|
@@ -89,10 +90,18 @@ const frameworkOptions = [
|
|
|
89
90
|
label: c.cyan("Solid"),
|
|
90
91
|
value: "solid"
|
|
91
92
|
},
|
|
93
|
+
{
|
|
94
|
+
label: c.magenta("Storybook"),
|
|
95
|
+
value: "storybook"
|
|
96
|
+
},
|
|
92
97
|
{
|
|
93
98
|
label: c.red("Svelte"),
|
|
94
99
|
value: "svelte"
|
|
95
100
|
},
|
|
101
|
+
{
|
|
102
|
+
label: c.yellow("TailwindCSS"),
|
|
103
|
+
value: "tailwindcss"
|
|
104
|
+
},
|
|
96
105
|
{
|
|
97
106
|
label: c.green("Vue"),
|
|
98
107
|
value: "vue"
|
|
@@ -121,7 +130,9 @@ const dependenciesMap = {
|
|
|
121
130
|
],
|
|
122
131
|
slidev: ["prettier-plugin-slidev"],
|
|
123
132
|
solid: ["eslint-plugin-solid"],
|
|
133
|
+
storybook: ["eslint-plugin-storybook"],
|
|
124
134
|
svelte: ["eslint-plugin-svelte", "svelte-eslint-parser"],
|
|
135
|
+
tailwindcss: ["eslint-plugin-better-tailwindcss"],
|
|
125
136
|
unocss: ["@unocss/eslint-plugin"],
|
|
126
137
|
vue: []
|
|
127
138
|
};
|
|
@@ -130,9 +141,9 @@ const dependenciesMap = {
|
|
|
130
141
|
//#region src/cli/utils.ts
|
|
131
142
|
function getEslintConfigContent(mainConfig, additionalConfigs) {
|
|
132
143
|
return `
|
|
133
|
-
import {
|
|
144
|
+
import { config } from '${PACKAGE_NAME}'
|
|
134
145
|
|
|
135
|
-
export default
|
|
146
|
+
export default config({
|
|
136
147
|
${mainConfig}
|
|
137
148
|
}${additionalConfigs?.map((config) => `,{\n${config}\n}`).join("")})
|
|
138
149
|
`.trimStart();
|
|
@@ -187,10 +198,12 @@ const versionsMap = {
|
|
|
187
198
|
"astro-eslint-parser": "^1.2.2",
|
|
188
199
|
"eslint": "^10.0.0",
|
|
189
200
|
"eslint-plugin-astro": "^1.5.0",
|
|
201
|
+
"eslint-plugin-better-tailwindcss": "^4.2.0",
|
|
190
202
|
"eslint-plugin-format": "^1.4.0",
|
|
191
203
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
192
204
|
"eslint-plugin-react-refresh": "^0.5.0",
|
|
193
205
|
"eslint-plugin-solid": "^0.14.5",
|
|
206
|
+
"eslint-plugin-storybook": "^10.2.8",
|
|
194
207
|
"eslint-plugin-svelte": "^3.15.0",
|
|
195
208
|
"prettier-plugin-astro": "^0.14.1",
|
|
196
209
|
"prettier-plugin-slidev": "^1.0.5",
|
|
@@ -202,11 +215,11 @@ const versionsMap = {
|
|
|
202
215
|
async function updatePackageJson(result) {
|
|
203
216
|
const cwd = process.cwd();
|
|
204
217
|
const pathPackageJSON = path.join(cwd, "package.json");
|
|
205
|
-
p.log.step(c.cyan`Bumping
|
|
218
|
+
p.log.step(c.cyan`Bumping ${PACKAGE_NAME} to v${version}`);
|
|
206
219
|
const pkgContent = await fs.readFile(pathPackageJSON, "utf-8");
|
|
207
220
|
const pkg = JSON.parse(pkgContent);
|
|
208
221
|
pkg.devDependencies ??= {};
|
|
209
|
-
pkg.devDependencies[
|
|
222
|
+
pkg.devDependencies[PACKAGE_NAME] = `^${version}`;
|
|
210
223
|
pkg.devDependencies.eslint ??= versionsMap.eslint;
|
|
211
224
|
const addedPackages = [];
|
|
212
225
|
if (result.extra.length) result.extra.forEach((item) => {
|
|
@@ -328,9 +341,9 @@ async function run(options = {}) {
|
|
|
328
341
|
//#region src/cli/index.ts
|
|
329
342
|
function header() {
|
|
330
343
|
console.log("\n");
|
|
331
|
-
p.intro(`${c.green
|
|
344
|
+
p.intro(`${c.green`${PACKAGE_NAME} `}${c.dim`v${version}`}`);
|
|
332
345
|
}
|
|
333
|
-
const cli = cac(
|
|
346
|
+
const cli = cac(PACKAGE_NAME);
|
|
334
347
|
cli.command("", "Run the initialization or migration").option("--yes, -y", "Skip prompts and use default values", { default: false }).option("--template, -t <template>", "Use the framework template for optimal customization: vue / react / svelte / astro", { type: [] }).option("--extra, -e <extra>", "Use the extra utils: formatter / perfectionist / unocss", { type: [] }).action(async (args) => {
|
|
335
348
|
header();
|
|
336
349
|
try {
|