@useinsider/eslint-config 1.13.0-beta.3 → 1.13.0-beta.5
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 +318 -58
- package/dist/builders/jquery.d.ts +5 -0
- package/dist/builders/scopeBlocks.d.ts +40 -0
- package/dist/builders/spellChecker.d.ts +7 -0
- package/dist/builders/strict.d.ts +2 -0
- package/dist/builders/typescript.d.ts +6 -0
- package/dist/builders/vue.d.ts +8 -0
- package/dist/cli.cjs +490 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/configs/vitest/index.d.ts +3 -0
- package/dist/{javascript-BXgxOHrE.js → javascript-DRBDZ53G.js} +2 -2
- package/dist/{javascript-BXgxOHrE.js.map → javascript-DRBDZ53G.js.map} +1 -1
- package/dist/{javascript-ZbGsFE17.cjs → javascript-Dgd5YZ4v.cjs} +2 -2
- package/dist/{javascript-ZbGsFE17.cjs.map → javascript-Dgd5YZ4v.cjs.map} +1 -1
- package/dist/{javascript-dom-DQiJS6LF.js → javascript-dom-BUo0oazt.js} +2 -2
- package/dist/{javascript-dom-DQiJS6LF.js.map → javascript-dom-BUo0oazt.js.map} +1 -1
- package/dist/{javascript-dom-D7RX0w0r.cjs → javascript-dom-DY-dVg10.cjs} +2 -2
- package/dist/{javascript-dom-D7RX0w0r.cjs.map → javascript-dom-DY-dVg10.cjs.map} +1 -1
- package/dist/{javascript-node-fII8MlI4.cjs → javascript-node-B2q-5MCV.cjs} +2 -2
- package/dist/{javascript-node-fII8MlI4.cjs.map → javascript-node-B2q-5MCV.cjs.map} +1 -1
- package/dist/{javascript-node-DDpIBysN.js → javascript-node-Cdx69Dtd.js} +2 -2
- package/dist/{javascript-node-DDpIBysN.js.map → javascript-node-Cdx69Dtd.js.map} +1 -1
- package/dist/{jest-B0jgh-Ns.js → jest-CHnGdlOz.js} +1 -1
- package/dist/{jest-B0jgh-Ns.js.map → jest-CHnGdlOz.js.map} +1 -1
- package/dist/{jest-Ct_2c2e5.cjs → jest-Cxug-2aj.cjs} +1 -1
- package/dist/{jest-Ct_2c2e5.cjs.map → jest-Cxug-2aj.cjs.map} +1 -1
- package/dist/{jsdoc-based-ts-B40HFdNC.js → jsdoc-based-ts-11d7Q2xg.js} +1 -1
- package/dist/{jsdoc-based-ts-B40HFdNC.js.map → jsdoc-based-ts-11d7Q2xg.js.map} +1 -1
- package/dist/{jsdoc-based-ts-De6bAjFn.cjs → jsdoc-based-ts-CH0bJyiQ.cjs} +1 -1
- package/dist/{jsdoc-based-ts-De6bAjFn.cjs.map → jsdoc-based-ts-CH0bJyiQ.cjs.map} +1 -1
- package/dist/main.cjs +187 -52
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.ts +44 -21
- package/dist/main.js +186 -52
- package/dist/main.js.map +1 -1
- package/dist/{removePluginsFromConfigs-BvvgY3b5.cjs → removePluginsFromConfigs-C6hBiYhB.cjs} +3 -2
- package/dist/{removePluginsFromConfigs-BvvgY3b5.cjs.map → removePluginsFromConfigs-C6hBiYhB.cjs.map} +1 -1
- package/dist/{removePluginsFromConfigs-DXGEhx1r.js → removePluginsFromConfigs-CZVb8Llj.js} +3 -2
- package/dist/{removePluginsFromConfigs-DXGEhx1r.js.map → removePluginsFromConfigs-CZVb8Llj.js.map} +1 -1
- package/dist/{strict-BfeS2xp_.js → strict-BCDy_p79.js} +1 -1
- package/dist/{strict-BfeS2xp_.js.map → strict-BCDy_p79.js.map} +1 -1
- package/dist/{strict-TbDHFSQX.cjs → strict-xrB0PqHI.cjs} +1 -1
- package/dist/{strict-TbDHFSQX.cjs.map → strict-xrB0PqHI.cjs.map} +1 -1
- package/dist/{stylistic-Cca81A-Y.js → stylistic-Bwo1XLKa.js} +1 -1
- package/dist/{stylistic-Cca81A-Y.js.map → stylistic-Bwo1XLKa.js.map} +1 -1
- package/dist/{stylistic-BltudTa0.cjs → stylistic-xuXbfq-L.cjs} +1 -1
- package/dist/{stylistic-BltudTa0.cjs.map → stylistic-xuXbfq-L.cjs.map} +1 -1
- package/dist/{typescript-CRRqsFpI.js → typescript-B2c32sBy.js} +4 -4
- package/dist/{typescript-CRRqsFpI.js.map → typescript-B2c32sBy.js.map} +1 -1
- package/dist/{typescript-CmD1xT7G.cjs → typescript-BRmCnG0B.cjs} +4 -4
- package/dist/{typescript-CmD1xT7G.cjs.map → typescript-BRmCnG0B.cjs.map} +1 -1
- package/dist/{typescript-dom-BLrRgrQB.js → typescript-dom-C_rK3dMI.js} +2 -2
- package/dist/{typescript-dom-BLrRgrQB.js.map → typescript-dom-C_rK3dMI.js.map} +1 -1
- package/dist/{typescript-dom-rOCUplwa.cjs → typescript-dom-DJBBaMuh.cjs} +2 -2
- package/dist/{typescript-dom-rOCUplwa.cjs.map → typescript-dom-DJBBaMuh.cjs.map} +1 -1
- package/dist/{typescript-node-sWiskEIb.cjs → typescript-node-DFd38ywl.cjs} +2 -2
- package/dist/{typescript-node-sWiskEIb.cjs.map → typescript-node-DFd38ywl.cjs.map} +1 -1
- package/dist/{typescript-node-CBSYnoOy.js → typescript-node-Dw6QK1Du.js} +2 -2
- package/dist/{typescript-node-CBSYnoOy.js.map → typescript-node-Dw6QK1Du.js.map} +1 -1
- package/dist/vitest-B-ezG20C.js +15 -0
- package/dist/vitest-B-ezG20C.js.map +1 -0
- package/dist/vitest-C66eWJuY.cjs +17 -0
- package/dist/vitest-C66eWJuY.cjs.map +1 -0
- package/dist/{vue2-DDKBhsLm.js → vue2-0JUzcNg8.js} +2 -2
- package/dist/{vue2-DDKBhsLm.js.map → vue2-0JUzcNg8.js.map} +1 -1
- package/dist/{vue2-Bh7W369C.cjs → vue2-BxcLGel4.cjs} +2 -2
- package/dist/{vue2-Bh7W369C.cjs.map → vue2-BxcLGel4.cjs.map} +1 -1
- package/dist/{vue2-typescript-B7J7fR77.js → vue2-typescript-DnQmxB-V.js} +3 -3
- package/dist/{vue2-typescript-B7J7fR77.js.map → vue2-typescript-DnQmxB-V.js.map} +1 -1
- package/dist/{vue2-typescript-blRUOCxt.cjs → vue2-typescript-cGnAnPPW.cjs} +3 -3
- package/dist/{vue2-typescript-blRUOCxt.cjs.map → vue2-typescript-cGnAnPPW.cjs.map} +1 -1
- package/dist/{vue3-BtNhSn_w.cjs → vue3-MaplnXCl.cjs} +2 -2
- package/dist/{vue3-BtNhSn_w.cjs.map → vue3-MaplnXCl.cjs.map} +1 -1
- package/dist/{vue3-CKwnKeS6.js → vue3-k9qGx747.js} +2 -2
- package/dist/{vue3-CKwnKeS6.js.map → vue3-k9qGx747.js.map} +1 -1
- package/dist/{vue3-typescript-Bt6uALvx.cjs → vue3-typescript-CgYTdvL7.cjs} +3 -3
- package/dist/{vue3-typescript-Bt6uALvx.cjs.map → vue3-typescript-CgYTdvL7.cjs.map} +1 -1
- package/dist/{vue3-typescript-Dn-0fPB_.js → vue3-typescript-DD8QAZnh.js} +3 -3
- package/dist/{vue3-typescript-Dn-0fPB_.js.map → vue3-typescript-DD8QAZnh.js.map} +1 -1
- package/package.json +6 -1
- package/dist/config-ByQJiSMj.cjs +0 -9
- package/dist/config-ByQJiSMj.cjs.map +0 -1
- package/dist/config-Css2Pu_R.js +0 -9
- package/dist/config-Css2Pu_R.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,97 +1,357 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @useinsider/eslint-config
|
|
2
|
+
|
|
3
|
+
Shared ESLint 9 flat-config for Insider projects. `useInsider()` takes a single
|
|
4
|
+
scope-keyed config object and returns a `defineConfig([...])` array — one
|
|
5
|
+
entry per file scope you describe. There is no opaque preset list, no
|
|
6
|
+
freeform `config` escape hatch, and no expectation that you spread the result
|
|
7
|
+
into your own array.
|
|
8
|
+
|
|
9
|
+
The default export is the resolved Promise returned by `useInsider(...)`;
|
|
10
|
+
ESLint 9 awaits it automatically. **Do not `await` it. Do not spread it. Do
|
|
11
|
+
not wrap it in an array.** If you find yourself wanting to append a block,
|
|
12
|
+
that is a sign your scope coverage is incomplete — describe the extra files
|
|
13
|
+
inside `useInsider({...})` instead.
|
|
2
14
|
|
|
3
15
|
## Table of Contents
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
- [Prerequisites](#prerequisites)
|
|
18
|
+
- [Quick start](#quick-start)
|
|
19
|
+
- [Manual setup](#manual-setup)
|
|
20
|
+
- [Node + TypeScript](#node--typescript)
|
|
21
|
+
- [Browser + Vue 3 + TypeScript with split tsconfigs](#browser--vue-3--typescript-with-split-tsconfigs)
|
|
22
|
+
- [Vue 2 + JavaScript with jQuery globals](#vue-2--javascript-with-jquery-globals)
|
|
23
|
+
- [Strict and spell-checker knobs](#strict-and-spell-checker-knobs)
|
|
24
|
+
- [API reference](#api-reference)
|
|
25
|
+
- [Migrating from v1.x](#migrating-from-v1x)
|
|
26
|
+
- [First lint after install](#first-lint-after-install)
|
|
27
|
+
- [Troubleshooting](#troubleshooting)
|
|
28
|
+
- [Contributing](#contributing)
|
|
16
29
|
|
|
17
30
|
## Prerequisites
|
|
18
31
|
|
|
19
|
-
-
|
|
32
|
+
- Node.js 20+
|
|
20
33
|
- ESLint 9+
|
|
34
|
+
- pnpm, npm, or yarn
|
|
35
|
+
|
|
36
|
+
## Quick start
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx @useinsider/eslint-config
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The CLI walks an interactive prompt (project type, language, framework, test
|
|
43
|
+
runner, jQuery globals, tsconfig layout), installs every required ESLint
|
|
44
|
+
plugin pinned to the versions this package was built against, and writes a
|
|
45
|
+
starter `eslint.config.mjs` at the project root.
|
|
46
|
+
|
|
47
|
+
Example output for a Node + TypeScript project:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
51
|
+
|
|
52
|
+
export default useInsider({
|
|
53
|
+
typescriptNode: [
|
|
54
|
+
{
|
|
55
|
+
files: ['**/*.{ts,tsx}'],
|
|
56
|
+
tsconfigPaths: ['tsconfig.json'],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
What the CLI installs for that answer set (versions reflect the publish-time
|
|
63
|
+
pins):
|
|
64
|
+
|
|
65
|
+
- `@useinsider/eslint-config`
|
|
66
|
+
- `eslint`
|
|
67
|
+
- `globals`
|
|
68
|
+
- `typescript`
|
|
69
|
+
- `typescript-eslint`
|
|
70
|
+
|
|
71
|
+
Vue, Jest, or Vitest answers add the matching plugin set (e.g. `eslint-plugin-vue`,
|
|
72
|
+
`vue-eslint-parser`, `eslint-plugin-vue-scoped-css`, `@vue/eslint-config-typescript`,
|
|
73
|
+
`@rushstack/eslint-patch`, `eslint-plugin-jest`, or `@vitest/eslint-plugin`).
|
|
74
|
+
|
|
75
|
+
## Manual setup
|
|
76
|
+
|
|
77
|
+
Install the package first:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
pnpm add -E -D @useinsider/eslint-config
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then create `eslint.config.mjs` and call `useInsider(...)` with the scopes
|
|
84
|
+
your project needs. Each scope holds an array of `{ files, ... }` entries;
|
|
85
|
+
each entry becomes its own flat-config block.
|
|
86
|
+
|
|
87
|
+
### Node + TypeScript
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
91
|
+
|
|
92
|
+
export default useInsider({
|
|
93
|
+
typescriptNode: [
|
|
94
|
+
{
|
|
95
|
+
files: ['**/*.{ts,tsx}'],
|
|
96
|
+
tsconfigPaths: ['tsconfig.json'],
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
vitest: [
|
|
100
|
+
{ files: ['**/*.{test,spec}.{ts,tsx}'] },
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Browser + Vue 3 + TypeScript with split tsconfigs
|
|
106
|
+
|
|
107
|
+
A project using `tsconfig.app.json` for source and `tsconfig.test.json` for
|
|
108
|
+
tests, with `RouterLink` and `RouterView` as globally-registered components.
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
112
|
+
|
|
113
|
+
export default useInsider({
|
|
114
|
+
vue3Typescript: [
|
|
115
|
+
{
|
|
116
|
+
files: ['src/**/*.{ts,tsx,vue}'],
|
|
117
|
+
tsconfigPaths: ['tsconfig.app.json'],
|
|
118
|
+
globalComponents: ['RouterLink', 'RouterView'],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
vitest: [
|
|
122
|
+
{
|
|
123
|
+
files: ['**/*.{test,spec}.{ts,tsx}'],
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
typescriptNode: [
|
|
127
|
+
{
|
|
128
|
+
files: ['*.config.{ts,mts,cts}'],
|
|
129
|
+
tsconfigPaths: ['tsconfig.node.json'],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Multiple `tsconfigPaths` entries are supported per block — pass an array of
|
|
136
|
+
paths if a single scope needs more than one project reference.
|
|
137
|
+
|
|
138
|
+
### Vue 2 + JavaScript with jQuery globals
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
142
|
+
|
|
143
|
+
export default useInsider({
|
|
144
|
+
vue2: [
|
|
145
|
+
{ files: ['src/**/*.{js,vue}'] },
|
|
146
|
+
],
|
|
147
|
+
javascriptNode: [
|
|
148
|
+
{ files: ['*.{js,cjs,mjs}'] },
|
|
149
|
+
],
|
|
150
|
+
jquery: [
|
|
151
|
+
{ files: ['src/**/*.{js,vue}'] },
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`jquery` is a top-level scope. Pass an array of `{ files }` entries describing
|
|
157
|
+
the globs that should see the jQuery globals (`$`, `jQuery`). The block is
|
|
158
|
+
emitted after the scope blocks and before `strict`/`spellChecker`, so the
|
|
159
|
+
matching language scope still applies its rule set and jQuery globals are
|
|
160
|
+
layered on top of it.
|
|
161
|
+
|
|
162
|
+
### Strict and spell-checker knobs
|
|
163
|
+
|
|
164
|
+
`strict` and `spellChecker` are flat cross-cutting options. They sit at the
|
|
165
|
+
top level of the config, not inside a scope entry.
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
import { useInsider } from '@useinsider/eslint-config';
|
|
169
|
+
|
|
170
|
+
export default useInsider({
|
|
171
|
+
typescriptNode: [
|
|
172
|
+
{
|
|
173
|
+
files: ['**/*.{ts,tsx}'],
|
|
174
|
+
tsconfigPaths: ['tsconfig.json'],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
strict: ['src/**/*.ts'],
|
|
178
|
+
spellChecker: {
|
|
179
|
+
ignoredPaths: ['vendor/**', 'dist/**'],
|
|
180
|
+
customWordListFile: './cspell.custom.json',
|
|
181
|
+
},
|
|
182
|
+
silenceRules: ['no-console'],
|
|
183
|
+
});
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- `strict: true` applies strict rules to every file.
|
|
187
|
+
- `strict: string[]` applies strict rules only to the matching paths.
|
|
188
|
+
- `spellChecker.customWordListFile` re-points `@cspell/spellchecker` to a
|
|
189
|
+
project-local word list.
|
|
190
|
+
- `spellChecker.ignoredPaths` turns the spell-checker off for the matching
|
|
191
|
+
globs (the off block is emitted after the custom-list block, so ignore
|
|
192
|
+
wins on overlap).
|
|
193
|
+
- `silenceRules` rewrites the severity of the listed rule IDs to `'warn'`
|
|
194
|
+
across every emitted block while preserving each rule's options.
|
|
21
195
|
|
|
22
|
-
##
|
|
196
|
+
## API reference
|
|
23
197
|
|
|
24
|
-
|
|
25
|
-
|
|
198
|
+
`useInsider(config)` accepts the following top-level properties. Each scope
|
|
199
|
+
holds an array of entries; each entry produces its own flat-config block.
|
|
26
200
|
|
|
27
|
-
|
|
201
|
+
| Property | Entry shape | Notes |
|
|
202
|
+
| ---------------- | ---------------------------------------------------------------------- | ----- |
|
|
203
|
+
| `javascript` | `{ files: string[] }` | Environment-agnostic JS (workers, isomorphic). |
|
|
204
|
+
| `javascriptDom` | `{ files: string[] }` | Browser JS. |
|
|
205
|
+
| `javascriptNode` | `{ files: string[] }` | Node JS. |
|
|
206
|
+
| `typescript` | `{ files: string[]; tsconfigPaths: string[] }` | Environment-agnostic TS. |
|
|
207
|
+
| `typescriptDom` | `{ files: string[]; tsconfigPaths: string[] }` | Browser TS. |
|
|
208
|
+
| `typescriptNode` | `{ files: string[]; tsconfigPaths: string[] }` | Node TS. |
|
|
209
|
+
| `vue2` | `{ files: string[]; globalComponents?: string[] }` | Vue 2 single-file components in JS. |
|
|
210
|
+
| `vue3` | `{ files: string[]; globalComponents?: string[] }` | Vue 3 single-file components in JS. |
|
|
211
|
+
| `vue2Typescript` | `{ files: string[]; globalComponents?: string[]; tsconfigPaths: string[] }` | Vue 2 + TS. |
|
|
212
|
+
| `vue3Typescript` | `{ files: string[]; globalComponents?: string[]; tsconfigPaths: string[] }` | Vue 3 + TS. |
|
|
213
|
+
| `jest` | `{ files: string[] }` | Jest test files. |
|
|
214
|
+
| `vitest` | `{ files: string[] }` | Vitest test files. |
|
|
215
|
+
| `jsdocBasedTs` | `{ files: string[]; tsconfigPaths: string[] }` | JS files type-checked via JSDoc. |
|
|
216
|
+
| `jquery` | `{ files: string[] }` | Layers jQuery globals (`$`, `jQuery`) on top of the matching globs. |
|
|
217
|
+
| `strict` | `boolean \| string[]` | Applies the strict preset globally (`true`) or scoped to globs. |
|
|
218
|
+
| `spellChecker` | `{ ignoredPaths?: string[]; customWordListFile?: string }` | Cross-cutting cspell overrides. |
|
|
219
|
+
| `silenceRules` | `string[]` | Rule IDs to demote to `'warn'` across every block. |
|
|
28
220
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
221
|
+
Block-emission order — scope blocks first (in the order their keys were
|
|
222
|
+
inserted into the config object), then `jquery` blocks, then any `strict`
|
|
223
|
+
blocks, then `spellChecker` blocks. Later blocks win on overlap, matching
|
|
224
|
+
ESLint's flat-config precedence model.
|
|
33
225
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
226
|
+
`useInsider` returns `Promise<Linter.Config[]>`. Export it directly — ESLint
|
|
227
|
+
9 resolves the Promise at load time. `useInsider`'s return type carries
|
|
228
|
+
through, so no JSDoc annotation is needed; the `UseInsiderResult` type alias
|
|
229
|
+
is exported for TypeScript callers that wrap `useInsider` in a helper of
|
|
230
|
+
their own.
|
|
38
231
|
|
|
39
|
-
|
|
232
|
+
`silenceRules()` (named export) is also available as a global registration
|
|
233
|
+
hook. Call it at module top level to register rule IDs to demote *before*
|
|
234
|
+
`useInsider` is invoked; the per-call `silenceRules: [...]` option layers
|
|
235
|
+
on top.
|
|
40
236
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
237
|
+
```js
|
|
238
|
+
import { useInsider, silenceRules } from '@useinsider/eslint-config';
|
|
239
|
+
|
|
240
|
+
silenceRules(['no-magic-numbers']);
|
|
241
|
+
|
|
242
|
+
export default useInsider({ /* ... */ });
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Migrating from v1.x
|
|
246
|
+
|
|
247
|
+
v2 is a hard break. The summary:
|
|
248
|
+
|
|
249
|
+
- **`preset: string[]`** → top-level scope properties. The order in the
|
|
250
|
+
v1 `preset` array no longer matters — the new shape has one property per
|
|
251
|
+
scope and overrides are explicit.
|
|
252
|
+
|
|
253
|
+
```diff
|
|
254
|
+
- await useInsider({
|
|
255
|
+
- preset: ['typescript-node'],
|
|
256
|
+
- config: { files: ['src/**/*.ts'], languageOptions: { parserOptions: { project: ['./tsconfig.json'] } } },
|
|
257
|
+
- })
|
|
258
|
+
+ useInsider({
|
|
259
|
+
+ typescriptNode: [
|
|
260
|
+
+ { files: ['src/**/*.ts'], tsconfigPaths: ['tsconfig.json'] },
|
|
261
|
+
+ ],
|
|
262
|
+
+ })
|
|
263
|
+
```
|
|
46
264
|
|
|
47
|
-
|
|
265
|
+
- **`preset: ['vue3-typescript']` + `config`** → `vue3Typescript` entry
|
|
266
|
+
with a dedicated `globalComponents` field. No more hand-rolled
|
|
267
|
+
`vue/no-undef-components` overrides.
|
|
48
268
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
269
|
+
```diff
|
|
270
|
+
- await useInsider({
|
|
271
|
+
- preset: ['vue3-typescript'],
|
|
272
|
+
- config: {
|
|
273
|
+
- files: ['src/**/*.{ts,vue}'],
|
|
274
|
+
- languageOptions: { parserOptions: { project: ['./tsconfig.app.json'] } },
|
|
275
|
+
- rules: { 'vue/no-undef-components': ['error', { ignorePatterns: ['^RouterLink$', '^RouterView$'] }] },
|
|
276
|
+
- },
|
|
277
|
+
- })
|
|
278
|
+
+ useInsider({
|
|
279
|
+
+ vue3Typescript: [
|
|
280
|
+
+ {
|
|
281
|
+
+ files: ['src/**/*.{ts,vue}'],
|
|
282
|
+
+ tsconfigPaths: ['tsconfig.app.json'],
|
|
283
|
+
+ globalComponents: ['RouterLink', 'RouterView'],
|
|
284
|
+
+ },
|
|
285
|
+
+ ],
|
|
286
|
+
+ })
|
|
287
|
+
```
|
|
54
288
|
|
|
55
|
-
|
|
289
|
+
- **`preset: ['strict']`** → top-level `strict: true | string[]`.
|
|
56
290
|
|
|
57
|
-
|
|
291
|
+
```diff
|
|
292
|
+
- await useInsider({ preset: ['typescript-node', 'strict'], config: { files: ['src/**/*.ts'] } })
|
|
293
|
+
+ useInsider({
|
|
294
|
+
+ typescriptNode: [{ files: ['src/**/*.ts'], tsconfigPaths: ['tsconfig.json'] }],
|
|
295
|
+
+ strict: true,
|
|
296
|
+
+ })
|
|
297
|
+
```
|
|
58
298
|
|
|
59
|
-
|
|
299
|
+
Behavior change: in v1 the `strict` preset was always global when listed.
|
|
300
|
+
In v2, `strict: true` keeps that global behavior; `strict: string[]`
|
|
301
|
+
scopes the strict rule set to the matching globs only. If you have
|
|
302
|
+
paths-targeted strict checks, set `strict: [...]` instead of
|
|
303
|
+
`strict: true`.
|
|
60
304
|
|
|
61
|
-
|
|
305
|
+
- **Shape change**: `useInsider(...)` is now exported directly as the
|
|
306
|
+
default export, without `await`, without spread, and without an array
|
|
307
|
+
wrap. ESLint 9 resolves the Promise on load. The old pattern
|
|
308
|
+
`export default [...await useInsider({...})]` still parses, but the
|
|
309
|
+
preferred shape is `export default useInsider({...})`. There is no
|
|
310
|
+
supported override path — describe every glob you want linted inside
|
|
311
|
+
the call, including jQuery files via the dedicated `jquery` scope.
|
|
62
312
|
|
|
63
|
-
|
|
64
|
-
|
|
313
|
+
- **Removed**: the `preset` array, the `config: Linter.Config` escape
|
|
314
|
+
hatch, and the `config` preset itself. Configuration-file linting is
|
|
315
|
+
now an ordinary `typescriptNode` (or `javascriptNode`) entry pointed at
|
|
316
|
+
the right tsconfig.
|
|
317
|
+
|
|
318
|
+
- **Kept**: `silenceRules` accepts the same `string[]` shape both as a
|
|
319
|
+
top-level option and via the named `silenceRules()` export.
|
|
320
|
+
`silenceDependencyWarning()` works unchanged. Side-effect lines such as
|
|
321
|
+
`silenceDependencyWarning(true)` continue to sit above the
|
|
322
|
+
`export default useInsider({...})` call.
|
|
323
|
+
|
|
324
|
+
## First lint after install
|
|
325
|
+
|
|
326
|
+
The first time you run lint after installing v2, `ensureDependencies` may
|
|
327
|
+
detect that your project's `eslint` or `globals` version is older than the
|
|
328
|
+
pin and auto-install them, exiting with code `1`. Run lint again and it
|
|
329
|
+
will complete normally.
|
|
65
330
|
|
|
66
331
|
## Troubleshooting
|
|
67
332
|
|
|
68
333
|
### `Missing dependencies detected:`
|
|
69
|
-
If you see this error, it means that the configuration you are trying to use
|
|
70
|
-
has some dependencies that are not installed in your project. You can install
|
|
71
|
-
them by running the command that it provides.
|
|
72
334
|
|
|
73
|
-
If you
|
|
74
|
-
|
|
335
|
+
If you see this error, your project is missing a peer plugin this config
|
|
336
|
+
needs. The error message lists the install command. To silence the warning
|
|
337
|
+
permanently:
|
|
75
338
|
|
|
76
339
|
```js
|
|
77
340
|
import { useInsider, silenceDependencyWarning } from '@useinsider/eslint-config';
|
|
78
341
|
|
|
79
342
|
silenceDependencyWarning(['@cspell/eslint-plugin', '@stylistic/eslint-plugin']);
|
|
80
|
-
```
|
|
81
343
|
|
|
82
|
-
|
|
83
|
-
|
|
344
|
+
export default useInsider({ /* ... */ });
|
|
345
|
+
```
|
|
84
346
|
|
|
85
|
-
|
|
86
|
-
|
|
347
|
+
Passing `true` silences every warning; that is not recommended because the
|
|
348
|
+
warning is the only signal that your installed plugin versions drifted
|
|
349
|
+
from what the config expects.
|
|
87
350
|
|
|
88
351
|
```js
|
|
89
|
-
import { useInsider, silenceDependencyWarning } from '@useinsider/eslint-config';
|
|
90
|
-
|
|
91
352
|
silenceDependencyWarning(true);
|
|
92
353
|
```
|
|
93
354
|
|
|
94
355
|
## Contributing
|
|
95
356
|
|
|
96
|
-
|
|
97
|
-
how to contribute to this project.
|
|
357
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) at the repo root.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
export interface JsEntry {
|
|
3
|
+
files: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface TsEntry {
|
|
6
|
+
files: string[];
|
|
7
|
+
tsconfigPaths: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface VueEntry {
|
|
10
|
+
files: string[];
|
|
11
|
+
globalComponents?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface VueTsEntry {
|
|
14
|
+
files: string[];
|
|
15
|
+
globalComponents?: string[];
|
|
16
|
+
tsconfigPaths: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface TestEntry {
|
|
19
|
+
files: string[];
|
|
20
|
+
}
|
|
21
|
+
export type ScopeEntry = JsEntry | TsEntry | VueEntry | VueTsEntry | TestEntry;
|
|
22
|
+
declare const scopeMap: {
|
|
23
|
+
javascript(): Promise<typeof import("../configs/javascript")>;
|
|
24
|
+
javascriptDom(): Promise<typeof import("../configs/javascript-dom")>;
|
|
25
|
+
javascriptNode(): Promise<typeof import("../configs/javascript-node")>;
|
|
26
|
+
typescript(): Promise<typeof import("../configs/typescript")>;
|
|
27
|
+
typescriptDom(): Promise<typeof import("../configs/typescript-dom")>;
|
|
28
|
+
typescriptNode(): Promise<typeof import("../configs/typescript-node")>;
|
|
29
|
+
vue2(): Promise<typeof import("../configs/vue2")>;
|
|
30
|
+
vue3(): Promise<typeof import("../configs/vue3")>;
|
|
31
|
+
vue2Typescript(): Promise<typeof import("../configs/vue2-typescript")>;
|
|
32
|
+
vue3Typescript(): Promise<typeof import("../configs/vue3-typescript")>;
|
|
33
|
+
jest(): Promise<typeof import("../configs/jest")>;
|
|
34
|
+
vitest(): Promise<typeof import("../configs/vitest")>;
|
|
35
|
+
jsdocBasedTs(): Promise<typeof import("../configs/jsdoc-based-ts")>;
|
|
36
|
+
};
|
|
37
|
+
export type ScopeName = keyof typeof scopeMap;
|
|
38
|
+
export declare function isScopeName(key: string): key is ScopeName;
|
|
39
|
+
export declare function buildScopeBlocks(scope: ScopeName, entries: readonly ScopeEntry[]): Promise<Linter.Config[]>;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
interface VueOverrideInput {
|
|
3
|
+
globalComponents?: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare function escapeRegex(input: string): string;
|
|
6
|
+
export declare function anchoredEscapeRegex(input: string): string;
|
|
7
|
+
export declare function applyVueOverrides<BlockType extends Linter.Config>(block: BlockType, input: VueOverrideInput): BlockType;
|
|
8
|
+
export {};
|