@chanyuxi/eslint-waltz 0.0.0-alpha.2 → 0.1.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 +39 -9
- package/dist/cli.js +1537 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +85 -3491
- package/package.json +61 -9
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Introduction
|
|
2
2
|
|
|
3
|
-
👋 A
|
|
3
|
+
👋 A composable ESLint flat config for JavaScript, TypeScript, JSONC, imports, and React.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
6
6
|
|
|
7
7
|
# Features
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The following configuration modules are available:
|
|
10
10
|
|
|
11
11
|
- ✅ Javascript
|
|
12
12
|
- ✅ Typescript
|
|
@@ -14,17 +14,20 @@ At present, the following modes are supported, and more features are under devel
|
|
|
14
14
|
- ✅ Json
|
|
15
15
|
- ✅ Import
|
|
16
16
|
- ✅ React
|
|
17
|
-
-
|
|
17
|
+
- JSONC is enabled by default and can be disabled with `json: false`.
|
|
18
|
+
- TypeScript, imports, React, and gitignore support are opt-in.
|
|
18
19
|
|
|
19
20
|
# Usage
|
|
20
21
|
|
|
21
22
|
#### Install
|
|
22
23
|
|
|
23
|
-
Install
|
|
24
|
+
Install the core package and its core ESLint peers:
|
|
24
25
|
|
|
25
26
|
```bash
|
|
26
|
-
|
|
27
|
-
```
|
|
27
|
+
pnpm add -D @chanyuxi/eslint-waltz eslint @eslint/js @stylistic/eslint-plugin eslint-plugin-jsonc jsonc-eslint-parser globals
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Install the peer packages for any optional modules you enable, such as `typescript-eslint`, `eslint-plugin-import`, or the React ESLint plugins.
|
|
28
31
|
|
|
29
32
|
#### Configuration
|
|
30
33
|
|
|
@@ -34,7 +37,34 @@ Create a `eslint.config.ts` file in the project root directory and configure it
|
|
|
34
37
|
import waltz from '@chanyuxi/eslint-waltz'
|
|
35
38
|
|
|
36
39
|
export default waltz({
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
// JSONC is enabled by default
|
|
41
|
+
json: true,
|
|
42
|
+
ts: true,
|
|
43
|
+
imports: true,
|
|
44
|
+
react: true,
|
|
45
|
+
js: { globals: ['browser'] },
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Every module accepts `files` and `overrides` where applicable. Custom flat configs can be appended after the options:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
export default waltz({}, {
|
|
53
|
+
files: ['src/**/*.js'],
|
|
54
|
+
rules: {
|
|
55
|
+
'no-console': 'off',
|
|
56
|
+
},
|
|
39
57
|
})
|
|
40
58
|
```
|
|
59
|
+
|
|
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.
|