acaleph-eslint 1.0.13 → 1.0.14
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/dist/index.cjs +184 -185
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +184 -185
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -84,8 +84,8 @@ var FlatConfigComposer = class {
|
|
|
84
84
|
|
|
85
85
|
// src/class/local-pkg.ts
|
|
86
86
|
var import_node_module = require("module");
|
|
87
|
-
var import_mlly = require("mlly");
|
|
88
87
|
var import_node_path = require("path");
|
|
88
|
+
var import_mlly = require("mlly");
|
|
89
89
|
function isPackageExists(name, options = {}) {
|
|
90
90
|
return !!resolvePackage(name, options);
|
|
91
91
|
}
|
|
@@ -123,6 +123,37 @@ function _resolve(path, options = {}) {
|
|
|
123
123
|
return modulePath;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// src/plugins.ts
|
|
127
|
+
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
128
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
129
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
130
|
+
|
|
131
|
+
// src/configs/import.ts
|
|
132
|
+
async function imports(options = {}) {
|
|
133
|
+
return [
|
|
134
|
+
{
|
|
135
|
+
name: "acaleph/imports/rules",
|
|
136
|
+
plugins: {
|
|
137
|
+
"unused-imports": import_eslint_plugin_unused_imports.default,
|
|
138
|
+
"import": pluginImport
|
|
139
|
+
},
|
|
140
|
+
rules: {
|
|
141
|
+
"unused-imports/no-unused-imports": "error",
|
|
142
|
+
"unused-imports/no-unused-vars": [
|
|
143
|
+
"warn",
|
|
144
|
+
{
|
|
145
|
+
vars: "all",
|
|
146
|
+
varsIgnorePattern: "^_",
|
|
147
|
+
args: "after-used",
|
|
148
|
+
argsIgnorePattern: "^_"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"import/newline-after-import": ["error"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
|
|
126
157
|
// src/configs/javascript.ts
|
|
127
158
|
var import_globals = __toESM(require("globals"), 1);
|
|
128
159
|
async function javascript(options = {}) {
|
|
@@ -180,9 +211,6 @@ async function javascript(options = {}) {
|
|
|
180
211
|
];
|
|
181
212
|
}
|
|
182
213
|
|
|
183
|
-
// src/configs/typescript.ts
|
|
184
|
-
var import_node_process = __toESM(require("process"), 1);
|
|
185
|
-
|
|
186
214
|
// src/globs.ts
|
|
187
215
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
188
216
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
@@ -206,7 +234,157 @@ function renameRules(rules, map) {
|
|
|
206
234
|
);
|
|
207
235
|
}
|
|
208
236
|
|
|
237
|
+
// src/configs/jsx.ts
|
|
238
|
+
async function jsx() {
|
|
239
|
+
const StylisticJsx = await interopDefault(import("@stylistic/eslint-plugin-jsx"));
|
|
240
|
+
return [
|
|
241
|
+
{
|
|
242
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
243
|
+
languageOptions: {
|
|
244
|
+
parserOptions: {
|
|
245
|
+
ecmaFeatures: {
|
|
246
|
+
jsx: true
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
name: "acaleph/jsx/setup"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
plugins: {
|
|
254
|
+
"@stylistic/jsx": StylisticJsx
|
|
255
|
+
},
|
|
256
|
+
rules: {
|
|
257
|
+
"@stylistic/jsx/jsx-indent": ["error", 2],
|
|
258
|
+
"@stylistic/jsx/jsx-props-no-multi-spaces": "error"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// src/configs/perfectionist.ts
|
|
265
|
+
async function perfectionist() {
|
|
266
|
+
return [
|
|
267
|
+
{
|
|
268
|
+
name: "acaleph/perfectionist/setup",
|
|
269
|
+
plugins: {
|
|
270
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
271
|
+
},
|
|
272
|
+
rules: {
|
|
273
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
274
|
+
"perfectionist/sort-imports": ["error", {
|
|
275
|
+
groups: [
|
|
276
|
+
"type",
|
|
277
|
+
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
278
|
+
"builtin",
|
|
279
|
+
"external",
|
|
280
|
+
"internal",
|
|
281
|
+
["parent", "sibling", "index"],
|
|
282
|
+
"side-effect",
|
|
283
|
+
"object",
|
|
284
|
+
"unknown"
|
|
285
|
+
],
|
|
286
|
+
newlinesBetween: "ignore",
|
|
287
|
+
order: "asc",
|
|
288
|
+
type: "natural"
|
|
289
|
+
}],
|
|
290
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
291
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/configs/react.ts
|
|
298
|
+
async function react(options = {}) {
|
|
299
|
+
const {
|
|
300
|
+
files = [GLOB_SRC],
|
|
301
|
+
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
302
|
+
overrides = {},
|
|
303
|
+
tsconfigPath
|
|
304
|
+
} = options;
|
|
305
|
+
const typeAwareRules = {
|
|
306
|
+
"react/no-leaked-conditional-rendering": "warn"
|
|
307
|
+
};
|
|
308
|
+
const isTypeAware = !!tsconfigPath;
|
|
309
|
+
const EslintPluginReact = await interopDefault(import("eslint-plugin-react"));
|
|
310
|
+
return [
|
|
311
|
+
{
|
|
312
|
+
name: "acaleph/react/setup",
|
|
313
|
+
plugins: {
|
|
314
|
+
react: EslintPluginReact
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "acaleph/react/rules",
|
|
319
|
+
files,
|
|
320
|
+
languageOptions: {
|
|
321
|
+
parserOptions: {
|
|
322
|
+
ecmaFeatures: {
|
|
323
|
+
jsx: true
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
sourceType: "module"
|
|
327
|
+
},
|
|
328
|
+
rules: {
|
|
329
|
+
"react/jsx-first-prop-new-line": ["error", "multiline"],
|
|
330
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 6 }],
|
|
331
|
+
"react/jsx-indent": ["error", 2],
|
|
332
|
+
"react/jsx-closing-tag-location": ["error", "line-aligned"],
|
|
333
|
+
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
334
|
+
"react/self-closing-comp": ["error", { component: true, html: true }],
|
|
335
|
+
"react/jsx-wrap-multilines": ["error", { declaration: "parens-new-line" }],
|
|
336
|
+
"react/jsx-space-before-closing": ["error", "always"],
|
|
337
|
+
"react/jsx-indent-props": ["error", 2],
|
|
338
|
+
"react/jsx-curly-spacing": ["error", { when: "always", children: true }],
|
|
339
|
+
...overrides
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
...isTypeAware ? [{
|
|
343
|
+
files: filesTypeAware,
|
|
344
|
+
name: "acaleph/react/type-aware-rules",
|
|
345
|
+
rules: {
|
|
346
|
+
...typeAwareRules
|
|
347
|
+
}
|
|
348
|
+
}] : []
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// src/configs/stylistic.ts
|
|
353
|
+
async function stylistic(options = {}) {
|
|
354
|
+
const { indent, jsx: jsx2, quotes, semi, overrides } = options;
|
|
355
|
+
const [Stylistic, StylisticJS] = await Promise.all([
|
|
356
|
+
interopDefault(import("@stylistic/eslint-plugin")),
|
|
357
|
+
interopDefault(import("@stylistic/eslint-plugin-js"))
|
|
358
|
+
]);
|
|
359
|
+
const config = Stylistic.configs.customize({
|
|
360
|
+
flat: true,
|
|
361
|
+
indent,
|
|
362
|
+
jsx: jsx2,
|
|
363
|
+
pluginName: "style",
|
|
364
|
+
quotes,
|
|
365
|
+
semi
|
|
366
|
+
});
|
|
367
|
+
return [
|
|
368
|
+
{
|
|
369
|
+
name: "acaleph/stylistic/rules",
|
|
370
|
+
plugins: {
|
|
371
|
+
style: Stylistic,
|
|
372
|
+
"@stylistic/js": StylisticJS
|
|
373
|
+
},
|
|
374
|
+
rules: {
|
|
375
|
+
...config.rules,
|
|
376
|
+
...overrides,
|
|
377
|
+
"@stylistic/js/indent": ["error", 2],
|
|
378
|
+
"@stylistic/js/no-multi-spaces": ["error"],
|
|
379
|
+
"@stylistic/js/space-in-parens": ["error", "never"],
|
|
380
|
+
"@stylistic/js/object-curly-spacing": ["error", "always"]
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
];
|
|
384
|
+
}
|
|
385
|
+
|
|
209
386
|
// src/configs/typescript.ts
|
|
387
|
+
var import_node_process = __toESM(require("process"), 1);
|
|
210
388
|
async function typescript(options = {}) {
|
|
211
389
|
const {
|
|
212
390
|
overrides = {},
|
|
@@ -355,33 +533,6 @@ async function typescript(options = {}) {
|
|
|
355
533
|
];
|
|
356
534
|
}
|
|
357
535
|
|
|
358
|
-
// src/configs/jsx.ts
|
|
359
|
-
async function jsx() {
|
|
360
|
-
const StylisticJsx = await interopDefault(import("@stylistic/eslint-plugin-jsx"));
|
|
361
|
-
return [
|
|
362
|
-
{
|
|
363
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
364
|
-
languageOptions: {
|
|
365
|
-
parserOptions: {
|
|
366
|
-
ecmaFeatures: {
|
|
367
|
-
jsx: true
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
},
|
|
371
|
-
name: "acaleph/jsx/setup"
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
plugins: {
|
|
375
|
-
"@stylistic/jsx": StylisticJsx
|
|
376
|
-
},
|
|
377
|
-
rules: {
|
|
378
|
-
"@stylistic/jsx/jsx-indent": ["error", 2],
|
|
379
|
-
"@stylistic/jsx/jsx-props-no-multi-spaces": "error"
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
];
|
|
383
|
-
}
|
|
384
|
-
|
|
385
536
|
// src/configs/vue.ts
|
|
386
537
|
async function vue(options = {}) {
|
|
387
538
|
const {
|
|
@@ -534,159 +685,6 @@ async function vue(options = {}) {
|
|
|
534
685
|
];
|
|
535
686
|
}
|
|
536
687
|
|
|
537
|
-
// src/configs/stylistic.ts
|
|
538
|
-
async function stylistic(options = {}) {
|
|
539
|
-
const { indent, jsx: jsx2, quotes, semi, overrides } = options;
|
|
540
|
-
const [Stylistic, StylisticJS] = await Promise.all([
|
|
541
|
-
interopDefault(import("@stylistic/eslint-plugin")),
|
|
542
|
-
interopDefault(import("@stylistic/eslint-plugin-js"))
|
|
543
|
-
]);
|
|
544
|
-
const config = Stylistic.configs.customize({
|
|
545
|
-
flat: true,
|
|
546
|
-
indent,
|
|
547
|
-
jsx: jsx2,
|
|
548
|
-
pluginName: "style",
|
|
549
|
-
quotes,
|
|
550
|
-
semi
|
|
551
|
-
});
|
|
552
|
-
return [
|
|
553
|
-
{
|
|
554
|
-
name: "acaleph/stylistic/rules",
|
|
555
|
-
plugins: {
|
|
556
|
-
style: Stylistic,
|
|
557
|
-
"@stylistic/js": StylisticJS
|
|
558
|
-
},
|
|
559
|
-
rules: {
|
|
560
|
-
...config.rules,
|
|
561
|
-
...overrides,
|
|
562
|
-
"@stylistic/js/indent": ["error", 2],
|
|
563
|
-
"@stylistic/js/no-multi-spaces": ["error"],
|
|
564
|
-
"@stylistic/js/space-in-parens": ["error", "never"],
|
|
565
|
-
"@stylistic/js/object-curly-spacing": ["error", "always"]
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
];
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// src/configs/react.ts
|
|
572
|
-
async function react(options = {}) {
|
|
573
|
-
const {
|
|
574
|
-
files = [GLOB_SRC],
|
|
575
|
-
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
576
|
-
overrides = {},
|
|
577
|
-
tsconfigPath
|
|
578
|
-
} = options;
|
|
579
|
-
const typeAwareRules = {
|
|
580
|
-
"react/no-leaked-conditional-rendering": "warn"
|
|
581
|
-
};
|
|
582
|
-
const isTypeAware = !!tsconfigPath;
|
|
583
|
-
const EslintPluginReact = await interopDefault(import("eslint-plugin-react"));
|
|
584
|
-
return [
|
|
585
|
-
{
|
|
586
|
-
name: "acaleph/react/setup",
|
|
587
|
-
plugins: {
|
|
588
|
-
react: EslintPluginReact
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
|
-
{
|
|
592
|
-
name: "acaleph/react/rules",
|
|
593
|
-
files,
|
|
594
|
-
languageOptions: {
|
|
595
|
-
parserOptions: {
|
|
596
|
-
ecmaFeatures: {
|
|
597
|
-
jsx: true
|
|
598
|
-
}
|
|
599
|
-
},
|
|
600
|
-
sourceType: "module"
|
|
601
|
-
},
|
|
602
|
-
rules: {
|
|
603
|
-
"react/jsx-first-prop-new-line": ["error", "multiline"],
|
|
604
|
-
"react/jsx-max-props-per-line": ["error", { maximum: 6 }],
|
|
605
|
-
"react/jsx-indent": ["error", 2],
|
|
606
|
-
"react/jsx-closing-tag-location": ["error", "line-aligned"],
|
|
607
|
-
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
608
|
-
"react/self-closing-comp": ["error", { component: true, html: true }],
|
|
609
|
-
"react/jsx-wrap-multilines": ["error", { declaration: "parens-new-line" }],
|
|
610
|
-
"react/jsx-space-before-closing": ["error", "always"],
|
|
611
|
-
"react/jsx-indent-props": ["error", 2],
|
|
612
|
-
"react/jsx-curly-spacing": ["error", { when: "always", children: true }],
|
|
613
|
-
...overrides
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
...isTypeAware ? [{
|
|
617
|
-
files: filesTypeAware,
|
|
618
|
-
name: "acaleph/react/type-aware-rules",
|
|
619
|
-
rules: {
|
|
620
|
-
...typeAwareRules
|
|
621
|
-
}
|
|
622
|
-
}] : []
|
|
623
|
-
];
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// src/plugins.ts
|
|
627
|
-
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
628
|
-
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
629
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
630
|
-
|
|
631
|
-
// src/configs/import.ts
|
|
632
|
-
async function imports(options = {}) {
|
|
633
|
-
return [
|
|
634
|
-
{
|
|
635
|
-
name: "acaleph/imports/rules",
|
|
636
|
-
plugins: {
|
|
637
|
-
"unused-imports": import_eslint_plugin_unused_imports.default,
|
|
638
|
-
"import": pluginImport
|
|
639
|
-
},
|
|
640
|
-
rules: {
|
|
641
|
-
"unused-imports/no-unused-imports": "error",
|
|
642
|
-
"unused-imports/no-unused-vars": [
|
|
643
|
-
"warn",
|
|
644
|
-
{
|
|
645
|
-
vars: "all",
|
|
646
|
-
varsIgnorePattern: "^_",
|
|
647
|
-
args: "after-used",
|
|
648
|
-
argsIgnorePattern: "^_"
|
|
649
|
-
}
|
|
650
|
-
],
|
|
651
|
-
"import/newline-after-import": ["error"]
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
];
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// src/configs/perfectionist.ts
|
|
658
|
-
async function perfectionist() {
|
|
659
|
-
return [
|
|
660
|
-
{
|
|
661
|
-
name: "acaleph/perfectionist/setup",
|
|
662
|
-
plugins: {
|
|
663
|
-
perfectionist: import_eslint_plugin_perfectionist.default
|
|
664
|
-
},
|
|
665
|
-
rules: {
|
|
666
|
-
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
667
|
-
"perfectionist/sort-imports": ["error", {
|
|
668
|
-
groups: [
|
|
669
|
-
"type",
|
|
670
|
-
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
671
|
-
"builtin",
|
|
672
|
-
"external",
|
|
673
|
-
"internal",
|
|
674
|
-
["parent", "sibling", "index"],
|
|
675
|
-
"side-effect",
|
|
676
|
-
"object",
|
|
677
|
-
"unknown"
|
|
678
|
-
],
|
|
679
|
-
newlinesBetween: "ignore",
|
|
680
|
-
order: "asc",
|
|
681
|
-
type: "natural"
|
|
682
|
-
}],
|
|
683
|
-
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
684
|
-
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
];
|
|
688
|
-
}
|
|
689
|
-
|
|
690
688
|
// src/factory.ts
|
|
691
689
|
var VuePackages = ["vue", "nuxt"];
|
|
692
690
|
function acaleph(options = {}, ...userConfigs) {
|
|
@@ -708,7 +706,8 @@ function acaleph(options = {}, ...userConfigs) {
|
|
|
708
706
|
overrides: getOverrides(options, "javascript")
|
|
709
707
|
}),
|
|
710
708
|
stylisticOptions ? stylistic(stylisticOptions) : stylistic(),
|
|
711
|
-
imports()
|
|
709
|
+
imports(),
|
|
710
|
+
perfectionist()
|
|
712
711
|
);
|
|
713
712
|
if (enableVue)
|
|
714
713
|
componentExts.push("vue");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
-
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
2
|
import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
3
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
/* prettier-ignore */
|
|
@@ -10562,23 +10562,23 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
|
10562
10562
|
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
10563
10563
|
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
10564
10564
|
|
|
10565
|
-
declare function
|
|
10565
|
+
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
10566
10566
|
|
|
10567
|
-
declare function
|
|
10567
|
+
declare function javascript(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
10568
10568
|
|
|
10569
10569
|
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
10570
10570
|
|
|
10571
|
-
declare function
|
|
10571
|
+
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
10572
|
+
|
|
10573
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
10572
10574
|
|
|
10573
10575
|
interface StylisticOptions extends StylisticConfig, OptionsOverrides {
|
|
10574
10576
|
}
|
|
10575
10577
|
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
10576
10578
|
|
|
10577
|
-
declare function
|
|
10578
|
-
|
|
10579
|
-
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
10579
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<TypedFlatConfigItem[]>;
|
|
10580
10580
|
|
|
10581
|
-
declare function
|
|
10581
|
+
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
10582
10582
|
|
|
10583
10583
|
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
10584
10584
|
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
|
-
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
2
|
import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
3
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable */
|
|
6
6
|
/* prettier-ignore */
|
|
@@ -10562,23 +10562,23 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
|
10562
10562
|
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
10563
10563
|
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
10564
10564
|
|
|
10565
|
-
declare function
|
|
10565
|
+
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
10566
10566
|
|
|
10567
|
-
declare function
|
|
10567
|
+
declare function javascript(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
10568
10568
|
|
|
10569
10569
|
declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
10570
10570
|
|
|
10571
|
-
declare function
|
|
10571
|
+
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
10572
|
+
|
|
10573
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
10572
10574
|
|
|
10573
10575
|
interface StylisticOptions extends StylisticConfig, OptionsOverrides {
|
|
10574
10576
|
}
|
|
10575
10577
|
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
10576
10578
|
|
|
10577
|
-
declare function
|
|
10578
|
-
|
|
10579
|
-
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
10579
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): Promise<TypedFlatConfigItem[]>;
|
|
10580
10580
|
|
|
10581
|
-
declare function
|
|
10581
|
+
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
10582
10582
|
|
|
10583
10583
|
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
10584
10584
|
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
package/dist/index.js
CHANGED
|
@@ -28,8 +28,8 @@ var FlatConfigComposer = class {
|
|
|
28
28
|
|
|
29
29
|
// src/class/local-pkg.ts
|
|
30
30
|
import { createRequire } from "node:module";
|
|
31
|
-
import { resolvePathSync } from "mlly";
|
|
32
31
|
import { win32 } from "node:path";
|
|
32
|
+
import { resolvePathSync } from "mlly";
|
|
33
33
|
function isPackageExists(name, options = {}) {
|
|
34
34
|
return !!resolvePackage(name, options);
|
|
35
35
|
}
|
|
@@ -67,6 +67,37 @@ function _resolve(path, options = {}) {
|
|
|
67
67
|
return modulePath;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// src/plugins.ts
|
|
71
|
+
import * as pluginImport from "eslint-plugin-import-x";
|
|
72
|
+
import { default as default2 } from "eslint-plugin-perfectionist";
|
|
73
|
+
import { default as default3 } from "eslint-plugin-unused-imports";
|
|
74
|
+
|
|
75
|
+
// src/configs/import.ts
|
|
76
|
+
async function imports(options = {}) {
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
name: "acaleph/imports/rules",
|
|
80
|
+
plugins: {
|
|
81
|
+
"unused-imports": default3,
|
|
82
|
+
"import": pluginImport
|
|
83
|
+
},
|
|
84
|
+
rules: {
|
|
85
|
+
"unused-imports/no-unused-imports": "error",
|
|
86
|
+
"unused-imports/no-unused-vars": [
|
|
87
|
+
"warn",
|
|
88
|
+
{
|
|
89
|
+
vars: "all",
|
|
90
|
+
varsIgnorePattern: "^_",
|
|
91
|
+
args: "after-used",
|
|
92
|
+
argsIgnorePattern: "^_"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"import/newline-after-import": ["error"]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
70
101
|
// src/configs/javascript.ts
|
|
71
102
|
import globals from "globals";
|
|
72
103
|
async function javascript(options = {}) {
|
|
@@ -124,9 +155,6 @@ async function javascript(options = {}) {
|
|
|
124
155
|
];
|
|
125
156
|
}
|
|
126
157
|
|
|
127
|
-
// src/configs/typescript.ts
|
|
128
|
-
import process2 from "node:process";
|
|
129
|
-
|
|
130
158
|
// src/globs.ts
|
|
131
159
|
var GLOB_JSX = "**/*.?([cm])jsx";
|
|
132
160
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
@@ -150,7 +178,157 @@ function renameRules(rules, map) {
|
|
|
150
178
|
);
|
|
151
179
|
}
|
|
152
180
|
|
|
181
|
+
// src/configs/jsx.ts
|
|
182
|
+
async function jsx() {
|
|
183
|
+
const StylisticJsx = await interopDefault(import("@stylistic/eslint-plugin-jsx"));
|
|
184
|
+
return [
|
|
185
|
+
{
|
|
186
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
187
|
+
languageOptions: {
|
|
188
|
+
parserOptions: {
|
|
189
|
+
ecmaFeatures: {
|
|
190
|
+
jsx: true
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
name: "acaleph/jsx/setup"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
plugins: {
|
|
198
|
+
"@stylistic/jsx": StylisticJsx
|
|
199
|
+
},
|
|
200
|
+
rules: {
|
|
201
|
+
"@stylistic/jsx/jsx-indent": ["error", 2],
|
|
202
|
+
"@stylistic/jsx/jsx-props-no-multi-spaces": "error"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/configs/perfectionist.ts
|
|
209
|
+
async function perfectionist() {
|
|
210
|
+
return [
|
|
211
|
+
{
|
|
212
|
+
name: "acaleph/perfectionist/setup",
|
|
213
|
+
plugins: {
|
|
214
|
+
perfectionist: default2
|
|
215
|
+
},
|
|
216
|
+
rules: {
|
|
217
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
218
|
+
"perfectionist/sort-imports": ["error", {
|
|
219
|
+
groups: [
|
|
220
|
+
"type",
|
|
221
|
+
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
222
|
+
"builtin",
|
|
223
|
+
"external",
|
|
224
|
+
"internal",
|
|
225
|
+
["parent", "sibling", "index"],
|
|
226
|
+
"side-effect",
|
|
227
|
+
"object",
|
|
228
|
+
"unknown"
|
|
229
|
+
],
|
|
230
|
+
newlinesBetween: "ignore",
|
|
231
|
+
order: "asc",
|
|
232
|
+
type: "natural"
|
|
233
|
+
}],
|
|
234
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
235
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// src/configs/react.ts
|
|
242
|
+
async function react(options = {}) {
|
|
243
|
+
const {
|
|
244
|
+
files = [GLOB_SRC],
|
|
245
|
+
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
246
|
+
overrides = {},
|
|
247
|
+
tsconfigPath
|
|
248
|
+
} = options;
|
|
249
|
+
const typeAwareRules = {
|
|
250
|
+
"react/no-leaked-conditional-rendering": "warn"
|
|
251
|
+
};
|
|
252
|
+
const isTypeAware = !!tsconfigPath;
|
|
253
|
+
const EslintPluginReact = await interopDefault(import("eslint-plugin-react"));
|
|
254
|
+
return [
|
|
255
|
+
{
|
|
256
|
+
name: "acaleph/react/setup",
|
|
257
|
+
plugins: {
|
|
258
|
+
react: EslintPluginReact
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "acaleph/react/rules",
|
|
263
|
+
files,
|
|
264
|
+
languageOptions: {
|
|
265
|
+
parserOptions: {
|
|
266
|
+
ecmaFeatures: {
|
|
267
|
+
jsx: true
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
sourceType: "module"
|
|
271
|
+
},
|
|
272
|
+
rules: {
|
|
273
|
+
"react/jsx-first-prop-new-line": ["error", "multiline"],
|
|
274
|
+
"react/jsx-max-props-per-line": ["error", { maximum: 6 }],
|
|
275
|
+
"react/jsx-indent": ["error", 2],
|
|
276
|
+
"react/jsx-closing-tag-location": ["error", "line-aligned"],
|
|
277
|
+
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
278
|
+
"react/self-closing-comp": ["error", { component: true, html: true }],
|
|
279
|
+
"react/jsx-wrap-multilines": ["error", { declaration: "parens-new-line" }],
|
|
280
|
+
"react/jsx-space-before-closing": ["error", "always"],
|
|
281
|
+
"react/jsx-indent-props": ["error", 2],
|
|
282
|
+
"react/jsx-curly-spacing": ["error", { when: "always", children: true }],
|
|
283
|
+
...overrides
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
...isTypeAware ? [{
|
|
287
|
+
files: filesTypeAware,
|
|
288
|
+
name: "acaleph/react/type-aware-rules",
|
|
289
|
+
rules: {
|
|
290
|
+
...typeAwareRules
|
|
291
|
+
}
|
|
292
|
+
}] : []
|
|
293
|
+
];
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/configs/stylistic.ts
|
|
297
|
+
async function stylistic(options = {}) {
|
|
298
|
+
const { indent, jsx: jsx2, quotes, semi, overrides } = options;
|
|
299
|
+
const [Stylistic, StylisticJS] = await Promise.all([
|
|
300
|
+
interopDefault(import("@stylistic/eslint-plugin")),
|
|
301
|
+
interopDefault(import("@stylistic/eslint-plugin-js"))
|
|
302
|
+
]);
|
|
303
|
+
const config = Stylistic.configs.customize({
|
|
304
|
+
flat: true,
|
|
305
|
+
indent,
|
|
306
|
+
jsx: jsx2,
|
|
307
|
+
pluginName: "style",
|
|
308
|
+
quotes,
|
|
309
|
+
semi
|
|
310
|
+
});
|
|
311
|
+
return [
|
|
312
|
+
{
|
|
313
|
+
name: "acaleph/stylistic/rules",
|
|
314
|
+
plugins: {
|
|
315
|
+
style: Stylistic,
|
|
316
|
+
"@stylistic/js": StylisticJS
|
|
317
|
+
},
|
|
318
|
+
rules: {
|
|
319
|
+
...config.rules,
|
|
320
|
+
...overrides,
|
|
321
|
+
"@stylistic/js/indent": ["error", 2],
|
|
322
|
+
"@stylistic/js/no-multi-spaces": ["error"],
|
|
323
|
+
"@stylistic/js/space-in-parens": ["error", "never"],
|
|
324
|
+
"@stylistic/js/object-curly-spacing": ["error", "always"]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
|
|
153
330
|
// src/configs/typescript.ts
|
|
331
|
+
import process2 from "node:process";
|
|
154
332
|
async function typescript(options = {}) {
|
|
155
333
|
const {
|
|
156
334
|
overrides = {},
|
|
@@ -299,33 +477,6 @@ async function typescript(options = {}) {
|
|
|
299
477
|
];
|
|
300
478
|
}
|
|
301
479
|
|
|
302
|
-
// src/configs/jsx.ts
|
|
303
|
-
async function jsx() {
|
|
304
|
-
const StylisticJsx = await interopDefault(import("@stylistic/eslint-plugin-jsx"));
|
|
305
|
-
return [
|
|
306
|
-
{
|
|
307
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
308
|
-
languageOptions: {
|
|
309
|
-
parserOptions: {
|
|
310
|
-
ecmaFeatures: {
|
|
311
|
-
jsx: true
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
name: "acaleph/jsx/setup"
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
plugins: {
|
|
319
|
-
"@stylistic/jsx": StylisticJsx
|
|
320
|
-
},
|
|
321
|
-
rules: {
|
|
322
|
-
"@stylistic/jsx/jsx-indent": ["error", 2],
|
|
323
|
-
"@stylistic/jsx/jsx-props-no-multi-spaces": "error"
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
];
|
|
327
|
-
}
|
|
328
|
-
|
|
329
480
|
// src/configs/vue.ts
|
|
330
481
|
async function vue(options = {}) {
|
|
331
482
|
const {
|
|
@@ -478,159 +629,6 @@ async function vue(options = {}) {
|
|
|
478
629
|
];
|
|
479
630
|
}
|
|
480
631
|
|
|
481
|
-
// src/configs/stylistic.ts
|
|
482
|
-
async function stylistic(options = {}) {
|
|
483
|
-
const { indent, jsx: jsx2, quotes, semi, overrides } = options;
|
|
484
|
-
const [Stylistic, StylisticJS] = await Promise.all([
|
|
485
|
-
interopDefault(import("@stylistic/eslint-plugin")),
|
|
486
|
-
interopDefault(import("@stylistic/eslint-plugin-js"))
|
|
487
|
-
]);
|
|
488
|
-
const config = Stylistic.configs.customize({
|
|
489
|
-
flat: true,
|
|
490
|
-
indent,
|
|
491
|
-
jsx: jsx2,
|
|
492
|
-
pluginName: "style",
|
|
493
|
-
quotes,
|
|
494
|
-
semi
|
|
495
|
-
});
|
|
496
|
-
return [
|
|
497
|
-
{
|
|
498
|
-
name: "acaleph/stylistic/rules",
|
|
499
|
-
plugins: {
|
|
500
|
-
style: Stylistic,
|
|
501
|
-
"@stylistic/js": StylisticJS
|
|
502
|
-
},
|
|
503
|
-
rules: {
|
|
504
|
-
...config.rules,
|
|
505
|
-
...overrides,
|
|
506
|
-
"@stylistic/js/indent": ["error", 2],
|
|
507
|
-
"@stylistic/js/no-multi-spaces": ["error"],
|
|
508
|
-
"@stylistic/js/space-in-parens": ["error", "never"],
|
|
509
|
-
"@stylistic/js/object-curly-spacing": ["error", "always"]
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
];
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// src/configs/react.ts
|
|
516
|
-
async function react(options = {}) {
|
|
517
|
-
const {
|
|
518
|
-
files = [GLOB_SRC],
|
|
519
|
-
filesTypeAware = [GLOB_TS, GLOB_TSX],
|
|
520
|
-
overrides = {},
|
|
521
|
-
tsconfigPath
|
|
522
|
-
} = options;
|
|
523
|
-
const typeAwareRules = {
|
|
524
|
-
"react/no-leaked-conditional-rendering": "warn"
|
|
525
|
-
};
|
|
526
|
-
const isTypeAware = !!tsconfigPath;
|
|
527
|
-
const EslintPluginReact = await interopDefault(import("eslint-plugin-react"));
|
|
528
|
-
return [
|
|
529
|
-
{
|
|
530
|
-
name: "acaleph/react/setup",
|
|
531
|
-
plugins: {
|
|
532
|
-
react: EslintPluginReact
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
name: "acaleph/react/rules",
|
|
537
|
-
files,
|
|
538
|
-
languageOptions: {
|
|
539
|
-
parserOptions: {
|
|
540
|
-
ecmaFeatures: {
|
|
541
|
-
jsx: true
|
|
542
|
-
}
|
|
543
|
-
},
|
|
544
|
-
sourceType: "module"
|
|
545
|
-
},
|
|
546
|
-
rules: {
|
|
547
|
-
"react/jsx-first-prop-new-line": ["error", "multiline"],
|
|
548
|
-
"react/jsx-max-props-per-line": ["error", { maximum: 6 }],
|
|
549
|
-
"react/jsx-indent": ["error", 2],
|
|
550
|
-
"react/jsx-closing-tag-location": ["error", "line-aligned"],
|
|
551
|
-
"react/jsx-closing-bracket-location": ["error", "line-aligned"],
|
|
552
|
-
"react/self-closing-comp": ["error", { component: true, html: true }],
|
|
553
|
-
"react/jsx-wrap-multilines": ["error", { declaration: "parens-new-line" }],
|
|
554
|
-
"react/jsx-space-before-closing": ["error", "always"],
|
|
555
|
-
"react/jsx-indent-props": ["error", 2],
|
|
556
|
-
"react/jsx-curly-spacing": ["error", { when: "always", children: true }],
|
|
557
|
-
...overrides
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
...isTypeAware ? [{
|
|
561
|
-
files: filesTypeAware,
|
|
562
|
-
name: "acaleph/react/type-aware-rules",
|
|
563
|
-
rules: {
|
|
564
|
-
...typeAwareRules
|
|
565
|
-
}
|
|
566
|
-
}] : []
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
// src/plugins.ts
|
|
571
|
-
import * as pluginImport from "eslint-plugin-import-x";
|
|
572
|
-
import { default as default2 } from "eslint-plugin-unused-imports";
|
|
573
|
-
import { default as default3 } from "eslint-plugin-perfectionist";
|
|
574
|
-
|
|
575
|
-
// src/configs/import.ts
|
|
576
|
-
async function imports(options = {}) {
|
|
577
|
-
return [
|
|
578
|
-
{
|
|
579
|
-
name: "acaleph/imports/rules",
|
|
580
|
-
plugins: {
|
|
581
|
-
"unused-imports": default2,
|
|
582
|
-
"import": pluginImport
|
|
583
|
-
},
|
|
584
|
-
rules: {
|
|
585
|
-
"unused-imports/no-unused-imports": "error",
|
|
586
|
-
"unused-imports/no-unused-vars": [
|
|
587
|
-
"warn",
|
|
588
|
-
{
|
|
589
|
-
vars: "all",
|
|
590
|
-
varsIgnorePattern: "^_",
|
|
591
|
-
args: "after-used",
|
|
592
|
-
argsIgnorePattern: "^_"
|
|
593
|
-
}
|
|
594
|
-
],
|
|
595
|
-
"import/newline-after-import": ["error"]
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
];
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
// src/configs/perfectionist.ts
|
|
602
|
-
async function perfectionist() {
|
|
603
|
-
return [
|
|
604
|
-
{
|
|
605
|
-
name: "acaleph/perfectionist/setup",
|
|
606
|
-
plugins: {
|
|
607
|
-
perfectionist: default3
|
|
608
|
-
},
|
|
609
|
-
rules: {
|
|
610
|
-
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
611
|
-
"perfectionist/sort-imports": ["error", {
|
|
612
|
-
groups: [
|
|
613
|
-
"type",
|
|
614
|
-
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
615
|
-
"builtin",
|
|
616
|
-
"external",
|
|
617
|
-
"internal",
|
|
618
|
-
["parent", "sibling", "index"],
|
|
619
|
-
"side-effect",
|
|
620
|
-
"object",
|
|
621
|
-
"unknown"
|
|
622
|
-
],
|
|
623
|
-
newlinesBetween: "ignore",
|
|
624
|
-
order: "asc",
|
|
625
|
-
type: "natural"
|
|
626
|
-
}],
|
|
627
|
-
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
628
|
-
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
];
|
|
632
|
-
}
|
|
633
|
-
|
|
634
632
|
// src/factory.ts
|
|
635
633
|
var VuePackages = ["vue", "nuxt"];
|
|
636
634
|
function acaleph(options = {}, ...userConfigs) {
|
|
@@ -652,7 +650,8 @@ function acaleph(options = {}, ...userConfigs) {
|
|
|
652
650
|
overrides: getOverrides(options, "javascript")
|
|
653
651
|
}),
|
|
654
652
|
stylisticOptions ? stylistic(stylisticOptions) : stylistic(),
|
|
655
|
-
imports()
|
|
653
|
+
imports(),
|
|
654
|
+
perfectionist()
|
|
656
655
|
);
|
|
657
656
|
if (enableVue)
|
|
658
657
|
componentExts.push("vue");
|