eslint-config-nick2bad4u 1.2.2 → 1.2.4
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 +87 -80
- package/dist/shared-config.js +246 -78
- package/dist/shared-config.js.map +1 -1
- package/docs/configuration.md +72 -68
- package/docs/index.md +12 -12
- package/docs/maintainer-guide.md +22 -20
- package/docs/migration.md +64 -64
- package/index.d.ts +10 -0
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ parsers that the shared config enables.
|
|
|
13
13
|
|
|
14
14
|
## Requirements
|
|
15
15
|
|
|
16
|
-
| Tool
|
|
17
|
-
|
|
|
18
|
-
| Node.js
|
|
19
|
-
| ESLint
|
|
20
|
-
| TypeScript | `^5.0.0 \|\| ^6.0.3` | Peer dependency used by TypeScript-aware lint rules.
|
|
16
|
+
| Tool | Supported range | Why it is required |
|
|
17
|
+
| ---------- | -------------------- | --------------------------------------------------------------- |
|
|
18
|
+
| Node.js | `>=22.0.0` | Runtime for ESLint, the config package, and repository scripts. |
|
|
19
|
+
| ESLint | `^10.4.0` | Peer dependency supplied by each consuming project. |
|
|
20
|
+
| TypeScript | `^5.0.0 \|\| ^6.0.3` | Peer dependency used by TypeScript-aware lint rules. |
|
|
21
21
|
|
|
22
22
|
Repository development also expects npm `>=11.0.0`; consumers can use the package
|
|
23
23
|
with whatever package manager their project supports.
|
|
@@ -48,13 +48,13 @@ spreading it lets you append local overrides without replacing the shared config
|
|
|
48
48
|
import nick2bad4u from "eslint-config-nick2bad4u";
|
|
49
49
|
|
|
50
50
|
export default [
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
...nick2bad4u.configs.all,
|
|
52
|
+
{
|
|
53
|
+
name: "Local overrides",
|
|
54
|
+
rules: {
|
|
55
|
+
"no-console": "off",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
58
|
];
|
|
59
59
|
```
|
|
60
60
|
|
|
@@ -73,15 +73,15 @@ For migration steps from an existing hand-written config, see the
|
|
|
73
73
|
|
|
74
74
|
Long-form project documentation lives in [`docs/`](./docs/index.md).
|
|
75
75
|
|
|
76
|
-
| Guide
|
|
77
|
-
|
|
|
78
|
-
| [Configuration](./docs/configuration.md)
|
|
79
|
-
| [Migration](./docs/migration.md)
|
|
80
|
-
| [Contributing](./CONTRIBUTING.md)
|
|
81
|
-
| [Maintainer guide](./docs/maintainer-guide.md) | Rule, preset, dependency, and release maintenance.
|
|
82
|
-
| [Support](./SUPPORT.md)
|
|
83
|
-
| [Security](./SECURITY.md)
|
|
84
|
-
| [Code of conduct](./CODE_OF_CONDUCT.md)
|
|
76
|
+
| Guide | Use it for |
|
|
77
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------- |
|
|
78
|
+
| [Configuration](./docs/configuration.md) | `createConfig()`, presets, plugin replacement, and environment variables. |
|
|
79
|
+
| [Migration](./docs/migration.md) | Moving a project from a hand-written flat config to this package. |
|
|
80
|
+
| [Contributing](./CONTRIBUTING.md) | Local development workflow and pull request expectations. |
|
|
81
|
+
| [Maintainer guide](./docs/maintainer-guide.md) | Rule, preset, dependency, and release maintenance. |
|
|
82
|
+
| [Support](./SUPPORT.md) | Issue triage and reproduction details. |
|
|
83
|
+
| [Security](./SECURITY.md) | Private vulnerability reporting. |
|
|
84
|
+
| [Code of conduct](./CODE_OF_CONDUCT.md) | Participation standards for the project. |
|
|
85
85
|
|
|
86
86
|
## `createConfig()`
|
|
87
87
|
|
|
@@ -93,16 +93,23 @@ shared defaults:
|
|
|
93
93
|
import { createConfig } from "eslint-config-nick2bad4u";
|
|
94
94
|
|
|
95
95
|
export default createConfig({
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
allowDefaultProjectFilePatterns: [
|
|
97
|
+
"*.config.{js,mjs,cjs,ts,mts,cts}",
|
|
98
|
+
"*.config.*.{js,mjs,cjs,ts,mts,cts}",
|
|
99
|
+
".*rc.{js,mjs,cjs,ts,mts,cts}",
|
|
100
|
+
"preset.mjs",
|
|
101
|
+
],
|
|
102
|
+
rootDirectory: import.meta.dirname,
|
|
103
|
+
tsconfigPaths: ["./tsconfig.eslint.json"],
|
|
98
104
|
});
|
|
99
105
|
```
|
|
100
106
|
|
|
101
|
-
| Option
|
|
102
|
-
|
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
107
|
+
| Option | Type | Default | Use it when |
|
|
108
|
+
| --------------------------------- | ----------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
109
|
+
| `allowDefaultProjectFilePatterns` | `readonly string[]` | `["*.mjs", ".*.mjs"]` | Root config files are intentionally outside `tsconfigPaths`; do not include files already covered by your lint tsconfig. |
|
|
110
|
+
| `rootDirectory` | `string` | `process.cwd()` | ESLint runs outside the project root or a monorepo package needs its own root. |
|
|
111
|
+
| `tsconfigPaths` | `readonly string[]` | `["./tsconfig.eslint.json"]` | The project uses a differently named lint tsconfig or a truly separate TypeScript project. |
|
|
112
|
+
| `plugins` | `Readonly<Record<string, unknown>>` | `{}` | You need to dogfood a local plugin build or disable packaged plugin rules by namespace. |
|
|
106
113
|
|
|
107
114
|
An example copy-paste config is available at
|
|
108
115
|
[`examples/eslint.config.create.mjs`](./examples/eslint.config.create.mjs).
|
|
@@ -114,30 +121,30 @@ Detailed configuration examples live in the
|
|
|
114
121
|
All presets are available from the default export as `nick2bad4u.configs.*` and
|
|
115
122
|
from the named `presets` export.
|
|
116
123
|
|
|
117
|
-
| Preset
|
|
118
|
-
|
|
|
119
|
-
| `all`
|
|
120
|
-
| `recommended`
|
|
121
|
-
| `base`
|
|
122
|
-
| `withoutCopilot`
|
|
123
|
-
| `withoutDocusaurus2`
|
|
124
|
-
| `withoutEtcMisc`
|
|
125
|
-
| `withoutFileProgress2`
|
|
126
|
-
| `withoutGitHubActions2`
|
|
127
|
-
| `withoutGithubActions2`
|
|
128
|
-
| `withoutImmutable2`
|
|
129
|
-
| `withoutRemark`
|
|
130
|
-
| `withoutRepo`
|
|
131
|
-
| `withoutRuntimeCleanup`
|
|
132
|
-
| `withoutSdl2`
|
|
133
|
-
| `withoutStylelint2`
|
|
134
|
-
| `withoutTestSignal`
|
|
135
|
-
| `withoutTsconfig`
|
|
136
|
-
| `withoutTsdocRequire2`
|
|
137
|
-
| `withoutTypedoc`
|
|
138
|
-
| `withoutTypefest`
|
|
139
|
-
| `withoutVite`
|
|
140
|
-
| `withoutWriteGoodComments2` | Full shared config without Write Good Comments 2 rules.
|
|
124
|
+
| Preset | Purpose |
|
|
125
|
+
| --------------------------- | ---------------------------------------------------------------------------------- |
|
|
126
|
+
| `all` | Full shared config, including packaged Typefest and Etc-Misc source-rule sections. |
|
|
127
|
+
| `recommended` | Alias for `all`; provided for familiar preset naming. |
|
|
128
|
+
| `base` | Shared config without explicit source-rule plugin sections. |
|
|
129
|
+
| `withoutCopilot` | Full shared config without Copilot rules. |
|
|
130
|
+
| `withoutDocusaurus2` | Full shared config without Docusaurus 2 plugin rules. |
|
|
131
|
+
| `withoutEtcMisc` | Full shared config without the Etc-Misc source-rule section. |
|
|
132
|
+
| `withoutFileProgress2` | Full shared config without File Progress 2 rules. |
|
|
133
|
+
| `withoutGitHubActions2` | Full shared config without GitHub Actions 2 rules. |
|
|
134
|
+
| `withoutGithubActions2` | Deprecated alias for `withoutGitHubActions2`. |
|
|
135
|
+
| `withoutImmutable2` | Full shared config without Immutable 2 rules. |
|
|
136
|
+
| `withoutRemark` | Full shared config without Remark plugin rules. |
|
|
137
|
+
| `withoutRepo` | Full shared config without Repo plugin rules. |
|
|
138
|
+
| `withoutRuntimeCleanup` | Full shared config without Runtime Cleanup plugin rules. |
|
|
139
|
+
| `withoutSdl2` | Full shared config without SDL 2 rules. |
|
|
140
|
+
| `withoutStylelint2` | Full shared config without Stylelint 2 rules. |
|
|
141
|
+
| `withoutTestSignal` | Full shared config without Test Signal plugin rules. |
|
|
142
|
+
| `withoutTsconfig` | Full shared config without tsconfig-validation rules. |
|
|
143
|
+
| `withoutTsdocRequire2` | Full shared config without TSDoc Require 2 rules. |
|
|
144
|
+
| `withoutTypedoc` | Full shared config without TypeDoc rules. |
|
|
145
|
+
| `withoutTypefest` | Full shared config without the Typefest source-rule section. |
|
|
146
|
+
| `withoutVite` | Full shared config without Vite plugin rules. |
|
|
147
|
+
| `withoutWriteGoodComments2` | Full shared config without Write Good Comments 2 rules. |
|
|
141
148
|
|
|
142
149
|
Use a `without*` preset when a repository does not use that surface or when it
|
|
143
150
|
needs to provide a local build of that plugin for dogfooding.
|
|
@@ -150,15 +157,15 @@ can lint: source, tests, scripts, dotfiles, examples, and docs tooling.
|
|
|
150
157
|
|
|
151
158
|
```json
|
|
152
159
|
{
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
"$schema": "https://www.schemastore.org/tsconfig.json",
|
|
161
|
+
"extends": "./tsconfig.json",
|
|
162
|
+
"compilerOptions": {
|
|
163
|
+
"allowJs": true,
|
|
164
|
+
"checkJs": true,
|
|
165
|
+
"noEmit": true
|
|
166
|
+
},
|
|
167
|
+
"exclude": ["node_modules/**", "dist/**", "coverage/**", ".cache/**"],
|
|
168
|
+
"include": ["**/*", "**/.*"]
|
|
162
169
|
}
|
|
163
170
|
```
|
|
164
171
|
|
|
@@ -180,17 +187,17 @@ import nick2bad4u from "eslint-config-nick2bad4u";
|
|
|
180
187
|
import localTypefest from "./plugin.mjs";
|
|
181
188
|
|
|
182
189
|
export default [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
...nick2bad4u.configs.withoutTypefest,
|
|
191
|
+
{
|
|
192
|
+
files: ["src/**/*.{ts,tsx,mts,cts}"],
|
|
193
|
+
name: "Local Typefest rules",
|
|
194
|
+
plugins: {
|
|
195
|
+
typefest: localTypefest,
|
|
196
|
+
},
|
|
197
|
+
rules: {
|
|
198
|
+
...localTypefest.configs.experimental.rules,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
194
201
|
];
|
|
195
202
|
```
|
|
196
203
|
|
|
@@ -201,9 +208,9 @@ Use the same shape for other plugin namespaces, such as `withoutCopilot`,
|
|
|
201
208
|
|
|
202
209
|
### JSON schema validation
|
|
203
210
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
`eslint-plugin-json-schema-validator` in the consuming repo and set the opt-in
|
|
211
|
+
Schema validation is disabled by default because schema fetching can make lint
|
|
212
|
+
runs flaky in offline or locked-down environments. To opt in, install
|
|
213
|
+
`eslint-plugin-json-schema-validator-2` in the consuming repo and set the opt-in
|
|
207
214
|
environment variable when running ESLint:
|
|
208
215
|
|
|
209
216
|
```sh
|
|
@@ -215,11 +222,11 @@ ENABLE_JSON_SCHEMA_VALIDATION=1 eslint .
|
|
|
215
222
|
`eslint-plugin-file-progress-2` is enabled by default. Control it with
|
|
216
223
|
`ESLINT_PROGRESS`:
|
|
217
224
|
|
|
218
|
-
| Value
|
|
219
|
-
|
|
|
220
|
-
| unset or `on`
|
|
221
|
-
| `nofile`
|
|
222
|
-
| `off`, `0`, or `false` | Disable progress output.
|
|
225
|
+
| Value | Behavior |
|
|
226
|
+
| ---------------------- | --------------------------------- |
|
|
227
|
+
| unset or `on` | Show progress and file names. |
|
|
228
|
+
| `nofile` | Show progress without file names. |
|
|
229
|
+
| `off`, `0`, or `false` | Disable progress output. |
|
|
223
230
|
|
|
224
231
|
## Development checks
|
|
225
232
|
|