@kirklin/eslint-config 2.1.0 → 2.2.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 +28 -1
- package/dist/cli.cjs +457 -146
- package/dist/cli.js +457 -146
- package/dist/index.cjs +155 -20
- package/dist/index.d.cts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +153 -20
- package/package.json +58 -38
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,
|
|
@@ -56,6 +57,7 @@ __export(src_exports, {
|
|
|
56
57
|
GLOB_VUE: () => GLOB_VUE,
|
|
57
58
|
GLOB_YAML: () => GLOB_YAML,
|
|
58
59
|
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
60
|
+
astro: () => astro,
|
|
59
61
|
combine: () => combine,
|
|
60
62
|
comments: () => comments,
|
|
61
63
|
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_kirklin = __toESM(require("eslint-plugin-kirklin"), 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}`,
|
|
@@ -187,6 +190,7 @@ var GLOB_EXCLUDE = [
|
|
|
187
190
|
"**/.cache",
|
|
188
191
|
"**/.output",
|
|
189
192
|
"**/.vite-inspect",
|
|
193
|
+
"**/.yarn",
|
|
190
194
|
"**/CHANGELOG*.md",
|
|
191
195
|
"**/*.min.*",
|
|
192
196
|
"**/LICENSE*",
|
|
@@ -228,7 +232,7 @@ async function imports(options = {}) {
|
|
|
228
232
|
"kirklin/no-import-dist": "error",
|
|
229
233
|
"kirklin/no-import-node-modules-by-path": "error",
|
|
230
234
|
...stylistic2 ? {
|
|
231
|
-
"import/newline-after-import": ["error", {
|
|
235
|
+
"import/newline-after-import": ["error", { count: 1 }]
|
|
232
236
|
} : {}
|
|
233
237
|
}
|
|
234
238
|
},
|
|
@@ -507,18 +511,14 @@ async function ensurePackages(packages) {
|
|
|
507
511
|
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false) {
|
|
508
512
|
return;
|
|
509
513
|
}
|
|
510
|
-
const nonExistingPackages = packages.filter((i) => !(0, import_local_pkg.isPackageExists)(i));
|
|
514
|
+
const nonExistingPackages = packages.filter((i) => i && !(0, import_local_pkg.isPackageExists)(i));
|
|
511
515
|
if (nonExistingPackages.length === 0) {
|
|
512
516
|
return;
|
|
513
517
|
}
|
|
514
|
-
const
|
|
515
|
-
const
|
|
516
|
-
{
|
|
517
|
-
|
|
518
|
-
name: "result",
|
|
519
|
-
type: "confirm"
|
|
520
|
-
}
|
|
521
|
-
]);
|
|
518
|
+
const p = await import("@clack/prompts");
|
|
519
|
+
const result = await p.confirm({
|
|
520
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
521
|
+
});
|
|
522
522
|
if (result) {
|
|
523
523
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
524
524
|
}
|
|
@@ -766,6 +766,9 @@ async function perfectionist() {
|
|
|
766
766
|
];
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
+
// src/configs/formatters.ts
|
|
770
|
+
var import_local_pkg2 = require("local-pkg");
|
|
771
|
+
|
|
769
772
|
// src/configs/stylistic.ts
|
|
770
773
|
var StylisticConfigDefaults = {
|
|
771
774
|
indent: 2,
|
|
@@ -816,17 +819,24 @@ async function stylistic(options = {}) {
|
|
|
816
819
|
|
|
817
820
|
// src/configs/formatters.ts
|
|
818
821
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
819
|
-
await ensurePackages([
|
|
820
|
-
"eslint-plugin-format"
|
|
821
|
-
]);
|
|
822
822
|
if (options === true) {
|
|
823
823
|
options = {
|
|
824
|
+
astro: (0, import_local_pkg2.isPackageExists)("astro"),
|
|
824
825
|
css: true,
|
|
825
826
|
graphql: true,
|
|
826
827
|
html: true,
|
|
827
|
-
markdown: true
|
|
828
|
+
markdown: true,
|
|
829
|
+
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli")
|
|
828
830
|
};
|
|
829
831
|
}
|
|
832
|
+
await ensurePackages([
|
|
833
|
+
"eslint-plugin-format",
|
|
834
|
+
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
835
|
+
options.astro ? "prettier-plugin-astro" : void 0
|
|
836
|
+
]);
|
|
837
|
+
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") {
|
|
838
|
+
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
839
|
+
}
|
|
830
840
|
const {
|
|
831
841
|
indent,
|
|
832
842
|
quotes,
|
|
@@ -935,8 +945,10 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
935
945
|
}
|
|
936
946
|
if (options.markdown) {
|
|
937
947
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
948
|
+
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
938
949
|
configs.push({
|
|
939
950
|
files: [GLOB_MARKDOWN],
|
|
951
|
+
ignores: GLOB_SLIDEV,
|
|
940
952
|
languageOptions: {
|
|
941
953
|
parser: parserPlain
|
|
942
954
|
},
|
|
@@ -956,6 +968,50 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
956
968
|
]
|
|
957
969
|
}
|
|
958
970
|
});
|
|
971
|
+
if (options.slidev) {
|
|
972
|
+
configs.push({
|
|
973
|
+
files: GLOB_SLIDEV,
|
|
974
|
+
languageOptions: {
|
|
975
|
+
parser: parserPlain
|
|
976
|
+
},
|
|
977
|
+
name: "kirklin:formatter:slidev",
|
|
978
|
+
rules: {
|
|
979
|
+
"format/prettier": [
|
|
980
|
+
"error",
|
|
981
|
+
{
|
|
982
|
+
printWidth: 120,
|
|
983
|
+
...prettierOptions,
|
|
984
|
+
embeddedLanguageFormatting: "off",
|
|
985
|
+
parser: "slidev",
|
|
986
|
+
plugins: [
|
|
987
|
+
"prettier-plugin-slidev"
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
if (options.astro) {
|
|
996
|
+
configs.push({
|
|
997
|
+
files: [GLOB_ASTRO],
|
|
998
|
+
languageOptions: {
|
|
999
|
+
parser: parserPlain
|
|
1000
|
+
},
|
|
1001
|
+
name: "kirklin:formatter:astro",
|
|
1002
|
+
rules: {
|
|
1003
|
+
"format/prettier": [
|
|
1004
|
+
"error",
|
|
1005
|
+
{
|
|
1006
|
+
...prettierOptions,
|
|
1007
|
+
parser: "astro",
|
|
1008
|
+
plugins: [
|
|
1009
|
+
"prettier-plugin-astro"
|
|
1010
|
+
]
|
|
1011
|
+
}
|
|
1012
|
+
]
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
959
1015
|
}
|
|
960
1016
|
if (options.graphql) {
|
|
961
1017
|
configs.push({
|
|
@@ -979,7 +1035,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
979
1035
|
}
|
|
980
1036
|
|
|
981
1037
|
// src/configs/react.ts
|
|
982
|
-
var
|
|
1038
|
+
var import_local_pkg3 = require("local-pkg");
|
|
983
1039
|
var ReactRefreshAllowConstantExportPackages = [
|
|
984
1040
|
"vite"
|
|
985
1041
|
];
|
|
@@ -1004,7 +1060,7 @@ async function react(options = {}) {
|
|
|
1004
1060
|
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1005
1061
|
]);
|
|
1006
1062
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1007
|
-
(i) => (0,
|
|
1063
|
+
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1008
1064
|
);
|
|
1009
1065
|
return [
|
|
1010
1066
|
{
|
|
@@ -1361,6 +1417,8 @@ async function svelte(options = {}) {
|
|
|
1361
1417
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^(_|\\$\\$Props$)" }
|
|
1362
1418
|
],
|
|
1363
1419
|
...stylistic2 ? {
|
|
1420
|
+
"style/indent": "off",
|
|
1421
|
+
// superseded by svelte/indent
|
|
1364
1422
|
"style/no-trailing-spaces": "off",
|
|
1365
1423
|
// superseded by svelte/no-trailing-spaces
|
|
1366
1424
|
"svelte/derived-has-same-inputs-outputs": "error",
|
|
@@ -1678,6 +1736,26 @@ async function vue(options = {}) {
|
|
|
1678
1736
|
]);
|
|
1679
1737
|
return [
|
|
1680
1738
|
{
|
|
1739
|
+
// This allows Vue plugin to work with auto imports
|
|
1740
|
+
// https://github.com/vuejs/eslint-plugin-vue/pull/2422
|
|
1741
|
+
languageOptions: {
|
|
1742
|
+
globals: {
|
|
1743
|
+
computed: "readonly",
|
|
1744
|
+
defineEmits: "readonly",
|
|
1745
|
+
defineExpose: "readonly",
|
|
1746
|
+
defineProps: "readonly",
|
|
1747
|
+
onMounted: "readonly",
|
|
1748
|
+
onUnmounted: "readonly",
|
|
1749
|
+
reactive: "readonly",
|
|
1750
|
+
ref: "readonly",
|
|
1751
|
+
shallowReactive: "readonly",
|
|
1752
|
+
shallowRef: "readonly",
|
|
1753
|
+
toRef: "readonly",
|
|
1754
|
+
toRefs: "readonly",
|
|
1755
|
+
watch: "readonly",
|
|
1756
|
+
watchEffect: "readonly"
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1681
1759
|
name: "kirklin:vue:setup",
|
|
1682
1760
|
plugins: {
|
|
1683
1761
|
vue: pluginVue
|
|
@@ -1923,6 +2001,54 @@ async function toml(options = {}) {
|
|
|
1923
2001
|
];
|
|
1924
2002
|
}
|
|
1925
2003
|
|
|
2004
|
+
// src/configs/astro.ts
|
|
2005
|
+
async function astro(options = {}) {
|
|
2006
|
+
const {
|
|
2007
|
+
files = [GLOB_ASTRO],
|
|
2008
|
+
overrides = {},
|
|
2009
|
+
stylistic: stylistic2 = true
|
|
2010
|
+
} = options;
|
|
2011
|
+
const [
|
|
2012
|
+
pluginAstro,
|
|
2013
|
+
parserAstro,
|
|
2014
|
+
parserTs
|
|
2015
|
+
] = await Promise.all([
|
|
2016
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
2017
|
+
interopDefault(import("astro-eslint-parser")),
|
|
2018
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
2019
|
+
]);
|
|
2020
|
+
return [
|
|
2021
|
+
{
|
|
2022
|
+
name: "kirklin:astro:setup",
|
|
2023
|
+
plugins: {
|
|
2024
|
+
astro: pluginAstro
|
|
2025
|
+
}
|
|
2026
|
+
},
|
|
2027
|
+
{
|
|
2028
|
+
files,
|
|
2029
|
+
languageOptions: {
|
|
2030
|
+
parser: parserAstro,
|
|
2031
|
+
parserOptions: {
|
|
2032
|
+
extraFileExtensions: [".astro"],
|
|
2033
|
+
parser: parserTs
|
|
2034
|
+
}
|
|
2035
|
+
},
|
|
2036
|
+
name: "kirklin:astro:rules",
|
|
2037
|
+
rules: {
|
|
2038
|
+
"astro/no-set-html-directive": "off",
|
|
2039
|
+
...stylistic2 ? {
|
|
2040
|
+
"style/indent": "off",
|
|
2041
|
+
"style/jsx-closing-tag-location": "off",
|
|
2042
|
+
"style/jsx-indent": "off",
|
|
2043
|
+
"style/jsx-one-expression-per-line": "off",
|
|
2044
|
+
"style/no-multiple-empty-lines": "off"
|
|
2045
|
+
} : {},
|
|
2046
|
+
...overrides
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
];
|
|
2050
|
+
}
|
|
2051
|
+
|
|
1926
2052
|
// src/factory.ts
|
|
1927
2053
|
var flatConfigProps = [
|
|
1928
2054
|
"name",
|
|
@@ -1943,14 +2069,15 @@ var VuePackages = [
|
|
|
1943
2069
|
];
|
|
1944
2070
|
async function kirklin(options = {}, ...userConfigs) {
|
|
1945
2071
|
const {
|
|
2072
|
+
astro: enableAstro = false,
|
|
1946
2073
|
componentExts = [],
|
|
1947
2074
|
gitignore: enableGitignore = true,
|
|
1948
|
-
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),
|
|
2075
|
+
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),
|
|
1949
2076
|
react: enableReact = false,
|
|
1950
2077
|
svelte: enableSvelte = false,
|
|
1951
|
-
typescript: enableTypeScript = (0,
|
|
2078
|
+
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
1952
2079
|
unocss: enableUnoCSS = false,
|
|
1953
|
-
vue: enableVue = VuePackages.some((i) => (0,
|
|
2080
|
+
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
1954
2081
|
} = options;
|
|
1955
2082
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1956
2083
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
@@ -2033,6 +2160,12 @@ async function kirklin(options = {}, ...userConfigs) {
|
|
|
2033
2160
|
overrides: getOverrides(options, "unocss")
|
|
2034
2161
|
}));
|
|
2035
2162
|
}
|
|
2163
|
+
if (enableAstro) {
|
|
2164
|
+
configs.push(astro({
|
|
2165
|
+
overrides: getOverrides(options, "astro"),
|
|
2166
|
+
stylistic: stylisticOptions
|
|
2167
|
+
}));
|
|
2168
|
+
}
|
|
2036
2169
|
if (options.jsonc ?? true) {
|
|
2037
2170
|
configs.push(
|
|
2038
2171
|
jsonc({
|
|
@@ -2102,6 +2235,7 @@ var src_default = kirklin;
|
|
|
2102
2235
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2103
2236
|
0 && (module.exports = {
|
|
2104
2237
|
GLOB_ALL_SRC,
|
|
2238
|
+
GLOB_ASTRO,
|
|
2105
2239
|
GLOB_CSS,
|
|
2106
2240
|
GLOB_EXCLUDE,
|
|
2107
2241
|
GLOB_HTML,
|
|
@@ -2127,6 +2261,7 @@ var src_default = kirklin;
|
|
|
2127
2261
|
GLOB_VUE,
|
|
2128
2262
|
GLOB_YAML,
|
|
2129
2263
|
StylisticConfigDefaults,
|
|
2264
|
+
astro,
|
|
2130
2265
|
combine,
|
|
2131
2266
|
comments,
|
|
2132
2267
|
ensurePackages,
|
package/dist/index.d.cts
CHANGED
|
@@ -189,6 +189,20 @@ 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
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Enable formatting support for Astro.
|
|
202
|
+
*
|
|
203
|
+
* Currently only support Prettier.
|
|
204
|
+
*/
|
|
205
|
+
astro?: "prettier" | boolean;
|
|
192
206
|
}
|
|
193
207
|
interface OptionsComponentExts {
|
|
194
208
|
/**
|
|
@@ -303,6 +317,18 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
303
317
|
* @default true
|
|
304
318
|
*/
|
|
305
319
|
toml?: boolean | OptionsOverrides;
|
|
320
|
+
/**
|
|
321
|
+
* Enable ASTRO support.
|
|
322
|
+
*
|
|
323
|
+
* Requires installing:
|
|
324
|
+
* - `eslint-plugin-astro`
|
|
325
|
+
*
|
|
326
|
+
* Requires installing for formatting .astro:
|
|
327
|
+
* - `prettier-plugin-astro`
|
|
328
|
+
*
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
astro?: boolean | OptionsOverrides;
|
|
306
332
|
/**
|
|
307
333
|
* Enable linting for **code snippets** in Markdown.
|
|
308
334
|
*
|
|
@@ -384,6 +410,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
384
410
|
|
|
385
411
|
/**
|
|
386
412
|
* Construct an array of ESLint flat config items.
|
|
413
|
+
*
|
|
414
|
+
* @param {OptionsConfig & FlatConfigItem} options
|
|
415
|
+
* The options for generating the ESLint configurations.
|
|
416
|
+
* @param {Awaitable<UserConfigItem | UserConfigItem[]>[]} userConfigs
|
|
417
|
+
* The user configurations to be merged with the generated configurations.
|
|
418
|
+
* @returns {Promise<UserConfigItem[]>}
|
|
419
|
+
* The merged ESLint configurations.
|
|
387
420
|
*/
|
|
388
421
|
declare function kirklin(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
389
422
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
@@ -449,6 +482,8 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
449
482
|
|
|
450
483
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
451
484
|
|
|
485
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
486
|
+
|
|
452
487
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
453
488
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
454
489
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -470,6 +505,7 @@ declare const GLOB_VUE = "**/*.vue";
|
|
|
470
505
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
471
506
|
declare const GLOB_TOML = "**/*.toml";
|
|
472
507
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
508
|
+
declare const GLOB_ASTRO = "**/*.astro";
|
|
473
509
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
474
510
|
declare const GLOB_TESTS: string[];
|
|
475
511
|
declare const GLOB_ALL_SRC: string[];
|
|
@@ -511,6 +547,6 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
511
547
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
512
548
|
default: infer U;
|
|
513
549
|
} ? U : T>;
|
|
514
|
-
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
550
|
+
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
515
551
|
|
|
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, combine, comments, kirklin as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, kirklin, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
552
|
+
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, astro, combine, comments, kirklin as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, kirklin, 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,20 @@ 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
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Enable formatting support for Astro.
|
|
202
|
+
*
|
|
203
|
+
* Currently only support Prettier.
|
|
204
|
+
*/
|
|
205
|
+
astro?: "prettier" | boolean;
|
|
192
206
|
}
|
|
193
207
|
interface OptionsComponentExts {
|
|
194
208
|
/**
|
|
@@ -303,6 +317,18 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
303
317
|
* @default true
|
|
304
318
|
*/
|
|
305
319
|
toml?: boolean | OptionsOverrides;
|
|
320
|
+
/**
|
|
321
|
+
* Enable ASTRO support.
|
|
322
|
+
*
|
|
323
|
+
* Requires installing:
|
|
324
|
+
* - `eslint-plugin-astro`
|
|
325
|
+
*
|
|
326
|
+
* Requires installing for formatting .astro:
|
|
327
|
+
* - `prettier-plugin-astro`
|
|
328
|
+
*
|
|
329
|
+
* @default false
|
|
330
|
+
*/
|
|
331
|
+
astro?: boolean | OptionsOverrides;
|
|
306
332
|
/**
|
|
307
333
|
* Enable linting for **code snippets** in Markdown.
|
|
308
334
|
*
|
|
@@ -384,6 +410,13 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
384
410
|
|
|
385
411
|
/**
|
|
386
412
|
* Construct an array of ESLint flat config items.
|
|
413
|
+
*
|
|
414
|
+
* @param {OptionsConfig & FlatConfigItem} options
|
|
415
|
+
* The options for generating the ESLint configurations.
|
|
416
|
+
* @param {Awaitable<UserConfigItem | UserConfigItem[]>[]} userConfigs
|
|
417
|
+
* The user configurations to be merged with the generated configurations.
|
|
418
|
+
* @returns {Promise<UserConfigItem[]>}
|
|
419
|
+
* The merged ESLint configurations.
|
|
387
420
|
*/
|
|
388
421
|
declare function kirklin(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
|
|
389
422
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
@@ -449,6 +482,8 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
449
482
|
|
|
450
483
|
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
451
484
|
|
|
485
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<FlatConfigItem[]>;
|
|
486
|
+
|
|
452
487
|
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
453
488
|
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
454
489
|
declare const GLOB_JS = "**/*.?([cm])js";
|
|
@@ -470,6 +505,7 @@ declare const GLOB_VUE = "**/*.vue";
|
|
|
470
505
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
471
506
|
declare const GLOB_TOML = "**/*.toml";
|
|
472
507
|
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
508
|
+
declare const GLOB_ASTRO = "**/*.astro";
|
|
473
509
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
474
510
|
declare const GLOB_TESTS: string[];
|
|
475
511
|
declare const GLOB_ALL_SRC: string[];
|
|
@@ -511,6 +547,6 @@ declare function toArray<T>(value: T | T[]): T[];
|
|
|
511
547
|
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
512
548
|
default: infer U;
|
|
513
549
|
} ? U : T>;
|
|
514
|
-
declare function ensurePackages(packages: string[]): Promise<void>;
|
|
550
|
+
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
515
551
|
|
|
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, combine, comments, kirklin as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, kirklin, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
|
552
|
+
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, astro, combine, comments, kirklin as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, kirklin, markdown, node, parserPlain, perfectionist, react, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|