@kitschpatrol/eslint-config 4.7.12 → 5.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.
@@ -1,18 +1,28 @@
1
1
  {
2
2
  "editor.codeActionsOnSave": {
3
- "source.fixAll": "explicit"
3
+ "source.fixAll": "explicit",
4
+ "source.organizeImports": "never"
4
5
  },
5
6
  "eslint.enable": true,
7
+ "eslint.runtime": "node",
6
8
  "eslint.validate": [
7
9
  "astro",
8
10
  "html",
9
11
  "javascript",
10
12
  "javascriptreact",
13
+ "json",
14
+ "json5",
15
+ "jsonc",
11
16
  "markdown",
12
17
  "mdx",
13
18
  "svelte",
19
+ "toml",
14
20
  "typescript",
15
- "typescriptreact"
21
+ "typescriptreact",
22
+ "xml",
23
+ "yaml"
16
24
  ],
17
- "typescript.tsdk": "node_modules/typescript/lib"
25
+ "eslint.useFlatConfig": true,
26
+ "typescript.tsdk": "node_modules/typescript/lib",
27
+ "typescript.enablePromptUseWorkspaceTsdk": true
18
28
  }
@@ -0,0 +1,9 @@
1
+ import { eslintConfig } from '@kitschpatrol/eslint-config'
2
+
3
+ export default eslintConfig({
4
+ // Enable as needed:
5
+ // astro: true,
6
+ // react: true,
7
+ // svelte: true,
8
+ // type: 'lib',
9
+ })
package/license.txt CHANGED
@@ -1,6 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-2024 Eric Mika
3
+ Copyright (c) 2023-2025 Eric Mika
4
+
5
+ Portions of this configuration are based on the MIT-licensed
6
+ "@antfu/eslint-config" project by Anthony Fu.
4
7
 
