@useinsider/eslint-config 1.13.0-beta.5 → 1.13.0-beta.7
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 +69 -19
- package/dist/builders/configFiles.d.ts +12 -0
- package/dist/cli.cjs +1539 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/main.cjs +55 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.ts +11 -5
- package/dist/main.js +55 -1
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,23 @@ runner, jQuery globals, tsconfig layout), installs every required ESLint
|
|
|
44
44
|
plugin pinned to the versions this package was built against, and writes a
|
|
45
45
|
starter `eslint.config.mjs` at the project root.
|
|
46
46
|
|
|
47
|
+
To migrate an existing v1 `eslint.config.{js,mjs,cjs}` or a legacy
|
|
48
|
+
`.eslintrc.{js,cjs}`:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx @useinsider/eslint-config migrate [path]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The migrate flow auto-detects the source format. For flat configs it
|
|
55
|
+
parses the v1 file, prints a summary plus any dropped custom rules, asks
|
|
56
|
+
for confirmation, then rewrites the file in place. For legacy `.eslintrc`
|
|
57
|
+
files it writes a fresh `eslint.config.mjs` next to the original (custom
|
|
58
|
+
rules and non-`@useinsider/eslint-config/*` extends are dropped with a
|
|
59
|
+
loud warning so you can review what changed). The original is backed up
|
|
60
|
+
in both cases as `eslint.config.v1-backup.<ext>` or
|
|
61
|
+
`.eslintrc.v1-backup.<ext>`. Legacy `.eslintrc.{json,yml,yaml}` are not
|
|
62
|
+
supported in this release — convert them to `.eslintrc.{js,cjs}` first.
|
|
63
|
+
|
|
47
64
|
Example output for a Node + TypeScript project:
|
|
48
65
|
|
|
49
66
|
```js
|
|
@@ -198,25 +215,58 @@ export default useInsider({
|
|
|
198
215
|
`useInsider(config)` accepts the following top-level properties. Each scope
|
|
199
216
|
holds an array of entries; each entry produces its own flat-config block.
|
|
200
217
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
| `
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
218
|
+
Every scope entry shape also accepts two common fields:
|
|
219
|
+
|
|
220
|
+
- `ignores?: string[]` — applies as the block's `ignores` key, scoping the
|
|
221
|
+
rule set away from the listed globs.
|
|
222
|
+
- `globals?: Record<string, GlobalConf>` — merged on top of the globals the
|
|
223
|
+
preset already provides; pass `'readonly'`, `'writable'`, or `'off'` per
|
|
224
|
+
ESLint's `Linter.Globals`. Use this to declare project-specific globals
|
|
225
|
+
like `APP_URL`, `axios`, `atatus`.
|
|
226
|
+
|
|
227
|
+
| Property | Entry shape | Notes |
|
|
228
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------- | ----- |
|
|
229
|
+
| `ignores` | `string[]` (top-level) | Emits a leading `{ ignores }` block applied to every other block. |
|
|
230
|
+
| `javascript` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Environment-agnostic JS (workers, isomorphic). |
|
|
231
|
+
| `javascriptDom` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Browser JS. |
|
|
232
|
+
| `javascriptNode` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Node JS. |
|
|
233
|
+
| `typescript` | `{ files: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | Environment-agnostic TS. |
|
|
234
|
+
| `typescriptDom` | `{ files: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | Browser TS. |
|
|
235
|
+
| `typescriptNode` | `{ files: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | Node TS. |
|
|
236
|
+
| `vue2` | `{ files: string[]; globalComponents?: string[]; ignores?: string[]; globals?: Linter.Globals }` | Vue 2 single-file components in JS. |
|
|
237
|
+
| `vue3` | `{ files: string[]; globalComponents?: string[]; ignores?: string[]; globals?: Linter.Globals }` | Vue 3 single-file components in JS. |
|
|
238
|
+
| `vue2Typescript` | `{ files: string[]; globalComponents?: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | Vue 2 + TS. |
|
|
239
|
+
| `vue3Typescript` | `{ files: string[]; globalComponents?: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | Vue 3 + TS. |
|
|
240
|
+
| `jest` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Jest test files. |
|
|
241
|
+
| `vitest` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Vitest test files. |
|
|
242
|
+
| `jsdocBasedTs` | `{ files: string[]; tsconfigPaths: string[]; ignores?: string[]; globals?: Linter.Globals }` | JS files type-checked via JSDoc. |
|
|
243
|
+
| `jquery` | `{ files: string[]; ignores?: string[]; globals?: Linter.Globals }` | Layers jQuery globals (`$`, `jQuery`) on top of the matching globs. Per-entry `globals` merge with the jQuery ones rather than replacing them. |
|
|
244
|
+
| `strict` | `boolean \| string[]` | Applies the strict preset globally (`true`) or scoped to globs. |
|
|
245
|
+
| `spellChecker` | `{ ignoredPaths?: string[]; customWordListFile?: string }` | Cross-cutting cspell overrides. |
|
|
246
|
+
| `silenceRules` | `string[]` | Rule IDs to demote to `'warn'` across every block. |
|
|
247
|
+
| `configFiles` | `false \| string[]` | Emits a dedicated block for root-level configuration files (`*.config.*`, `eslint.config.*`) that disables `import-x/no-extraneous-dependencies` and `import-x/prefer-default-export`. **Defaults are applied automatically** — omit the key (or pass `[]`) to use the built-in defaults only, pass a `string[]` to layer your own globs on top, or pass `false` to opt out entirely. |
|
|
248
|
+
|
|
249
|
+
A scope entry with per-entry globals — declare project-specific bindings
|
|
250
|
+
without spreading the `useInsider` return into your own array:
|
|
251
|
+
|
|
252
|
+
```js
|
|
253
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
254
|
+
|
|
255
|
+
export default useInsider({
|
|
256
|
+
ignores: ['dist', 'coverage'],
|
|
257
|
+
javascriptDom: [
|
|
258
|
+
{
|
|
259
|
+
files: ['src/**/*.js'],
|
|
260
|
+
ignores: ['src/vendor/**'],
|
|
261
|
+
globals: {
|
|
262
|
+
APP_URL: 'readonly',
|
|
263
|
+
axios: 'readonly',
|
|
264
|
+
atatus: 'readonly',
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
});
|
|
269
|
+
```
|
|
220
270
|
|
|
221
271
|
Block-emission order — scope blocks first (in the order their keys were
|
|
222
272
|
inserted into the config object), then `jquery` blocks, then any `strict`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Default globs treated as "configuration files" — root-level `*.config.*`
|
|
4
|
+
* variants plus the canonical `eslint.config.*` flat-config filenames.
|
|
5
|
+
*
|
|
6
|
+
* These are intentionally conservative: only the top-level matches that the
|
|
7
|
+
* v1 `config` preset was overwhelmingly applied to. Project-specific paths
|
|
8
|
+
* (subdirectories, custom names) must be opted into by passing them via the
|
|
9
|
+
* `configFiles: string[]` knob.
|
|
10
|
+
*/
|
|
11
|
+
export declare const DEFAULT_CONFIG_FILE_GLOBS: readonly string[];
|
|
12
|
+
export declare function buildConfigFilesBlocks(value: false | string[] | undefined): Linter.Config[];
|