@chanyuxi/eslint-waltz 0.1.0 → 1.0.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/LICENSE +19 -0
- package/README.md +32 -20
- package/dist/cli.js +4 -4
- package/dist/index.d.ts +5391 -439
- package/dist/index.js +152 -21
- package/package.json +47 -38
package/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2026-present Chanyuxi
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
-
👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, and
|
|
3
|
+
👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and Perfectionist.
|
|
4
4
|
|
|
5
5
|
Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
6
6
|
|
|
@@ -9,13 +9,17 @@ Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
|
9
9
|
The following configuration modules are available:
|
|
10
10
|
|
|
11
11
|
- ✅ Javascript
|
|
12
|
-
- ✅ Typescript
|
|
13
|
-
- ✅ Stylistic
|
|
12
|
+
- ✅ Typescript
|
|
13
|
+
- ✅ Stylistic
|
|
14
|
+
- ✅ Perfectionist
|
|
14
15
|
- ✅ Json
|
|
15
16
|
- ✅ Import
|
|
16
17
|
- ✅ React
|
|
17
|
-
-
|
|
18
|
-
-
|
|
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 JSX prop sorting.
|
|
19
23
|
|
|
20
24
|
# Usage
|
|
21
25
|
|
|
@@ -24,10 +28,14 @@ The following configuration modules are available:
|
|
|
24
28
|
Install the core package and its core ESLint peers:
|
|
25
29
|
|
|
26
30
|
```bash
|
|
27
|
-
pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc jsonc-eslint-parser globals
|
|
31
|
+
pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc eslint-plugin-import-x eslint-plugin-perfectionist jsonc-eslint-parser globals
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-
|
|
34
|
+
Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-tailwindcss`, `tailwindcss`, or the React ESLint plugins.
|
|
35
|
+
|
|
36
|
+
Perfectionist's `sort-jsx-props` rule is enabled by default for JSX props. Use `perfectionist: { preset: 'recommended-alphabetical' }` to enable its full recommended preset. ESLint 10 and the current integrations require Node.js `>=20.19.0`.
|
|
37
|
+
|
|
38
|
+
Tailwind CSS support targets `eslint-plugin-tailwindcss` 4.x and Tailwind CSS 4.x. Node.js `>=20.19.0` is required when the Tailwind CSS module is enabled.
|
|
31
39
|
|
|
32
40
|
#### Configuration
|
|
33
41
|
|
|
@@ -37,11 +45,15 @@ Create a `eslint.config.ts` file in the project root directory and configure it
|
|
|
37
45
|
import waltz from '@chanyuxi/eslint-waltz'
|
|
38
46
|
|
|
39
47
|
export default waltz({
|
|
40
|
-
// JSONC
|
|
48
|
+
// JSONC and imports are enabled by default
|
|
41
49
|
json: true,
|
|
42
50
|
ts: true,
|
|
43
|
-
imports: true,
|
|
44
51
|
react: true,
|
|
52
|
+
tailwindcss: {
|
|
53
|
+
settings: {
|
|
54
|
+
tailwindcss: { cssConfigPath: './src/styles.css' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
45
57
|
js: { globals: ['browser'] },
|
|
46
58
|
})
|
|
47
59
|
```
|
|
@@ -57,14 +69,14 @@ export default waltz({}, {
|
|
|
57
69
|
})
|
|
58
70
|
```
|
|
59
71
|
|
|
60
|
-
Run `pnpm run check` before committing. `pnpm pack` and `npm publish` build the package automatically through the `prepack` lifecycle.
|
|
61
|
-
|
|
62
|
-
#### VS Code synchronization
|
|
63
|
-
|
|
64
|
-
After installing the package, run this command from your project root:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npx eslint-waltz sync-vscode
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
It creates or updates `.vscode/settings.json` with ESLint fix-on-save settings while preserving other settings and JSONC comments.
|
|
72
|
+
Run `pnpm run check` before committing. `pnpm pack` and `npm publish` build the package automatically through the `prepack` lifecycle.
|
|
73
|
+
|
|
74
|
+
#### VS Code synchronization
|
|
75
|
+
|
|
76
|
+
After installing the package, run this command from your project root:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx eslint-waltz sync-vscode
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It creates or updates `.vscode/settings.json` with ESLint fix-on-save settings while preserving other settings and JSONC comments.
|
package/dist/cli.js
CHANGED
|
@@ -1509,10 +1509,10 @@ async function syncVSCodeSettings(cwd = process.cwd()) {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
|
|
1511
1511
|
function printHelp() {
|
|
1512
|
-
console.log(`Usage: eslint-waltz <command>
|
|
1513
|
-
|
|
1514
|
-
Commands:
|
|
1515
|
-
sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
|
|
1512
|
+
console.log(`Usage: eslint-waltz <command>
|
|
1513
|
+
|
|
1514
|
+
Commands:
|
|
1515
|
+
sync-vscode Create or update .vscode/settings.json for ESLint fix-on-save
|
|
1516
1516
|
`);
|
|
1517
1517
|
}
|
|
1518
1518
|
async function main() {
|