@chanyuxi/eslint-waltz 1.1.1 → 1.3.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 +80 -56
- package/dist/cli.js +0 -0
- package/dist/index.d.ts +3 -10050
- package/dist/index.js +212 -110
- package/dist/typegen.d.ts +8598 -0
- package/dist/types.d.ts +219 -0
- package/package.json +147 -147
package/README.md
CHANGED
|
@@ -1,82 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @chanyuxi/eslint-waltz
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Composable ESLint flat config for JavaScript, TypeScript, JSONC, React, Tailwind CSS, Perfectionist, and Vitest.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Requires Node.js `>=20.19.0`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install the package, ESLint, and the peer dependencies used by the default configuration:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
- ✅ Perfectionist
|
|
15
|
-
- ✅ Json
|
|
16
|
-
- ✅ Import
|
|
17
|
-
- ✅ React
|
|
18
|
-
- ✅ Tailwind CSS
|
|
19
|
-
- JSONC and imports are enabled by default and can be disabled with `json: false` and `imports: false`.
|
|
20
|
-
- TypeScript, React, Tailwind CSS, and gitignore support are opt-in.
|
|
21
|
-
|
|
22
|
-
The `stylistic` configuration is always enabled. Perfectionist is enabled by default with the `recommended-alphabetical` preset.
|
|
23
|
-
|
|
24
|
-
# Usage
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add -D @chanyuxi/eslint-waltz eslint eslint-plugin-jsonc eslint-plugin-import-x eslint-plugin-perfectionist jsonc-eslint-parser
|
|
13
|
+
```
|
|
25
14
|
|
|
26
|
-
|
|
15
|
+
`@eslint/js`, `@stylistic/eslint-plugin`, `globals`, and `jsonc-parser` are included automatically.
|
|
27
16
|
|
|
28
|
-
Install
|
|
17
|
+
Install peers only for the optional modules you enable:
|
|
29
18
|
|
|
30
19
|
```bash
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
# TypeScript
|
|
21
|
+
pnpm add -D typescript-eslint
|
|
33
22
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Perfectionist uses the `recommended-alphabetical` preset by default. Use `perfectionist: { preset: 'recommended-custom' }`, `recommended-line-length`, or `recommended-natural` to select another recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
|
|
23
|
+
# React
|
|
24
|
+
pnpm add -D eslint-plugin-react-x eslint-plugin-react-debug eslint-plugin-react-dom eslint-plugin-react-hooks-extra eslint-plugin-react-naming-convention eslint-plugin-react-web-api
|
|
37
25
|
|
|
38
|
-
|
|
26
|
+
# Tailwind CSS
|
|
27
|
+
pnpm add -D eslint-plugin-tailwindcss tailwindcss
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
# .gitignore support
|
|
30
|
+
pnpm add -D eslint-config-flat-gitignore
|
|
31
|
+
|
|
32
|
+
# Vitest
|
|
33
|
+
pnpm add -D @vitest/eslint-plugin vitest
|
|
34
|
+
```
|
|
41
35
|
|
|
42
|
-
|
|
36
|
+
## Usage
|
|
43
37
|
|
|
44
38
|
```ts
|
|
39
|
+
// eslint.config.ts
|
|
45
40
|
import waltz from '@chanyuxi/eslint-waltz'
|
|
46
41
|
|
|
47
42
|
export default waltz({
|
|
48
|
-
// JSONC and imports are enabled by default
|
|
49
|
-
json: true,
|
|
50
43
|
ts: true,
|
|
51
44
|
react: true,
|
|
52
|
-
tailwindcss: {
|
|
53
|
-
settings: {
|
|
54
|
-
tailwindcss: { cssConfigPath: './src/styles.css' },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
js: { globals: ['browser'] },
|
|
58
45
|
})
|
|
59
46
|
```
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
Enabled by default:
|
|
62
49
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'no-console': 'off',
|
|
68
|
-
},
|
|
69
|
-
})
|
|
70
|
-
```
|
|
50
|
+
- JavaScript and stylistic rules
|
|
51
|
+
- JSONC rules
|
|
52
|
+
- import validation
|
|
53
|
+
- Perfectionist with `recommended-alphabetical`
|
|
71
54
|
|
|
72
|
-
|
|
55
|
+
Optional: `ts`, `react`, `tailwindcss`, `gitignore`, and `vitest`.
|
|
73
56
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
57
|
+
More options are documented in the exported TypeScript types.
|
|
58
|
+
|
|
59
|
+
The potentially expensive module-resolution rules are disabled by default. Enable
|
|
60
|
+
them explicitly when your project needs them:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
export default waltz({
|
|
64
|
+
imports: {
|
|
65
|
+
overrides: {
|
|
66
|
+
'imports/named': 'error',
|
|
67
|
+
'imports/namespace': 'error',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## TypeScript file scope
|
|
74
|
+
|
|
75
|
+
When `ts.files` is provided, it is the maximum TypeScript scope used by the
|
|
76
|
+
other modules that automatically include TypeScript files. JavaScript files
|
|
77
|
+
keep their normal scope, and a module's own `files` option can override this
|
|
78
|
+
limit. Vitest additionally intersects its test-file patterns with this scope.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
export default waltz({
|
|
82
|
+
ts: { files: ['src/**/*.ts'] },
|
|
83
|
+
react: true,
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## VS Code synchronization
|
|
88
|
+
|
|
89
|
+
Run this command from your project root to enable ESLint fix-on-save settings
|
|
90
|
+
while preserving existing `.vscode/settings.json` values and comments:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npx eslint-waltz sync-vscode
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
React plugin settings can be customized when needed:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
export default waltz({
|
|
100
|
+
react: {
|
|
101
|
+
settings: {
|
|
102
|
+
'react-x': { importSource: 'preact' },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
```
|
package/dist/cli.js
CHANGED
|
File without changes
|