@will-stone/eslint-config 19.0.0 → 20.1.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.
- package/README.md +0 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +158 -161
- package/package.json +6 -12
package/README.md
CHANGED
|
@@ -18,7 +18,6 @@ the corresponding plugin.
|
|
|
18
18
|
| Package | Plugin |
|
|
19
19
|
| ------------- | ----------------------------------------------- |
|
|
20
20
|
| `astro` | `astro-eslint-parser eslint-plugin-astro` |
|
|
21
|
-
| `jest` | `eslint-plugin-jest` |
|
|
22
21
|
| `react` | `eslint-plugin-react eslint-plugin-react-hooks` |
|
|
23
22
|
| `tailwindcss` | `eslint-plugin-tailwindcss` |
|
|
24
23
|
| `vitest` | `@vitest/eslint-plugin` |
|
package/dist/index.d.ts
CHANGED
|
@@ -6,15 +6,19 @@ import { TSESLint } from "@typescript-eslint/utils";
|
|
|
6
6
|
*/
|
|
7
7
|
type Options = {
|
|
8
8
|
astro?: boolean;
|
|
9
|
-
jest?: boolean;
|
|
10
9
|
react?: boolean;
|
|
11
10
|
tailwind?: {
|
|
12
11
|
config?: string;
|
|
13
12
|
cssFiles?: string[];
|
|
14
13
|
} | boolean;
|
|
15
|
-
typescript?: boolean
|
|
14
|
+
typescript?: boolean | {
|
|
15
|
+
tsconfigPath?: string;
|
|
16
|
+
};
|
|
16
17
|
vitest?: boolean;
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* A context of data and options passed to all configs.
|
|
21
|
+
*/
|
|
18
22
|
//#endregion
|
|
19
23
|
//#region src/index.d.ts
|
|
20
24
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,12 @@ import parserTypescript from "@typescript-eslint/parser";
|
|
|
2
2
|
import restrictedGlobals from "confusing-browser-globals";
|
|
3
3
|
import globals from "globals";
|
|
4
4
|
import gitignore from "eslint-config-flat-gitignore";
|
|
5
|
+
import jsdocPlugin from "eslint-plugin-jsdoc";
|
|
5
6
|
import pluginNode from "eslint-plugin-n";
|
|
6
7
|
import pluginPackageJson from "eslint-plugin-package-json";
|
|
7
8
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
8
9
|
import stylistic from "@stylistic/eslint-plugin";
|
|
9
|
-
import
|
|
10
|
+
import pluginTypescript from "@typescript-eslint/eslint-plugin";
|
|
10
11
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
11
12
|
import { globbySync } from "globby";
|
|
12
13
|
import { readFileSync } from "node:fs";
|
|
@@ -62,7 +63,7 @@ async function interopDefault(m) {
|
|
|
62
63
|
|
|
63
64
|
//#endregion
|
|
64
65
|
//#region src/configs/astro.ts
|
|
65
|
-
async function astro(
|
|
66
|
+
async function astro(_configContext) {
|
|
66
67
|
const [pluginAstro, parserAstro] = await Promise.all([interopDefault(import("eslint-plugin-astro")), interopDefault(import("astro-eslint-parser"))]);
|
|
67
68
|
return [{
|
|
68
69
|
files: [GLOB_ASTRO],
|
|
@@ -140,7 +141,7 @@ async function astro(_options) {
|
|
|
140
141
|
|
|
141
142
|
//#endregion
|
|
142
143
|
//#region src/configs/base.ts
|
|
143
|
-
|
|
144
|
+
function base() {
|
|
144
145
|
return [{
|
|
145
146
|
languageOptions: { globals: {
|
|
146
147
|
...globals.browser,
|
|
@@ -366,7 +367,7 @@ async function base() {
|
|
|
366
367
|
|
|
367
368
|
//#endregion
|
|
368
369
|
//#region src/configs/ignores.ts
|
|
369
|
-
|
|
370
|
+
function ignores() {
|
|
370
371
|
return [{
|
|
371
372
|
ignores: GLOB_EXCLUDE,
|
|
372
373
|
name: "will-stone/ignores"
|
|
@@ -377,97 +378,84 @@ async function ignores() {
|
|
|
377
378
|
}
|
|
378
379
|
|
|
379
380
|
//#endregion
|
|
380
|
-
//#region src/configs/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
"jest
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
"jest/require-to-throw-message": "error",
|
|
452
|
-
"jest/require-top-level-describe": "off",
|
|
453
|
-
"jest/unbound-method": "off",
|
|
454
|
-
"jest/valid-describe-callback": "error",
|
|
455
|
-
"jest/valid-expect": "error",
|
|
456
|
-
"jest/valid-expect-in-promise": "error",
|
|
457
|
-
"jest/valid-title": "error"
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
files: ["**/*.{spec,test}.{ts,tsx}"],
|
|
462
|
-
name: "will-stone/jest/typescript",
|
|
463
|
-
rules: { "jest/no-untyped-mock-factory": "warn" }
|
|
381
|
+
//#region src/configs/jsdoc.ts
|
|
382
|
+
function jsdoc() {
|
|
383
|
+
return [{
|
|
384
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
385
|
+
name: "will-stone/jsdoc",
|
|
386
|
+
plugins: { jsdoc: jsdocPlugin },
|
|
387
|
+
rules: {
|
|
388
|
+
"jsdoc/check-access": "off",
|
|
389
|
+
"jsdoc/check-alignment": "warn",
|
|
390
|
+
"jsdoc/check-examples": "off",
|
|
391
|
+
"jsdoc/check-indentation": "off",
|
|
392
|
+
"jsdoc/check-line-alignment": [
|
|
393
|
+
"warn",
|
|
394
|
+
"never",
|
|
395
|
+
{ wrapIndent: " " }
|
|
396
|
+
],
|
|
397
|
+
"jsdoc/check-param-names": "warn",
|
|
398
|
+
"jsdoc/check-property-names": "off",
|
|
399
|
+
"jsdoc/check-syntax": "off",
|
|
400
|
+
"jsdoc/check-tag-names": ["warn", {
|
|
401
|
+
definedTags: ["jest-environment"],
|
|
402
|
+
typed: false
|
|
403
|
+
}],
|
|
404
|
+
"jsdoc/check-template-names": "off",
|
|
405
|
+
"jsdoc/check-types": "off",
|
|
406
|
+
"jsdoc/check-values": "warn",
|
|
407
|
+
"jsdoc/convert-to-jsdoc-comments": "off",
|
|
408
|
+
"jsdoc/empty-tags": "warn",
|
|
409
|
+
"jsdoc/implements-on-classes": "off",
|
|
410
|
+
"jsdoc/imports-as-dependencies": "off",
|
|
411
|
+
"jsdoc/informative-docs": "warn",
|
|
412
|
+
"jsdoc/lines-before-block": "off",
|
|
413
|
+
"jsdoc/match-description": "off",
|
|
414
|
+
"jsdoc/match-name": "off",
|
|
415
|
+
"jsdoc/multiline-blocks": "off",
|
|
416
|
+
"jsdoc/no-bad-blocks": "warn",
|
|
417
|
+
"jsdoc/no-blank-block-descriptions": "warn",
|
|
418
|
+
"jsdoc/no-blank-blocks": "off",
|
|
419
|
+
"jsdoc/no-defaults": "warn",
|
|
420
|
+
"jsdoc/no-missing-syntax": "off",
|
|
421
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
422
|
+
"jsdoc/no-restricted-syntax": "off",
|
|
423
|
+
"jsdoc/no-types": "warn",
|
|
424
|
+
"jsdoc/no-undefined-types": "off",
|
|
425
|
+
"jsdoc/require-asterisk-prefix": "warn",
|
|
426
|
+
"jsdoc/require-description": "off",
|
|
427
|
+
"jsdoc/require-description-complete-sentence": "warn",
|
|
428
|
+
"jsdoc/require-example": "off",
|
|
429
|
+
"jsdoc/require-file-overview": "off",
|
|
430
|
+
"jsdoc/require-hyphen-before-param-description": "warn",
|
|
431
|
+
"jsdoc/require-jsdoc": "off",
|
|
432
|
+
"jsdoc/require-param": "off",
|
|
433
|
+
"jsdoc/require-param-description": "warn",
|
|
434
|
+
"jsdoc/require-param-name": "warn",
|
|
435
|
+
"jsdoc/require-param-type": "off",
|
|
436
|
+
"jsdoc/require-property": "off",
|
|
437
|
+
"jsdoc/require-property-description": "off",
|
|
438
|
+
"jsdoc/require-property-name": "off",
|
|
439
|
+
"jsdoc/require-property-type": "off",
|
|
440
|
+
"jsdoc/require-returns": "off",
|
|
441
|
+
"jsdoc/require-returns-check": "warn",
|
|
442
|
+
"jsdoc/require-returns-description": "warn",
|
|
443
|
+
"jsdoc/require-returns-type": "off",
|
|
444
|
+
"jsdoc/require-template": "off",
|
|
445
|
+
"jsdoc/require-throws": "warn",
|
|
446
|
+
"jsdoc/require-yields": "warn",
|
|
447
|
+
"jsdoc/require-yields-check": "warn",
|
|
448
|
+
"jsdoc/sort-tags": "warn",
|
|
449
|
+
"jsdoc/tag-lines": "off",
|
|
450
|
+
"jsdoc/text-escaping": "off",
|
|
451
|
+
"jsdoc/valid-types": "off"
|
|
464
452
|
}
|
|
465
|
-
];
|
|
453
|
+
}];
|
|
466
454
|
}
|
|
467
455
|
|
|
468
456
|
//#endregion
|
|
469
457
|
//#region src/configs/node.ts
|
|
470
|
-
|
|
458
|
+
function node() {
|
|
471
459
|
return [{
|
|
472
460
|
languageOptions: { globals: globals.node },
|
|
473
461
|
name: "will-stone/node",
|
|
@@ -518,7 +506,7 @@ async function node() {
|
|
|
518
506
|
|
|
519
507
|
//#endregion
|
|
520
508
|
//#region src/configs/package-json.ts
|
|
521
|
-
|
|
509
|
+
function packageJson() {
|
|
522
510
|
return [{
|
|
523
511
|
...pluginPackageJson.configs.recommended,
|
|
524
512
|
name: "will-stone/package.json",
|
|
@@ -550,28 +538,56 @@ async function packageJson() {
|
|
|
550
538
|
|
|
551
539
|
//#endregion
|
|
552
540
|
//#region src/configs/perfectionist.ts
|
|
553
|
-
|
|
541
|
+
const sortOrder = [{
|
|
542
|
+
customGroups: {
|
|
543
|
+
type: "^type$",
|
|
544
|
+
payload: "^payload$",
|
|
545
|
+
error: "^error$",
|
|
546
|
+
meta: "^meta$"
|
|
547
|
+
},
|
|
548
|
+
groups: [
|
|
549
|
+
"type",
|
|
550
|
+
"payload",
|
|
551
|
+
"error",
|
|
552
|
+
"meta"
|
|
553
|
+
],
|
|
554
|
+
useConfigurationIf: { allNamesMatchPattern: "^type|payload|meta|error$" }
|
|
555
|
+
}, {
|
|
556
|
+
partitionByNewLine: true,
|
|
557
|
+
type: "natural"
|
|
558
|
+
}];
|
|
559
|
+
function perfectionist() {
|
|
554
560
|
return [{
|
|
555
561
|
name: "will-stone/perfectionist",
|
|
556
562
|
plugins: { perfectionist: pluginPerfectionist },
|
|
557
563
|
rules: {
|
|
558
|
-
"perfectionist/sort-
|
|
564
|
+
"perfectionist/sort-array-includes": "off",
|
|
565
|
+
"perfectionist/sort-classes": "off",
|
|
566
|
+
"perfectionist/sort-decorators": "off",
|
|
567
|
+
"perfectionist/sort-enums": "off",
|
|
568
|
+
"perfectionist/sort-exports": "off",
|
|
569
|
+
"perfectionist/sort-heritage-clauses": "off",
|
|
570
|
+
"perfectionist/sort-imports": ["warn", { type: "natural" }],
|
|
571
|
+
"perfectionist/sort-interfaces": "off",
|
|
572
|
+
"perfectionist/sort-intersection-types": "off",
|
|
573
|
+
"perfectionist/sort-jsx-props": "off",
|
|
574
|
+
"perfectionist/sort-maps": "off",
|
|
575
|
+
"perfectionist/sort-modules": "off",
|
|
576
|
+
"perfectionist/sort-named-exports": "off",
|
|
559
577
|
"perfectionist/sort-named-imports": "warn",
|
|
560
|
-
"perfectionist/sort-object-types": ["warn",
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
"perfectionist/sort-
|
|
565
|
-
|
|
566
|
-
type: "natural"
|
|
567
|
-
}]
|
|
578
|
+
"perfectionist/sort-object-types": ["warn", ...sortOrder],
|
|
579
|
+
"perfectionist/sort-objects": ["warn", ...sortOrder],
|
|
580
|
+
"perfectionist/sort-sets": "off",
|
|
581
|
+
"perfectionist/sort-switch-case": "off",
|
|
582
|
+
"perfectionist/sort-union-types": "off",
|
|
583
|
+
"perfectionist/sort-variable-declarations": "off"
|
|
568
584
|
}
|
|
569
585
|
}];
|
|
570
586
|
}
|
|
571
587
|
|
|
572
588
|
//#endregion
|
|
573
589
|
//#region src/configs/react.ts
|
|
574
|
-
async function react(
|
|
590
|
+
async function react(_configContext) {
|
|
575
591
|
const [pluginJsxA11y, pluginReact, pluginReactHooks] = await Promise.all([
|
|
576
592
|
interopDefault(import("eslint-plugin-jsx-a11y")),
|
|
577
593
|
interopDefault(import("eslint-plugin-react")),
|
|
@@ -837,7 +853,7 @@ async function react(_options) {
|
|
|
837
853
|
|
|
838
854
|
//#endregion
|
|
839
855
|
//#region src/configs/style.ts
|
|
840
|
-
|
|
856
|
+
function style() {
|
|
841
857
|
return [{
|
|
842
858
|
name: "will-stone/style",
|
|
843
859
|
plugins: { "@stylistic": stylistic },
|
|
@@ -859,7 +875,7 @@ async function style() {
|
|
|
859
875
|
|
|
860
876
|
//#endregion
|
|
861
877
|
//#region src/configs/tailwind.ts
|
|
862
|
-
async function tailwind(rawOptions) {
|
|
878
|
+
async function tailwind({ options: { tailwind: rawOptions } }) {
|
|
863
879
|
const options = !rawOptions || rawOptions === true ? {} : rawOptions;
|
|
864
880
|
const plugin = await interopDefault(import("eslint-plugin-tailwindcss"));
|
|
865
881
|
return [{
|
|
@@ -883,22 +899,10 @@ async function tailwind(rawOptions) {
|
|
|
883
899
|
}];
|
|
884
900
|
}
|
|
885
901
|
|
|
886
|
-
//#endregion
|
|
887
|
-
//#region src/configs/tsdoc.ts
|
|
888
|
-
async function tsdoc() {
|
|
889
|
-
return [{
|
|
890
|
-
files: [GLOB_TS, GLOB_TSX],
|
|
891
|
-
name: "will-stone/tsdoc",
|
|
892
|
-
plugins: { tsdoc: pluginTsdoc },
|
|
893
|
-
rules: { "tsdoc/syntax": "error" }
|
|
894
|
-
}];
|
|
895
|
-
}
|
|
896
|
-
|
|
897
902
|
//#endregion
|
|
898
903
|
//#region src/configs/typescript.ts
|
|
899
|
-
|
|
904
|
+
function typescript({ options: { typescript: rawOptions } }) {
|
|
900
905
|
const options = !rawOptions || typeof rawOptions === "boolean" ? {} : rawOptions;
|
|
901
|
-
const [pluginTypescript, parserTypescript$1] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
902
906
|
return [{
|
|
903
907
|
files: [
|
|
904
908
|
GLOB_ASTRO_TS,
|
|
@@ -906,7 +910,7 @@ async function typescript(rawOptions) {
|
|
|
906
910
|
GLOB_TSX
|
|
907
911
|
],
|
|
908
912
|
languageOptions: {
|
|
909
|
-
parser: parserTypescript
|
|
913
|
+
parser: parserTypescript,
|
|
910
914
|
parserOptions: { ...options.tsconfigPath ? {
|
|
911
915
|
projectService: {
|
|
912
916
|
allowDefaultProject: ["./*.js"],
|
|
@@ -1090,7 +1094,7 @@ async function typescript(rawOptions) {
|
|
|
1090
1094
|
|
|
1091
1095
|
//#endregion
|
|
1092
1096
|
//#region src/configs/unicorn.ts
|
|
1093
|
-
|
|
1097
|
+
function unicorn() {
|
|
1094
1098
|
return [{
|
|
1095
1099
|
name: "will-stone/unicorn",
|
|
1096
1100
|
plugins: { unicorn: pluginUnicorn },
|
|
@@ -1235,7 +1239,7 @@ async function unicorn() {
|
|
|
1235
1239
|
|
|
1236
1240
|
//#endregion
|
|
1237
1241
|
//#region src/configs/vitest.ts
|
|
1238
|
-
async function vitest(
|
|
1242
|
+
async function vitest(_configContext) {
|
|
1239
1243
|
const pluginVitest = await interopDefault(import("@vitest/eslint-plugin"));
|
|
1240
1244
|
return [{
|
|
1241
1245
|
files: GLOB_TESTS,
|
|
@@ -1244,14 +1248,20 @@ async function vitest(_options) {
|
|
|
1244
1248
|
rules: {
|
|
1245
1249
|
"vitest/consistent-test-filename": "warn",
|
|
1246
1250
|
"vitest/consistent-test-it": "warn",
|
|
1251
|
+
"vitest/expect-expect": "error",
|
|
1252
|
+
"vitest/max-expects": "off",
|
|
1247
1253
|
"vitest/max-nested-describe": "warn",
|
|
1248
1254
|
"vitest/no-alias-methods": "warn",
|
|
1255
|
+
"vitest/no-commented-out-tests": "error",
|
|
1249
1256
|
"vitest/no-conditional-expect": "warn",
|
|
1250
1257
|
"vitest/no-conditional-in-test": "warn",
|
|
1251
1258
|
"vitest/no-conditional-tests": "warn",
|
|
1252
1259
|
"vitest/no-disabled-tests": "warn",
|
|
1253
1260
|
"vitest/no-duplicate-hooks": "warn",
|
|
1254
1261
|
"vitest/no-focused-tests": ["warn", { fixable: false }],
|
|
1262
|
+
"vitest/no-hooks": "off",
|
|
1263
|
+
"vitest/no-identical-title": "warn",
|
|
1264
|
+
"vitest/no-import-node-test": "warn",
|
|
1255
1265
|
"vitest/no-interpolation-in-snapshots": "warn",
|
|
1256
1266
|
"vitest/no-large-snapshots": "warn",
|
|
1257
1267
|
"vitest/no-mocks-import": "warn",
|
|
@@ -1260,11 +1270,20 @@ async function vitest(_options) {
|
|
|
1260
1270
|
"vitest/no-standalone-expect": "warn",
|
|
1261
1271
|
"vitest/no-test-prefixes": "warn",
|
|
1262
1272
|
"vitest/no-test-return-statement": "warn",
|
|
1273
|
+
"vitest/padding-around-after-all-blocks": "warn",
|
|
1274
|
+
"vitest/padding-around-after-each-blocks": "warn",
|
|
1275
|
+
"vitest/padding-around-all": "off",
|
|
1276
|
+
"vitest/padding-around-before-all-blocks": "warn",
|
|
1277
|
+
"vitest/padding-around-before-each-blocks": "warn",
|
|
1278
|
+
"vitest/padding-around-describe-blocks": "warn",
|
|
1279
|
+
"vitest/padding-around-expect-groups": "off",
|
|
1280
|
+
"vitest/padding-around-test-blocks": "warn",
|
|
1263
1281
|
"vitest/prefer-called-with": "warn",
|
|
1264
1282
|
"vitest/prefer-comparison-matcher": "warn",
|
|
1265
1283
|
"vitest/prefer-describe-function-title": "warn",
|
|
1266
1284
|
"vitest/prefer-each": "warn",
|
|
1267
1285
|
"vitest/prefer-equality-matcher": "warn",
|
|
1286
|
+
"vitest/prefer-expect-assertions": "off",
|
|
1268
1287
|
"vitest/prefer-expect-resolves": "warn",
|
|
1269
1288
|
"vitest/prefer-hooks-in-order": "warn",
|
|
1270
1289
|
"vitest/prefer-hooks-on-top": "warn",
|
|
@@ -1272,40 +1291,25 @@ async function vitest(_options) {
|
|
|
1272
1291
|
"vitest/prefer-mock-promise-shorthand": "warn",
|
|
1273
1292
|
"vitest/prefer-snapshot-hint": "warn",
|
|
1274
1293
|
"vitest/prefer-spy-on": "warn",
|
|
1294
|
+
"vitest/prefer-strict-boolean-matchers": "warn",
|
|
1275
1295
|
"vitest/prefer-strict-equal": "warn",
|
|
1276
1296
|
"vitest/prefer-to-be": "warn",
|
|
1297
|
+
"vitest/prefer-to-be-falsy": "off",
|
|
1277
1298
|
"vitest/prefer-to-be-object": "warn",
|
|
1299
|
+
"vitest/prefer-to-be-truthy": "off",
|
|
1278
1300
|
"vitest/prefer-to-contain": "warn",
|
|
1279
1301
|
"vitest/prefer-to-have-length": "warn",
|
|
1280
1302
|
"vitest/prefer-todo": "warn",
|
|
1303
|
+
"vitest/prefer-vi-mocked": "warn",
|
|
1281
1304
|
"vitest/require-hook": "warn",
|
|
1282
|
-
"vitest/require-to-throw-message": "warn",
|
|
1283
|
-
"vitest/expect-expect": "error",
|
|
1284
|
-
"vitest/max-expects": "off",
|
|
1285
|
-
"vitest/no-commented-out-tests": "error",
|
|
1286
|
-
"vitest/no-hooks": "off",
|
|
1287
|
-
"vitest/no-identical-title": "warn",
|
|
1288
|
-
"vitest/no-import-node-test": "warn",
|
|
1289
|
-
"vitest/prefer-expect-assertions": "off",
|
|
1290
|
-
"vitest/prefer-strict-boolean-matchers": "warn",
|
|
1291
|
-
"vitest/prefer-to-be-falsy": "off",
|
|
1292
|
-
"vitest/prefer-to-be-truthy": "off",
|
|
1293
1305
|
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
|
|
1294
1306
|
"vitest/require-mock-type-parameters": "warn",
|
|
1307
|
+
"vitest/require-to-throw-message": "warn",
|
|
1295
1308
|
"vitest/require-top-level-describe": "off",
|
|
1296
1309
|
"vitest/valid-describe-callback": "error",
|
|
1297
1310
|
"vitest/valid-expect": "error",
|
|
1298
1311
|
"vitest/valid-expect-in-promise": "error",
|
|
1299
|
-
"vitest/valid-title": "warn",
|
|
1300
|
-
"vitest/prefer-vi-mocked": "warn",
|
|
1301
|
-
"vitest/padding-around-after-all-blocks": "warn",
|
|
1302
|
-
"vitest/padding-around-after-each-blocks": "warn",
|
|
1303
|
-
"vitest/padding-around-all": "warn",
|
|
1304
|
-
"vitest/padding-around-before-all-blocks": "warn",
|
|
1305
|
-
"vitest/padding-around-before-each-blocks": "warn",
|
|
1306
|
-
"vitest/padding-around-describe-blocks": "warn",
|
|
1307
|
-
"vitest/padding-around-expect-groups": "warn",
|
|
1308
|
-
"vitest/padding-around-test-blocks": "warn"
|
|
1312
|
+
"vitest/valid-title": ["warn", { ignoreTypeOfDescribeName: true }]
|
|
1309
1313
|
}
|
|
1310
1314
|
}];
|
|
1311
1315
|
}
|
|
@@ -1334,8 +1338,8 @@ const defaultConfigs = [
|
|
|
1334
1338
|
name: "package.json"
|
|
1335
1339
|
},
|
|
1336
1340
|
{
|
|
1337
|
-
config:
|
|
1338
|
-
name: "
|
|
1341
|
+
config: jsdoc,
|
|
1342
|
+
name: "JSDoc"
|
|
1339
1343
|
},
|
|
1340
1344
|
{
|
|
1341
1345
|
config: style,
|
|
@@ -1344,27 +1348,19 @@ const defaultConfigs = [
|
|
|
1344
1348
|
{
|
|
1345
1349
|
config: perfectionist,
|
|
1346
1350
|
name: "Perfectionist"
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
config: typescript,
|
|
1354
|
+
name: "Typescript"
|
|
1347
1355
|
}
|
|
1348
1356
|
];
|
|
1349
1357
|
const autoConfigs = [
|
|
1350
|
-
{
|
|
1351
|
-
config: typescript,
|
|
1352
|
-
dep: "typescript",
|
|
1353
|
-
name: "Typescript",
|
|
1354
|
-
optionName: "typescript"
|
|
1355
|
-
},
|
|
1356
1358
|
{
|
|
1357
1359
|
config: astro,
|
|
1358
1360
|
dep: "astro",
|
|
1359
1361
|
name: "Astro.js",
|
|
1360
1362
|
optionName: "astro"
|
|
1361
1363
|
},
|
|
1362
|
-
{
|
|
1363
|
-
config: jest,
|
|
1364
|
-
dep: "jest",
|
|
1365
|
-
name: "Jest",
|
|
1366
|
-
optionName: "jest"
|
|
1367
|
-
},
|
|
1368
1364
|
{
|
|
1369
1365
|
config: react,
|
|
1370
1366
|
dep: "react",
|
|
@@ -1414,23 +1410,24 @@ function checkDepsExist(depNames) {
|
|
|
1414
1410
|
|
|
1415
1411
|
//#endregion
|
|
1416
1412
|
//#region src/index.ts
|
|
1413
|
+
const defaultOptions = {};
|
|
1417
1414
|
/**
|
|
1418
1415
|
* Construct an array of ESLint flat config items.
|
|
1419
1416
|
*/
|
|
1420
|
-
async function config(options) {
|
|
1417
|
+
async function config(options = defaultOptions) {
|
|
1421
1418
|
const configs = [];
|
|
1422
1419
|
const autoConfigDeps = Object.values(autoConfigs).map(({ dep }) => dep);
|
|
1423
1420
|
const existingAutoConfigDeps = checkDepsExist(autoConfigDeps);
|
|
1424
|
-
for await (const defaultConfig of defaultConfigs) configs.push(await defaultConfig.config());
|
|
1425
1421
|
const enabledAutoConfigs = autoConfigs.filter(({ dep, optionName }) => {
|
|
1426
1422
|
return options?.[optionName] || existingAutoConfigDeps[dep] && options?.[optionName] !== false;
|
|
1427
1423
|
});
|
|
1428
1424
|
if (enabledAutoConfigs.length > 0) console.log("Auto-configured plugins:");
|
|
1429
|
-
|
|
1425
|
+
const configContext = { options };
|
|
1426
|
+
for (const defaultConfig of defaultConfigs) configs.push(defaultConfig.config(configContext));
|
|
1427
|
+
await Promise.all(enabledAutoConfigs.map(async (autoConfig) => {
|
|
1430
1428
|
console.log(`- ${autoConfig.name}`);
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
}
|
|
1429
|
+
configs.push(await autoConfig.config(configContext));
|
|
1430
|
+
}));
|
|
1434
1431
|
const merged = configs.flat();
|
|
1435
1432
|
return merged;
|
|
1436
1433
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "Will Stone's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -20,11 +20,9 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsdown",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"lint": "pnpm build && eslint .",
|
|
23
|
+
"dev": "config-inspector --config ./eslint-config-for-inspector.js",
|
|
24
|
+
"lint": "eslint .",
|
|
26
25
|
"prepare": "husky",
|
|
27
|
-
"prepublishOnly": "pnpm build",
|
|
28
26
|
"release": "release-it",
|
|
29
27
|
"test": "vitest",
|
|
30
28
|
"typecheck": "tsc --noEmit"
|
|
@@ -35,11 +33,11 @@
|
|
|
35
33
|
"@typescript-eslint/parser": "^8.33.1",
|
|
36
34
|
"confusing-browser-globals": "^1.0.11",
|
|
37
35
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
36
|
+
"eslint-plugin-jsdoc": "^54.1.0",
|
|
38
37
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
39
38
|
"eslint-plugin-n": "^17.19.0",
|
|
40
39
|
"eslint-plugin-package-json": "^0.33.2",
|
|
41
40
|
"eslint-plugin-perfectionist": "^4.14.0",
|
|
42
|
-
"eslint-plugin-tsdoc": "^0.4.0",
|
|
43
41
|
"eslint-plugin-unicorn": "^59.0.1",
|
|
44
42
|
"globals": "^16.2.0",
|
|
45
43
|
"globby": "^14.1.0",
|
|
@@ -57,11 +55,11 @@
|
|
|
57
55
|
"@will-stone/prettier-config": "^11.0.1",
|
|
58
56
|
"astro-eslint-parser": "^1.2.2",
|
|
59
57
|
"eslint-plugin-astro": "^1.3.1",
|
|
60
|
-
"eslint-plugin-jest": "^28.12.0",
|
|
61
58
|
"eslint-plugin-react": "^7.37.5",
|
|
62
59
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
63
60
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
64
61
|
"husky": "^9.1.7",
|
|
62
|
+
"jiti": "^2.5.1",
|
|
65
63
|
"lint-staged": "^16.1.0",
|
|
66
64
|
"memfs": "^4.17.2",
|
|
67
65
|
"prettier": "^3.5.3",
|
|
@@ -75,7 +73,6 @@
|
|
|
75
73
|
"astro-eslint-parser": "^1.2.2",
|
|
76
74
|
"eslint": ">=9.23.0",
|
|
77
75
|
"eslint-plugin-astro": "^1.3.1",
|
|
78
|
-
"eslint-plugin-jest": "^28.11.0",
|
|
79
76
|
"eslint-plugin-react": "^7.37.4",
|
|
80
77
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
81
78
|
"eslint-plugin-tailwindcss": "^3.18.0"
|
|
@@ -90,9 +87,6 @@
|
|
|
90
87
|
"eslint-plugin-astro": {
|
|
91
88
|
"optional": true
|
|
92
89
|
},
|
|
93
|
-
"eslint-plugin-jest": {
|
|
94
|
-
"optional": true
|
|
95
|
-
},
|
|
96
90
|
"eslint-plugin-react": {
|
|
97
91
|
"optional": true
|
|
98
92
|
},
|
|
@@ -103,7 +97,7 @@
|
|
|
103
97
|
"optional": true
|
|
104
98
|
}
|
|
105
99
|
},
|
|
106
|
-
"packageManager": "pnpm@10.
|
|
100
|
+
"packageManager": "pnpm@10.14.0",
|
|
107
101
|
"engines": {
|
|
108
102
|
"node": ">=22"
|
|
109
103
|
},
|