@antfu/eslint-config 2.6.3 → 2.7.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 +20 -1
- package/dist/cli.cjs +13 -10
- package/dist/cli.js +13 -10
- package/dist/index.cjs +103 -11
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +101 -11
- package/package.json +42 -27
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
13
13
|
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
14
14
|
- Respects `.gitignore` by default
|
|
15
|
-
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss) support
|
|
15
|
+
- Optional [React](#react), [Svelte](#svelte), [UnoCSS](#unocss), [Astro](#astro) support
|
|
16
16
|
- Optional [formatters](#formatters) support for CSS, HTML, etc.
|
|
17
17
|
- **Style principle**: Minimal for reading, stable for diff, consistent
|
|
18
18
|
|
|
@@ -431,6 +431,25 @@ Running `npx eslint` should prompt you to install the required dependencies, oth
|
|
|
431
431
|
npm i -D eslint-plugin-svelte
|
|
432
432
|
```
|
|
433
433
|
|
|
434
|
+
#### Astro
|
|
435
|
+
|
|
436
|
+
To enable astro support, you need to explicitly turn it on:
|
|
437
|
+
|
|
438
|
+
```js
|
|
439
|
+
// eslint.config.js
|
|
440
|
+
import antfu from '@antfu/eslint-config'
|
|
441
|
+
|
|
442
|
+
export default antfu({
|
|
443
|
+
astro: true,
|
|
444
|
+
})
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
npm i -D eslint-plugin-astro
|
|
451
|
+
```
|
|
452
|
+
|
|
434
453
|
#### UnoCSS
|
|
435
454
|
|
|
436
455
|
To enable UnoCSS support, you need to explicitly turn it on:
|
package/dist/cli.cjs
CHANGED
|
@@ -46,21 +46,23 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "2.
|
|
49
|
+
var version = "2.7.0";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/eslint-config": "workspace:*",
|
|
52
52
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
53
53
|
"@antfu/ni": "^0.21.12",
|
|
54
|
-
"@stylistic/eslint-plugin-migrate": "^1.
|
|
55
|
-
"@types/eslint": "^8.56.
|
|
54
|
+
"@stylistic/eslint-plugin-migrate": "^1.6.3",
|
|
55
|
+
"@types/eslint": "^8.56.5",
|
|
56
56
|
"@types/fs-extra": "^11.0.4",
|
|
57
|
-
"@types/node": "^20.11.
|
|
57
|
+
"@types/node": "^20.11.24",
|
|
58
58
|
"@types/prompts": "^2.4.9",
|
|
59
59
|
"@types/yargs": "^17.0.32",
|
|
60
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
60
|
+
"@unocss/eslint-plugin": "^0.58.5",
|
|
61
|
+
"astro-eslint-parser": "^0.16.3",
|
|
61
62
|
bumpp: "^9.3.0",
|
|
62
63
|
eslint: "npm:eslint-ts-patch@^8.56.0-0",
|
|
63
64
|
"eslint-flat-config-viewer": "^0.1.11",
|
|
65
|
+
"eslint-plugin-astro": "^0.31.4",
|
|
64
66
|
"eslint-plugin-format": "^0.1.0",
|
|
65
67
|
"eslint-plugin-react": "^7.33.2",
|
|
66
68
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
@@ -71,15 +73,16 @@ var devDependencies = {
|
|
|
71
73
|
execa: "^8.0.1",
|
|
72
74
|
"fast-glob": "^3.3.2",
|
|
73
75
|
"fs-extra": "^11.2.0",
|
|
74
|
-
"lint-staged": "^15.2.
|
|
76
|
+
"lint-staged": "^15.2.2",
|
|
77
|
+
"prettier-plugin-slidev": "^1.0.5",
|
|
75
78
|
rimraf: "^5.0.5",
|
|
76
79
|
"simple-git-hooks": "^2.9.0",
|
|
77
|
-
svelte: "^4.2.
|
|
80
|
+
svelte: "^4.2.12",
|
|
78
81
|
"svelte-eslint-parser": "^0.33.1",
|
|
79
|
-
tsup: "^8.0.
|
|
82
|
+
tsup: "^8.0.2",
|
|
80
83
|
typescript: "^5.3.3",
|
|
81
|
-
vitest: "^1.
|
|
82
|
-
vue: "^3.4.
|
|
84
|
+
vitest: "^1.3.1",
|
|
85
|
+
vue: "^3.4.21"
|
|
83
86
|
};
|
|
84
87
|
|
|
85
88
|
// src/cli/constants.ts
|
package/dist/cli.js
CHANGED
|
@@ -17,21 +17,23 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "2.
|
|
20
|
+
var version = "2.7.0";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/eslint-config": "workspace:*",
|
|
23
23
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
24
24
|
"@antfu/ni": "^0.21.12",
|
|
25
|
-
"@stylistic/eslint-plugin-migrate": "^1.
|
|
26
|
-
"@types/eslint": "^8.56.
|
|
25
|
+
"@stylistic/eslint-plugin-migrate": "^1.6.3",
|
|
26
|
+
"@types/eslint": "^8.56.5",
|
|
27
27
|
"@types/fs-extra": "^11.0.4",
|
|
28
|
-
"@types/node": "^20.11.
|
|
28
|
+
"@types/node": "^20.11.24",
|
|
29
29
|
"@types/prompts": "^2.4.9",
|
|
30
30
|
"@types/yargs": "^17.0.32",
|
|
31
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
31
|
+
"@unocss/eslint-plugin": "^0.58.5",
|
|
32
|
+
"astro-eslint-parser": "^0.16.3",
|
|
32
33
|
bumpp: "^9.3.0",
|
|
33
34
|
eslint: "npm:eslint-ts-patch@^8.56.0-0",
|
|
34
35
|
"eslint-flat-config-viewer": "^0.1.11",
|
|
36
|
+
"eslint-plugin-astro": "^0.31.4",
|
|
35
37
|
"eslint-plugin-format": "^0.1.0",
|
|
36
38
|
"eslint-plugin-react": "^7.33.2",
|
|
37
39
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
@@ -42,15 +44,16 @@ var devDependencies = {
|
|
|
42
44
|
execa: "^8.0.1",
|
|
43
45
|
"fast-glob": "^3.3.2",
|
|
44
46
|
"fs-extra": "^11.2.0",
|
|
45
|
-
"lint-staged": "^15.2.
|
|
47
|
+
"lint-staged": "^15.2.2",
|
|
48
|
+
"prettier-plugin-slidev": "^1.0.5",
|
|
46
49
|
rimraf: "^5.0.5",
|
|
47
50
|
"simple-git-hooks": "^2.9.0",
|
|
48
|
-
svelte: "^4.2.
|
|
51
|
+
svelte: "^4.2.12",
|
|
49
52
|
"svelte-eslint-parser": "^0.33.1",
|
|
50
|
-
tsup: "^8.0.
|
|
53
|
+
tsup: "^8.0.2",
|
|
51
54
|
typescript: "^5.3.3",
|
|
52
|
-
vitest: "^1.
|
|
53
|
-
vue: "^3.4.
|
|
55
|
+
vitest: "^1.3.1",
|
|
56
|
+
vue: "^3.4.21"
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
// src/cli/constants.ts
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
34
35
|
GLOB_CSS: () => GLOB_CSS,
|
|
35
36
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
36
37
|
GLOB_HTML: () => GLOB_HTML,
|
|
@@ -57,6 +58,7 @@ __export(src_exports, {
|
|
|
57
58
|
GLOB_YAML: () => GLOB_YAML,
|
|
58
59
|
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
59
60
|
antfu: () => antfu,
|
|
61
|
+
astro: () => astro,
|
|
60
62
|
combine: () => combine,
|
|
61
63
|
comments: () => comments,
|
|
62
64
|
default: () => src_default,
|
|
@@ -94,7 +96,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
94
96
|
// src/factory.ts
|
|
95
97
|
var import_node_process3 = __toESM(require("process"), 1);
|
|
96
98
|
var import_node_fs = __toESM(require("fs"), 1);
|
|
97
|
-
var
|
|
99
|
+
var import_local_pkg4 = require("local-pkg");
|
|
98
100
|
|
|
99
101
|
// src/plugins.ts
|
|
100
102
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
@@ -145,6 +147,7 @@ var GLOB_VUE = "**/*.vue";
|
|
|
145
147
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
146
148
|
var GLOB_TOML = "**/*.toml";
|
|
147
149
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
150
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
148
151
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
149
152
|
var GLOB_TESTS = [
|
|
150
153
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -505,7 +508,7 @@ async function interopDefault(m) {
|
|
|
505
508
|
async function ensurePackages(packages) {
|
|
506
509
|
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false)
|
|
507
510
|
return;
|
|
508
|
-
const nonExistingPackages = packages.filter((i) => !(0, import_local_pkg.isPackageExists)(i));
|
|
511
|
+
const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
|
|
509
512
|
if (nonExistingPackages.length === 0)
|
|
510
513
|
return;
|
|
511
514
|
const { default: prompts } = await import("prompts");
|
|
@@ -762,6 +765,9 @@ async function perfectionist() {
|
|
|
762
765
|
];
|
|
763
766
|
}
|
|
764
767
|
|
|
768
|
+
// src/configs/formatters.ts
|
|
769
|
+
var import_local_pkg2 = require("local-pkg");
|
|
770
|
+
|
|
765
771
|
// src/configs/stylistic.ts
|
|
766
772
|
var StylisticConfigDefaults = {
|
|
767
773
|
indent: 2,
|
|
@@ -810,17 +816,21 @@ async function stylistic(options = {}) {
|
|
|
810
816
|
|
|
811
817
|
// src/configs/formatters.ts
|
|
812
818
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
813
|
-
await ensurePackages([
|
|
814
|
-
"eslint-plugin-format"
|
|
815
|
-
]);
|
|
816
819
|
if (options === true) {
|
|
817
820
|
options = {
|
|
818
821
|
css: true,
|
|
819
822
|
graphql: true,
|
|
820
823
|
html: true,
|
|
821
|
-
markdown: true
|
|
824
|
+
markdown: true,
|
|
825
|
+
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli")
|
|
822
826
|
};
|
|
823
827
|
}
|
|
828
|
+
await ensurePackages([
|
|
829
|
+
"eslint-plugin-format",
|
|
830
|
+
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0
|
|
831
|
+
]);
|
|
832
|
+
if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
|
|
833
|
+
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
824
834
|
const {
|
|
825
835
|
indent,
|
|
826
836
|
quotes,
|
|
@@ -929,8 +939,10 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
929
939
|
}
|
|
930
940
|
if (options.markdown) {
|
|
931
941
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
942
|
+
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
932
943
|
configs.push({
|
|
933
944
|
files: [GLOB_MARKDOWN],
|
|
945
|
+
ignores: GLOB_SLIDEV,
|
|
934
946
|
languageOptions: {
|
|
935
947
|
parser: parserPlain
|
|
936
948
|
},
|
|
@@ -950,6 +962,29 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
950
962
|
]
|
|
951
963
|
}
|
|
952
964
|
});
|
|
965
|
+
if (options.slidev) {
|
|
966
|
+
configs.push({
|
|
967
|
+
files: GLOB_SLIDEV,
|
|
968
|
+
languageOptions: {
|
|
969
|
+
parser: parserPlain
|
|
970
|
+
},
|
|
971
|
+
name: "antfu:formatter:slidev",
|
|
972
|
+
rules: {
|
|
973
|
+
"format/prettier": [
|
|
974
|
+
"error",
|
|
975
|
+
{
|
|
976
|
+
printWidth: 120,
|
|
977
|
+
...prettierOptions,
|
|
978
|
+
embeddedLanguageFormatting: "off",
|
|
979
|
+
parser: "slidev",
|
|
980
|
+
plugins: [
|
|
981
|
+
"prettier-plugin-slidev"
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
]
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
}
|
|
953
988
|
}
|
|
954
989
|
if (options.graphql) {
|
|
955
990
|
configs.push({
|
|
@@ -973,7 +1008,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
973
1008
|
}
|
|
974
1009
|
|
|
975
1010
|
// src/configs/react.ts
|
|
976
|
-
var
|
|
1011
|
+
var import_local_pkg3 = require("local-pkg");
|
|
977
1012
|
var ReactRefreshAllowConstantExportPackages = [
|
|
978
1013
|
"vite"
|
|
979
1014
|
];
|
|
@@ -998,7 +1033,7 @@ async function react(options = {}) {
|
|
|
998
1033
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
999
1034
|
]);
|
|
1000
1035
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1001
|
-
(i) => (0,
|
|
1036
|
+
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1002
1037
|
);
|
|
1003
1038
|
return [
|
|
1004
1039
|
{
|
|
@@ -1355,6 +1390,8 @@ async function svelte(options = {}) {
|
|
|
1355
1390
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
|
|
1356
1391
|
],
|
|
1357
1392
|
...stylistic2 ? {
|
|
1393
|
+
"style/indent": "off",
|
|
1394
|
+
// superseded by svelte/indent
|
|
1358
1395
|
"style/no-trailing-spaces": "off",
|
|
1359
1396
|
// superseded by svelte/no-trailing-spaces
|
|
1360
1397
|
"svelte/derived-has-same-inputs-outputs": "error",
|
|
@@ -1517,6 +1554,8 @@ async function typescript(options = {}) {
|
|
|
1517
1554
|
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1518
1555
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1519
1556
|
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1557
|
+
"ts/method-signature-style": ["error", "property"],
|
|
1558
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1520
1559
|
"ts/no-dupe-class-members": "error",
|
|
1521
1560
|
"ts/no-dynamic-delete": "off",
|
|
1522
1561
|
"ts/no-explicit-any": "off",
|
|
@@ -1910,8 +1949,52 @@ async function toml(options = {}) {
|
|
|
1910
1949
|
];
|
|
1911
1950
|
}
|
|
1912
1951
|
|
|
1952
|
+
// src/configs/astro.ts
|
|
1953
|
+
async function astro(options = {}) {
|
|
1954
|
+
const {
|
|
1955
|
+
files = [GLOB_ASTRO],
|
|
1956
|
+
overrides = {},
|
|
1957
|
+
stylistic: stylistic2 = true
|
|
1958
|
+
} = options;
|
|
1959
|
+
const [
|
|
1960
|
+
pluginAstro,
|
|
1961
|
+
parserAstro,
|
|
1962
|
+
parserTs
|
|
1963
|
+
] = await Promise.all([
|
|
1964
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
1965
|
+
interopDefault(import("astro-eslint-parser")),
|
|
1966
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1967
|
+
]);
|
|
1968
|
+
return [
|
|
1969
|
+
{
|
|
1970
|
+
name: "antfu:astro:setup",
|
|
1971
|
+
plugins: {
|
|
1972
|
+
astro: pluginAstro
|
|
1973
|
+
}
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
files,
|
|
1977
|
+
languageOptions: {
|
|
1978
|
+
parser: parserAstro,
|
|
1979
|
+
parserOptions: {
|
|
1980
|
+
extraFileExtensions: [".astro"],
|
|
1981
|
+
parser: parserTs
|
|
1982
|
+
}
|
|
1983
|
+
},
|
|
1984
|
+
name: "antfu:astro:rules",
|
|
1985
|
+
rules: {
|
|
1986
|
+
"astro/no-set-html-directive": "off",
|
|
1987
|
+
"astro/semi": "off",
|
|
1988
|
+
...stylistic2 ? {} : {},
|
|
1989
|
+
...overrides
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
];
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1913
1995
|
// src/factory.ts
|
|
1914
1996
|
var flatConfigProps = [
|
|
1997
|
+
"name",
|
|
1915
1998
|
"files",
|
|
1916
1999
|
"ignores",
|
|
1917
2000
|
"languageOptions",
|
|
@@ -1929,14 +2012,15 @@ var VuePackages = [
|
|
|
1929
2012
|
];
|
|
1930
2013
|
async function antfu(options = {}, ...userConfigs) {
|
|
1931
2014
|
const {
|
|
2015
|
+
astro: enableAstro = false,
|
|
1932
2016
|
componentExts = [],
|
|
1933
2017
|
gitignore: enableGitignore = true,
|
|
1934
|
-
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2018
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
1935
2019
|
react: enableReact = false,
|
|
1936
2020
|
svelte: enableSvelte = false,
|
|
1937
|
-
typescript: enableTypeScript = (0,
|
|
2021
|
+
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
1938
2022
|
unocss: enableUnoCSS = false,
|
|
1939
|
-
vue: enableVue = VuePackages.some((i) => (0,
|
|
2023
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
1940
2024
|
} = options;
|
|
1941
2025
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1942
2026
|
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
@@ -2016,6 +2100,12 @@ async function antfu(options = {}, ...userConfigs) {
|
|
|
2016
2100
|
overrides: getOverrides(options, "unocss")
|
|
2017
2101
|
}));
|
|
2018
2102
|
}
|
|
2103
|
+
if (enableAstro) {
|
|
2104
|
+
configs.push(astro({
|
|
2105
|
+
overrides: getOverrides(options, "astro"),
|
|
2106
|
+
stylistic: stylisticOptions
|
|
2107
|
+
}));
|
|
2108
|
+
}
|
|
2019
2109
|
if (options.jsonc ?? true) {
|
|
2020
2110
|
configs.push(
|
|
2021
2111
|
jsonc({
|
|
@@ -2083,6 +2173,7 @@ var src_default = antfu;
|
|
|
2083
2173
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2084
2174
|
0 && (module.exports = {
|
|
2085
2175
|
GLOB_ALL_SRC,
|
|
2176
|
+
GLOB_ASTRO,
|
|
2086
2177
|
GLOB_CSS,
|
|
2087
2178
|
GLOB_EXCLUDE,
|
|
2088
2179
|
GLOB_HTML,
|
|
@@ -2109,6 +2200,7 @@ var src_default = antfu;
|
|
|
2109
2200
|
GLOB_YAML,
|
|
2110
2201
|
StylisticConfigDefaults,
|
|
2111
2202
|
antfu,
|
|
2203
|
+
astro,
|
|
2112
2204
|
combine,
|
|
2113
2205
|
comments,
|
|
2114
2206
|
ensurePackages,
|
package/dist/index.d.cts
CHANGED
|
@@ -189,6 +189,14 @@ interface OptionsFormatters {
|
|
|
189
189
|
* By default it's controlled by our own config.
|
|
190
190
|
*/
|
|
191
191
|
dprintOptions?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Install the prettier plugin for handle Slidev markdown
|
|
194
|
+
*
|
|
195
|
+
* Only works when `markdown` is enabled with `prettier`.
|
|
196
|
+
*/
|
|
197
|
+
slidev?: boolean | {
|
|
198
|
+
files?: string[];
|
|
199
|
+
};
|
|
192
200
|
}
|
|
193
201
|
interface OptionsComponentExts {
|
|
194
202
|
/**
|
|
@@ -303,6 +311,12 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
303
311
|
* @default true
|
|
304
312
|
*/
|
|
305
313
|
toml?: boolean | OptionsOverrides;
|
|
314
|
+
/**
|
|
315
|
+
* Enable ASTRO support.
|
|
316
|
+
*
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
astro?: boolean | OptionsOverrides;
|
|
306
320
|
/**
|
|
307
321
|
* Enable linting for **code snippets** in Markdown.
|
|
308
322
|
*
|
|
@@ -449,6 +463,8 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
449
463
|
|
|
450
464
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
451
465
|
|
|
466
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
467
|
+
|
|
452
468
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
453
469
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
454
470
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -470,6 +486,7 @@ declare const GLOB_VUE = "**/*.vue";
|
|
|
470
486
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
471
487
|
declare const GLOB_TOML = "**/*.toml";
|
|
472
488
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
489
|
+
declare const GLOB_ASTRO = "**/*.astro";
|
|
473
490
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
474
491
|
declare const GLOB_TESTS: string[];
|
|
475
492
|
declare const GLOB_ALL_SRC: string[];
|
|
@@ -511,6 +528,6 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
511
528
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
512
529
|
default: infer U;
|
|
513
530
|
} ? U : T>;
|
|
514
|
-
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
531
|
+
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
515
532
|
|
|
516
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, 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 OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, antfu, combine, comments, antfu as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
533
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, 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 OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, antfu, astro, combine, comments, antfu as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -189,6 +189,14 @@ interface OptionsFormatters {
|
|
|
189
189
|
* By default it's controlled by our own config.
|
|
190
190
|
*/
|
|
191
191
|
dprintOptions?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Install the prettier plugin for handle Slidev markdown
|
|
194
|
+
*
|
|
195
|
+
* Only works when `markdown` is enabled with `prettier`.
|
|
196
|
+
*/
|
|
197
|
+
slidev?: boolean | {
|
|
198
|
+
files?: string[];
|
|
199
|
+
};
|
|
192
200
|
}
|
|
193
201
|
interface OptionsComponentExts {
|
|
194
202
|
/**
|
|
@@ -303,6 +311,12 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
303
311
|
* @default true
|
|
304
312
|
*/
|
|
305
313
|
toml?: boolean | OptionsOverrides;
|
|
314
|
+
/**
|
|
315
|
+
* Enable ASTRO support.
|
|
316
|
+
*
|
|
317
|
+
* @default true
|
|
318
|
+
*/
|
|
319
|
+
astro?: boolean | OptionsOverrides;
|
|
306
320
|
/**
|
|
307
321
|
* Enable linting for **code snippets** in Markdown.
|
|
308
322
|
*
|
|
@@ -449,6 +463,8 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
449
463
|
|
|
450
464
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
451
465
|
|
|
466
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
467
|
+
|
|
452
468
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
453
469
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
454
470
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -470,6 +486,7 @@ declare const GLOB_VUE = "**/*.vue";
|
|
|
470
486
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
471
487
|
declare const GLOB_TOML = "**/*.toml";
|
|
472
488
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
489
|
+
declare const GLOB_ASTRO = "**/*.astro";
|
|
473
490
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
474
491
|
declare const GLOB_TESTS: string[];
|
|
475
492
|
declare const GLOB_ALL_SRC: string[];
|
|
@@ -511,6 +528,6 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
511
528
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
512
529
|
default: infer U;
|
|
513
530
|
} ? U : T>;
|
|
514
|
-
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
531
|
+
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
515
532
|
|
|
516
|
-
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, 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 OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, antfu, combine, comments, antfu as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
533
|
+
export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, 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 OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, antfu, astro, combine, comments, antfu as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
2
|
import process3 from "process";
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import { isPackageExists as
|
|
4
|
+
import { isPackageExists as isPackageExists4 } from "local-pkg";
|
|
5
5
|
|
|
6
6
|
// src/plugins.ts
|
|
7
7
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
@@ -52,6 +52,7 @@ var GLOB_VUE = "**/*.vue";
|
|
|
52
52
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
53
53
|
var GLOB_TOML = "**/*.toml";
|
|
54
54
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
55
|
+
var GLOB_ASTRO = "**/*.astro";
|
|
55
56
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
56
57
|
var GLOB_TESTS = [
|
|
57
58
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -412,7 +413,7 @@ async function interopDefault(m) {
|
|
|
412
413
|
async function ensurePackages(packages) {
|
|
413
414
|
if (process.env.CI || process.stdout.isTTY === false)
|
|
414
415
|
return;
|
|
415
|
-
const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
|
|
416
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageExists(i));
|
|
416
417
|
if (nonExistingPackages.length === 0)
|
|
417
418
|
return;
|
|
418
419
|
const { default: prompts } = await import("prompts");
|
|
@@ -669,6 +670,9 @@ async function perfectionist() {
|
|
|
669
670
|
];
|
|
670
671
|
}
|
|
671
672
|
|
|
673
|
+
// src/configs/formatters.ts
|
|
674
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
675
|
+
|
|
672
676
|
// src/configs/stylistic.ts
|
|
673
677
|
var StylisticConfigDefaults = {
|
|
674
678
|
indent: 2,
|
|
@@ -717,17 +721,21 @@ async function stylistic(options = {}) {
|
|
|
717
721
|
|
|
718
722
|
// src/configs/formatters.ts
|
|
719
723
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
720
|
-
await ensurePackages([
|
|
721
|
-
"eslint-plugin-format"
|
|
722
|
-
]);
|
|
723
724
|
if (options === true) {
|
|
724
725
|
options = {
|
|
725
726
|
css: true,
|
|
726
727
|
graphql: true,
|
|
727
728
|
html: true,
|
|
728
|
-
markdown: true
|
|
729
|
+
markdown: true,
|
|
730
|
+
slidev: isPackageExists2("@slidev/cli")
|
|
729
731
|
};
|
|
730
732
|
}
|
|
733
|
+
await ensurePackages([
|
|
734
|
+
"eslint-plugin-format",
|
|
735
|
+
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0
|
|
736
|
+
]);
|
|
737
|
+
if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
|
|
738
|
+
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
731
739
|
const {
|
|
732
740
|
indent,
|
|
733
741
|
quotes,
|
|
@@ -836,8 +844,10 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
836
844
|
}
|
|
837
845
|
if (options.markdown) {
|
|
838
846
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
847
|
+
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
839
848
|
configs.push({
|
|
840
849
|
files: [GLOB_MARKDOWN],
|
|
850
|
+
ignores: GLOB_SLIDEV,
|
|
841
851
|
languageOptions: {
|
|
842
852
|
parser: parserPlain
|
|
843
853
|
},
|
|
@@ -857,6 +867,29 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
857
867
|
]
|
|
858
868
|
}
|
|
859
869
|
});
|
|
870
|
+
if (options.slidev) {
|
|
871
|
+
configs.push({
|
|
872
|
+
files: GLOB_SLIDEV,
|
|
873
|
+
languageOptions: {
|
|
874
|
+
parser: parserPlain
|
|
875
|
+
},
|
|
876
|
+
name: "antfu:formatter:slidev",
|
|
877
|
+
rules: {
|
|
878
|
+
"format/prettier": [
|
|
879
|
+
"error",
|
|
880
|
+
{
|
|
881
|
+
printWidth: 120,
|
|
882
|
+
...prettierOptions,
|
|
883
|
+
embeddedLanguageFormatting: "off",
|
|
884
|
+
parser: "slidev",
|
|
885
|
+
plugins: [
|
|
886
|
+
"prettier-plugin-slidev"
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
]
|
|
890
|
+
}
|
|
891
|
+
});
|
|
892
|
+
}
|
|
860
893
|
}
|
|
861
894
|
if (options.graphql) {
|
|
862
895
|
configs.push({
|
|
@@ -880,7 +913,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
880
913
|
}
|
|
881
914
|
|
|
882
915
|
// src/configs/react.ts
|
|
883
|
-
import { isPackageExists as
|
|
916
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
884
917
|
var ReactRefreshAllowConstantExportPackages = [
|
|
885
918
|
"vite"
|
|
886
919
|
];
|
|
@@ -905,7 +938,7 @@ async function react(options = {}) {
|
|
|
905
938
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
906
939
|
]);
|
|
907
940
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
908
|
-
(i) =>
|
|
941
|
+
(i) => isPackageExists3(i)
|
|
909
942
|
);
|
|
910
943
|
return [
|
|
911
944
|
{
|
|
@@ -1262,6 +1295,8 @@ async function svelte(options = {}) {
|
|
|
1262
1295
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
|
|
1263
1296
|
],
|
|
1264
1297
|
...stylistic2 ? {
|
|
1298
|
+
"style/indent": "off",
|
|
1299
|
+
// superseded by svelte/indent
|
|
1265
1300
|
"style/no-trailing-spaces": "off",
|
|
1266
1301
|
// superseded by svelte/no-trailing-spaces
|
|
1267
1302
|
"svelte/derived-has-same-inputs-outputs": "error",
|
|
@@ -1424,6 +1459,8 @@ async function typescript(options = {}) {
|
|
|
1424
1459
|
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1425
1460
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1426
1461
|
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1462
|
+
"ts/method-signature-style": ["error", "property"],
|
|
1463
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1427
1464
|
"ts/no-dupe-class-members": "error",
|
|
1428
1465
|
"ts/no-dynamic-delete": "off",
|
|
1429
1466
|
"ts/no-explicit-any": "off",
|
|
@@ -1817,8 +1854,52 @@ async function toml(options = {}) {
|
|
|
1817
1854
|
];
|
|
1818
1855
|
}
|
|
1819
1856
|
|
|
1857
|
+
// src/configs/astro.ts
|
|
1858
|
+
async function astro(options = {}) {
|
|
1859
|
+
const {
|
|
1860
|
+
files = [GLOB_ASTRO],
|
|
1861
|
+
overrides = {},
|
|
1862
|
+
stylistic: stylistic2 = true
|
|
1863
|
+
} = options;
|
|
1864
|
+
const [
|
|
1865
|
+
pluginAstro,
|
|
1866
|
+
parserAstro,
|
|
1867
|
+
parserTs
|
|
1868
|
+
] = await Promise.all([
|
|
1869
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
1870
|
+
interopDefault(import("astro-eslint-parser")),
|
|
1871
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1872
|
+
]);
|
|
1873
|
+
return [
|
|
1874
|
+
{
|
|
1875
|
+
name: "antfu:astro:setup",
|
|
1876
|
+
plugins: {
|
|
1877
|
+
astro: pluginAstro
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
files,
|
|
1882
|
+
languageOptions: {
|
|
1883
|
+
parser: parserAstro,
|
|
1884
|
+
parserOptions: {
|
|
1885
|
+
extraFileExtensions: [".astro"],
|
|
1886
|
+
parser: parserTs
|
|
1887
|
+
}
|
|
1888
|
+
},
|
|
1889
|
+
name: "antfu:astro:rules",
|
|
1890
|
+
rules: {
|
|
1891
|
+
"astro/no-set-html-directive": "off",
|
|
1892
|
+
"astro/semi": "off",
|
|
1893
|
+
...stylistic2 ? {} : {},
|
|
1894
|
+
...overrides
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
];
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1820
1900
|
// src/factory.ts
|
|
1821
1901
|
var flatConfigProps = [
|
|
1902
|
+
"name",
|
|
1822
1903
|
"files",
|
|
1823
1904
|
"ignores",
|
|
1824
1905
|
"languageOptions",
|
|
@@ -1836,14 +1917,15 @@ var VuePackages = [
|
|
|
1836
1917
|
];
|
|
1837
1918
|
async function antfu(options = {}, ...userConfigs) {
|
|
1838
1919
|
const {
|
|
1920
|
+
astro: enableAstro = false,
|
|
1839
1921
|
componentExts = [],
|
|
1840
1922
|
gitignore: enableGitignore = true,
|
|
1841
|
-
isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
|
|
1923
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
|
|
1842
1924
|
react: enableReact = false,
|
|
1843
1925
|
svelte: enableSvelte = false,
|
|
1844
|
-
typescript: enableTypeScript =
|
|
1926
|
+
typescript: enableTypeScript = isPackageExists4("typescript"),
|
|
1845
1927
|
unocss: enableUnoCSS = false,
|
|
1846
|
-
vue: enableVue = VuePackages.some((i) =>
|
|
1928
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists4(i))
|
|
1847
1929
|
} = options;
|
|
1848
1930
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1849
1931
|
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
@@ -1923,6 +2005,12 @@ async function antfu(options = {}, ...userConfigs) {
|
|
|
1923
2005
|
overrides: getOverrides(options, "unocss")
|
|
1924
2006
|
}));
|
|
1925
2007
|
}
|
|
2008
|
+
if (enableAstro) {
|
|
2009
|
+
configs.push(astro({
|
|
2010
|
+
overrides: getOverrides(options, "astro"),
|
|
2011
|
+
stylistic: stylisticOptions
|
|
2012
|
+
}));
|
|
2013
|
+
}
|
|
1926
2014
|
if (options.jsonc ?? true) {
|
|
1927
2015
|
configs.push(
|
|
1928
2016
|
jsonc({
|
|
@@ -1989,6 +2077,7 @@ function getOverrides(options, key) {
|
|
|
1989
2077
|
var src_default = antfu;
|
|
1990
2078
|
export {
|
|
1991
2079
|
GLOB_ALL_SRC,
|
|
2080
|
+
GLOB_ASTRO,
|
|
1992
2081
|
GLOB_CSS,
|
|
1993
2082
|
GLOB_EXCLUDE,
|
|
1994
2083
|
GLOB_HTML,
|
|
@@ -2015,6 +2104,7 @@ export {
|
|
|
2015
2104
|
GLOB_YAML,
|
|
2016
2105
|
StylisticConfigDefaults,
|
|
2017
2106
|
antfu,
|
|
2107
|
+
astro,
|
|
2018
2108
|
combine,
|
|
2019
2109
|
comments,
|
|
2020
2110
|
src_default as default,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antfu/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"packageManager": "pnpm@8.
|
|
4
|
+
"version": "2.7.0",
|
|
5
|
+
"packageManager": "pnpm@8.15.4",
|
|
6
6
|
"description": "Anthony's ESLint config",
|
|
7
7
|
"author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
|
|
8
8
|
"license": "MIT",
|
|
@@ -26,18 +26,27 @@
|
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@unocss/eslint-plugin": ">=0.50.0",
|
|
29
|
+
"astro-eslint-parser": "^0.16.3",
|
|
29
30
|
"eslint": ">=8.40.0",
|
|
31
|
+
"eslint-plugin-astro": "^0.31.4",
|
|
30
32
|
"eslint-plugin-format": ">=0.1.0",
|
|
31
33
|
"eslint-plugin-react": "^7.33.2",
|
|
32
34
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
33
35
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
34
36
|
"eslint-plugin-svelte": "^2.34.1",
|
|
37
|
+
"prettier-plugin-slidev": "^1.0.5",
|
|
35
38
|
"svelte-eslint-parser": "^0.33.1"
|
|
36
39
|
},
|
|
37
40
|
"peerDependenciesMeta": {
|
|
38
41
|
"@unocss/eslint-plugin": {
|
|
39
42
|
"optional": true
|
|
40
43
|
},
|
|
44
|
+
"astro-eslint-parser": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
|
+
"eslint-plugin-astro": {
|
|
48
|
+
"optional": true
|
|
49
|
+
},
|
|
41
50
|
"eslint-plugin-format": {
|
|
42
51
|
"optional": true
|
|
43
52
|
},
|
|
@@ -53,6 +62,9 @@
|
|
|
53
62
|
"eslint-plugin-svelte": {
|
|
54
63
|
"optional": true
|
|
55
64
|
},
|
|
65
|
+
"prettier-plugin-slidev": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
56
68
|
"svelte-eslint-parser": {
|
|
57
69
|
"optional": true
|
|
58
70
|
}
|
|
@@ -61,53 +73,55 @@
|
|
|
61
73
|
"@antfu/eslint-define-config": "^1.23.0-2",
|
|
62
74
|
"@antfu/install-pkg": "^0.3.1",
|
|
63
75
|
"@eslint-types/jsdoc": "46.8.2-1",
|
|
64
|
-
"@eslint-types/typescript-eslint": "^
|
|
65
|
-
"@eslint-types/unicorn": "^
|
|
66
|
-
"@stylistic/eslint-plugin": "^1.
|
|
67
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
68
|
-
"@typescript-eslint/parser": "^
|
|
69
|
-
"eslint-config-flat-gitignore": "^0.1.
|
|
76
|
+
"@eslint-types/typescript-eslint": "^7.0.2",
|
|
77
|
+
"@eslint-types/unicorn": "^51.0.1",
|
|
78
|
+
"@stylistic/eslint-plugin": "^1.6.3",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
80
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
81
|
+
"eslint-config-flat-gitignore": "^0.1.3",
|
|
70
82
|
"eslint-merge-processors": "^0.1.0",
|
|
71
|
-
"eslint-plugin-antfu": "^2.1.
|
|
83
|
+
"eslint-plugin-antfu": "^2.1.2",
|
|
72
84
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
73
85
|
"eslint-plugin-i": "^2.29.1",
|
|
74
|
-
"eslint-plugin-jsdoc": "^48.0
|
|
75
|
-
"eslint-plugin-jsonc": "^2.
|
|
86
|
+
"eslint-plugin-jsdoc": "^48.2.0",
|
|
87
|
+
"eslint-plugin-jsonc": "^2.13.0",
|
|
76
88
|
"eslint-plugin-markdown": "^3.0.1",
|
|
77
89
|
"eslint-plugin-n": "^16.6.2",
|
|
78
90
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
79
91
|
"eslint-plugin-perfectionist": "^2.5.0",
|
|
80
92
|
"eslint-plugin-toml": "^0.9.2",
|
|
81
|
-
"eslint-plugin-unicorn": "^
|
|
82
|
-
"eslint-plugin-unused-imports": "^3.
|
|
83
|
-
"eslint-plugin-vitest": "^0.3.
|
|
84
|
-
"eslint-plugin-vue": "^9.
|
|
93
|
+
"eslint-plugin-unicorn": "^51.0.1",
|
|
94
|
+
"eslint-plugin-unused-imports": "^3.1.0",
|
|
95
|
+
"eslint-plugin-vitest": "^0.3.22",
|
|
96
|
+
"eslint-plugin-vue": "^9.22.0",
|
|
85
97
|
"eslint-plugin-yml": "^1.12.2",
|
|
86
98
|
"eslint-processor-vue-blocks": "^0.1.1",
|
|
87
|
-
"globals": "^
|
|
99
|
+
"globals": "^14.0.0",
|
|
88
100
|
"jsonc-eslint-parser": "^2.4.0",
|
|
89
101
|
"local-pkg": "^0.5.0",
|
|
90
102
|
"parse-gitignore": "^2.0.0",
|
|
91
103
|
"picocolors": "^1.0.0",
|
|
92
104
|
"prompts": "^2.4.2",
|
|
93
105
|
"toml-eslint-parser": "^0.9.3",
|
|
94
|
-
"vue-eslint-parser": "^9.4.
|
|
106
|
+
"vue-eslint-parser": "^9.4.2",
|
|
95
107
|
"yaml-eslint-parser": "^1.2.2",
|
|
96
108
|
"yargs": "^17.7.2"
|
|
97
109
|
},
|
|
98
110
|
"devDependencies": {
|
|
99
111
|
"@antfu/eslint-plugin-prettier": "^5.0.1-1",
|
|
100
112
|
"@antfu/ni": "^0.21.12",
|
|
101
|
-
"@stylistic/eslint-plugin-migrate": "^1.
|
|
102
|
-
"@types/eslint": "^8.56.
|
|
113
|
+
"@stylistic/eslint-plugin-migrate": "^1.6.3",
|
|
114
|
+
"@types/eslint": "^8.56.5",
|
|
103
115
|
"@types/fs-extra": "^11.0.4",
|
|
104
|
-
"@types/node": "^20.11.
|
|
116
|
+
"@types/node": "^20.11.24",
|
|
105
117
|
"@types/prompts": "^2.4.9",
|
|
106
118
|
"@types/yargs": "^17.0.32",
|
|
107
|
-
"@unocss/eslint-plugin": "^0.58.
|
|
119
|
+
"@unocss/eslint-plugin": "^0.58.5",
|
|
120
|
+
"astro-eslint-parser": "^0.16.3",
|
|
108
121
|
"bumpp": "^9.3.0",
|
|
109
122
|
"eslint": "npm:eslint-ts-patch@^8.56.0-0",
|
|
110
123
|
"eslint-flat-config-viewer": "^0.1.11",
|
|
124
|
+
"eslint-plugin-astro": "^0.31.4",
|
|
111
125
|
"eslint-plugin-format": "^0.1.0",
|
|
112
126
|
"eslint-plugin-react": "^7.33.2",
|
|
113
127
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
@@ -118,16 +132,17 @@
|
|
|
118
132
|
"execa": "^8.0.1",
|
|
119
133
|
"fast-glob": "^3.3.2",
|
|
120
134
|
"fs-extra": "^11.2.0",
|
|
121
|
-
"lint-staged": "^15.2.
|
|
135
|
+
"lint-staged": "^15.2.2",
|
|
136
|
+
"prettier-plugin-slidev": "^1.0.5",
|
|
122
137
|
"rimraf": "^5.0.5",
|
|
123
138
|
"simple-git-hooks": "^2.9.0",
|
|
124
|
-
"svelte": "^4.2.
|
|
139
|
+
"svelte": "^4.2.12",
|
|
125
140
|
"svelte-eslint-parser": "^0.33.1",
|
|
126
|
-
"tsup": "^8.0.
|
|
141
|
+
"tsup": "^8.0.2",
|
|
127
142
|
"typescript": "^5.3.3",
|
|
128
|
-
"vitest": "^1.
|
|
129
|
-
"vue": "^3.4.
|
|
130
|
-
"@antfu/eslint-config": "2.
|
|
143
|
+
"vitest": "^1.3.1",
|
|
144
|
+
"vue": "^3.4.21",
|
|
145
|
+
"@antfu/eslint-config": "2.7.0"
|
|
131
146
|
},
|
|
132
147
|
"simple-git-hooks": {
|
|
133
148
|
"pre-commit": "pnpm lint-staged"
|