@zinkawaii/eslint-config 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +248 -2
- package/dist/index.mjs +134 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { StylisticCustomizeOptions } from "@stylistic/eslint-plugin";
|
|
|
4
4
|
import { ParserOptions } from "@typescript-eslint/parser";
|
|
5
5
|
import { FlatGitignoreOptions } from "eslint-config-flat-gitignore";
|
|
6
6
|
import { Options } from "eslint-processor-vue-blocks";
|
|
7
|
-
//#region ../../node_modules/.pnpm/@antfu+eslint-config@9.2.0_patch_hash=
|
|
7
|
+
//#region ../../node_modules/.pnpm/@antfu+eslint-config@9.2.0_patch_hash=69df02b36d793b2588fb6ed642c6c83986ef891c17d086eef_7868d1f4617dd223618ad09f5b142177/node_modules/@antfu/eslint-config/dist/index.d.mts
|
|
8
8
|
//#region src/typegen.d.ts
|
|
9
9
|
interface RuleOptions {
|
|
10
10
|
/**
|
|
@@ -21754,6 +21754,12 @@ type TypedFlatConfigItem = Omit<ConfigWithExtends, 'plugins' | 'rules'> & {
|
|
|
21754
21754
|
*/
|
|
21755
21755
|
rules?: Rules;
|
|
21756
21756
|
};
|
|
21757
|
+
interface OptionsFiles {
|
|
21758
|
+
/**
|
|
21759
|
+
* Override the `files` option to provide custom globs.
|
|
21760
|
+
*/
|
|
21761
|
+
files?: string[];
|
|
21762
|
+
}
|
|
21757
21763
|
interface OptionsVue extends OptionsOverrides {
|
|
21758
21764
|
/**
|
|
21759
21765
|
* Create virtual files for Vue SFC blocks to enable linting.
|
|
@@ -21933,6 +21939,12 @@ interface OptionsTypeScriptWithTypes {
|
|
|
21933
21939
|
*/
|
|
21934
21940
|
overridesTypeAware?: TypedFlatConfigItem['rules'];
|
|
21935
21941
|
}
|
|
21942
|
+
interface OptionsHasTypeScript {
|
|
21943
|
+
typescript?: boolean;
|
|
21944
|
+
}
|
|
21945
|
+
interface OptionsStylistic {
|
|
21946
|
+
stylistic?: boolean | StylisticConfig;
|
|
21947
|
+
}
|
|
21936
21948
|
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'jsx' | 'semi' | 'braceStyle' | 'experimental'> {}
|
|
21937
21949
|
interface OptionsOverrides {
|
|
21938
21950
|
overrides?: TypedFlatConfigItem['rules'];
|
|
@@ -22260,6 +22272,18 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
22260
22272
|
svelte?: TypedFlatConfigItem['rules'];
|
|
22261
22273
|
};
|
|
22262
22274
|
}
|
|
22275
|
+
//#endregion
|
|
22276
|
+
//#region src/factory.d.ts
|
|
22277
|
+
declare const defaultPluginRenaming: {
|
|
22278
|
+
'@eslint-react': string;
|
|
22279
|
+
'@next/next': string;
|
|
22280
|
+
'@stylistic': string;
|
|
22281
|
+
'@typescript-eslint': string;
|
|
22282
|
+
'import-lite': string;
|
|
22283
|
+
n: string;
|
|
22284
|
+
vitest: string;
|
|
22285
|
+
yml: string;
|
|
22286
|
+
};
|
|
22263
22287
|
/**
|
|
22264
22288
|
* Construct an array of ESLint flat config items.
|
|
22265
22289
|
*
|
|
@@ -22271,8 +22295,230 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
22271
22295
|
* The merged ESLint configurations.
|
|
22272
22296
|
*/
|
|
22273
22297
|
declare function antfu(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files' | 'ignores'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
22298
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
22299
|
+
declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
|
|
22300
|
+
declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): Partial<Linter.RulesRecord & RuleOptions>;
|
|
22301
|
+
//#endregion
|
|
22302
|
+
//#region src/config-presets.d.ts
|
|
22303
|
+
declare const CONFIG_PRESET_FULL_ON: OptionsConfig;
|
|
22304
|
+
declare const CONFIG_PRESET_FULL_OFF: OptionsConfig;
|
|
22305
|
+
//#endregion
|
|
22306
|
+
//#region src/configs/angular.d.ts
|
|
22307
|
+
declare function angular(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22308
|
+
//#endregion
|
|
22309
|
+
//#region src/configs/astro.d.ts
|
|
22310
|
+
declare function astro(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22311
|
+
//#endregion
|
|
22312
|
+
//#region src/configs/command.d.ts
|
|
22313
|
+
declare function command(): Promise<TypedFlatConfigItem[]>;
|
|
22314
|
+
//#endregion
|
|
22315
|
+
//#region src/configs/comments.d.ts
|
|
22316
|
+
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
22317
|
+
//#endregion
|
|
22318
|
+
//#region src/configs/disables.d.ts
|
|
22319
|
+
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
22320
|
+
//#endregion
|
|
22321
|
+
//#region src/configs/formatters.d.ts
|
|
22322
|
+
declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<TypedFlatConfigItem[]>;
|
|
22323
|
+
//#endregion
|
|
22324
|
+
//#region src/configs/ignores.d.ts
|
|
22325
|
+
declare function ignores(userIgnores?: string[] | ((originals: string[]) => string[]), ignoreTypeScript?: boolean): Promise<TypedFlatConfigItem[]>;
|
|
22326
|
+
//#endregion
|
|
22327
|
+
//#region src/configs/imports.d.ts
|
|
22328
|
+
declare function imports(options?: OptionsOverrides & OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
22329
|
+
//#endregion
|
|
22330
|
+
//#region src/configs/javascript.d.ts
|
|
22331
|
+
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22332
|
+
//#endregion
|
|
22333
|
+
//#region src/configs/jsdoc.d.ts
|
|
22334
|
+
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
22335
|
+
//#endregion
|
|
22336
|
+
//#region src/configs/jsonc.d.ts
|
|
22337
|
+
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22338
|
+
//#endregion
|
|
22339
|
+
//#region src/configs/jsx.d.ts
|
|
22340
|
+
declare function jsx(options?: OptionsJSX): Promise<TypedFlatConfigItem[]>;
|
|
22341
|
+
//#endregion
|
|
22342
|
+
//#region src/configs/markdown.d.ts
|
|
22343
|
+
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsMarkdown): Promise<TypedFlatConfigItem[]>;
|
|
22344
|
+
//#endregion
|
|
22345
|
+
//#region src/configs/nextjs.d.ts
|
|
22346
|
+
declare function nextjs(options?: OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22347
|
+
//#endregion
|
|
22348
|
+
//#region src/configs/node.d.ts
|
|
22349
|
+
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
22350
|
+
//#endregion
|
|
22351
|
+
//#region src/configs/perfectionist.d.ts
|
|
22352
|
+
/**
|
|
22353
|
+
* Perfectionist plugin for props and items sorting.
|
|
22354
|
+
*
|
|
22355
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
22356
|
+
*/
|
|
22357
|
+
declare function perfectionist(options: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22358
|
+
//#endregion
|
|
22359
|
+
//#region src/configs/pnpm.d.ts
|
|
22360
|
+
declare function pnpm(options: OptionsPnpm): Promise<TypedFlatConfigItem[]>;
|
|
22361
|
+
//#endregion
|
|
22362
|
+
//#region src/configs/react.d.ts
|
|
22363
|
+
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsReact & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22364
|
+
//#endregion
|
|
22365
|
+
//#region src/configs/regexp.d.ts
|
|
22366
|
+
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22367
|
+
//#endregion
|
|
22368
|
+
//#region src/configs/solid.d.ts
|
|
22369
|
+
declare function solid(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles & OptionsTypeScriptWithTypes): Promise<TypedFlatConfigItem[]>;
|
|
22370
|
+
//#endregion
|
|
22371
|
+
//#region src/configs/sort.d.ts
|
|
22372
|
+
/**
|
|
22373
|
+
* Sort package.json
|
|
22374
|
+
*
|
|
22375
|
+
* Requires `jsonc` config
|
|
22376
|
+
*/
|
|
22377
|
+
declare function sortPackageJson(): Promise<TypedFlatConfigItem[]>;
|
|
22378
|
+
/**
|
|
22379
|
+
* Sort tsconfig.json
|
|
22380
|
+
*
|
|
22381
|
+
* Requires `jsonc` config
|
|
22382
|
+
*/
|
|
22383
|
+
declare function sortTsconfig(): TypedFlatConfigItem[];
|
|
22384
|
+
//#endregion
|
|
22385
|
+
//#region src/configs/stylistic.d.ts
|
|
22386
|
+
declare const StylisticConfigDefaults: StylisticConfig;
|
|
22387
|
+
interface StylisticOptions extends StylisticConfig, OptionsOverrides {
|
|
22388
|
+
lessOpinionated?: boolean;
|
|
22389
|
+
}
|
|
22390
|
+
declare function stylistic(options?: StylisticOptions): Promise<TypedFlatConfigItem[]>;
|
|
22391
|
+
//#endregion
|
|
22392
|
+
//#region src/configs/svelte.d.ts
|
|
22393
|
+
declare function svelte(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22394
|
+
//#endregion
|
|
22395
|
+
//#region src/configs/test.d.ts
|
|
22396
|
+
declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
22397
|
+
//#endregion
|
|
22398
|
+
//#region src/configs/toml.d.ts
|
|
22399
|
+
declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22400
|
+
//#endregion
|
|
22401
|
+
//#region src/configs/typescript.d.ts
|
|
22402
|
+
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType & OptionsTypeScriptErasableOnly): Promise<TypedFlatConfigItem[]>;
|
|
22403
|
+
//#endregion
|
|
22404
|
+
//#region src/configs/unicorn.d.ts
|
|
22405
|
+
declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
|
|
22406
|
+
//#endregion
|
|
22407
|
+
//#region src/configs/unocss.d.ts
|
|
22408
|
+
declare function unocss(options?: OptionsUnoCSS): Promise<TypedFlatConfigItem[]>;
|
|
22409
|
+
//#endregion
|
|
22410
|
+
//#region src/configs/vue.d.ts
|
|
22411
|
+
declare function vue(options?: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22412
|
+
//#endregion
|
|
22413
|
+
//#region src/configs/yaml.d.ts
|
|
22414
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
22415
|
+
//#endregion
|
|
22416
|
+
//#region src/globs.d.ts
|
|
22417
|
+
declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
22418
|
+
declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
22419
|
+
declare const GLOB_JS = "**/*.?([cm])js";
|
|
22420
|
+
declare const GLOB_JSX = "**/*.?([cm])jsx";
|
|
22421
|
+
declare const GLOB_TS = "**/*.?([cm])ts";
|
|
22422
|
+
declare const GLOB_TSX = "**/*.?([cm])tsx";
|
|
22423
|
+
declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
22424
|
+
declare const GLOB_CSS = "**/*.css";
|
|
22425
|
+
declare const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
22426
|
+
declare const GLOB_LESS = "**/*.less";
|
|
22427
|
+
declare const GLOB_SCSS = "**/*.scss";
|
|
22428
|
+
declare const GLOB_JSON = "**/*.json";
|
|
22429
|
+
declare const GLOB_JSON5 = "**/*.json5";
|
|
22430
|
+
declare const GLOB_JSONC = "**/*.jsonc";
|
|
22431
|
+
declare const GLOB_MARKDOWN = "**/*.md";
|
|
22432
|
+
declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
22433
|
+
declare const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
|
|
22434
|
+
declare const GLOB_VUE = "**/*.vue";
|
|
22435
|
+
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
22436
|
+
declare const GLOB_TOML = "**/*.toml";
|
|
22437
|
+
declare const GLOB_XML = "**/*.xml";
|
|
22438
|
+
declare const GLOB_SVG = "**/*.svg";
|
|
22439
|
+
declare const GLOB_HTML = "**/*.htm?(l)";
|
|
22440
|
+
declare const GLOB_ASTRO = "**/*.astro";
|
|
22441
|
+
declare const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
22442
|
+
declare const GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
22443
|
+
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
22444
|
+
declare const GLOB_TESTS: string[];
|
|
22445
|
+
declare const GLOB_ALL_SRC: string[];
|
|
22446
|
+
declare const GLOB_EXCLUDE: string[];
|
|
22447
|
+
//#endregion
|
|
22448
|
+
//#region src/utils.d.ts
|
|
22449
|
+
declare const parserPlain: {
|
|
22450
|
+
meta: {
|
|
22451
|
+
name: string;
|
|
22452
|
+
};
|
|
22453
|
+
parseForESLint: (code: string) => {
|
|
22454
|
+
ast: {
|
|
22455
|
+
body: never[];
|
|
22456
|
+
comments: never[];
|
|
22457
|
+
loc: {
|
|
22458
|
+
end: number;
|
|
22459
|
+
start: number;
|
|
22460
|
+
};
|
|
22461
|
+
range: number[];
|
|
22462
|
+
tokens: never[];
|
|
22463
|
+
type: string;
|
|
22464
|
+
};
|
|
22465
|
+
scopeManager: null;
|
|
22466
|
+
services: {
|
|
22467
|
+
isPlain: boolean;
|
|
22468
|
+
};
|
|
22469
|
+
visitorKeys: {
|
|
22470
|
+
Program: never[];
|
|
22471
|
+
};
|
|
22472
|
+
};
|
|
22473
|
+
};
|
|
22474
|
+
/**
|
|
22475
|
+
* Combine array and non-array configs into a single array.
|
|
22476
|
+
*/
|
|
22477
|
+
declare function combine(...configs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]): Promise<TypedFlatConfigItem[]>;
|
|
22478
|
+
/**
|
|
22479
|
+
* Rename plugin prefixes in a rule object.
|
|
22480
|
+
* Accepts a map of prefixes to rename.
|
|
22481
|
+
*
|
|
22482
|
+
* @example
|
|
22483
|
+
* ```ts
|
|
22484
|
+
* import { renameRules } from '@antfu/eslint-config'
|
|
22485
|
+
*
|
|
22486
|
+
* export default [{
|
|
22487
|
+
* rules: renameRules(
|
|
22488
|
+
* {
|
|
22489
|
+
* '@typescript-eslint/indent': 'error'
|
|
22490
|
+
* },
|
|
22491
|
+
* { '@typescript-eslint': 'ts' }
|
|
22492
|
+
* )
|
|
22493
|
+
* }]
|
|
22494
|
+
* ```
|
|
22495
|
+
*/
|
|
22496
|
+
declare function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
|
|
22497
|
+
/**
|
|
22498
|
+
* Rename plugin names a flat configs array
|
|
22499
|
+
*
|
|
22500
|
+
* @example
|
|
22501
|
+
* ```ts
|
|
22502
|
+
* import { renamePluginInConfigs } from '@antfu/eslint-config'
|
|
22503
|
+
* import someConfigs from './some-configs'
|
|
22504
|
+
*
|
|
22505
|
+
* export default renamePluginInConfigs(someConfigs, {
|
|
22506
|
+
* '@typescript-eslint': 'ts',
|
|
22507
|
+
* '@stylistic': 'style',
|
|
22508
|
+
* })
|
|
22509
|
+
* ```
|
|
22510
|
+
*/
|
|
22511
|
+
declare function renamePluginInConfigs(configs: TypedFlatConfigItem[], map: Record<string, string>): TypedFlatConfigItem[];
|
|
22512
|
+
declare function toArray<T>(value: T | T[]): T[];
|
|
22513
|
+
declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
22514
|
+
default: infer U;
|
|
22515
|
+
} ? U : T>;
|
|
22516
|
+
declare function isPackageInScope(name: string): boolean;
|
|
22517
|
+
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
22518
|
+
declare function isInEditorEnv(): boolean;
|
|
22519
|
+
declare function isInGitHooksOrLintStaged(): boolean;
|
|
22274
22520
|
//#endregion
|
|
22275
22521
|
//#region src/index.d.ts
|
|
22276
22522
|
declare const zin: typeof antfu;
|
|
22277
22523
|
//#endregion
|
|
22278
|
-
export { zin as default, zin };
|
|
22524
|
+
export { Awaitable, CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, type ConfigNames, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsE18e, OptionsFiles, OptionsFormatters, OptionsHasTypeScript, OptionsIsInEditor, OptionsJSX, OptionsJSXA11y, OptionsMarkdown, OptionsOverrides, OptionsPnpm, OptionsProjectType, OptionsReact, OptionsRegExp, OptionsStylistic, OptionsTypeScriptErasableOnly, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, OptionsUnoCSS, OptionsVue, ResolvedOptions, type RuleOptions, Rules, StylisticConfig, StylisticConfigDefaults, StylisticOptions, TypedFlatConfigItem, angular, antfu, astro, combine, command, comments, zin as default, zin, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
16
16
|
import globals from "globals";
|
|
17
17
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
18
18
|
import { configs } from "eslint-plugin-regexp";
|
|
19
|
-
//#region ../../node_modules/.pnpm/@antfu+eslint-config@9.2.0_patch_hash=
|
|
19
|
+
//#region ../../node_modules/.pnpm/@antfu+eslint-config@9.2.0_patch_hash=69df02b36d793b2588fb6ed642c6c83986ef891c17d086eef_7868d1f4617dd223618ad09f5b142177/node_modules/@antfu/eslint-config/dist/index.mjs
|
|
20
20
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
21
21
|
async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
22
22
|
let directory = path.resolve(toPath(cwd) ?? "");
|
|
@@ -50,9 +50,11 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
50
50
|
}
|
|
51
51
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
52
52
|
const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
53
|
+
const GLOB_JS = "**/*.?([cm])js";
|
|
53
54
|
const GLOB_JSX = "**/*.?([cm])jsx";
|
|
54
55
|
const GLOB_TS = "**/*.?([cm])ts";
|
|
55
56
|
const GLOB_TSX = "**/*.?([cm])tsx";
|
|
57
|
+
const GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
56
58
|
const GLOB_CSS = "**/*.css";
|
|
57
59
|
const GLOB_POSTCSS = "**/*.{p,post}css";
|
|
58
60
|
const GLOB_LESS = "**/*.less";
|
|
@@ -80,6 +82,18 @@ const GLOB_TESTS = [
|
|
|
80
82
|
`**/*.bench.${GLOB_SRC_EXT}`,
|
|
81
83
|
`**/*.benchmark.${GLOB_SRC_EXT}`
|
|
82
84
|
];
|
|
85
|
+
const GLOB_ALL_SRC = [
|
|
86
|
+
GLOB_SRC,
|
|
87
|
+
GLOB_STYLE,
|
|
88
|
+
GLOB_JSON,
|
|
89
|
+
GLOB_JSON5,
|
|
90
|
+
GLOB_MARKDOWN,
|
|
91
|
+
GLOB_SVELTE,
|
|
92
|
+
GLOB_VUE,
|
|
93
|
+
GLOB_YAML,
|
|
94
|
+
GLOB_XML,
|
|
95
|
+
GLOB_HTML
|
|
96
|
+
];
|
|
83
97
|
const GLOB_EXCLUDE = [
|
|
84
98
|
"**/node_modules",
|
|
85
99
|
"**/dist",
|
|
@@ -139,6 +153,12 @@ const parserPlain = {
|
|
|
139
153
|
})
|
|
140
154
|
};
|
|
141
155
|
/**
|
|
156
|
+
* Combine array and non-array configs into a single array.
|
|
157
|
+
*/
|
|
158
|
+
async function combine(...configs) {
|
|
159
|
+
return (await Promise.all(configs)).flat();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
142
162
|
* Rename plugin prefixes in a rule object.
|
|
143
163
|
* Accepts a map of prefixes to rename.
|
|
144
164
|
*
|
|
@@ -162,6 +182,31 @@ function renameRules(rules, map) {
|
|
|
162
182
|
return [key, value];
|
|
163
183
|
}));
|
|
164
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Rename plugin names a flat configs array
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { renamePluginInConfigs } from '@antfu/eslint-config'
|
|
191
|
+
* import someConfigs from './some-configs'
|
|
192
|
+
*
|
|
193
|
+
* export default renamePluginInConfigs(someConfigs, {
|
|
194
|
+
* '@typescript-eslint': 'ts',
|
|
195
|
+
* '@stylistic': 'style',
|
|
196
|
+
* })
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
function renamePluginInConfigs(configs, map) {
|
|
200
|
+
return configs.map((i) => {
|
|
201
|
+
const clone = { ...i };
|
|
202
|
+
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
203
|
+
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
204
|
+
if (key in map) return [map[key], value];
|
|
205
|
+
return [key, value];
|
|
206
|
+
}));
|
|
207
|
+
return clone;
|
|
208
|
+
});
|
|
209
|
+
}
|
|
165
210
|
function toArray(value) {
|
|
166
211
|
return Array.isArray(value) ? value : [value];
|
|
167
212
|
}
|
|
@@ -1910,6 +1955,36 @@ async function typescript(options = {}) {
|
|
|
1910
1955
|
}] : []
|
|
1911
1956
|
];
|
|
1912
1957
|
}
|
|
1958
|
+
async function unicorn(options = {}) {
|
|
1959
|
+
const { allRecommended = false, overrides = {} } = options;
|
|
1960
|
+
return [{
|
|
1961
|
+
name: "antfu/unicorn/setup",
|
|
1962
|
+
plugins: { unicorn: pluginUnicorn }
|
|
1963
|
+
}, {
|
|
1964
|
+
files: [GLOB_SRC],
|
|
1965
|
+
name: "antfu/unicorn/rules",
|
|
1966
|
+
rules: {
|
|
1967
|
+
...allRecommended ? pluginUnicorn.configs.recommended.rules : {
|
|
1968
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1969
|
+
"unicorn/error-message": "error",
|
|
1970
|
+
"unicorn/escape-case": "error",
|
|
1971
|
+
"unicorn/new-for-builtins": "error",
|
|
1972
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1973
|
+
"unicorn/no-new-array": "error",
|
|
1974
|
+
"unicorn/no-new-buffer": "error",
|
|
1975
|
+
"unicorn/number-literal-case": "error",
|
|
1976
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1977
|
+
"unicorn/prefer-includes": "error",
|
|
1978
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1979
|
+
"unicorn/prefer-number-properties": "error",
|
|
1980
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1981
|
+
"unicorn/prefer-type-error": "error",
|
|
1982
|
+
"unicorn/throw-new-error": "error"
|
|
1983
|
+
},
|
|
1984
|
+
...overrides
|
|
1985
|
+
}
|
|
1986
|
+
}];
|
|
1987
|
+
}
|
|
1913
1988
|
async function unocss(options = {}) {
|
|
1914
1989
|
const { attributify = true, strict = false } = options;
|
|
1915
1990
|
await ensurePackages(["@unocss/eslint-plugin"]);
|
|
@@ -2362,6 +2437,63 @@ function getOverrides(options, key) {
|
|
|
2362
2437
|
..."overrides" in sub ? sub.overrides : {}
|
|
2363
2438
|
};
|
|
2364
2439
|
}
|
|
2440
|
+
const CONFIG_PRESET_FULL_ON = {
|
|
2441
|
+
angular: true,
|
|
2442
|
+
astro: true,
|
|
2443
|
+
formatters: true,
|
|
2444
|
+
gitignore: true,
|
|
2445
|
+
imports: true,
|
|
2446
|
+
jsdoc: true,
|
|
2447
|
+
jsonc: true,
|
|
2448
|
+
jsx: { a11y: true },
|
|
2449
|
+
markdown: true,
|
|
2450
|
+
nextjs: true,
|
|
2451
|
+
node: true,
|
|
2452
|
+
perfectionist: true,
|
|
2453
|
+
pnpm: true,
|
|
2454
|
+
react: true,
|
|
2455
|
+
regexp: true,
|
|
2456
|
+
solid: true,
|
|
2457
|
+
stylistic: { experimental: true },
|
|
2458
|
+
svelte: true,
|
|
2459
|
+
test: true,
|
|
2460
|
+
toml: true,
|
|
2461
|
+
typescript: {
|
|
2462
|
+
erasableOnly: true,
|
|
2463
|
+
tsconfigPath: "tsconfig.json"
|
|
2464
|
+
},
|
|
2465
|
+
unicorn: true,
|
|
2466
|
+
unocss: true,
|
|
2467
|
+
vue: { a11y: true },
|
|
2468
|
+
yaml: true
|
|
2469
|
+
};
|
|
2470
|
+
const CONFIG_PRESET_FULL_OFF = {
|
|
2471
|
+
angular: false,
|
|
2472
|
+
astro: false,
|
|
2473
|
+
formatters: false,
|
|
2474
|
+
gitignore: false,
|
|
2475
|
+
imports: false,
|
|
2476
|
+
jsdoc: false,
|
|
2477
|
+
jsonc: false,
|
|
2478
|
+
jsx: false,
|
|
2479
|
+
markdown: false,
|
|
2480
|
+
nextjs: false,
|
|
2481
|
+
node: false,
|
|
2482
|
+
perfectionist: false,
|
|
2483
|
+
pnpm: false,
|
|
2484
|
+
react: false,
|
|
2485
|
+
regexp: false,
|
|
2486
|
+
solid: false,
|
|
2487
|
+
stylistic: false,
|
|
2488
|
+
svelte: false,
|
|
2489
|
+
test: false,
|
|
2490
|
+
toml: false,
|
|
2491
|
+
typescript: false,
|
|
2492
|
+
unicorn: false,
|
|
2493
|
+
unocss: false,
|
|
2494
|
+
vue: false,
|
|
2495
|
+
yaml: false
|
|
2496
|
+
};
|
|
2365
2497
|
var src_default = antfu;
|
|
2366
2498
|
//#endregion
|
|
2367
2499
|
//#region src/configs/javascript.ts
|
|
@@ -2888,4 +3020,4 @@ const zin = (options = {}, ...userConfigs) => {
|
|
|
2888
3020
|
}, ...userConfigs);
|
|
2889
3021
|
};
|
|
2890
3022
|
//#endregion
|
|
2891
|
-
export { zin as default, zin };
|
|
3023
|
+
export { CONFIG_PRESET_FULL_OFF, CONFIG_PRESET_FULL_ON, GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, 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_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, StylisticConfigDefaults, angular, antfu, astro, combine, command, comments, zin as default, zin, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pnpm, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, solid, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
|