@isentinel/eslint-config 1.3.0 → 3.0.0-beta.1
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 +72 -44
- package/dist/cli.js +24 -22
- package/dist/index.d.ts +121 -41
- package/dist/index.js +710 -519
- package/package.json +20 -8
package/README.md
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
### Starter Wizard
|
|
6
6
|
|
|
7
|
-
We provided a CLI tool to help you set up your project, or migrate from the
|
|
7
|
+
We provided a CLI tool to help you set up your project, or migrate from the
|
|
8
|
+
legacy config to the new flat config with one command.
|
|
8
9
|
|
|
9
10
|
### Example Usage
|
|
10
11
|
|
|
11
12
|
For an existing template that already has this config setup, please refer to the
|
|
12
|
-
[roblox-ts
|
|
13
|
-
template](https://github.com/christopher-buss/roblox-ts-project-template)
|
|
13
|
+
[roblox-ts template](https://github.com/christopher-buss/roblox-ts-project-template)
|
|
14
14
|
repository. This includes all necessarily files and configurations to get you up
|
|
15
15
|
and running.
|
|
16
16
|
|
|
@@ -28,40 +28,46 @@ pnpm i -D eslint @isentinel/eslint-config
|
|
|
28
28
|
|
|
29
29
|
### Create config file
|
|
30
30
|
|
|
31
|
-
With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in
|
|
31
|
+
With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in
|
|
32
|
+
`package.json` (recommended):
|
|
32
33
|
|
|
33
34
|
```ts
|
|
34
35
|
// eslint.config.ts
|
|
35
|
-
import
|
|
36
|
+
import isentinel from "@isentinel/eslint-config";
|
|
36
37
|
|
|
37
|
-
export default
|
|
38
|
+
export default isentinel();
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
#### Optional: TypeScript Config Support
|
|
41
42
|
|
|
42
|
-
If you want to use `eslint.config.ts` instead of `.js`, install `jiti` v2.0.0 or
|
|
43
|
+
If you want to use `eslint.config.ts` instead of `.js`, install `jiti` v2.0.0 or
|
|
44
|
+
greater:
|
|
43
45
|
|
|
44
46
|
```bash
|
|
45
47
|
pnpm i -D jiti@^2.0.0
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
See
|
|
50
|
+
See
|
|
51
|
+
[ESLint's TypeScript configuration documentation](https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files)
|
|
52
|
+
for more details.
|
|
49
53
|
|
|
50
54
|
<details>
|
|
51
55
|
<summary>
|
|
52
56
|
Combined with legacy config:
|
|
53
57
|
</summary>
|
|
54
58
|
|
|
55
|
-
If you still use some configs from the legacy eslintrc format, you can use the
|
|
59
|
+
If you still use some configs from the legacy eslintrc format, you can use the
|
|
60
|
+
[`@eslint/eslintrc`](https://www.npmjs.com/package/@eslint/eslintrc) package to
|
|
61
|
+
convert them to the flat config.
|
|
56
62
|
|
|
57
63
|
```ts
|
|
58
64
|
// eslint.config.ts
|
|
59
65
|
import { FlatCompat } from "@eslint/eslintrc";
|
|
60
|
-
import
|
|
66
|
+
import isentinel from "@isentinel/eslint-config";
|
|
61
67
|
|
|
62
68
|
const compat = new FlatCompat();
|
|
63
69
|
|
|
64
|
-
export default
|
|
70
|
+
export default isentinel(
|
|
65
71
|
{
|
|
66
72
|
ignores: [],
|
|
67
73
|
},
|
|
@@ -78,8 +84,8 @@ export default style(
|
|
|
78
84
|
);
|
|
79
85
|
```
|
|
80
86
|
|
|
81
|
-
> Note that `.eslintignore` no longer works in Flat config
|
|
82
|
-
> [customization](#customization) for more details.
|
|
87
|
+
> Note that `.eslintignore` no longer works in Flat config. Use the `ignores`
|
|
88
|
+
> option instead, see [customization](#customization) for more details.
|
|
83
89
|
|
|
84
90
|
</details>
|
|
85
91
|
|
|
@@ -118,7 +124,8 @@ when you use the `!` operator to assert that a value is not `undefined`. The
|
|
|
118
124
|
caveat is that this rule will not always play nicely with
|
|
119
125
|
`noUncheckedIndexedAccess`, and will often require you to disable it in certain
|
|
120
126
|
places. I believe that this is a good trade-off, as it will help you catch
|
|
121
|
-
potential bugs in your code, but you can disable it if you find it too
|
|
127
|
+
potential bugs in your code, but you can disable it if you find it too
|
|
128
|
+
restrictive.
|
|
122
129
|
|
|
123
130
|
```json
|
|
124
131
|
{
|
|
@@ -130,7 +137,8 @@ potential bugs in your code, but you can disable it if you find it too restricti
|
|
|
130
137
|
|
|
131
138
|
## VS Code support (auto fix)
|
|
132
139
|
|
|
133
|
-
Install
|
|
140
|
+
Install
|
|
141
|
+
[VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
134
142
|
|
|
135
143
|
Add the following settings to your `.vscode/settings.json`:
|
|
136
144
|
|
|
@@ -173,22 +181,22 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
173
181
|
|
|
174
182
|
## Customization
|
|
175
183
|
|
|
176
|
-
Normally you only need to import the `
|
|
184
|
+
Normally you only need to import the `isentinel` preset:
|
|
177
185
|
|
|
178
186
|
```ts
|
|
179
187
|
// eslint.config.ts
|
|
180
|
-
import
|
|
188
|
+
import isentinel from "@isentinel/eslint-config";
|
|
181
189
|
|
|
182
|
-
export default
|
|
190
|
+
export default isentinel();
|
|
183
191
|
```
|
|
184
192
|
|
|
185
193
|
And that's it! Or you can configure each integration individually, for example:
|
|
186
194
|
|
|
187
195
|
```ts
|
|
188
196
|
// eslint.config.ts
|
|
189
|
-
import
|
|
197
|
+
import isentinel from "@isentinel/eslint-config";
|
|
190
198
|
|
|
191
|
-
export default
|
|
199
|
+
export default isentinel({
|
|
192
200
|
// `.eslintignore` is no longer supported in Flat config, use `ignores`
|
|
193
201
|
// instead
|
|
194
202
|
ignores: [
|
|
@@ -204,13 +212,14 @@ export default style({
|
|
|
204
212
|
});
|
|
205
213
|
```
|
|
206
214
|
|
|
207
|
-
The `
|
|
215
|
+
The `isentinel` factory function also accepts any number of arbitrary custom
|
|
216
|
+
config overrides:
|
|
208
217
|
|
|
209
218
|
```ts
|
|
210
219
|
// eslint.config.ts
|
|
211
|
-
import
|
|
220
|
+
import isentinel from "@isentinel/eslint-config";
|
|
212
221
|
|
|
213
|
-
export default
|
|
222
|
+
export default isentinel(
|
|
214
223
|
{
|
|
215
224
|
// Configures for this config
|
|
216
225
|
},
|
|
@@ -227,13 +236,21 @@ export default style(
|
|
|
227
236
|
);
|
|
228
237
|
```
|
|
229
238
|
|
|
230
|
-
Check out the
|
|
239
|
+
Check out the
|
|
240
|
+
[configs](https://github.com/christopher-buss/eslint-config/tree/main/src/configs)
|
|
241
|
+
and
|
|
242
|
+
[factory](https://github.com/christopher-buss/eslint-config/blob/main/src/factory.ts)
|
|
243
|
+
for more details.
|
|
231
244
|
|
|
232
|
-
> Thanks to [antfu/eslint-config](https://github.com/antfu/eslint-config) and
|
|
245
|
+
> Thanks to [antfu/eslint-config](https://github.com/antfu/eslint-config) and
|
|
246
|
+
> [sxzz/eslint-config](https://github.com/sxzz/eslint-config) for the
|
|
247
|
+
> inspiration and reference.
|
|
233
248
|
|
|
234
249
|
### Plugins Renaming
|
|
235
250
|
|
|
236
|
-
Since flat config requires us to explicitly provide the plugin names (instead of
|
|
251
|
+
Since flat config requires us to explicitly provide the plugin names (instead of
|
|
252
|
+
the mandatory convention from npm package name), we renamed some plugins to make
|
|
253
|
+
the overall scope more consistent and easier to write.
|
|
237
254
|
|
|
238
255
|
| New Prefix | Original Prefix | Source Plugin |
|
|
239
256
|
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
@@ -243,7 +260,8 @@ Since flat config requires us to explicitly provide the plugin names (instead of
|
|
|
243
260
|
| `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
|
|
244
261
|
| `style/*` | `@stylistic/*` | [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic) |
|
|
245
262
|
|
|
246
|
-
When you want to override rules, or disable them inline, you need to update to
|
|
263
|
+
When you want to override rules, or disable them inline, you need to update to
|
|
264
|
+
the new prefix:
|
|
247
265
|
|
|
248
266
|
```diff
|
|
249
267
|
-// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
@@ -263,22 +281,23 @@ repository rather than this one.
|
|
|
263
281
|
|
|
264
282
|
Sometimes you will have words that are not in the dictionary, but are still
|
|
265
283
|
valid for your project. To add these words to the dictionary, you can create a
|
|
266
|
-
`cspell.config.yaml` file in the root of your project with the following
|
|
284
|
+
`cspell.config.yaml` file in the root of your project with the following
|
|
285
|
+
content:
|
|
267
286
|
|
|
268
287
|
```yaml
|
|
269
288
|
# cspell.config.yaml
|
|
270
289
|
words:
|
|
271
|
-
|
|
272
|
-
|
|
290
|
+
- isentinel
|
|
291
|
+
- isverycool
|
|
273
292
|
```
|
|
274
293
|
|
|
275
294
|
To disable this, you can set the `spellCheck` option to `false`:
|
|
276
295
|
|
|
277
296
|
```js
|
|
278
297
|
// eslint.config.ts
|
|
279
|
-
import
|
|
298
|
+
import isentinel from "@isentinel/eslint-config";
|
|
280
299
|
|
|
281
|
-
export default
|
|
300
|
+
export default isentinel({
|
|
282
301
|
spellCheck: false,
|
|
283
302
|
});
|
|
284
303
|
```
|
|
@@ -288,7 +307,9 @@ For more information on how to configure the spell checker, please refer to the
|
|
|
288
307
|
|
|
289
308
|
#### `perfectionist` (sorting)
|
|
290
309
|
|
|
291
|
-
This plugin
|
|
310
|
+
This plugin
|
|
311
|
+
[`eslint-plugin-perfectionist`](https://github.com/azat-io/eslint-plugin-perfectionist)
|
|
312
|
+
allows you to sort object keys, imports, etc, with auto-fix.
|
|
292
313
|
|
|
293
314
|
The plugin is installed and some rules are enabled by default, but these rules
|
|
294
315
|
can be disabled or overridden by your own config. For example, I personally have
|
|
@@ -296,9 +317,9 @@ sort-objects set to:
|
|
|
296
317
|
|
|
297
318
|
```js
|
|
298
319
|
// eslint.config.ts
|
|
299
|
-
import
|
|
320
|
+
import isentinel from "@isentinel/eslint-config";
|
|
300
321
|
|
|
301
|
-
export default
|
|
322
|
+
export default isentinel({
|
|
302
323
|
rules: {
|
|
303
324
|
"perfectionist/sort-objects": [
|
|
304
325
|
"warn",
|
|
@@ -321,7 +342,8 @@ export default style({
|
|
|
321
342
|
|
|
322
343
|
### Optional Configs
|
|
323
344
|
|
|
324
|
-
We provide some optional configs for specific use cases, that we don't include
|
|
345
|
+
We provide some optional configs for specific use cases, that we don't include
|
|
346
|
+
their dependencies by default.
|
|
325
347
|
|
|
326
348
|
#### React
|
|
327
349
|
|
|
@@ -329,9 +351,9 @@ To enable React support, you need to explicitly turn it on:
|
|
|
329
351
|
|
|
330
352
|
```js
|
|
331
353
|
// eslint.config.ts
|
|
332
|
-
import
|
|
354
|
+
import isentinel from "@isentinel/eslint-config";
|
|
333
355
|
|
|
334
|
-
export default
|
|
356
|
+
export default isentinel({
|
|
335
357
|
react: true,
|
|
336
358
|
});
|
|
337
359
|
```
|
|
@@ -342,14 +364,15 @@ To enable Jest support, you need to explicitly turn it on:
|
|
|
342
364
|
|
|
343
365
|
```js
|
|
344
366
|
// eslint.config.ts
|
|
345
|
-
import
|
|
367
|
+
import isentinel from "@isentinel/eslint-config";
|
|
346
368
|
|
|
347
|
-
export default
|
|
369
|
+
export default isentinel({
|
|
348
370
|
test: true,
|
|
349
371
|
});
|
|
350
372
|
```
|
|
351
373
|
|
|
352
|
-
Running `npx eslint` should prompt you to install the required dependencies,
|
|
374
|
+
Running `npx eslint` should prompt you to install the required dependencies,
|
|
375
|
+
otherwise, you can install them manually:
|
|
353
376
|
|
|
354
377
|
```bash
|
|
355
378
|
pnpm i -D @eslint-react/eslint-plugin eslint-plugin-react-roblox-hooks eslint-plugin-jest
|
|
@@ -357,7 +380,8 @@ pnpm i -D @eslint-react/eslint-plugin eslint-plugin-react-roblox-hooks eslint-pl
|
|
|
357
380
|
|
|
358
381
|
### Lint Staged
|
|
359
382
|
|
|
360
|
-
If you want to apply lint and auto-fix before every commit, you can add the
|
|
383
|
+
If you want to apply lint and auto-fix before every commit, you can add the
|
|
384
|
+
following to your `package.json`:
|
|
361
385
|
|
|
362
386
|
```json
|
|
363
387
|
{
|
|
@@ -378,7 +402,9 @@ pnpm i -D lint-staged simple-git-hooks
|
|
|
378
402
|
|
|
379
403
|
## View what rules are enabled
|
|
380
404
|
|
|
381
|
-
There is a visual tool to help you view what rules are enabled in your project
|
|
405
|
+
There is a visual tool to help you view what rules are enabled in your project
|
|
406
|
+
and apply them to what files,
|
|
407
|
+
[eslint-config-inspector](https://github.com/eslint/config-inspector)
|
|
382
408
|
|
|
383
409
|
Go to your project root that contains `eslint.config.ts` and run:
|
|
384
410
|
|
|
@@ -388,7 +414,9 @@ npx eslint-config-inspector
|
|
|
388
414
|
|
|
389
415
|
## Versioning Policy
|
|
390
416
|
|
|
391
|
-
This project follows [Semantic Versioning](https://semver.org/) for releases.
|
|
417
|
+
This project follows [Semantic Versioning](https://semver.org/) for releases.
|
|
418
|
+
However, since this is just a config and involves opinions and many moving
|
|
419
|
+
parts, we don't treat rules changes as breaking changes.
|
|
392
420
|
|
|
393
421
|
### Changes Considered as Breaking Changes
|
|
394
422
|
|
package/dist/cli.js
CHANGED
|
@@ -18,27 +18,20 @@ init_esm_shims();
|
|
|
18
18
|
import ansis from "ansis";
|
|
19
19
|
|
|
20
20
|
// package.json
|
|
21
|
-
var version = "
|
|
21
|
+
var version = "3.0.0-beta.1";
|
|
22
22
|
var package_default = {
|
|
23
23
|
name: "@isentinel/eslint-config",
|
|
24
24
|
version,
|
|
25
25
|
description: "iSentinel's ESLint config",
|
|
26
|
-
keywords: [
|
|
27
|
-
|
|
28
|
-
"roblox",
|
|
29
|
-
"roblox-ts",
|
|
30
|
-
"rbxts"
|
|
31
|
-
],
|
|
32
|
-
homepage: "https://github.com/christopher-buss/roblox-ts-eslint-config",
|
|
26
|
+
keywords: ["eslint-config", "roblox", "roblox-ts", "rbxts"],
|
|
27
|
+
homepage: "https://github.com/christopher-buss/eslint-config",
|
|
33
28
|
repository: {
|
|
34
29
|
type: "git",
|
|
35
|
-
url: "git+https://github.com/christopher-buss/
|
|
30
|
+
url: "git+https://github.com/christopher-buss/eslint-config.git"
|
|
36
31
|
},
|
|
37
32
|
license: "MIT",
|
|
38
33
|
author: "Christopher Buss <christopher.buss@pm.me> (https://github.com/christopher-buss)",
|
|
39
|
-
contributors: [
|
|
40
|
-
"Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)"
|
|
41
|
-
],
|
|
34
|
+
contributors: ["Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)"],
|
|
42
35
|
type: "module",
|
|
43
36
|
exports: {
|
|
44
37
|
".": "./dist/index.js"
|
|
@@ -46,10 +39,7 @@ var package_default = {
|
|
|
46
39
|
main: "./dist/index.js",
|
|
47
40
|
types: "./dist/index.d.ts",
|
|
48
41
|
bin: "./bin/index.js",
|
|
49
|
-
files: [
|
|
50
|
-
"bin",
|
|
51
|
-
"dist"
|
|
52
|
-
],
|
|
42
|
+
files: ["bin", "dist"],
|
|
53
43
|
scripts: {
|
|
54
44
|
build: "nr gen && tsup --clean --dts",
|
|
55
45
|
"build:inspector": "pnpm build && npx @eslint/config-inspector build",
|
|
@@ -63,7 +53,7 @@ var package_default = {
|
|
|
63
53
|
release: "bumpp",
|
|
64
54
|
stub: "tsup",
|
|
65
55
|
typecheck: "tsc --noEmit",
|
|
66
|
-
watch: "tsup --watch"
|
|
56
|
+
watch: "tsup --watch --dts"
|
|
67
57
|
},
|
|
68
58
|
"simple-git-hooks": {
|
|
69
59
|
"pre-commit": "pnpm lint-staged"
|
|
@@ -88,21 +78,23 @@ var package_default = {
|
|
|
88
78
|
"eslint-config-flat-gitignore": "catalog:prod",
|
|
89
79
|
"eslint-config-prettier": "catalog:prod",
|
|
90
80
|
"eslint-flat-config-utils": "catalog:prod",
|
|
81
|
+
"eslint-import-resolver-node": "catalog:prod",
|
|
91
82
|
"eslint-merge-processors": "catalog:prod",
|
|
92
83
|
"eslint-plugin-antfu": "catalog:prod",
|
|
93
|
-
"eslint-plugin-arrow-return-style": "catalog:prod",
|
|
84
|
+
"eslint-plugin-arrow-return-style-x": "catalog:prod",
|
|
94
85
|
"eslint-plugin-better-max-params": "catalog:prod",
|
|
95
86
|
"eslint-plugin-comment-length": "catalog:prod",
|
|
96
87
|
"eslint-plugin-de-morgan": "catalog:prod",
|
|
97
|
-
"eslint-plugin-format": "catalog:prod",
|
|
98
88
|
"eslint-plugin-format-lua": "catalog:prod",
|
|
99
89
|
"eslint-plugin-import-lite": "catalog:prod",
|
|
100
90
|
"eslint-plugin-jsdoc": "catalog:prod",
|
|
101
91
|
"eslint-plugin-jsonc": "catalog:prod",
|
|
92
|
+
"eslint-plugin-n": "catalog:peer",
|
|
102
93
|
"eslint-plugin-no-only-tests": "catalog:prod",
|
|
103
94
|
"eslint-plugin-package-json": "catalog:prod",
|
|
104
95
|
"eslint-plugin-perfectionist": "catalog:prod",
|
|
105
96
|
"eslint-plugin-pnpm": "catalog:prod",
|
|
97
|
+
"eslint-plugin-prettier": "catalog:prod",
|
|
106
98
|
"eslint-plugin-promise": "catalog:prod",
|
|
107
99
|
"eslint-plugin-roblox-ts": "catalog:prod",
|
|
108
100
|
"eslint-plugin-sentinel": "catalog:prod",
|
|
@@ -130,9 +122,11 @@ var package_default = {
|
|
|
130
122
|
"@types/node": "catalog:dev",
|
|
131
123
|
"@types/prompts": "catalog:dev",
|
|
132
124
|
"@types/yargs": "catalog:dev",
|
|
125
|
+
"@vitest/eslint-plugin": "catalog:peer",
|
|
133
126
|
bumpp: "catalog:dev",
|
|
134
127
|
eslint: "catalog:peer",
|
|
135
128
|
"eslint-plugin-jest": "catalog:peer",
|
|
129
|
+
"eslint-plugin-pnpm": "catalog:prod",
|
|
136
130
|
"eslint-plugin-react-roblox-hooks": "catalog:peer",
|
|
137
131
|
"eslint-plugin-simple-import-sort": "catalog:dev",
|
|
138
132
|
"eslint-typegen": "catalog:dev",
|
|
@@ -150,17 +144,25 @@ var package_default = {
|
|
|
150
144
|
},
|
|
151
145
|
peerDependencies: {
|
|
152
146
|
"@eslint-react/eslint-plugin": "^1.45.0",
|
|
147
|
+
"@vitest/eslint-plugin": "^1.0.0",
|
|
153
148
|
eslint: "^9.10.0",
|
|
154
|
-
"eslint-plugin-jest": "^28.9.0",
|
|
149
|
+
"eslint-plugin-jest": "^28.9.0 || ^29.0.0",
|
|
150
|
+
"eslint-plugin-n": "^17.0.0",
|
|
155
151
|
"eslint-plugin-react-roblox-hooks": "^5.1.0-rbx.1"
|
|
156
152
|
},
|
|
157
153
|
peerDependenciesMeta: {
|
|
158
154
|
"@eslint-react/eslint-plugin": {
|
|
159
155
|
optional: true
|
|
160
156
|
},
|
|
157
|
+
"@vitest/eslint-plugin": {
|
|
158
|
+
optional: true
|
|
159
|
+
},
|
|
161
160
|
"eslint-plugin-jest": {
|
|
162
161
|
optional: true
|
|
163
162
|
},
|
|
163
|
+
"eslint-plugin-n": {
|
|
164
|
+
optional: true
|
|
165
|
+
},
|
|
164
166
|
"eslint-plugin-react-roblox-hooks": {
|
|
165
167
|
optional: true
|
|
166
168
|
}
|
|
@@ -250,9 +252,9 @@ init_esm_shims();
|
|
|
250
252
|
import { execSync } from "child_process";
|
|
251
253
|
function getEslintConfigContent(mainConfig, additionalConfigs) {
|
|
252
254
|
return `
|
|
253
|
-
import
|
|
255
|
+
import isentinel from '@isentinel/eslint-config'
|
|
254
256
|
|
|
255
|
-
export default
|
|
257
|
+
export default isentinel({
|
|
256
258
|
${mainConfig}
|
|
257
259
|
}${additionalConfigs?.map((config) => `,{
|
|
258
260
|
${config}
|