5
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
9
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,67 +1,108 @@
1
1
  {
2
2
  "name": "@kitschpatrol/eslint-config",
3
- "version": "4.7.12",
4
- "type": "module",
3
+ "version": "5.0.0",
5
4
  "description": "ESLint configuration for @kitschpatrol/shared-config.",
5
+ "keywords": [
6
+ "shared-config",
7
+ "eslint-config",
8
+ "eslint",
9
+ "cli",
10
+ "kpi",
11
+ "kpi-eslint"
12
+ ],
13
+ "bugs": "https://github.com/kitschpatrol/shared-config/issues",
6
14
  "repository": {
7
15
  "type": "git",
8
16
  "url": "git+https://github.com/kitschpatrol/shared-config/cli.git",
9
17
  "directory": "packages/eslint-config"
10
18
  },
11
- "bugs": "https://github.com/kitschpatrol/shared-config/issues",
19
+ "license": "MIT",
12
20
  "author": {
13
21
  "name": "Eric Mika",
14
22
  "email": "eric@ericmika.com",
15
23
  "url": "https://ericmika.com"
16
24
  },
17
- "license": "MIT",
18
- "engines": {
19
- "node": ">=18.0.0",
20
- "pnpm": ">=8.0.0"
25
+ "type": "module",
26
+ "exports": {
27
+ ".": {
28
+ "import": "./dist/index.js",
29
+ "types": "./dist/index.d.ts"
30
+ }
21
31
  },
32
+ "main": "dist/index.js",
33
+ "types": "dist/index.d.ts",
22
34
  "bin": {
23
- "eslint-config": "bin/cli.js"
35
+ "kpi-eslint": "bin/cli.js"
24
36
  },
25
- "main": "./eslint.config.cjs",
26
37
  "files": [
27
38
  "bin/*",
39
+ "dist/*",
28
40
  "init/*"
29
41
  ],
30
- "keywords": [
31
- "shared-config",
32
- "eslint-config",
33
- "eslint",
34
- "cli"
35
- ],
36
- "peerDependencies": {
37
- "eslint": "^8.57.1"
38
- },
39
42
  "dependencies": {
40
- "@html-eslint/eslint-plugin": "^0.26.0",
41
- "@html-eslint/parser": "^0.26.0",
43
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
44
+ "@eslint-react/eslint-plugin": "^1.26.2",
45
+ "@html-eslint/eslint-plugin": "^0.34.0",
46
+ "@html-eslint/parser": "^0.34.0",
42
47
  "@pinojs/json-colorizer": "^4.0.0",
43
- "@typescript-eslint/eslint-plugin": "^7.18.0",
44
- "@typescript-eslint/parser": "^7.18.0",
45
- "astro-eslint-parser": "^1.0.3",
46
- "eslint-config-prettier": "^9.1.0",
47
- "eslint-config-xo": "^0.45.0",
48
- "eslint-config-xo-typescript": "^5.0.0",
48
+ "@typescript-eslint/eslint-plugin": "^8.23.0",
49
+ "@typescript-eslint/parser": "^8.23.0",
50
+ "@vitest/eslint-plugin": "^1.1.25",
51
+ "astro-eslint-parser": "^1.2.1",
52
+ "eslint": "^9.19.0",
53
+ "eslint-config-flat-gitignore": "^2.0.0",
54
+ "eslint-flat-config-utils": "^2.0.1",
55
+ "eslint-import-resolver-typescript": "^3.7.0",
56
+ "eslint-mdx": "^3.1.5",
49
57
  "eslint-plugin-astro": "^1.3.1",
58
+ "eslint-plugin-depend": "^0.12.0",
50
59
  "eslint-plugin-html": "^8.1.2",
60
+ "eslint-plugin-import-x": "^4.6.1",
61
+ "eslint-plugin-jsdoc": "^50.6.3",
62
+ "eslint-plugin-jsonc": "^2.19.1",
51
63
  "eslint-plugin-jsx-a11y": "^6.10.2",
52
64
  "eslint-plugin-mdx": "^3.1.5",
53
- "eslint-plugin-n": "^17.13.1",
54
- "eslint-plugin-perfectionist": "^3.9.1",
55
- "eslint-plugin-svelte": "^2.46.0",
56
- "eslint-plugin-unicorn": "^55.0.0",
57
- "execa": "^8.0.1",
58
- "fs-extra": "^11.2.0"
65
+ "eslint-plugin-n": "^17.15.1",
66
+ "eslint-plugin-no-only-tests": "^3.3.0",
67
+ "eslint-plugin-package-json": "^0.23.0",
68
+ "eslint-plugin-perfectionist": "^4.8.0",
69
+ "eslint-plugin-regexp": "^2.7.0",
70
+ "eslint-plugin-svelte": "^2.46.1",
71
+ "eslint-plugin-toml": "^0.12.0",
72
+ "eslint-plugin-unicorn": "^56.0.1",
73
+ "eslint-plugin-yml": "^1.16.0",
74
+ "execa": "^9.5.2",
75
+ "fs-extra": "^11.3.0",
76
+ "globals": "^15.14.0",
77
+ "jsonc-eslint-parser": "^2.4.0",
78
+ "local-pkg": "^1.0.0",
79
+ "svelte-eslint-parser": "^0.43.0",
80
+ "toml-eslint-parser": "^0.10.0",
81
+ "yaml-eslint-parser": "^1.2.3"
82
+ },
83
+ "devDependencies": {
84
+ "@types/eslint-config-prettier": "^6.11.3",
85
+ "@types/eslint-plugin-jsx-a11y": "^6.10.0",
86
+ "dot-prop": "^9.0.0",
87
+ "eslint-config-prettier": "^10.0.1",
88
+ "eslint-config-xo-typescript": "^7.0.0",
89
+ "eslint-typegen": "^1.0.0",
90
+ "prettier": "^3.4.2",
91
+ "svelte": "^5.19.9",
92
+ "tsup": "^8.3.6"
93
+ },
94
+ "engines": {
95
+ "node": ">=22.0.0",
96
+ "pnpm": ">=10.0.0"
59
97
  },
60
98
  "publishConfig": {
61
99
  "access": "public"
62
100
  },
63
101
  "scripts": {
64
- "build": "../../scripts/build.ts && pnpm mdat readme",
65
- "cli": "node ./bin/cli.js"
102
+ "build": "pnpm run typegen && tsup --format esm --clean --dts && ../../scripts/build.ts",
103
+ "cli": "node ./bin/cli.js",
104
+ "inspect": "npx @eslint/config-inspector --config ./init/eslint.config.ts",
105
+ "presetgen": "tsx scripts/presetgen.ts && pnpm run typegen && kpi fix",
106
+ "typegen": "tsx scripts/typegen.ts"
66
107
  }
67
108
  }
package/readme.md CHANGED
@@ -21,9 +21,17 @@
21
21
 
22
22
  ## Overview
23
23
 
24
- It's a shared [ESLint](https://eslint.org) config.
24
+ It's a shared [ESLint](https://eslint.org) config, plus a command-line tool `kpi-eslint` to perform ESLint-related project initialization, linting, and fixing.
25
25
 
26
- **See [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) for the recommended single-package approach.**
26
+ <!-- recommendation -->
27
+
28
+ > [!Important]
29
+ >
30
+ > **You can use this package on its own, but it's recommended to use [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) instead for a single-dependency and single-package approach to linting and fixing your project.**
31
+ >
32
+ > This package is included as a dependency in [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config), which also automatically invokes the command line functionality in this package via its `kpi` command
33
+
34
+ <!-- /recommendation -->
27
35
 
28
36
  ## Setup
29
37
 
@@ -32,19 +40,26 @@ To use just this ESLint config in isolation:
32
40
  1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior:
33
41
 
34
42
  ```sh
35
- pnpm dlx @kitschpatrol/repo-config --init
43
+ pnpm dlx @kitschpatrol/repo-config init
44
+ ```
45
+
46
+ 2. Install and initialize the required TypeScript `tsconfig.json` configuration in your project root:
47
+
48
+ ```sh
49
+ pnpm add -D @kitschpatrol/typescript-config
50
+ pnpm dlx @kitschpatrol/typescript-config init
36
51
  ```
37
52
 
38
- 2. Add the package:
53
+ 3. Add the package:
39
54
 
40
55
  ```sh
41
56
  pnpm add -D @kitschpatrol/eslint-config
42
57
  ```
43
58
 
44
- 3. Add the starter `.eslintrc.cjs` config and `.eslintignore` files to your project root, and add any overrides you'd like:
59
+ 4. Add the starter `eslint.config.ts` config files to your project root, and add any overrides you'd like:
45
60
 
46
61
  ```sh
47
- pnpm exec eslint-config --init
62
+ pnpm exec eslint-kpi init
48
63
  ```
49
64
 
50
65
  ## Usage
@@ -56,9 +71,11 @@ You can call it directly, or use the script bundled with the config.
56
71
  Integrate with your `package.json` scripts as you see fit, for example:
57
72
 
58
73
  ```json
59
- "scripts": {
60
- "lint": "eslint-config --check"
61
- "fix": "eslint-config --fix"
74
+ {
75
+ "scripts": {
76
+ "lint": "eslint-config lint",
77
+ "fix": "eslint-config fix"
78
+ }
62
79
  }
63
80
  ```
64
81
 
@@ -66,34 +83,120 @@ Integrate with your `package.json` scripts as you see fit, for example:
66
83
 
67
84
  <!-- cli-help -->
68
85
 
69
- #### Command: `eslint-config`
86
+ #### Command: `kpi-eslint`
87
+
88
+ Kitschpatrol's ESLint shared configuration tools.
89
+
90
+ This section lists top-level commands for `kpi-eslint`.
91
+
92
+ Usage:
93
+
94
+ ```txt
95
+ kpi-eslint <command>
96
+ ```
97
+
98
+ | Command | Argument | Description |
99
+ | -------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
100
+ | `init` | | Initialize by copying starter config files to your project root. |
101
+ | `lint` | `[files..]` | Lint your project with ESLint. Matches files below the current working directory by default. |
102
+ | `fix` | `[files..]` | Fix your project with ESLint. Matches files below the current working directory by default. |
103
+ | `print-config` | `[file]` | Print the effective ESLint configuration. Package-scoped by default, file-scoped if a file argument is provided. Use `@eslint/config-inspector` for a more detailed view. |
104
+
105
+ | Option | Description | Type |
106
+ | ------------------- | ------------------- | --------- |
107
+ | `--help`<br>`-h` | Show help | `boolean` |
108
+ | `--version`<br>`-v` | Show version number | `boolean` |
109
+
110
+ _See the sections below for more information on each subcommand._
111
+
112
+ #### Subcommand: `kpi-eslint init`
113
+
114
+ Initialize by copying starter config files to your project root.
115
+
116
+ Usage:
117
+
118
+ ```txt
119
+ kpi-eslint init
120
+ ```
121
+
122
+ | Option | Description | Type |
123
+ | ------------------- | ------------------- | --------- |
124
+ | `--help`<br>`-h` | Show help | `boolean` |
125
+ | `--version`<br>`-v` | Show version number | `boolean` |
126
+
127
+ #### Subcommand: `kpi-eslint lint`
128
+
129
+ Lint your project with ESLint. Matches files below the current working directory by default.
130
+
131
+ Usage:
132
+
133
+ ```txt
134
+ kpi-eslint lint [files..]
135
+ ```
136
+
137
+ | Positional Argument | Description | Type | Default |
138
+ | ------------------- | ------------------------------ | ------- | ------- |
139
+ | `files` | Files or glob pattern to lint. | `array` | `"."` |
70
140
 
71
- ESLint configuration for @kitschpatrol/shared-config.
141
+ | Option | Description | Type |
142
+ | ------------------- | ------------------- | --------- |
143
+ | `--help`<br>`-h` | Show help | `boolean` |
144
+ | `--version`<br>`-v` | Show version number | `boolean` |
145
+
146
+ #### Subcommand: `kpi-eslint fix`
147
+
148
+ Fix your project with ESLint. Matches files below the current working directory by default.
72
149
 
73
150
  Usage:
74
151
 
75
152
  ```txt
76
- eslint-config [<file|glob> ...]
153
+ kpi-eslint fix [files..]
77
154
  ```
78
155
 
79
- | Option | Argument | Description |
80
- | ------------------------ | -------- | ---------------------------------------------------------------- |
81
- | `--check`<br>`-c` | | Check for and report issues. Same as `eslint-config`. |
82
- | `--fix`<br>`-f` | | Fix all auto-fixable issues, and report the un-fixable. |
83
- | `--init`<br>`-i` | | Initialize by copying starter config files to your project root. |
84
- | `--print-config`<br>`-p` | `<path>` | Print the effective configuration at a certain path. |
85
- | `--help`<br>`-h` | | Print this help info. |
86
- | `--version`<br>`-v` | | Print the package version. |
156
+ | Positional Argument | Description | Type | Default |
157
+ | ------------------- | ----------------------------- | ------- | ------- |
158
+ | `files` | Files or glob pattern to fix. | `array` | `"."` |
159
+
160
+ | Option | Description | Type |
161
+ | ------------------- | ------------------- | --------- |
162
+ | `--help`<br>`-h` | Show help | `boolean` |
163
+ | `--version`<br>`-v` | Show version number | `boolean` |
164
+
165
+ #### Subcommand: `kpi-eslint print-config`
166
+
167
+ Print the effective ESLint configuration. Package-scoped by default, file-scoped if a file argument is provided. Use `@eslint/config-inspector` for a more detailed view.
168
+
169
+ Usage:
170
+
171
+ ```txt
172
+ kpi-eslint print-config [file]
173
+ ```
174
+
175
+ | Positional Argument | Description | Type |
176
+ | ------------------- | --------------------------- | -------- |
177
+ | `file` | File or glob pattern to TK. | `string` |
178
+
179
+ | Option | Description | Type |
180
+ | ------------------- | ------------------- | --------- |
181
+ | `--help`<br>`-h` | Show help | `boolean` |
182
+ | `--version`<br>`-v` | Show version number | `boolean` |
87
183
 
88
184
  <!-- /cli-help -->
89
185
 
90
186
  ## Notes
91
187
 
92
- The whole flat file config thing is pending...
188
+ Regrettably the `eslint-config init --location package` option is not supported due to ESLint 9's deprecation of support for putting configuration in `package.json`. See ESLint discussion thread [18131](https://github.com/eslint/eslint/discussions/18131).
189
+
190
+ ### Origins
191
+
192
+ 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.
93
193
 
94
- ESLint does not inherit files and paths from `.gitignore`. Ignored paths must be specified in `.eslintignore`.
194
+ ### References
95
195
 
96
- This shared config will also initialize a `tsconfig.json` and a `tsconfig.eslint.json`. These should probably live in a separate configuration package, but they'll reside here for now.
196
+ - [@antfu/eslint-config](https://github.com/antfu/eslint-config)
197
+ - [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
198
+ - [linting-setup-using-eslint](https://chris.lu/web_development/tutorials/next-js-static-mdx-blog/linting-setup-using-eslint)
199
+ - On [prefer-repository-shorthand](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/223)
97
200
 
98
201
  <!-- license -->
99
202