@ivanmaxlogiudice/eslint-config 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/README.md +24 -4
- package/dist/cli.cjs +3 -2
- package/dist/cli.js +3 -2
- package/dist/index.cjs +93 -117
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +93 -117
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -370,10 +370,30 @@ export default config({
|
|
|
370
370
|
|
|
371
371
|
// Or customize the formatters
|
|
372
372
|
formatters: {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Format CSS, LESS, SCSS files, also the `<style>` blocks in Vue
|
|
375
|
+
* By default uses Prettier
|
|
376
|
+
*/
|
|
377
|
+
css: true,
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Format HTML files
|
|
381
|
+
* By default uses Prettier
|
|
382
|
+
*/
|
|
383
|
+
html: true,
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Format TOML files
|
|
387
|
+
* Currently only supports dprint
|
|
388
|
+
*/
|
|
389
|
+
toml: 'dprint',
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Format Markdown files
|
|
393
|
+
* Supports Prettier and dprint
|
|
394
|
+
* By default uses Prettier
|
|
395
|
+
*/
|
|
396
|
+
markdown: 'prettier'
|
|
377
397
|
}
|
|
378
398
|
})
|
|
379
399
|
```
|
package/dist/cli.cjs
CHANGED
|
@@ -35,7 +35,7 @@ var import_picocolors4 = __toESM(require("picocolors"), 1);
|
|
|
35
35
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
|
-
var version = "1.0.
|
|
38
|
+
var version = "1.0.14";
|
|
39
39
|
var devDependencies = {
|
|
40
40
|
"@stylistic/eslint-plugin-migrate": "^1.5.0",
|
|
41
41
|
"@types/eslint": "^8.44.8",
|
|
@@ -54,7 +54,8 @@ var devDependencies = {
|
|
|
54
54
|
"simple-git-hooks": "^2.9.0",
|
|
55
55
|
tsup: "^8.0.1",
|
|
56
56
|
typescript: "^5.3.2",
|
|
57
|
-
vitest: "^1.0.1"
|
|
57
|
+
vitest: "^1.0.1",
|
|
58
|
+
vue: "^3.3.11"
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
// src/cli/constants.ts
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import c4 from "picocolors";
|
|
|
6
6
|
import c from "picocolors";
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
|
-
var version = "1.0.
|
|
9
|
+
var version = "1.0.14";
|
|
10
10
|
var devDependencies = {
|
|
11
11
|
"@stylistic/eslint-plugin-migrate": "^1.5.0",
|
|
12
12
|
"@types/eslint": "^8.44.8",
|
|
@@ -25,7 +25,8 @@ var devDependencies = {
|
|
|
25
25
|
"simple-git-hooks": "^2.9.0",
|
|
26
26
|
tsup: "^8.0.1",
|
|
27
27
|
typescript: "^5.3.2",
|
|
28
|
-
vitest: "^1.0.1"
|
|
28
|
+
vitest: "^1.0.1",
|
|
29
|
+
vue: "^3.3.11"
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
// src/cli/constants.ts
|
package/dist/index.cjs
CHANGED
|
@@ -153,6 +153,9 @@ async function comments() {
|
|
|
153
153
|
];
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
// src/configs/formatters.ts
|
|
157
|
+
var parserPlain = __toESM(require("eslint-parser-plain"), 1);
|
|
158
|
+
|
|
156
159
|
// src/globs.ts
|
|
157
160
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
158
161
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -284,7 +287,7 @@ async function stylistic(options = {}) {
|
|
|
284
287
|
}
|
|
285
288
|
|
|
286
289
|
// src/configs/formatters.ts
|
|
287
|
-
async function formatters(options = {}, stylistic2 = {}
|
|
290
|
+
async function formatters(options = {}, stylistic2 = {}) {
|
|
288
291
|
await ensurePackages([
|
|
289
292
|
"eslint-plugin-format"
|
|
290
293
|
]);
|
|
@@ -305,28 +308,23 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
305
308
|
...StylisticConfigDefaults,
|
|
306
309
|
...stylistic2
|
|
307
310
|
};
|
|
308
|
-
const prettierOptions = Object.assign(
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
322
|
-
useTabs: indent === "tab"
|
|
323
|
-
},
|
|
324
|
-
options.dprintOptions || {}
|
|
325
|
-
);
|
|
311
|
+
const prettierOptions = Object.assign({
|
|
312
|
+
endOfLine: "auto",
|
|
313
|
+
semi,
|
|
314
|
+
singleQuote: quotes === "single",
|
|
315
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
316
|
+
trailingComma: "all",
|
|
317
|
+
useTabs: indent === "tab"
|
|
318
|
+
}, options.prettierOptions || {});
|
|
319
|
+
const dprintOptions = Object.assign({
|
|
320
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
321
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
322
|
+
useTabs: indent === "tab"
|
|
323
|
+
}, options.dprintOptions || {});
|
|
326
324
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
327
325
|
const configs = [
|
|
328
326
|
{
|
|
329
|
-
name: "
|
|
327
|
+
name: "config:formatters:setup",
|
|
330
328
|
plugins: {
|
|
331
329
|
format: pluginFormat
|
|
332
330
|
}
|
|
@@ -337,49 +335,40 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
337
335
|
{
|
|
338
336
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
339
337
|
languageOptions: {
|
|
340
|
-
parser:
|
|
338
|
+
parser: parserPlain
|
|
341
339
|
},
|
|
342
|
-
name: "
|
|
340
|
+
name: "config:formatter:css",
|
|
343
341
|
rules: {
|
|
344
|
-
"format/prettier": [
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
parser: "css"
|
|
349
|
-
}
|
|
350
|
-
]
|
|
342
|
+
"format/prettier": ["error", {
|
|
343
|
+
...prettierOptions,
|
|
344
|
+
parser: "css"
|
|
345
|
+
}]
|
|
351
346
|
}
|
|
352
347
|
},
|
|
353
348
|
{
|
|
354
349
|
files: [GLOB_SCSS],
|
|
355
350
|
languageOptions: {
|
|
356
|
-
parser:
|
|
351
|
+
parser: parserPlain
|
|
357
352
|
},
|
|
358
|
-
name: "
|
|
353
|
+
name: "config:formatter:scss",
|
|
359
354
|
rules: {
|
|
360
|
-
"format/prettier": [
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
parser: "scss"
|
|
365
|
-
}
|
|
366
|
-
]
|
|
355
|
+
"format/prettier": ["error", {
|
|
356
|
+
...prettierOptions,
|
|
357
|
+
parser: "scss"
|
|
358
|
+
}]
|
|
367
359
|
}
|
|
368
360
|
},
|
|
369
361
|
{
|
|
370
362
|
files: [GLOB_LESS],
|
|
371
363
|
languageOptions: {
|
|
372
|
-
parser:
|
|
364
|
+
parser: parserPlain
|
|
373
365
|
},
|
|
374
|
-
name: "
|
|
366
|
+
name: "config:formatter:less",
|
|
375
367
|
rules: {
|
|
376
|
-
"format/prettier": [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
parser: "less"
|
|
381
|
-
}
|
|
382
|
-
]
|
|
368
|
+
"format/prettier": ["error", {
|
|
369
|
+
...prettierOptions,
|
|
370
|
+
parser: "less"
|
|
371
|
+
}]
|
|
383
372
|
}
|
|
384
373
|
}
|
|
385
374
|
);
|
|
@@ -388,17 +377,14 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
388
377
|
configs.push({
|
|
389
378
|
files: ["**/*.html"],
|
|
390
379
|
languageOptions: {
|
|
391
|
-
parser:
|
|
380
|
+
parser: parserPlain
|
|
392
381
|
},
|
|
393
|
-
name: "
|
|
382
|
+
name: "config:formatter:html",
|
|
394
383
|
rules: {
|
|
395
|
-
"format/prettier": [
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
parser: "html"
|
|
400
|
-
}
|
|
401
|
-
]
|
|
384
|
+
"format/prettier": ["error", {
|
|
385
|
+
...prettierOptions,
|
|
386
|
+
parser: "html"
|
|
387
|
+
}]
|
|
402
388
|
}
|
|
403
389
|
});
|
|
404
390
|
}
|
|
@@ -406,28 +392,25 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
406
392
|
configs.push({
|
|
407
393
|
files: ["**/*.toml"],
|
|
408
394
|
languageOptions: {
|
|
409
|
-
parser:
|
|
395
|
+
parser: parserPlain
|
|
410
396
|
},
|
|
411
|
-
name: "
|
|
397
|
+
name: "config:formatter:toml",
|
|
412
398
|
rules: {
|
|
413
|
-
"format/dprint": [
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
language: "toml"
|
|
418
|
-
}
|
|
419
|
-
]
|
|
399
|
+
"format/dprint": ["error", {
|
|
400
|
+
...dprintOptions,
|
|
401
|
+
language: "toml"
|
|
402
|
+
}]
|
|
420
403
|
}
|
|
421
404
|
});
|
|
422
405
|
}
|
|
423
406
|
if (options.markdown) {
|
|
424
407
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
425
408
|
configs.push({
|
|
426
|
-
files:
|
|
409
|
+
files: [GLOB_MARKDOWN],
|
|
427
410
|
languageOptions: {
|
|
428
|
-
parser:
|
|
411
|
+
parser: parserPlain
|
|
429
412
|
},
|
|
430
|
-
name: "
|
|
413
|
+
name: "config:formatter:markdown",
|
|
431
414
|
rules: {
|
|
432
415
|
[`format/${formater}`]: [
|
|
433
416
|
"error",
|
|
@@ -447,17 +430,14 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
447
430
|
configs.push({
|
|
448
431
|
files: ["**/*.graphql"],
|
|
449
432
|
languageOptions: {
|
|
450
|
-
parser:
|
|
433
|
+
parser: parserPlain
|
|
451
434
|
},
|
|
452
|
-
name: "
|
|
435
|
+
name: "config:formatter:graphql",
|
|
453
436
|
rules: {
|
|
454
|
-
"format/prettier": [
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
parser: "graphql"
|
|
459
|
-
}
|
|
460
|
-
]
|
|
437
|
+
"format/prettier": ["error", {
|
|
438
|
+
...prettierOptions,
|
|
439
|
+
parser: "graphql"
|
|
440
|
+
}]
|
|
461
441
|
}
|
|
462
442
|
});
|
|
463
443
|
}
|
|
@@ -878,44 +858,15 @@ async function jsonc(options = {}) {
|
|
|
878
858
|
}
|
|
879
859
|
|
|
880
860
|
// src/configs/markdown.ts
|
|
881
|
-
|
|
861
|
+
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
862
|
+
var parserPlain2 = __toESM(require("eslint-parser-plain"), 1);
|
|
863
|
+
async function markdown(options = {}) {
|
|
882
864
|
const {
|
|
883
865
|
componentExts = [],
|
|
884
866
|
files = [GLOB_MARKDOWN],
|
|
885
867
|
overrides = {}
|
|
886
868
|
} = options;
|
|
887
869
|
const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
|
|
888
|
-
const baseProcessor = markdown2.processors.markdown;
|
|
889
|
-
const processor = !formatMarkdown ? {
|
|
890
|
-
meta: {
|
|
891
|
-
name: "markdown-processor"
|
|
892
|
-
},
|
|
893
|
-
supportsAutofix: true,
|
|
894
|
-
...baseProcessor
|
|
895
|
-
} : {
|
|
896
|
-
meta: {
|
|
897
|
-
name: "markdown-processor-with-content"
|
|
898
|
-
},
|
|
899
|
-
postprocess(messages, filename) {
|
|
900
|
-
const markdownContent = messages.pop();
|
|
901
|
-
const codeSnippets = baseProcessor.postprocess(messages, filename);
|
|
902
|
-
return [
|
|
903
|
-
...markdownContent || [],
|
|
904
|
-
...codeSnippets || []
|
|
905
|
-
];
|
|
906
|
-
},
|
|
907
|
-
preprocess(text, filename) {
|
|
908
|
-
const result = baseProcessor.preprocess(text, filename);
|
|
909
|
-
return [
|
|
910
|
-
...result,
|
|
911
|
-
{
|
|
912
|
-
filename: ".__markdown_content__",
|
|
913
|
-
text
|
|
914
|
-
}
|
|
915
|
-
];
|
|
916
|
-
},
|
|
917
|
-
supportsAutofix: true
|
|
918
|
-
};
|
|
919
870
|
return [
|
|
920
871
|
{
|
|
921
872
|
name: "config:markdown:setup",
|
|
@@ -927,7 +878,20 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
927
878
|
files,
|
|
928
879
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
929
880
|
name: "config:markdown:processor",
|
|
930
|
-
|
|
881
|
+
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
882
|
+
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
883
|
+
// add a pass-through processor for the markdown file itself.
|
|
884
|
+
processor: (0, import_eslint_merge_processors.mergeProcessors)([
|
|
885
|
+
markdown2.processors.markdown,
|
|
886
|
+
import_eslint_merge_processors.processorPassThrough
|
|
887
|
+
])
|
|
888
|
+
},
|
|
889
|
+
{
|
|
890
|
+
files,
|
|
891
|
+
languageOptions: {
|
|
892
|
+
parser: parserPlain2
|
|
893
|
+
},
|
|
894
|
+
name: "config:markdown:parser"
|
|
931
895
|
},
|
|
932
896
|
{
|
|
933
897
|
files: [
|
|
@@ -943,7 +907,6 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
943
907
|
},
|
|
944
908
|
name: "config:markdown:rules",
|
|
945
909
|
rules: {
|
|
946
|
-
...markdown2.configs.recommended.overrides[1].rules,
|
|
947
910
|
"import/newline-after-import": "off",
|
|
948
911
|
"no-alert": "off",
|
|
949
912
|
"no-console": "off",
|
|
@@ -1591,22 +1554,26 @@ async function unocss(options = {}) {
|
|
|
1591
1554
|
}
|
|
1592
1555
|
|
|
1593
1556
|
// src/configs/vue.ts
|
|
1557
|
+
var import_eslint_merge_processors2 = require("eslint-merge-processors");
|
|
1594
1558
|
async function vue(options = {}) {
|
|
1595
1559
|
const {
|
|
1596
1560
|
files = [GLOB_VUE],
|
|
1597
1561
|
overrides = {},
|
|
1598
1562
|
stylistic: stylistic2 = true
|
|
1599
1563
|
} = options;
|
|
1564
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1600
1565
|
const {
|
|
1601
1566
|
indent = 4
|
|
1602
1567
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1603
1568
|
const [
|
|
1604
1569
|
pluginVue,
|
|
1605
|
-
parserVue
|
|
1570
|
+
parserVue,
|
|
1571
|
+
processorVueBlocks
|
|
1606
1572
|
] = await Promise.all([
|
|
1607
1573
|
// @ts-expect-error Missing types
|
|
1608
1574
|
interopDefault(import("eslint-plugin-vue")),
|
|
1609
|
-
interopDefault(import("vue-eslint-parser"))
|
|
1575
|
+
interopDefault(import("vue-eslint-parser")),
|
|
1576
|
+
interopDefault(import("eslint-processor-vue-blocks"))
|
|
1610
1577
|
]);
|
|
1611
1578
|
return [
|
|
1612
1579
|
{
|
|
@@ -1629,7 +1596,16 @@ async function vue(options = {}) {
|
|
|
1629
1596
|
}
|
|
1630
1597
|
},
|
|
1631
1598
|
name: "config:vue:rules",
|
|
1632
|
-
processor: pluginVue.processors[".vue"],
|
|
1599
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
|
|
1600
|
+
pluginVue.processors[".vue"],
|
|
1601
|
+
processorVueBlocks({
|
|
1602
|
+
...sfcBlocks,
|
|
1603
|
+
blocks: {
|
|
1604
|
+
styles: true,
|
|
1605
|
+
...sfcBlocks.blocks
|
|
1606
|
+
}
|
|
1607
|
+
})
|
|
1608
|
+
]),
|
|
1633
1609
|
rules: {
|
|
1634
1610
|
...pluginVue.configs.base.rules,
|
|
1635
1611
|
...pluginVue.configs["vue3-essential"].rules,
|
|
@@ -1888,6 +1864,7 @@ async function config(options = {}, ...userConfigs) {
|
|
|
1888
1864
|
}
|
|
1889
1865
|
if (enableVue) {
|
|
1890
1866
|
configs.push(vue({
|
|
1867
|
+
...typeof enableVue !== "boolean" ? enableVue : {},
|
|
1891
1868
|
overrides: overrides.vue,
|
|
1892
1869
|
stylistic: stylisticOptions,
|
|
1893
1870
|
typescript: !!enableTypeScript
|
|
@@ -1913,13 +1890,12 @@ async function config(options = {}, ...userConfigs) {
|
|
|
1913
1890
|
configs.push(markdown({
|
|
1914
1891
|
componentExts,
|
|
1915
1892
|
overrides: overrides.markdown
|
|
1916
|
-
}
|
|
1893
|
+
}));
|
|
1917
1894
|
}
|
|
1918
1895
|
if (options.formatters) {
|
|
1919
1896
|
configs.push(formatters(
|
|
1920
1897
|
options.formatters,
|
|
1921
|
-
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
1922
|
-
options.markdown !== false
|
|
1898
|
+
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
1923
1899
|
));
|
|
1924
1900
|
}
|
|
1925
1901
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,7 @@ import { ParserOptions } from '@typescript-eslint/parser';
|
|
|
7
7
|
import { Linter } from 'eslint';
|
|
8
8
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
9
9
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
10
|
+
import { Options } from 'eslint-processor-vue-blocks';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -130,6 +131,15 @@ interface OptionsFiles {
|
|
|
130
131
|
*/
|
|
131
132
|
files?: string[];
|
|
132
133
|
}
|
|
134
|
+
interface OptionsVue {
|
|
135
|
+
/**
|
|
136
|
+
* Create virtual files for Vue SFC blocks to enable linting.
|
|
137
|
+
*
|
|
138
|
+
* @see https://github.com/antfu/eslint-processor-vue-blocks
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
sfcBlocks?: boolean | Options;
|
|
142
|
+
}
|
|
133
143
|
interface OptionsFormatters {
|
|
134
144
|
/**
|
|
135
145
|
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
@@ -259,7 +269,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
259
269
|
*
|
|
260
270
|
* @default auto-detect based on the dependencies
|
|
261
271
|
*/
|
|
262
|
-
vue?: boolean;
|
|
272
|
+
vue?: boolean | OptionsVue;
|
|
263
273
|
/**
|
|
264
274
|
* Enable JSONC support.
|
|
265
275
|
*
|
|
@@ -333,7 +343,7 @@ declare function config(options?: OptionsConfig & FlatConfigItem, ...userConfigs
|
|
|
333
343
|
|
|
334
344
|
declare function comments(): Promise<FlatConfigItem[]>;
|
|
335
345
|
|
|
336
|
-
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig
|
|
346
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
337
347
|
|
|
338
348
|
declare function ignores(): FlatConfigItem[];
|
|
339
349
|
|
|
@@ -345,7 +355,7 @@ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
|
345
355
|
|
|
346
356
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
347
357
|
|
|
348
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides
|
|
358
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
349
359
|
|
|
350
360
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
351
361
|
|
|
@@ -375,7 +385,7 @@ declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
|
375
385
|
|
|
376
386
|
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
377
387
|
|
|
378
|
-
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
388
|
+
declare function vue(options?: OptionsVue & OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
379
389
|
|
|
380
390
|
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
381
391
|
|
|
@@ -419,4 +429,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
419
429
|
} ? U : T>;
|
|
420
430
|
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
421
431
|
|
|
422
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
|
432
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { ParserOptions } from '@typescript-eslint/parser';
|
|
|
7
7
|
import { Linter } from 'eslint';
|
|
8
8
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
9
9
|
import { Rules as Rules$1 } from 'eslint-plugin-antfu';
|
|
10
|
+
import { Options } from 'eslint-processor-vue-blocks';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -130,6 +131,15 @@ interface OptionsFiles {
|
|
|
130
131
|
*/
|
|
131
132
|
files?: string[];
|
|
132
133
|
}
|
|
134
|
+
interface OptionsVue {
|
|
135
|
+
/**
|
|
136
|
+
* Create virtual files for Vue SFC blocks to enable linting.
|
|
137
|
+
*
|
|
138
|
+
* @see https://github.com/antfu/eslint-processor-vue-blocks
|
|
139
|
+
* @default true
|
|
140
|
+
*/
|
|
141
|
+
sfcBlocks?: boolean | Options;
|
|
142
|
+
}
|
|
133
143
|
interface OptionsFormatters {
|
|
134
144
|
/**
|
|
135
145
|
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
@@ -259,7 +269,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
259
269
|
*
|
|
260
270
|
* @default auto-detect based on the dependencies
|
|
261
271
|
*/
|
|
262
|
-
vue?: boolean;
|
|
272
|
+
vue?: boolean | OptionsVue;
|
|
263
273
|
/**
|
|
264
274
|
* Enable JSONC support.
|
|
265
275
|
*
|
|
@@ -333,7 +343,7 @@ declare function config(options?: OptionsConfig & FlatConfigItem, ...userConfigs
|
|
|
333
343
|
|
|
334
344
|
declare function comments(): Promise<FlatConfigItem[]>;
|
|
335
345
|
|
|
336
|
-
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig
|
|
346
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
|
|
337
347
|
|
|
338
348
|
declare function ignores(): FlatConfigItem[];
|
|
339
349
|
|
|
@@ -345,7 +355,7 @@ declare function jsdoc(options?: OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
|
345
355
|
|
|
346
356
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
347
357
|
|
|
348
|
-
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides
|
|
358
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<FlatConfigItem[]>;
|
|
349
359
|
|
|
350
360
|
declare function node(): Promise<FlatConfigItem[]>;
|
|
351
361
|
|
|
@@ -375,7 +385,7 @@ declare function unicorn(): Promise<FlatConfigItem[]>;
|
|
|
375
385
|
|
|
376
386
|
declare function unocss(options?: OptionsUnoCSS): Promise<FlatConfigItem[]>;
|
|
377
387
|
|
|
378
|
-
declare function vue(options?: OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
388
|
+
declare function vue(options?: OptionsVue & OptionsFiles & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
379
389
|
|
|
380
390
|
declare function yaml(options?: OptionsFiles & OptionsOverrides & OptionsStylistic): Promise<FlatConfigItem[]>;
|
|
381
391
|
|
|
@@ -419,4 +429,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
419
429
|
} ? U : T>;
|
|
420
430
|
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
421
431
|
|
|
422
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
|
432
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,9 @@ async function comments() {
|
|
|
65
65
|
];
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
// src/configs/formatters.ts
|
|
69
|
+
import * as parserPlain from "eslint-parser-plain";
|
|
70
|
+
|
|
68
71
|
// src/globs.ts
|
|
69
72
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
70
73
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
@@ -196,7 +199,7 @@ async function stylistic(options = {}) {
|
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
// src/configs/formatters.ts
|
|
199
|
-
async function formatters(options = {}, stylistic2 = {}
|
|
202
|
+
async function formatters(options = {}, stylistic2 = {}) {
|
|
200
203
|
await ensurePackages([
|
|
201
204
|
"eslint-plugin-format"
|
|
202
205
|
]);
|
|
@@ -217,28 +220,23 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
217
220
|
...StylisticConfigDefaults,
|
|
218
221
|
...stylistic2
|
|
219
222
|
};
|
|
220
|
-
const prettierOptions = Object.assign(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
234
|
-
useTabs: indent === "tab"
|
|
235
|
-
},
|
|
236
|
-
options.dprintOptions || {}
|
|
237
|
-
);
|
|
223
|
+
const prettierOptions = Object.assign({
|
|
224
|
+
endOfLine: "auto",
|
|
225
|
+
semi,
|
|
226
|
+
singleQuote: quotes === "single",
|
|
227
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
228
|
+
trailingComma: "all",
|
|
229
|
+
useTabs: indent === "tab"
|
|
230
|
+
}, options.prettierOptions || {});
|
|
231
|
+
const dprintOptions = Object.assign({
|
|
232
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
233
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
234
|
+
useTabs: indent === "tab"
|
|
235
|
+
}, options.dprintOptions || {});
|
|
238
236
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
239
237
|
const configs = [
|
|
240
238
|
{
|
|
241
|
-
name: "
|
|
239
|
+
name: "config:formatters:setup",
|
|
242
240
|
plugins: {
|
|
243
241
|
format: pluginFormat
|
|
244
242
|
}
|
|
@@ -249,49 +247,40 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
249
247
|
{
|
|
250
248
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
251
249
|
languageOptions: {
|
|
252
|
-
parser:
|
|
250
|
+
parser: parserPlain
|
|
253
251
|
},
|
|
254
|
-
name: "
|
|
252
|
+
name: "config:formatter:css",
|
|
255
253
|
rules: {
|
|
256
|
-
"format/prettier": [
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
parser: "css"
|
|
261
|
-
}
|
|
262
|
-
]
|
|
254
|
+
"format/prettier": ["error", {
|
|
255
|
+
...prettierOptions,
|
|
256
|
+
parser: "css"
|
|
257
|
+
}]
|
|
263
258
|
}
|
|
264
259
|
},
|
|
265
260
|
{
|
|
266
261
|
files: [GLOB_SCSS],
|
|
267
262
|
languageOptions: {
|
|
268
|
-
parser:
|
|
263
|
+
parser: parserPlain
|
|
269
264
|
},
|
|
270
|
-
name: "
|
|
265
|
+
name: "config:formatter:scss",
|
|
271
266
|
rules: {
|
|
272
|
-
"format/prettier": [
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
parser: "scss"
|
|
277
|
-
}
|
|
278
|
-
]
|
|
267
|
+
"format/prettier": ["error", {
|
|
268
|
+
...prettierOptions,
|
|
269
|
+
parser: "scss"
|
|
270
|
+
}]
|
|
279
271
|
}
|
|
280
272
|
},
|
|
281
273
|
{
|
|
282
274
|
files: [GLOB_LESS],
|
|
283
275
|
languageOptions: {
|
|
284
|
-
parser:
|
|
276
|
+
parser: parserPlain
|
|
285
277
|
},
|
|
286
|
-
name: "
|
|
278
|
+
name: "config:formatter:less",
|
|
287
279
|
rules: {
|
|
288
|
-
"format/prettier": [
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
parser: "less"
|
|
293
|
-
}
|
|
294
|
-
]
|
|
280
|
+
"format/prettier": ["error", {
|
|
281
|
+
...prettierOptions,
|
|
282
|
+
parser: "less"
|
|
283
|
+
}]
|
|
295
284
|
}
|
|
296
285
|
}
|
|
297
286
|
);
|
|
@@ -300,17 +289,14 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
300
289
|
configs.push({
|
|
301
290
|
files: ["**/*.html"],
|
|
302
291
|
languageOptions: {
|
|
303
|
-
parser:
|
|
292
|
+
parser: parserPlain
|
|
304
293
|
},
|
|
305
|
-
name: "
|
|
294
|
+
name: "config:formatter:html",
|
|
306
295
|
rules: {
|
|
307
|
-
"format/prettier": [
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
parser: "html"
|
|
312
|
-
}
|
|
313
|
-
]
|
|
296
|
+
"format/prettier": ["error", {
|
|
297
|
+
...prettierOptions,
|
|
298
|
+
parser: "html"
|
|
299
|
+
}]
|
|
314
300
|
}
|
|
315
301
|
});
|
|
316
302
|
}
|
|
@@ -318,28 +304,25 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
318
304
|
configs.push({
|
|
319
305
|
files: ["**/*.toml"],
|
|
320
306
|
languageOptions: {
|
|
321
|
-
parser:
|
|
307
|
+
parser: parserPlain
|
|
322
308
|
},
|
|
323
|
-
name: "
|
|
309
|
+
name: "config:formatter:toml",
|
|
324
310
|
rules: {
|
|
325
|
-
"format/dprint": [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
language: "toml"
|
|
330
|
-
}
|
|
331
|
-
]
|
|
311
|
+
"format/dprint": ["error", {
|
|
312
|
+
...dprintOptions,
|
|
313
|
+
language: "toml"
|
|
314
|
+
}]
|
|
332
315
|
}
|
|
333
316
|
});
|
|
334
317
|
}
|
|
335
318
|
if (options.markdown) {
|
|
336
319
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
337
320
|
configs.push({
|
|
338
|
-
files:
|
|
321
|
+
files: [GLOB_MARKDOWN],
|
|
339
322
|
languageOptions: {
|
|
340
|
-
parser:
|
|
323
|
+
parser: parserPlain
|
|
341
324
|
},
|
|
342
|
-
name: "
|
|
325
|
+
name: "config:formatter:markdown",
|
|
343
326
|
rules: {
|
|
344
327
|
[`format/${formater}`]: [
|
|
345
328
|
"error",
|
|
@@ -359,17 +342,14 @@ async function formatters(options = {}, stylistic2 = {}, markdownEnabled = true)
|
|
|
359
342
|
configs.push({
|
|
360
343
|
files: ["**/*.graphql"],
|
|
361
344
|
languageOptions: {
|
|
362
|
-
parser:
|
|
345
|
+
parser: parserPlain
|
|
363
346
|
},
|
|
364
|
-
name: "
|
|
347
|
+
name: "config:formatter:graphql",
|
|
365
348
|
rules: {
|
|
366
|
-
"format/prettier": [
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
parser: "graphql"
|
|
371
|
-
}
|
|
372
|
-
]
|
|
349
|
+
"format/prettier": ["error", {
|
|
350
|
+
...prettierOptions,
|
|
351
|
+
parser: "graphql"
|
|
352
|
+
}]
|
|
373
353
|
}
|
|
374
354
|
});
|
|
375
355
|
}
|
|
@@ -790,44 +770,15 @@ async function jsonc(options = {}) {
|
|
|
790
770
|
}
|
|
791
771
|
|
|
792
772
|
// src/configs/markdown.ts
|
|
793
|
-
|
|
773
|
+
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
774
|
+
import * as parserPlain2 from "eslint-parser-plain";
|
|
775
|
+
async function markdown(options = {}) {
|
|
794
776
|
const {
|
|
795
777
|
componentExts = [],
|
|
796
778
|
files = [GLOB_MARKDOWN],
|
|
797
779
|
overrides = {}
|
|
798
780
|
} = options;
|
|
799
781
|
const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
|
|
800
|
-
const baseProcessor = markdown2.processors.markdown;
|
|
801
|
-
const processor = !formatMarkdown ? {
|
|
802
|
-
meta: {
|
|
803
|
-
name: "markdown-processor"
|
|
804
|
-
},
|
|
805
|
-
supportsAutofix: true,
|
|
806
|
-
...baseProcessor
|
|
807
|
-
} : {
|
|
808
|
-
meta: {
|
|
809
|
-
name: "markdown-processor-with-content"
|
|
810
|
-
},
|
|
811
|
-
postprocess(messages, filename) {
|
|
812
|
-
const markdownContent = messages.pop();
|
|
813
|
-
const codeSnippets = baseProcessor.postprocess(messages, filename);
|
|
814
|
-
return [
|
|
815
|
-
...markdownContent || [],
|
|
816
|
-
...codeSnippets || []
|
|
817
|
-
];
|
|
818
|
-
},
|
|
819
|
-
preprocess(text, filename) {
|
|
820
|
-
const result = baseProcessor.preprocess(text, filename);
|
|
821
|
-
return [
|
|
822
|
-
...result,
|
|
823
|
-
{
|
|
824
|
-
filename: ".__markdown_content__",
|
|
825
|
-
text
|
|
826
|
-
}
|
|
827
|
-
];
|
|
828
|
-
},
|
|
829
|
-
supportsAutofix: true
|
|
830
|
-
};
|
|
831
782
|
return [
|
|
832
783
|
{
|
|
833
784
|
name: "config:markdown:setup",
|
|
@@ -839,7 +790,20 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
839
790
|
files,
|
|
840
791
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
841
792
|
name: "config:markdown:processor",
|
|
842
|
-
|
|
793
|
+
// `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
794
|
+
// but not the markdown file itself. We use `eslint-merge-processors` to
|
|
795
|
+
// add a pass-through processor for the markdown file itself.
|
|
796
|
+
processor: mergeProcessors([
|
|
797
|
+
markdown2.processors.markdown,
|
|
798
|
+
processorPassThrough
|
|
799
|
+
])
|
|
800
|
+
},
|
|
801
|
+
{
|
|
802
|
+
files,
|
|
803
|
+
languageOptions: {
|
|
804
|
+
parser: parserPlain2
|
|
805
|
+
},
|
|
806
|
+
name: "config:markdown:parser"
|
|
843
807
|
},
|
|
844
808
|
{
|
|
845
809
|
files: [
|
|
@@ -855,7 +819,6 @@ async function markdown(options = {}, formatMarkdown = false) {
|
|
|
855
819
|
},
|
|
856
820
|
name: "config:markdown:rules",
|
|
857
821
|
rules: {
|
|
858
|
-
...markdown2.configs.recommended.overrides[1].rules,
|
|
859
822
|
"import/newline-after-import": "off",
|
|
860
823
|
"no-alert": "off",
|
|
861
824
|
"no-console": "off",
|
|
@@ -1503,22 +1466,26 @@ async function unocss(options = {}) {
|
|
|
1503
1466
|
}
|
|
1504
1467
|
|
|
1505
1468
|
// src/configs/vue.ts
|
|
1469
|
+
import { mergeProcessors as mergeProcessors2 } from "eslint-merge-processors";
|
|
1506
1470
|
async function vue(options = {}) {
|
|
1507
1471
|
const {
|
|
1508
1472
|
files = [GLOB_VUE],
|
|
1509
1473
|
overrides = {},
|
|
1510
1474
|
stylistic: stylistic2 = true
|
|
1511
1475
|
} = options;
|
|
1476
|
+
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
1512
1477
|
const {
|
|
1513
1478
|
indent = 4
|
|
1514
1479
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1515
1480
|
const [
|
|
1516
1481
|
pluginVue,
|
|
1517
|
-
parserVue
|
|
1482
|
+
parserVue,
|
|
1483
|
+
processorVueBlocks
|
|
1518
1484
|
] = await Promise.all([
|
|
1519
1485
|
// @ts-expect-error Missing types
|
|
1520
1486
|
interopDefault(import("eslint-plugin-vue")),
|
|
1521
|
-
interopDefault(import("vue-eslint-parser"))
|
|
1487
|
+
interopDefault(import("vue-eslint-parser")),
|
|
1488
|
+
interopDefault(import("eslint-processor-vue-blocks"))
|
|
1522
1489
|
]);
|
|
1523
1490
|
return [
|
|
1524
1491
|
{
|
|
@@ -1541,7 +1508,16 @@ async function vue(options = {}) {
|
|
|
1541
1508
|
}
|
|
1542
1509
|
},
|
|
1543
1510
|
name: "config:vue:rules",
|
|
1544
|
-
processor: pluginVue.processors[".vue"]
|
|
1511
|
+
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : mergeProcessors2([
|
|
1512
|
+
pluginVue.processors[".vue"],
|
|
1513
|
+
processorVueBlocks({
|
|
1514
|
+
...sfcBlocks,
|
|
1515
|
+
blocks: {
|
|
1516
|
+
styles: true,
|
|
1517
|
+
...sfcBlocks.blocks
|
|
1518
|
+
}
|
|
1519
|
+
})
|
|
1520
|
+
]),
|
|
1545
1521
|
rules: {
|
|
1546
1522
|
...pluginVue.configs.base.rules,
|
|
1547
1523
|
...pluginVue.configs["vue3-essential"].rules,
|
|
@@ -1800,6 +1776,7 @@ async function config(options = {}, ...userConfigs) {
|
|
|
1800
1776
|
}
|
|
1801
1777
|
if (enableVue) {
|
|
1802
1778
|
configs.push(vue({
|
|
1779
|
+
...typeof enableVue !== "boolean" ? enableVue : {},
|
|
1803
1780
|
overrides: overrides.vue,
|
|
1804
1781
|
stylistic: stylisticOptions,
|
|
1805
1782
|
typescript: !!enableTypeScript
|
|
@@ -1825,13 +1802,12 @@ async function config(options = {}, ...userConfigs) {
|
|
|
1825
1802
|
configs.push(markdown({
|
|
1826
1803
|
componentExts,
|
|
1827
1804
|
overrides: overrides.markdown
|
|
1828
|
-
}
|
|
1805
|
+
}));
|
|
1829
1806
|
}
|
|
1830
1807
|
if (options.formatters) {
|
|
1831
1808
|
configs.push(formatters(
|
|
1832
1809
|
options.formatters,
|
|
1833
|
-
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
1834
|
-
options.markdown !== false
|
|
1810
|
+
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
1835
1811
|
));
|
|
1836
1812
|
}
|
|
1837
1813
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivanmaxlogiudice/eslint-config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"packageManager": "pnpm@8.11.0",
|
|
5
5
|
"description": "Personal ESLint config",
|
|
6
6
|
"type": "module",
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
"cac": "^6.7.14",
|
|
58
58
|
"detect-indent": "^7.0.1",
|
|
59
59
|
"eslint-config-flat-gitignore": "^0.1.2",
|
|
60
|
+
"eslint-merge-processors": "^0.1.0",
|
|
61
|
+
"eslint-parser-plain": "^0.1.0",
|
|
60
62
|
"eslint-plugin-antfu": "^2.0.0",
|
|
61
63
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
62
64
|
"eslint-plugin-i": "^2.29.0",
|
|
@@ -72,6 +74,7 @@
|
|
|
72
74
|
"eslint-plugin-vitest": "^0.3.10",
|
|
73
75
|
"eslint-plugin-vue": "^9.19.2",
|
|
74
76
|
"eslint-plugin-yml": "^1.10.0",
|
|
77
|
+
"eslint-processor-vue-blocks": "^0.1.1",
|
|
75
78
|
"globals": "^13.23.0",
|
|
76
79
|
"jsonc-eslint-parser": "^2.4.0",
|
|
77
80
|
"local-pkg": "^0.5.0",
|
|
@@ -99,7 +102,8 @@
|
|
|
99
102
|
"simple-git-hooks": "^2.9.0",
|
|
100
103
|
"tsup": "^8.0.1",
|
|
101
104
|
"typescript": "^5.3.2",
|
|
102
|
-
"vitest": "^1.0.1"
|
|
105
|
+
"vitest": "^1.0.1",
|
|
106
|
+
"vue": "^3.3.11"
|
|
103
107
|
},
|
|
104
108
|
"engines": {
|
|
105
109
|
"node": ">=18.12.0"
|