@kitschpatrol/eslint-config 8.0.0 → 8.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/bin/cli.js +6 -7
- package/dist/index.d.ts +2298 -1224
- package/dist/index.js +1 -1
- package/init/.vscode/tasks.json +73 -0
- package/package.json +18 -18
- package/readme.md +38 -8
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "ksc-eslint lint",
|
|
6
|
+
"detail": "Lint your project with ESLint.",
|
|
7
|
+
"type": "shell",
|
|
8
|
+
"command": "pnpm exec ksc-eslint lint --format machine",
|
|
9
|
+
"options": {
|
|
10
|
+
"cwd": "${workspaceFolder}"
|
|
11
|
+
},
|
|
12
|
+
"presentation": {
|
|
13
|
+
"clear": true,
|
|
14
|
+
"echo": true,
|
|
15
|
+
"focus": false,
|
|
16
|
+
"panel": "dedicated",
|
|
17
|
+
"reveal": "silent",
|
|
18
|
+
"revealProblems": "onProblem",
|
|
19
|
+
"showReuseMessage": false
|
|
20
|
+
},
|
|
21
|
+
"problemMatcher": [
|
|
22
|
+
{
|
|
23
|
+
"owner": "ksc",
|
|
24
|
+
"source": "ksc",
|
|
25
|
+
"fileLocation": ["relative", "${workspaceFolder}"],
|
|
26
|
+
"pattern": {
|
|
27
|
+
"regexp": "^(.+?):(\\d+):(\\d+): (error|warning|info): (.+) \\[([^\\]]+)\\]$",
|
|
28
|
+
"file": 1,
|
|
29
|
+
"line": 2,
|
|
30
|
+
"column": 3,
|
|
31
|
+
"severity": 4,
|
|
32
|
+
"message": 5,
|
|
33
|
+
"code": 6
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"label": "ksc-eslint fix",
|
|
40
|
+
"detail": "Fix your project with ESLint.",
|
|
41
|
+
"type": "shell",
|
|
42
|
+
"command": "pnpm exec ksc-eslint fix --format machine",
|
|
43
|
+
"options": {
|
|
44
|
+
"cwd": "${workspaceFolder}"
|
|
45
|
+
},
|
|
46
|
+
"presentation": {
|
|
47
|
+
"clear": true,
|
|
48
|
+
"echo": true,
|
|
49
|
+
"focus": false,
|
|
50
|
+
"panel": "dedicated",
|
|
51
|
+
"reveal": "silent",
|
|
52
|
+
"revealProblems": "onProblem",
|
|
53
|
+
"showReuseMessage": false
|
|
54
|
+
},
|
|
55
|
+
"problemMatcher": [
|
|
56
|
+
{
|
|
57
|
+
"owner": "ksc",
|
|
58
|
+
"source": "ksc",
|
|
59
|
+
"fileLocation": ["relative", "${workspaceFolder}"],
|
|
60
|
+
"pattern": {
|
|
61
|
+
"regexp": "^(.+?):(\\d+):(\\d+): (error|warning|info): (.+) \\[([^\\]]+)\\]$",
|
|
62
|
+
"file": 1,
|
|
63
|
+
"line": 2,
|
|
64
|
+
"column": 3,
|
|
65
|
+
"severity": 4,
|
|
66
|
+
"message": 5,
|
|
67
|
+
"code": 6
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitschpatrol/eslint-config",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "ESLint configuration for @kitschpatrol/shared-config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shared-config",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@e18e/eslint-plugin": "^0.5.1",
|
|
46
46
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
47
|
-
"@eslint-react/eslint-plugin": "^5.
|
|
48
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
49
|
-
"@html-eslint/parser": "^0.
|
|
47
|
+
"@eslint-react/eslint-plugin": "^5.13.2",
|
|
48
|
+
"@html-eslint/eslint-plugin": "^0.64.0",
|
|
49
|
+
"@html-eslint/parser": "^0.64.0",
|
|
50
50
|
"@pinojs/json-colorizer": "^4.0.0",
|
|
51
51
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
53
|
-
"@typescript-eslint/parser": "^8.
|
|
54
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
55
|
-
"astro-eslint-parser": "^
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^8.63.0",
|
|
53
|
+
"@typescript-eslint/parser": "^8.63.0",
|
|
54
|
+
"@vitest/eslint-plugin": "^1.6.22",
|
|
55
|
+
"astro-eslint-parser": "^3.0.0",
|
|
56
56
|
"cosmiconfig": "^9.0.2",
|
|
57
57
|
"cosmiconfig-typescript-loader": "^6.3.0",
|
|
58
58
|
"decircular": "^1.0.0",
|
|
@@ -62,25 +62,25 @@
|
|
|
62
62
|
"eslint-flat-config-utils": "^3.2.0",
|
|
63
63
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
64
64
|
"eslint-mdx": "^3.8.1",
|
|
65
|
-
"eslint-plugin-astro": "^
|
|
65
|
+
"eslint-plugin-astro": "^3.0.0",
|
|
66
66
|
"eslint-plugin-de-morgan": "^2.1.2",
|
|
67
67
|
"eslint-plugin-depend": "^1.5.0",
|
|
68
68
|
"eslint-plugin-html": "^8.1.4",
|
|
69
69
|
"eslint-plugin-import-x": "^4.17.1",
|
|
70
70
|
"eslint-plugin-jsdoc": "^63.0.12",
|
|
71
|
-
"eslint-plugin-jsonc": "^3.
|
|
71
|
+
"eslint-plugin-jsonc": "^3.3.0",
|
|
72
72
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
73
73
|
"eslint-plugin-math": "^0.13.1",
|
|
74
74
|
"eslint-plugin-mdx": "^3.8.1",
|
|
75
75
|
"eslint-plugin-n": "^18.2.1",
|
|
76
76
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
77
77
|
"eslint-plugin-package-json": "^1.5.0",
|
|
78
|
-
"eslint-plugin-perfectionist": "^5.
|
|
78
|
+
"eslint-plugin-perfectionist": "^5.10.0",
|
|
79
79
|
"eslint-plugin-regexp": "^3.1.1",
|
|
80
80
|
"eslint-plugin-svelte": "^3.20.0",
|
|
81
81
|
"eslint-plugin-toml": "^1.4.0",
|
|
82
|
-
"eslint-plugin-unicorn": "^
|
|
83
|
-
"eslint-plugin-yml": "^3.
|
|
82
|
+
"eslint-plugin-unicorn": "^72.0.0",
|
|
83
|
+
"eslint-plugin-yml": "^3.6.0",
|
|
84
84
|
"execa": "^9.6.1",
|
|
85
85
|
"find-workspaces": "^0.3.1",
|
|
86
86
|
"fs-extra": "^11.3.6",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"local-pkg": "^1.2.1",
|
|
91
91
|
"package-up": "^5.0.0",
|
|
92
92
|
"picocolors": "^1.1.1",
|
|
93
|
-
"prettier": "^3.9.
|
|
93
|
+
"prettier": "^3.9.5",
|
|
94
94
|
"sort-package-json": "^4.0.0",
|
|
95
95
|
"svelte-eslint-parser": "^1.8.0",
|
|
96
96
|
"toml-eslint-parser": "^1.0.3",
|
|
97
|
-
"yaml-eslint-parser": "^2.
|
|
97
|
+
"yaml-eslint-parser": "^2.1.0",
|
|
98
98
|
"yargs": "^18.0.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
104
104
|
"dot-prop": "^10.1.0",
|
|
105
105
|
"eslint-config-prettier": "^10.1.8",
|
|
106
|
-
"eslint-config-xo": "^0.
|
|
106
|
+
"eslint-config-xo": "^0.58.0",
|
|
107
107
|
"eslint-typegen": "^2.3.1",
|
|
108
|
-
"globby": "^16.2.
|
|
108
|
+
"globby": "^16.2.1",
|
|
109
109
|
"svelte": "^5.56.4"
|
|
110
110
|
},
|
|
111
111
|
"engines": {
|
|
@@ -119,6 +119,6 @@
|
|
|
119
119
|
"cli": "node ./bin/cli.js",
|
|
120
120
|
"inspect": "npx @eslint/config-inspector --config ./init/eslint.config.ts",
|
|
121
121
|
"test": "vitest run",
|
|
122
|
-
"update-rules": "tsx scripts/presetgen.ts && tsx scripts/typegen.ts && cd ../../ && ksc-eslint fix $PWD && ksc-prettier fix $PWD"
|
|
122
|
+
"update-rules": "tsx scripts/presetgen.ts && tsx scripts/typegen.ts && cd ../../ && ksc-eslint fix $PWD && ksc-prettier fix $PWD && ksc-prettier fix $PWD"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/readme.md
CHANGED
|
@@ -136,10 +136,11 @@ ksc-eslint lint [files..]
|
|
|
136
136
|
| ------------------- | ------------------------------ | ------- | ------- |
|
|
137
137
|
| `files` | Files or glob pattern to lint. | `array` | `"."` |
|
|
138
138
|
|
|
139
|
-
| Option | Description
|
|
140
|
-
| ------------------- |
|
|
141
|
-
| `--
|
|
142
|
-
| `--
|
|
139
|
+
| Option | Description | Type | Default |
|
|
140
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ---------- |
|
|
141
|
+
| `--format` | Output format: "native" streams each tool's own output, "machine" prints one parseable line per issue for editor problem matchers, "json" prints an aggregate report. | `"json"` `"machine"` `"native"` | `"native"` |
|
|
142
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
143
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
143
144
|
|
|
144
145
|
#### Subcommand: `ksc-eslint fix`
|
|
145
146
|
|
|
@@ -155,10 +156,11 @@ ksc-eslint fix [files..]
|
|
|
155
156
|
| ------------------- | ----------------------------- | ------- | ------- |
|
|
156
157
|
| `files` | Files or glob pattern to fix. | `array` | `"."` |
|
|
157
158
|
|
|
158
|
-
| Option | Description
|
|
159
|
-
| ------------------- |
|
|
160
|
-
| `--
|
|
161
|
-
| `--
|
|
159
|
+
| Option | Description | Type | Default |
|
|
160
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ---------- |
|
|
161
|
+
| `--format` | Output format: "native" streams each tool's own output, "machine" prints one parseable line per issue for editor problem matchers, "json" prints an aggregate report. | `"json"` `"machine"` `"native"` | `"native"` |
|
|
162
|
+
| `--help`<br>`-h` | Show help | `boolean` | |
|
|
163
|
+
| `--version`<br>`-v` | Show version number | `boolean` | |
|
|
162
164
|
|
|
163
165
|
#### Subcommand: `ksc-eslint print-config`
|
|
164
166
|
|
|
@@ -181,6 +183,26 @@ ksc-eslint print-config [file]
|
|
|
181
183
|
|
|
182
184
|
<!-- /cli-help -->
|
|
183
185
|
|
|
186
|
+
### VS Code tasks
|
|
187
|
+
|
|
188
|
+
`ksc-eslint init` adds a `.vscode/tasks.json` with two tasks:
|
|
189
|
+
|
|
190
|
+
- **`ksc-eslint lint`** runs `ksc-eslint lint --format machine` across the whole project
|
|
191
|
+
- **`ksc-eslint fix`** runs `ksc-eslint fix --format machine`, applying auto-fixes and reporting whatever couldn't be fixed
|
|
192
|
+
|
|
193
|
+
If you're using the complete [@kitschpatrol/shared-config](https://github.com/kitschpatrol/shared-config) package, you'd more likely want to run:
|
|
194
|
+
|
|
195
|
+
- **`ksc lint`** runs `ksc lint --format machine`, which runs all `ksc lint` tools across the whole project
|
|
196
|
+
- **`ksc fix`** runs `ksc fix --format machine`, which applies all `ksc fix` auto-fixes and reports anything unfixable
|
|
197
|
+
|
|
198
|
+
Run them via the _Tasks: Run Task_ command (or the _Terminal → Run Task…_ menu item).
|
|
199
|
+
|
|
200
|
+
Each task's problem matcher parses the machine-format output and populates VS Code's [Problems panel](https://code.visualstudio.com/docs/debugtest/debugging#_errors-and-warnings) with every reported issue, pointing to the offending file, line, and column.
|
|
201
|
+
|
|
202
|
+
The tasks share a problem matcher owner with the other `@kitschpatrol/shared-config` tasks, so the panel reflects the most recent run rather than stacking duplicates.
|
|
203
|
+
|
|
204
|
+
If your project already has a `.vscode/tasks.json`, `init` merges by task label: your own tasks are left alone, and same-label tasks are replaced with the latest definitions.
|
|
205
|
+
|
|
184
206
|
### API
|
|
185
207
|
|
|
186
208
|
The package also exports `fix`, `fixFile` functions for linting and fixing code programmatically, pre-configured with the shared ESLint configuration.
|
|
@@ -213,8 +235,16 @@ The ESLint module and instances are cached internally for performance across mul
|
|
|
213
235
|
|
|
214
236
|
## Notes
|
|
215
237
|
|
|
238
|
+
### Config location
|
|
239
|
+
|
|
216
240
|
Regrettably the `eslint-config init --location package` option is not supported due to ESLint's removal of support for putting configuration in `package.json`. See ESLint discussion thread [18131](https://github.com/eslint/eslint/discussions/18131).
|
|
217
241
|
|
|
242
|
+
### Preset generation
|
|
243
|
+
|
|
244
|
+
The `update-rules` script is used to manually regenerate preset rule sets when plugin dependencies are updated.
|
|
245
|
+
|
|
246
|
+
The script requires two calls to `ksc-prettier fix` to accommodate a lack of idempotence in Prettier's handling of the resulting `typegen.d.ts` file. This surfaced a few Prettier versions ago, and the necessity of this work-around should be reevaluated periodically against future versions of Prettier.
|
|
247
|
+
|
|
218
248
|
### Origins
|
|
219
249
|
|
|
220
250
|
This config is a heavily modified variation on Anthony Fu's [@antfu/eslint-config](https://github.com/antfu/eslint-config). This package is a somewhat leaner approach intended to work with other tools wrapped behind a monolithic CLI instead of handling everything on its own. It mainly leverages the factory / type generation implementation from the original repo, which itself builds on Kevin Deng's [@sxzz/eslint-config](https://github.com/sxzz/eslint-config). See the [modification notes](./modification-notes.md) for more details on what's changed from Anthony's approach.
|