@ntnyq/eslint-config 3.0.0-beta.9 → 3.0.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 +112 -8
- package/dist/index.cjs +469 -346
- package/dist/index.d.cts +6404 -3061
- package/dist/index.d.ts +6404 -3061
- package/dist/index.js +506 -387
- package/package.json +30 -28
package/dist/index.js
CHANGED
|
@@ -5,11 +5,16 @@ import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
|
5
5
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
6
6
|
var GLOB_SRC = `**/*.${GLOB_SRC_EXT}`;
|
|
7
7
|
var GLOB_JS = "**/*.?([cm])js";
|
|
8
|
-
var GLOB_JSX =
|
|
8
|
+
var GLOB_JSX = `${GLOB_JS}x`;
|
|
9
9
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
10
|
-
var GLOB_TSX =
|
|
10
|
+
var GLOB_TSX = `${GLOB_TS}x`;
|
|
11
11
|
var GLOB_DTS = "**/*.d.?([cm])ts";
|
|
12
|
-
var GLOB_TEST =
|
|
12
|
+
var GLOB_TEST = [
|
|
13
|
+
`**/*.test.${GLOB_SRC_EXT}`,
|
|
14
|
+
`**/*.spec.${GLOB_SRC_EXT}`,
|
|
15
|
+
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
16
|
+
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
17
|
+
];
|
|
13
18
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
14
19
|
var GLOB_CSS = "**/*.css";
|
|
15
20
|
var GLOB_LESS = "**/*.less";
|
|
@@ -21,6 +26,8 @@ var GLOB_VUE = "**/*.vue";
|
|
|
21
26
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
22
27
|
var GLOB_TOML = "**/*.toml";
|
|
23
28
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
29
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
30
|
+
var GLOB_SVELTE = "**/*.svelte";
|
|
24
31
|
var GLOB_MARKDOWN = "**/*.md";
|
|
25
32
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
26
33
|
var GLOB_MARKDOWN_NESTED = `${GLOB_MARKDOWN}/*.md`;
|
|
@@ -100,18 +107,19 @@ import { default as default2 } from "eslint-plugin-n";
|
|
|
100
107
|
import { default as default3 } from "eslint-plugin-vue";
|
|
101
108
|
import { default as default4 } from "eslint-plugin-yml";
|
|
102
109
|
import { default as default5 } from "eslint-plugin-toml";
|
|
103
|
-
import { default as default6 } from "
|
|
104
|
-
import { default as default7 } from "eslint
|
|
105
|
-
import { default as default8 } from "eslint-plugin-
|
|
106
|
-
import { default as default9 } from "eslint-plugin-
|
|
107
|
-
import { default as default10 } from "
|
|
108
|
-
import { default as default11 } from "@
|
|
109
|
-
import { default as default12 } from "eslint-plugin
|
|
110
|
-
import { default as default13 } from "eslint-plugin-
|
|
111
|
-
import { default as default14 } from "eslint-plugin-
|
|
112
|
-
import { default as default15 } from "eslint-plugin-
|
|
113
|
-
import { default as default16 } from "eslint-plugin-
|
|
114
|
-
import { default as default17 } from "
|
|
110
|
+
import { default as default6 } from "eslint-plugin-ntnyq";
|
|
111
|
+
import { default as default7 } from "@eslint/markdown";
|
|
112
|
+
import { default as default8 } from "eslint-plugin-antfu";
|
|
113
|
+
import { default as default9 } from "eslint-plugin-jsdoc";
|
|
114
|
+
import { default as default10 } from "eslint-plugin-jsonc";
|
|
115
|
+
import { default as default11 } from "@unocss/eslint-plugin";
|
|
116
|
+
import { default as default12 } from "@vitest/eslint-plugin";
|
|
117
|
+
import { default as default13 } from "eslint-plugin-import-x";
|
|
118
|
+
import { default as default14 } from "eslint-plugin-unicorn";
|
|
119
|
+
import { default as default15 } from "eslint-plugin-prettier";
|
|
120
|
+
import { default as default16 } from "eslint-plugin-perfectionist";
|
|
121
|
+
import { default as default17 } from "eslint-plugin-unused-imports";
|
|
122
|
+
import { default as default18 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
115
123
|
|
|
116
124
|
// src/configs/typescript.ts
|
|
117
125
|
import process from "node:process";
|
|
@@ -134,6 +142,29 @@ var typescriptCore = (options = {}) => {
|
|
|
134
142
|
}
|
|
135
143
|
},
|
|
136
144
|
rules: {
|
|
145
|
+
// Disabled in favor of ts rules
|
|
146
|
+
"no-redeclare": "off",
|
|
147
|
+
"no-use-before-define": "off",
|
|
148
|
+
"no-unused-vars": "off",
|
|
149
|
+
"@typescript-eslint/no-redeclare": [
|
|
150
|
+
"error",
|
|
151
|
+
{
|
|
152
|
+
builtinGlobals: false,
|
|
153
|
+
ignoreDeclarationMerge: true
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"@typescript-eslint/no-use-before-define": [
|
|
157
|
+
"error",
|
|
158
|
+
{
|
|
159
|
+
functions: false,
|
|
160
|
+
classes: false,
|
|
161
|
+
variables: true,
|
|
162
|
+
allowNamedExports: false,
|
|
163
|
+
enums: true,
|
|
164
|
+
typedefs: false,
|
|
165
|
+
ignoreTypeReferences: false
|
|
166
|
+
}
|
|
167
|
+
],
|
|
137
168
|
"@typescript-eslint/no-unused-vars": [
|
|
138
169
|
"error",
|
|
139
170
|
{
|
|
@@ -147,7 +178,14 @@ var typescriptCore = (options = {}) => {
|
|
|
147
178
|
ignoreRestSiblings: true
|
|
148
179
|
}
|
|
149
180
|
],
|
|
150
|
-
"@typescript-eslint/no-
|
|
181
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
182
|
+
"error",
|
|
183
|
+
{
|
|
184
|
+
allowShortCircuit: true,
|
|
185
|
+
allowTernary: true,
|
|
186
|
+
allowTaggedTemplates: true
|
|
187
|
+
}
|
|
188
|
+
],
|
|
151
189
|
"@typescript-eslint/consistent-type-imports": [
|
|
152
190
|
"error",
|
|
153
191
|
{
|
|
@@ -185,37 +223,25 @@ var typescriptCore = (options = {}) => {
|
|
|
185
223
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
186
224
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
187
225
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
188
|
-
"@typescript-eslint/consistent-indexed-object-style": "off"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
226
|
+
"@typescript-eslint/consistent-indexed-object-style": "off",
|
|
227
|
+
// Overrides rules
|
|
228
|
+
...options.overrides
|
|
229
|
+
}
|
|
192
230
|
});
|
|
193
231
|
return configs;
|
|
194
232
|
};
|
|
195
233
|
var typescript = (options = {}) => [
|
|
196
234
|
...typescriptCore(options),
|
|
197
235
|
{
|
|
198
|
-
name: "ntnyq/ts/
|
|
199
|
-
files: [GLOB_DTS],
|
|
236
|
+
name: "ntnyq/ts/types",
|
|
237
|
+
files: [GLOB_DTS, "**/types/**/*.ts"],
|
|
200
238
|
rules: {
|
|
201
239
|
"no-use-before-define": "off",
|
|
202
240
|
"no-restricted-syntax": "off",
|
|
203
241
|
"import/no-duplicates": "off",
|
|
204
|
-
"import/newline-after-import": "off"
|
|
242
|
+
"import/newline-after-import": "off",
|
|
243
|
+
"@typescript-eslint/no-use-before-define": "off"
|
|
205
244
|
}
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: "ntnyq/ts/test",
|
|
209
|
-
files: ["**/*.{spec,test}.ts?(x)"],
|
|
210
|
-
rules: {
|
|
211
|
-
"no-unused-expressions": "off",
|
|
212
|
-
"max-lines-per-function": "off"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: "ntnyq/ts/cjs",
|
|
217
|
-
files: [GLOB_JS],
|
|
218
|
-
rules: {}
|
|
219
245
|
}
|
|
220
246
|
];
|
|
221
247
|
|
|
@@ -341,6 +367,7 @@ var vue = (options = {}) => {
|
|
|
341
367
|
"vue/no-irregular-whitespace": "error",
|
|
342
368
|
"vue/no-use-v-else-with-v-for": "error",
|
|
343
369
|
"vue/require-typed-object-prop": "error",
|
|
370
|
+
"vue/no-deprecated-delete-set": "error",
|
|
344
371
|
"vue/no-extra-parens": ["error", "functions"],
|
|
345
372
|
"vue/no-restricted-syntax": [
|
|
346
373
|
"error",
|
|
@@ -487,7 +514,7 @@ var vue = (options = {}) => {
|
|
|
487
514
|
multiline: 1
|
|
488
515
|
}
|
|
489
516
|
],
|
|
490
|
-
// Overrides
|
|
517
|
+
// Overrides rules
|
|
491
518
|
...options.overrides
|
|
492
519
|
}
|
|
493
520
|
}
|
|
@@ -510,7 +537,7 @@ var yml = (options = {}) => [
|
|
|
510
537
|
...default4.configs.prettier.rules,
|
|
511
538
|
"yml/no-empty-mapping-value": "off",
|
|
512
539
|
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
513
|
-
// Overrides
|
|
540
|
+
// Overrides rules
|
|
514
541
|
...options.overrides
|
|
515
542
|
}
|
|
516
543
|
}
|
|
@@ -532,244 +559,255 @@ var node = (options = {}) => [
|
|
|
532
559
|
"node/prefer-global/buffer": ["error", "never"],
|
|
533
560
|
"node/prefer-global/process": ["error", "never"],
|
|
534
561
|
"node/process-exit-as-throw": "error",
|
|
535
|
-
// Overrides
|
|
562
|
+
// Overrides rules
|
|
536
563
|
...options.overrides
|
|
537
564
|
}
|
|
538
565
|
}
|
|
539
566
|
];
|
|
540
567
|
|
|
541
568
|
// src/configs/sort.ts
|
|
542
|
-
var
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
"
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
"
|
|
553
|
-
"
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
569
|
+
var sort = (options = {}) => {
|
|
570
|
+
const configs = [];
|
|
571
|
+
if (options.tsconfig ?? true) {
|
|
572
|
+
configs.push({
|
|
573
|
+
name: "ntnyq/sort/tsconfig",
|
|
574
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
575
|
+
rules: {
|
|
576
|
+
"jsonc/sort-keys": [
|
|
577
|
+
"error",
|
|
578
|
+
{
|
|
579
|
+
order: ["extends", "compilerOptions", "references", "files", "include", "exclude"],
|
|
580
|
+
pathPattern: "^$"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
order: [
|
|
584
|
+
/* Projects */
|
|
585
|
+
"incremental",
|
|
586
|
+
"composite",
|
|
587
|
+
"tsBuildInfoFile",
|
|
588
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
589
|
+
"disableSolutionSearching",
|
|
590
|
+
"disableReferencedProjectLoad",
|
|
591
|
+
/* Language and Environment */
|
|
592
|
+
"target",
|
|
593
|
+
"lib",
|
|
594
|
+
"jsx",
|
|
595
|
+
"experimentalDecorators",
|
|
596
|
+
"emitDecoratorMetadata",
|
|
597
|
+
"jsxFactory",
|
|
598
|
+
"jsxFragmentFactory",
|
|
599
|
+
"jsxImportSource",
|
|
600
|
+
"reactNamespace",
|
|
601
|
+
"noLib",
|
|
602
|
+
"useDefineForClassFields",
|
|
603
|
+
"moduleDetection",
|
|
604
|
+
/* Modules */
|
|
605
|
+
"module",
|
|
606
|
+
"rootDir",
|
|
607
|
+
"moduleResolution",
|
|
608
|
+
"baseUrl",
|
|
609
|
+
"paths",
|
|
610
|
+
"rootDirs",
|
|
611
|
+
"typeRoots",
|
|
612
|
+
"types",
|
|
613
|
+
"allowUmdGlobalAccess",
|
|
614
|
+
"moduleSuffixes",
|
|
615
|
+
"allowImportingTsExtensions",
|
|
616
|
+
"resolvePackageJsonExports",
|
|
617
|
+
"resolvePackageJsonImports",
|
|
618
|
+
"customConditions",
|
|
619
|
+
"resolveJsonModule",
|
|
620
|
+
"allowArbitraryExtensions",
|
|
621
|
+
"noResolve",
|
|
622
|
+
/* JavaScript Support */
|
|
623
|
+
"allowJs",
|
|
624
|
+
"checkJs",
|
|
625
|
+
"maxNodeModuleJsDepth",
|
|
626
|
+
/* Emit */
|
|
627
|
+
"declaration",
|
|
628
|
+
"declarationMap",
|
|
629
|
+
"emitDeclarationOnly",
|
|
630
|
+
"sourceMap",
|
|
631
|
+
"inlineSourceMap",
|
|
632
|
+
"outFile",
|
|
633
|
+
"outDir",
|
|
634
|
+
"removeComments",
|
|
635
|
+
"noEmit",
|
|
636
|
+
"importHelpers",
|
|
637
|
+
"importsNotUsedAsValues",
|
|
638
|
+
"downlevelIteration",
|
|
639
|
+
"sourceRoot",
|
|
640
|
+
"mapRoot",
|
|
641
|
+
"inlineSources",
|
|
642
|
+
"emitBOM",
|
|
643
|
+
"newLine",
|
|
644
|
+
"stripInternal",
|
|
645
|
+
"noEmitHelpers",
|
|
646
|
+
"noEmitOnError",
|
|
647
|
+
"preserveConstEnums",
|
|
648
|
+
"declarationDir",
|
|
649
|
+
"preserveValueImports",
|
|
650
|
+
/* Interop Constraints */
|
|
651
|
+
"isolatedModules",
|
|
652
|
+
"verbatimModuleSyntax",
|
|
653
|
+
"allowSyntheticDefaultImports",
|
|
654
|
+
"esModuleInterop",
|
|
655
|
+
"preserveSymlinks",
|
|
656
|
+
"forceConsistentCasingInFileNames",
|
|
657
|
+
/* Type Checking */
|
|
658
|
+
"strict",
|
|
659
|
+
"strictBindCallApply",
|
|
660
|
+
"strictFunctionTypes",
|
|
661
|
+
"strictNullChecks",
|
|
662
|
+
"strictPropertyInitialization",
|
|
663
|
+
"allowUnreachableCode",
|
|
664
|
+
"allowUnusedLabels",
|
|
665
|
+
"alwaysStrict",
|
|
666
|
+
"exactOptionalPropertyTypes",
|
|
667
|
+
"noFallthroughCasesInSwitch",
|
|
668
|
+
"noImplicitAny",
|
|
669
|
+
"noImplicitOverride",
|
|
670
|
+
"noImplicitReturns",
|
|
671
|
+
"noImplicitThis",
|
|
672
|
+
"noPropertyAccessFromIndexSignature",
|
|
673
|
+
"noUncheckedIndexedAccess",
|
|
674
|
+
"noUnusedLocals",
|
|
675
|
+
"noUnusedParameters",
|
|
676
|
+
"useUnknownInCatchVariables",
|
|
677
|
+
/* Completeness */
|
|
678
|
+
"skipDefaultLibCheck",
|
|
679
|
+
"skipLibCheck"
|
|
680
|
+
],
|
|
681
|
+
pathPattern: "^compilerOptions$"
|
|
682
|
+
}
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
});
|
|
640
686
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
"
|
|
700
|
-
"
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
"
|
|
704
|
-
"
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
"
|
|
708
|
-
"
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
"
|
|
712
|
-
"
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
"
|
|
735
|
-
"
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
"noImplicitOverride",
|
|
741
|
-
"noImplicitReturns",
|
|
742
|
-
"noImplicitThis",
|
|
743
|
-
"noPropertyAccessFromIndexSignature",
|
|
744
|
-
"noUncheckedIndexedAccess",
|
|
745
|
-
"noUnusedLocals",
|
|
746
|
-
"noUnusedParameters",
|
|
747
|
-
"useUnknownInCatchVariables",
|
|
748
|
-
/* Completeness */
|
|
749
|
-
"skipDefaultLibCheck",
|
|
750
|
-
"skipLibCheck"
|
|
751
|
-
],
|
|
752
|
-
pathPattern: "^compilerOptions$"
|
|
753
|
-
}
|
|
754
|
-
]
|
|
755
|
-
}
|
|
687
|
+
if (options.packageJson ?? true) {
|
|
688
|
+
configs.push({
|
|
689
|
+
name: "ntnyq/sort/package-json",
|
|
690
|
+
files: ["**/package.json"],
|
|
691
|
+
rules: {
|
|
692
|
+
"jsonc/sort-keys": [
|
|
693
|
+
"error",
|
|
694
|
+
{
|
|
695
|
+
pathPattern: "^$",
|
|
696
|
+
order: [
|
|
697
|
+
"publisher",
|
|
698
|
+
"name",
|
|
699
|
+
"displayName",
|
|
700
|
+
"preview",
|
|
701
|
+
"type",
|
|
702
|
+
"version",
|
|
703
|
+
"private",
|
|
704
|
+
"packageManager",
|
|
705
|
+
"description",
|
|
706
|
+
"keywords",
|
|
707
|
+
"license",
|
|
708
|
+
"author",
|
|
709
|
+
"homepage",
|
|
710
|
+
"repository",
|
|
711
|
+
"funding",
|
|
712
|
+
"exports",
|
|
713
|
+
"main",
|
|
714
|
+
"module",
|
|
715
|
+
"unpkg",
|
|
716
|
+
"jsdelivr",
|
|
717
|
+
// workaround for `type: "module"` with TS `moduleResolution: "node16"`
|
|
718
|
+
"types",
|
|
719
|
+
"typesVersions",
|
|
720
|
+
"bin",
|
|
721
|
+
"icon",
|
|
722
|
+
"files",
|
|
723
|
+
"sideEffects",
|
|
724
|
+
"scripts",
|
|
725
|
+
"peerDependencies",
|
|
726
|
+
"peerDependenciesMeta",
|
|
727
|
+
"dependencies",
|
|
728
|
+
"optionalDependencies",
|
|
729
|
+
"devDependencies",
|
|
730
|
+
"activationEvents",
|
|
731
|
+
"contributes",
|
|
732
|
+
"categories",
|
|
733
|
+
"engines",
|
|
734
|
+
"pnpm",
|
|
735
|
+
"overrides",
|
|
736
|
+
"resolutions",
|
|
737
|
+
"husky",
|
|
738
|
+
"prettier",
|
|
739
|
+
"nano-staged",
|
|
740
|
+
"lint-staged",
|
|
741
|
+
"eslintConfig"
|
|
742
|
+
]
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
|
|
746
|
+
order: { type: "asc" }
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
order: { type: "asc" },
|
|
750
|
+
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$"
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
pathPattern: "^exports.*$",
|
|
754
|
+
order: ["types", "import", "require", "default"]
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
pathPattern: "^scripts$",
|
|
758
|
+
order: { type: "asc" }
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
order: [
|
|
762
|
+
// client hooks only
|
|
763
|
+
"pre-commit",
|
|
764
|
+
"prepare-commit-msg",
|
|
765
|
+
"commit-msg",
|
|
766
|
+
"post-commit",
|
|
767
|
+
"pre-rebase",
|
|
768
|
+
"post-rewrite",
|
|
769
|
+
"post-checkout",
|
|
770
|
+
"post-merge",
|
|
771
|
+
"pre-push",
|
|
772
|
+
"pre-auto-gc"
|
|
773
|
+
],
|
|
774
|
+
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$"
|
|
775
|
+
}
|
|
776
|
+
],
|
|
777
|
+
"jsonc/sort-array-values": [
|
|
778
|
+
"error",
|
|
779
|
+
{
|
|
780
|
+
pathPattern: "^files$",
|
|
781
|
+
order: { type: "asc" }
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
}
|
|
785
|
+
});
|
|
756
786
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
787
|
+
if (options.i18nLocale ?? true) {
|
|
788
|
+
configs.push({
|
|
789
|
+
name: "ntnyq/sort/i18n-locale",
|
|
790
|
+
files: ["**/{locales,i18n}/*.json", "**/{locales,i18n}/*.y?(a)ml"],
|
|
791
|
+
rules: {
|
|
792
|
+
"jsonc/sort-keys": [
|
|
793
|
+
"error",
|
|
794
|
+
{
|
|
795
|
+
pathPattern: ".*",
|
|
796
|
+
order: { type: "asc" }
|
|
797
|
+
}
|
|
798
|
+
],
|
|
799
|
+
"yml/sort-keys": [
|
|
800
|
+
"error",
|
|
801
|
+
{
|
|
802
|
+
pathPattern: ".*",
|
|
803
|
+
order: { type: "asc" }
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
}
|
|
807
|
+
});
|
|
771
808
|
}
|
|
772
|
-
|
|
809
|
+
return configs;
|
|
810
|
+
};
|
|
773
811
|
|
|
774
812
|
// src/configs/toml.ts
|
|
775
813
|
var toml = (options = {}) => [
|
|
@@ -802,24 +840,53 @@ var toml = (options = {}) => [
|
|
|
802
840
|
"toml/quoted-keys": "error",
|
|
803
841
|
"toml/spaced-comment": "error",
|
|
804
842
|
"toml/table-bracket-spacing": "error",
|
|
805
|
-
// Overrides
|
|
843
|
+
// Overrides rules
|
|
806
844
|
...options.overrides
|
|
807
845
|
}
|
|
808
846
|
}
|
|
809
847
|
];
|
|
810
848
|
|
|
849
|
+
// src/configs/test.ts
|
|
850
|
+
var test = (options = {}) => [
|
|
851
|
+
{
|
|
852
|
+
name: "ntnyq/test",
|
|
853
|
+
files: [...GLOB_TEST],
|
|
854
|
+
rules: {
|
|
855
|
+
"no-unused-expressions": "off",
|
|
856
|
+
"max-lines-per-function": "off",
|
|
857
|
+
// Overrides rules
|
|
858
|
+
...options.overrides
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
];
|
|
862
|
+
var vitest = (options = {}) => [
|
|
863
|
+
{
|
|
864
|
+
name: "ntnyq/vitest",
|
|
865
|
+
plugins: {
|
|
866
|
+
vitest: default12
|
|
867
|
+
},
|
|
868
|
+
files: [...GLOB_TEST],
|
|
869
|
+
rules: {
|
|
870
|
+
...default12.configs.recommended.rules,
|
|
871
|
+
// Overrides rules
|
|
872
|
+
...options.overridesVitestRules
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
];
|
|
876
|
+
|
|
811
877
|
// src/configs/antfu.ts
|
|
812
878
|
var antfu = (options = {}) => [
|
|
813
879
|
{
|
|
814
880
|
name: "ntnyq/antfu",
|
|
815
881
|
plugins: {
|
|
816
|
-
antfu:
|
|
882
|
+
antfu: default8
|
|
817
883
|
},
|
|
818
884
|
rules: {
|
|
819
885
|
// required `object-curly-newline` to be disabled
|
|
820
886
|
// 'antfu/consistent-list-newline': 'error',
|
|
821
887
|
"antfu/import-dedupe": "error",
|
|
822
888
|
"antfu/top-level-function": "error",
|
|
889
|
+
// Overrides rules
|
|
823
890
|
...options.overrides
|
|
824
891
|
}
|
|
825
892
|
}
|
|
@@ -830,7 +897,7 @@ var jsdoc = (options = {}) => [
|
|
|
830
897
|
{
|
|
831
898
|
name: "ntnyq/jsdoc",
|
|
832
899
|
plugins: {
|
|
833
|
-
jsdoc:
|
|
900
|
+
jsdoc: default9
|
|
834
901
|
},
|
|
835
902
|
rules: {
|
|
836
903
|
"jsdoc/check-access": "warn",
|
|
@@ -850,7 +917,7 @@ var jsdoc = (options = {}) => [
|
|
|
850
917
|
"jsdoc/require-yields-check": "warn",
|
|
851
918
|
"jsdoc/check-alignment": "warn",
|
|
852
919
|
"jsdoc/multiline-blocks": "warn",
|
|
853
|
-
// Overrides
|
|
920
|
+
// Overrides rules
|
|
854
921
|
...options.overrides
|
|
855
922
|
}
|
|
856
923
|
}
|
|
@@ -862,13 +929,13 @@ var jsonc = (options = {}) => [
|
|
|
862
929
|
name: "ntnyq/jsonc",
|
|
863
930
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
864
931
|
plugins: {
|
|
865
|
-
jsonc:
|
|
932
|
+
jsonc: default10
|
|
866
933
|
},
|
|
867
934
|
languageOptions: {
|
|
868
935
|
parser: parserJsonc
|
|
869
936
|
},
|
|
870
937
|
rules: {
|
|
871
|
-
...
|
|
938
|
+
...default10.configs["recommended-with-jsonc"].rules,
|
|
872
939
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
873
940
|
"jsonc/comma-dangle": ["error", "never"],
|
|
874
941
|
"jsonc/comma-style": ["error", "last"],
|
|
@@ -895,7 +962,22 @@ var jsonc = (options = {}) => [
|
|
|
895
962
|
allowMultiplePropertiesPerLine: true
|
|
896
963
|
}
|
|
897
964
|
],
|
|
898
|
-
// Overrides
|
|
965
|
+
// Overrides rules
|
|
966
|
+
...options.overrides
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
];
|
|
970
|
+
|
|
971
|
+
// src/configs/ntnyq.ts
|
|
972
|
+
var ntnyq = (options = {}) => [
|
|
973
|
+
{
|
|
974
|
+
name: "ntnyq/ntnyq",
|
|
975
|
+
plugins: {
|
|
976
|
+
ntnyq: default6
|
|
977
|
+
},
|
|
978
|
+
rules: {
|
|
979
|
+
"ntnyq/no-member-accessibility": "error",
|
|
980
|
+
// Overrides rules
|
|
899
981
|
...options.overrides
|
|
900
982
|
}
|
|
901
983
|
}
|
|
@@ -909,7 +991,7 @@ var regexp = (options = {}) => [
|
|
|
909
991
|
{
|
|
910
992
|
name: "ntnyq/regexp",
|
|
911
993
|
...pluginRegexp.configs["flat/recommended"],
|
|
912
|
-
// Overrides
|
|
994
|
+
// Overrides rules
|
|
913
995
|
...options.overrides
|
|
914
996
|
}
|
|
915
997
|
];
|
|
@@ -919,39 +1001,23 @@ var unocss = (options = {}) => [
|
|
|
919
1001
|
{
|
|
920
1002
|
name: "ntnyq/unocss",
|
|
921
1003
|
plugins: {
|
|
922
|
-
unocss:
|
|
1004
|
+
unocss: default11
|
|
923
1005
|
},
|
|
924
1006
|
rules: {
|
|
925
1007
|
"unocss/order": "error",
|
|
926
1008
|
// We don't use this
|
|
927
1009
|
"unocss/order-attributify": "off",
|
|
928
|
-
// Overrides
|
|
929
|
-
...options.overrides
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
];
|
|
933
|
-
|
|
934
|
-
// src/configs/vitest.ts
|
|
935
|
-
var vitest = (options = {}) => [
|
|
936
|
-
{
|
|
937
|
-
name: "ntnyq/vitest",
|
|
938
|
-
plugins: {
|
|
939
|
-
vitest: default11
|
|
940
|
-
},
|
|
941
|
-
files: [GLOB_TEST],
|
|
942
|
-
rules: {
|
|
943
|
-
...default11.configs.recommended.rules,
|
|
944
|
-
// Overrides built-in rules
|
|
1010
|
+
// Overrides rules
|
|
945
1011
|
...options.overrides
|
|
946
1012
|
}
|
|
947
1013
|
}
|
|
948
1014
|
];
|
|
949
1015
|
|
|
950
1016
|
// src/configs/command.ts
|
|
951
|
-
import
|
|
1017
|
+
import createCommandConfig from "eslint-plugin-command/config";
|
|
952
1018
|
var command = (options = {}) => [
|
|
953
1019
|
{
|
|
954
|
-
...
|
|
1020
|
+
...createCommandConfig(options),
|
|
955
1021
|
name: "ntnyq/command"
|
|
956
1022
|
}
|
|
957
1023
|
];
|
|
@@ -973,7 +1039,7 @@ var imports = (options = {}) => [
|
|
|
973
1039
|
{
|
|
974
1040
|
name: "ntnyq/imports",
|
|
975
1041
|
plugins: {
|
|
976
|
-
import:
|
|
1042
|
+
import: default13
|
|
977
1043
|
},
|
|
978
1044
|
settings: {
|
|
979
1045
|
"import/resolver": {
|
|
@@ -984,14 +1050,16 @@ var imports = (options = {}) => [
|
|
|
984
1050
|
"import/no-unresolved": "off",
|
|
985
1051
|
"import/no-absolute-path": "off",
|
|
986
1052
|
"import/no-named-as-default-member": "off",
|
|
987
|
-
|
|
1053
|
+
"import/no-named-default": "off",
|
|
1054
|
+
// disabled in favor or `perfectionist/sort-imports`
|
|
1055
|
+
"import/order": "off",
|
|
988
1056
|
"import/first": "error",
|
|
989
1057
|
"import/export": "error",
|
|
990
1058
|
"import/no-self-import": "error",
|
|
991
1059
|
"import/no-duplicates": "error",
|
|
992
1060
|
"import/no-mutable-exports": "error",
|
|
993
1061
|
"import/newline-after-import": "error",
|
|
994
|
-
// Overrides
|
|
1062
|
+
// Overrides rules
|
|
995
1063
|
...options.overrides
|
|
996
1064
|
}
|
|
997
1065
|
}
|
|
@@ -1002,7 +1070,7 @@ var unicorn = (options = {}) => [
|
|
|
1002
1070
|
{
|
|
1003
1071
|
name: "ntnyq/unicorn",
|
|
1004
1072
|
plugins: {
|
|
1005
|
-
unicorn:
|
|
1073
|
+
unicorn: default14
|
|
1006
1074
|
},
|
|
1007
1075
|
rules: {
|
|
1008
1076
|
// Disabled for now
|
|
@@ -1010,6 +1078,10 @@ var unicorn = (options = {}) => [
|
|
|
1010
1078
|
"unicorn/prefer-top-level-await": "off",
|
|
1011
1079
|
"unicorn/explicit-length-check": "off",
|
|
1012
1080
|
"unicorn/no-array-callback-reference": "off",
|
|
1081
|
+
/**
|
|
1082
|
+
* @see https://caniuse.com/?search=globalThis
|
|
1083
|
+
*/
|
|
1084
|
+
"unicorn/prefer-global-this": "off",
|
|
1013
1085
|
"unicorn/error-message": "error",
|
|
1014
1086
|
"unicorn/escape-case": "error",
|
|
1015
1087
|
"unicorn/no-new-buffer": "error",
|
|
@@ -1039,6 +1111,8 @@ var unicorn = (options = {}) => [
|
|
|
1039
1111
|
"unicorn/prefer-optional-catch-binding": "error",
|
|
1040
1112
|
"unicorn/prefer-prototype-methods": "error",
|
|
1041
1113
|
"unicorn/prefer-reflect-apply": "error",
|
|
1114
|
+
"unicorn/prefer-math-min-max": "error",
|
|
1115
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
1042
1116
|
"unicorn/catch-error-name": [
|
|
1043
1117
|
"error",
|
|
1044
1118
|
{
|
|
@@ -1069,23 +1143,61 @@ var unicorn = (options = {}) => [
|
|
|
1069
1143
|
"unicorn/prefer-array-some": "error",
|
|
1070
1144
|
"unicorn/prefer-array-flat-map": "error",
|
|
1071
1145
|
"unicorn/prefer-array-index-of": "error",
|
|
1072
|
-
// Overrides
|
|
1146
|
+
// Overrides rules
|
|
1073
1147
|
...options.overrides
|
|
1074
1148
|
}
|
|
1075
1149
|
}
|
|
1076
1150
|
];
|
|
1077
1151
|
|
|
1152
|
+
// src/configs/specials.ts
|
|
1153
|
+
import globals from "globals";
|
|
1154
|
+
var specials = () => [
|
|
1155
|
+
{
|
|
1156
|
+
name: "ntnyq/specials/scripts",
|
|
1157
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
1158
|
+
rules: {
|
|
1159
|
+
"no-console": "off",
|
|
1160
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
name: "ntnyq/specials/cli",
|
|
1165
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
1166
|
+
rules: {
|
|
1167
|
+
"no-console": "off",
|
|
1168
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
1169
|
+
}
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
name: "ntnyq/specials/userscript",
|
|
1173
|
+
files: [`**/*.user.${GLOB_SRC_EXT}`],
|
|
1174
|
+
languageOptions: {
|
|
1175
|
+
globals: {
|
|
1176
|
+
...globals.greasemonkey
|
|
1177
|
+
}
|
|
1178
|
+
},
|
|
1179
|
+
rules: {
|
|
1180
|
+
camelcase: [
|
|
1181
|
+
"error",
|
|
1182
|
+
{
|
|
1183
|
+
allow: ["^GM_.+"]
|
|
1184
|
+
}
|
|
1185
|
+
]
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
];
|
|
1189
|
+
|
|
1078
1190
|
// src/configs/comments.ts
|
|
1079
1191
|
var comments = (options = {}) => [
|
|
1080
1192
|
{
|
|
1081
1193
|
name: "ntnyq/eslint-comments",
|
|
1082
1194
|
plugins: {
|
|
1083
|
-
"@eslint-community/eslint-comments":
|
|
1195
|
+
"@eslint-community/eslint-comments": default18
|
|
1084
1196
|
},
|
|
1085
1197
|
rules: {
|
|
1086
|
-
...
|
|
1198
|
+
...default18.configs.recommended.rules,
|
|
1087
1199
|
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
|
1088
|
-
// Overrides
|
|
1200
|
+
// Overrides rules
|
|
1089
1201
|
...options.overrides
|
|
1090
1202
|
}
|
|
1091
1203
|
}
|
|
@@ -1093,9 +1205,9 @@ var comments = (options = {}) => [
|
|
|
1093
1205
|
|
|
1094
1206
|
// src/configs/markdown.ts
|
|
1095
1207
|
var markdown = (options = {}) => {
|
|
1096
|
-
if (!Array.isArray(
|
|
1208
|
+
if (!Array.isArray(default7.configs?.processor)) return [];
|
|
1097
1209
|
return [
|
|
1098
|
-
...
|
|
1210
|
+
...default7.configs.processor.map((config) => ({
|
|
1099
1211
|
...config,
|
|
1100
1212
|
name: `ntnyq/${config.name}`
|
|
1101
1213
|
})),
|
|
@@ -1123,7 +1235,7 @@ var markdown = (options = {}) => {
|
|
|
1123
1235
|
"@typescript-eslint/no-use-before-define": "off",
|
|
1124
1236
|
"@typescript-eslint/no-unused-expressions": "off",
|
|
1125
1237
|
"@typescript-eslint/consistent-type-imports": "off",
|
|
1126
|
-
// Overrides
|
|
1238
|
+
// Overrides rules
|
|
1127
1239
|
...options.overrides
|
|
1128
1240
|
}
|
|
1129
1241
|
}
|
|
@@ -1135,7 +1247,7 @@ var prettier = (options = {}) => [
|
|
|
1135
1247
|
{
|
|
1136
1248
|
name: "ntnyq/prettier",
|
|
1137
1249
|
plugins: {
|
|
1138
|
-
prettier:
|
|
1250
|
+
prettier: default15
|
|
1139
1251
|
},
|
|
1140
1252
|
rules: {
|
|
1141
1253
|
"vue/array-bracket-newline": "off",
|
|
@@ -1175,9 +1287,9 @@ var prettier = (options = {}) => [
|
|
|
1175
1287
|
"vue/space-infix-ops": "off",
|
|
1176
1288
|
"vue/space-unary-ops": "off",
|
|
1177
1289
|
"vue/template-curly-spacing": "off",
|
|
1178
|
-
...
|
|
1290
|
+
...default15.configs.recommended.rules,
|
|
1179
1291
|
"prettier/prettier": options.level || "warn",
|
|
1180
|
-
// Overrides
|
|
1292
|
+
// Overrides rules
|
|
1181
1293
|
...options.overrides
|
|
1182
1294
|
}
|
|
1183
1295
|
},
|
|
@@ -1186,9 +1298,9 @@ var prettier = (options = {}) => [
|
|
|
1186
1298
|
*/
|
|
1187
1299
|
{
|
|
1188
1300
|
name: "ntnyq/prettier/disabled",
|
|
1189
|
-
files: [GLOB_TOML],
|
|
1301
|
+
files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1190
1302
|
plugins: {
|
|
1191
|
-
prettier:
|
|
1303
|
+
prettier: default15
|
|
1192
1304
|
},
|
|
1193
1305
|
rules: {
|
|
1194
1306
|
"prettier/prettier": "off"
|
|
@@ -1197,17 +1309,17 @@ var prettier = (options = {}) => [
|
|
|
1197
1309
|
];
|
|
1198
1310
|
|
|
1199
1311
|
// src/configs/gitignore.ts
|
|
1200
|
-
import
|
|
1312
|
+
import createGitIgnoreConfig from "eslint-config-flat-gitignore";
|
|
1201
1313
|
var gitignore = (options = {}) => [
|
|
1202
1314
|
{
|
|
1203
|
-
...
|
|
1315
|
+
...createGitIgnoreConfig(options),
|
|
1204
1316
|
name: "ntnyq/gitignore"
|
|
1205
1317
|
}
|
|
1206
1318
|
];
|
|
1207
1319
|
|
|
1208
1320
|
// src/configs/javascript.ts
|
|
1209
1321
|
import jsConfig from "@eslint/js";
|
|
1210
|
-
import
|
|
1322
|
+
import globals2 from "globals";
|
|
1211
1323
|
var javascript = (options = {}) => {
|
|
1212
1324
|
const strictRules = {
|
|
1213
1325
|
complexity: ["error", { max: 30 }],
|
|
@@ -1240,13 +1352,19 @@ var javascript = (options = {}) => {
|
|
|
1240
1352
|
name: "ntnyq/js/core",
|
|
1241
1353
|
languageOptions: {
|
|
1242
1354
|
globals: {
|
|
1243
|
-
...
|
|
1244
|
-
...
|
|
1245
|
-
...
|
|
1355
|
+
...globals2.browser,
|
|
1356
|
+
...globals2.es2021,
|
|
1357
|
+
...globals2.node
|
|
1246
1358
|
},
|
|
1247
1359
|
sourceType: "module"
|
|
1248
1360
|
},
|
|
1249
1361
|
rules: {
|
|
1362
|
+
"require-await": "off",
|
|
1363
|
+
"no-return-assign": "off",
|
|
1364
|
+
"no-useless-escape": "off",
|
|
1365
|
+
"consistent-return": "off",
|
|
1366
|
+
// disabled in favor of `perfectionist/sort-named-imports`
|
|
1367
|
+
"sort-imports": "off",
|
|
1250
1368
|
// standard v17.0.0
|
|
1251
1369
|
"accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }],
|
|
1252
1370
|
camelcase: [
|
|
@@ -1394,55 +1512,27 @@ var javascript = (options = {}) => {
|
|
|
1394
1512
|
eqeqeq: ["error", "smart"],
|
|
1395
1513
|
"array-callback-return": "error",
|
|
1396
1514
|
"block-scoped-var": "error",
|
|
1397
|
-
"consistent-return": "off",
|
|
1398
1515
|
"no-alert": "error",
|
|
1399
1516
|
"no-case-declarations": "error",
|
|
1400
1517
|
"no-multi-str": "error",
|
|
1401
1518
|
"no-with": "error",
|
|
1402
1519
|
"no-void": "error",
|
|
1403
|
-
"no-useless-escape": "off",
|
|
1404
1520
|
"vars-on-top": "error",
|
|
1405
|
-
"require-await": "off",
|
|
1406
|
-
"no-return-assign": "off",
|
|
1407
1521
|
"one-var": ["error", "never"],
|
|
1408
1522
|
"no-use-before-define": [
|
|
1409
1523
|
"error",
|
|
1410
1524
|
{
|
|
1411
1525
|
functions: false,
|
|
1412
1526
|
classes: false,
|
|
1413
|
-
variables: true
|
|
1414
|
-
|
|
1415
|
-
],
|
|
1416
|
-
"sort-imports": [
|
|
1417
|
-
"error",
|
|
1418
|
-
{
|
|
1419
|
-
ignoreCase: false,
|
|
1420
|
-
ignoreDeclarationSort: true,
|
|
1421
|
-
ignoreMemberSort: false,
|
|
1422
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
|
|
1423
|
-
allowSeparatedGroups: false
|
|
1527
|
+
variables: true,
|
|
1528
|
+
allowNamedExports: false
|
|
1424
1529
|
}
|
|
1425
1530
|
],
|
|
1426
1531
|
// Strict rules
|
|
1427
1532
|
...options.strict ? strictRules : {},
|
|
1428
|
-
// Overrides
|
|
1533
|
+
// Overrides rules
|
|
1429
1534
|
...options.overrides
|
|
1430
1535
|
}
|
|
1431
|
-
},
|
|
1432
|
-
{
|
|
1433
|
-
name: "ntnyq/js/scripts",
|
|
1434
|
-
files: ["**/scripts/*", "**/cli.*"],
|
|
1435
|
-
rules: {
|
|
1436
|
-
"no-console": "off"
|
|
1437
|
-
}
|
|
1438
|
-
},
|
|
1439
|
-
{
|
|
1440
|
-
name: "ntnyq/js/test",
|
|
1441
|
-
files: ["**/*.{test,spec}.js?(x)"],
|
|
1442
|
-
rules: {
|
|
1443
|
-
"no-unused-expressions": "off",
|
|
1444
|
-
"max-lines-per-function": "off"
|
|
1445
|
-
}
|
|
1446
1536
|
}
|
|
1447
1537
|
];
|
|
1448
1538
|
};
|
|
@@ -1465,7 +1555,7 @@ var perfectionist = (options = {}) => [
|
|
|
1465
1555
|
{
|
|
1466
1556
|
name: "ntnyq/perfectionist",
|
|
1467
1557
|
plugins: {
|
|
1468
|
-
perfectionist:
|
|
1558
|
+
perfectionist: default16
|
|
1469
1559
|
},
|
|
1470
1560
|
rules: {
|
|
1471
1561
|
"perfectionist/sort-imports": [
|
|
@@ -1507,8 +1597,8 @@ var perfectionist = (options = {}) => [
|
|
|
1507
1597
|
*/
|
|
1508
1598
|
"unknown"
|
|
1509
1599
|
],
|
|
1510
|
-
order: "asc",
|
|
1511
|
-
type: "natural",
|
|
1600
|
+
order: options.imports?.order || "asc",
|
|
1601
|
+
type: options.imports?.type || "natural",
|
|
1512
1602
|
ignoreCase: true,
|
|
1513
1603
|
internalPattern: ["~/**", "@/**", "#**"],
|
|
1514
1604
|
newlinesBetween: "ignore"
|
|
@@ -1517,13 +1607,30 @@ var perfectionist = (options = {}) => [
|
|
|
1517
1607
|
"perfectionist/sort-exports": [
|
|
1518
1608
|
"error",
|
|
1519
1609
|
{
|
|
1520
|
-
order: "asc",
|
|
1521
|
-
type: "line-length"
|
|
1610
|
+
order: options.exports?.order || "asc",
|
|
1611
|
+
type: options.exports?.type || "line-length"
|
|
1612
|
+
}
|
|
1613
|
+
],
|
|
1614
|
+
"perfectionist/sort-named-exports": [
|
|
1615
|
+
"error",
|
|
1616
|
+
{
|
|
1617
|
+
type: options.namedExports?.type || "alphabetical",
|
|
1618
|
+
order: options.namedExports?.order || "asc",
|
|
1619
|
+
ignoreCase: true,
|
|
1620
|
+
groupKind: "values-first"
|
|
1522
1621
|
}
|
|
1523
1622
|
],
|
|
1524
|
-
"perfectionist/sort-named-
|
|
1525
|
-
|
|
1526
|
-
|
|
1623
|
+
"perfectionist/sort-named-imports": [
|
|
1624
|
+
"error",
|
|
1625
|
+
{
|
|
1626
|
+
type: options.namedImports?.type || "alphabetical",
|
|
1627
|
+
order: options.namedImports?.order || "asc",
|
|
1628
|
+
ignoreCase: true,
|
|
1629
|
+
ignoreAlias: false,
|
|
1630
|
+
groupKind: "values-first"
|
|
1631
|
+
}
|
|
1632
|
+
],
|
|
1633
|
+
// Overrides rules
|
|
1527
1634
|
...options.overrides
|
|
1528
1635
|
}
|
|
1529
1636
|
}
|
|
@@ -1534,21 +1641,25 @@ var unusedImports = (options = {}) => [
|
|
|
1534
1641
|
{
|
|
1535
1642
|
name: "ntnyq/unused-imports",
|
|
1536
1643
|
plugins: {
|
|
1537
|
-
"unused-imports":
|
|
1644
|
+
"unused-imports": default17
|
|
1538
1645
|
},
|
|
1539
1646
|
rules: {
|
|
1540
1647
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1541
1648
|
"unused-imports/no-unused-imports": "error",
|
|
1542
1649
|
"unused-imports/no-unused-vars": [
|
|
1543
|
-
"
|
|
1650
|
+
"error",
|
|
1544
1651
|
{
|
|
1545
1652
|
vars: "all",
|
|
1546
1653
|
varsIgnorePattern: "^_",
|
|
1547
1654
|
args: "after-used",
|
|
1548
|
-
argsIgnorePattern: "^_"
|
|
1655
|
+
argsIgnorePattern: "^_",
|
|
1656
|
+
ignoreRestSiblings: true,
|
|
1657
|
+
destructuredArrayIgnorePattern: "^_",
|
|
1658
|
+
caughtErrors: "all",
|
|
1659
|
+
caughtErrorsIgnorePattern: "^_"
|
|
1549
1660
|
}
|
|
1550
1661
|
],
|
|
1551
|
-
// Overrides
|
|
1662
|
+
// Overrides rules
|
|
1552
1663
|
...options.overrides
|
|
1553
1664
|
}
|
|
1554
1665
|
}
|
|
@@ -1598,7 +1709,7 @@ function getOverrides(options, key) {
|
|
|
1598
1709
|
}
|
|
1599
1710
|
|
|
1600
1711
|
// src/core.ts
|
|
1601
|
-
function
|
|
1712
|
+
function defineESLintConfig(options = {}, userConfigs = []) {
|
|
1602
1713
|
const configs = [];
|
|
1603
1714
|
if (options.gitignore ?? true) {
|
|
1604
1715
|
configs.push(
|
|
@@ -1624,6 +1735,7 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1624
1735
|
if (options.perfectionist ?? true) {
|
|
1625
1736
|
configs.push(
|
|
1626
1737
|
...perfectionist({
|
|
1738
|
+
...resolveSubOptions(options, "perfectionist"),
|
|
1627
1739
|
overrides: getOverrides(options, "perfectionist")
|
|
1628
1740
|
})
|
|
1629
1741
|
);
|
|
@@ -1664,15 +1776,6 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1664
1776
|
})
|
|
1665
1777
|
);
|
|
1666
1778
|
}
|
|
1667
|
-
if (options.sortI18nLocale ?? true) {
|
|
1668
|
-
configs.push(...sortI18nLocale());
|
|
1669
|
-
}
|
|
1670
|
-
if (options.sortTsConfig ?? true) {
|
|
1671
|
-
configs.push(...sortTsConfig());
|
|
1672
|
-
}
|
|
1673
|
-
if (options.sortPackageJson ?? true) {
|
|
1674
|
-
configs.push(...sortPackageJson());
|
|
1675
|
-
}
|
|
1676
1779
|
if (options.yml ?? true) {
|
|
1677
1780
|
configs.push(
|
|
1678
1781
|
...yml({
|
|
@@ -1694,6 +1797,13 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1694
1797
|
})
|
|
1695
1798
|
);
|
|
1696
1799
|
}
|
|
1800
|
+
if (options.sort ?? true) {
|
|
1801
|
+
configs.push(
|
|
1802
|
+
...sort({
|
|
1803
|
+
...resolveSubOptions(options, "sort")
|
|
1804
|
+
})
|
|
1805
|
+
);
|
|
1806
|
+
}
|
|
1697
1807
|
if (options.vue ?? hasVue) {
|
|
1698
1808
|
configs.push(
|
|
1699
1809
|
...vue({
|
|
@@ -1702,10 +1812,13 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1702
1812
|
})
|
|
1703
1813
|
);
|
|
1704
1814
|
}
|
|
1705
|
-
if (options.
|
|
1815
|
+
if (options.test ?? hasVitest) {
|
|
1706
1816
|
configs.push(
|
|
1817
|
+
...test({
|
|
1818
|
+
overrides: getOverrides(options, "test")
|
|
1819
|
+
}),
|
|
1707
1820
|
...vitest({
|
|
1708
|
-
overrides: getOverrides(options, "
|
|
1821
|
+
overrides: getOverrides(options, "test")
|
|
1709
1822
|
})
|
|
1710
1823
|
);
|
|
1711
1824
|
}
|
|
@@ -1730,6 +1843,7 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1730
1843
|
})
|
|
1731
1844
|
);
|
|
1732
1845
|
}
|
|
1846
|
+
const configSpecials = specials();
|
|
1733
1847
|
const configPrettier = options.prettier ?? true ? prettier({
|
|
1734
1848
|
...resolveSubOptions(options, "prettier"),
|
|
1735
1849
|
overrides: getOverrides(options, "prettier")
|
|
@@ -1738,12 +1852,14 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1738
1852
|
composer.append(
|
|
1739
1853
|
...configs,
|
|
1740
1854
|
...toArray(userConfigs),
|
|
1855
|
+
...configSpecials,
|
|
1741
1856
|
...configPrettier
|
|
1742
1857
|
);
|
|
1743
1858
|
return composer;
|
|
1744
1859
|
}
|
|
1745
1860
|
export {
|
|
1746
1861
|
GLOB_ALL_SRC,
|
|
1862
|
+
GLOB_ASTRO,
|
|
1747
1863
|
GLOB_CSS,
|
|
1748
1864
|
GLOB_DIST,
|
|
1749
1865
|
GLOB_DTS,
|
|
@@ -1764,6 +1880,7 @@ export {
|
|
|
1764
1880
|
GLOB_SRC,
|
|
1765
1881
|
GLOB_SRC_EXT,
|
|
1766
1882
|
GLOB_STYLE,
|
|
1883
|
+
GLOB_SVELTE,
|
|
1767
1884
|
GLOB_TEST,
|
|
1768
1885
|
GLOB_TOML,
|
|
1769
1886
|
GLOB_TS,
|
|
@@ -1773,6 +1890,7 @@ export {
|
|
|
1773
1890
|
antfu,
|
|
1774
1891
|
command,
|
|
1775
1892
|
comments,
|
|
1893
|
+
defineESLintConfig,
|
|
1776
1894
|
getOverrides,
|
|
1777
1895
|
gitignore,
|
|
1778
1896
|
hasTypeScript,
|
|
@@ -1795,29 +1913,30 @@ export {
|
|
|
1795
1913
|
parserVue,
|
|
1796
1914
|
parserYaml,
|
|
1797
1915
|
perfectionist,
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1916
|
+
default8 as pluginAntfu,
|
|
1917
|
+
default18 as pluginComments,
|
|
1918
|
+
default13 as pluginImport,
|
|
1919
|
+
default9 as pluginJsdoc,
|
|
1920
|
+
default10 as pluginJsonc,
|
|
1921
|
+
default7 as pluginMarkdown,
|
|
1804
1922
|
default2 as pluginNode,
|
|
1805
|
-
|
|
1806
|
-
|
|
1923
|
+
default6 as pluginNtnyq,
|
|
1924
|
+
default16 as pluginPerfectionist,
|
|
1925
|
+
default15 as pluginPrettier,
|
|
1807
1926
|
pluginRegexp,
|
|
1808
1927
|
default5 as pluginToml,
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1928
|
+
default14 as pluginUnicorn,
|
|
1929
|
+
default11 as pluginUnoCSS,
|
|
1930
|
+
default17 as pluginUnusedImports,
|
|
1931
|
+
default12 as pluginVitest,
|
|
1813
1932
|
default3 as pluginVue,
|
|
1814
1933
|
default4 as pluginYaml,
|
|
1815
1934
|
prettier,
|
|
1816
1935
|
regexp,
|
|
1817
1936
|
resolveSubOptions,
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1937
|
+
sort,
|
|
1938
|
+
specials,
|
|
1939
|
+
test,
|
|
1821
1940
|
toArray,
|
|
1822
1941
|
toml,
|
|
1823
1942
|
tseslint,
|