@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.
Files changed (4) hide show
  1. package/README.md +31 -56
  2. package/dist/index.d.ts +599 -14
  3. package/dist/index.js +131 -62
  4. package/package.json +151 -148
package/README.md CHANGED
@@ -1,82 +1,57 @@
1
- # Introduction
1
+ # @chanyuxi/eslint-waltz
2
2
 
3
- 👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, React, Tailwind CSS, and Perfectionist.
3
+ Composable ESLint flat config for JavaScript, TypeScript, JSONC, React, Tailwind CSS, Perfectionist, and Vitest.
4
4
 
5
- Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
5
+ Requires Node.js `>=20.19.0`.
6
6
 
7
- # Features
7
+ ## Install
8
8
 
9
- The following configuration modules are available:
9
+ Install the package, ESLint, and the peer dependencies used by the default configuration:
10
10
 
11
- - ✅ Javascript
12
- - ✅ Typescript
13
- - ✅ Stylistic
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
- #### Install
15
+ `@eslint/js`, `@stylistic/eslint-plugin`, `globals`, and `jsonc-parser` are included automatically.
27
16
 
28
- Install the core package and its core ESLint peers:
17
+ Install peers only for the optional modules you enable:
29
18
 
30
19
  ```bash
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
32
- ```
20
+ # TypeScript
21
+ pnpm add -D typescript-eslint
33
22
 
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`.
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
- 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.
26
+ # Tailwind CSS
27
+ pnpm add -D eslint-plugin-tailwindcss tailwindcss
39
28
 
40
- #### Configuration
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
- Create a `eslint.config.ts` file in the project root directory and configure it as follows:
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
- Every module accepts `files` and `overrides` where applicable. Custom flat configs can be appended after the options:
48
+ Enabled by default:
62
49
 
63
- ```ts
64
- export default waltz({}, {
65
- files: ['src/**/*.js'],
66
- rules: {
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
- After installing the package, run this command from your project root:
77
-
78
- ```bash
79
- npx eslint-waltz sync-vscode
80
- ```
55
+ Optional: `ts`, `react`, `tailwindcss`, `gitignore`, and `vitest`.
81
56
 
82
- It creates or updates `.vscode/settings.json` with ESLint fix-on-save settings while preserving other settings and JSONC comments.
57
+ More options are documented in the exported TypeScript types.