@chanyuxi/eslint-waltz 1.1.0 → 1.2.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 +31 -56
- package/dist/index.d.ts +599 -14
- package/dist/index.js +131 -62
- package/package.json +151 -148
package/README.md
CHANGED
|
@@ -1,82 +1,57 @@
|
|
|
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 JSX prop sorting.
|
|
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'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`.
|
|
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
|
-
```
|
|
71
|
-
|
|
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
|
|
50
|
+
- JavaScript and stylistic rules
|
|
51
|
+
- JSONC rules
|
|
52
|
+
- import validation
|
|
53
|
+
- Perfectionist with `recommended-alphabetical`
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npx eslint-waltz sync-vscode
|
|
80
|
-
```
|
|
55
|
+
Optional: `ts`, `react`, `tailwindcss`, `gitignore`, and `vitest`.
|
|
81
56
|
|
|
82
|
-
|
|
57
|
+
More options are documented in the exported TypeScript types.
|