UNPKG

@sankeyangshu/eslint-config

Version:
1,362 lines (1,361 loc) 715 kB
import { FlatConfigComposer } from "eslint-flat-config-utils"; import { configs as configsTypeScript, parser as parserTypeScript, plugin as pluginTypeScript } from "typescript-eslint"; import * as parserToml from "toml-eslint-parser"; import * as parserYaml from "yaml-eslint-parser"; import * as parserPlain from "eslint-parser-plain"; import * as parserJsonc from "jsonc-eslint-parser"; import * as pluginRegexp from "eslint-plugin-regexp"; import pluginNode from "eslint-plugin-n"; import pluginYml from "eslint-plugin-yml"; import pluginToml from "eslint-plugin-toml"; import pluginMarkdown from "@eslint/markdown"; import pluginJsdoc from "eslint-plugin-jsdoc"; import pluginJsonc from "eslint-plugin-jsonc"; import pluginVitest from "@vitest/eslint-plugin"; import pluginUnicorn from "eslint-plugin-unicorn"; import pluginImportX from "eslint-plugin-import-x"; import pluginPrettier from "eslint-plugin-prettier"; import pluginNoOnlyTests from "eslint-plugin-no-only-tests"; import pluginPerfectionist from "eslint-plugin-perfectionist"; import pluginUnusedImports from "eslint-plugin-unused-imports"; import pluginComments from "@eslint-community/eslint-plugin-eslint-comments"; import { FlatGitignoreOptions } from "eslint-config-flat-gitignore"; import { Options } from "eslint-processor-vue-blocks"; import { ESLintPluginCommandOptions } from "eslint-plugin-command/types"; import { ParserOptions } from "@typescript-eslint/parser"; import { Linter } from "eslint"; import { BuiltInParserName, Options as Options$1 } from "prettier"; //#region src/types/utils.d.ts /** * A type that can be awaited */ type Awaitable<T> = Promise<T> | T; /** * Make types human readable */ type InteropModuleDefault<T> = T extends { default: infer U; } ? U : T; type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>; //#endregion //#region src/configs/vue.d.ts /** * Options type of {@link createVueConfig} */ type ConfigVueOptions = OptionsFiles & OptionsOverrides & OptionsShareable & { /** * Create virtual files for Vue SFC blocks to enable linting. * * @see https://github.com/antfu/eslint-processor-vue-blocks * * @default true */ sfcBlocks?: boolean | Options; }; /** * Create a basic configuration for Vue. * * @see {@link https://github.com/vuejs/eslint-plugin-vue} * * @param options - {@link ConfigVueOptions} * @returns A list of flat config items. */ declare function createVueConfig(options?: ConfigVueOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/node.d.ts /** * Options type of {@link createNodeConfig} */ type ConfigNodeOptions = OptionsOverrides; /** * Create a basic configuration for Node. * * @see {@link https://github.com/eslint-community/eslint-plugin-n} * * @param options - {@link ConfigNodeOptions} * @returns A list of flat config items. */ declare function createNodeConfig(options?: ConfigNodeOptions): TypedConfigItem[]; //#endregion //#region src/configs/pnpm.d.ts /** * Options type of {@link createPnpmConfig} */ type ConfigPnpmOptions = { filesJson?: TypedConfigItem['files']; filesYaml?: TypedConfigItem['files']; overridesJsonRules?: TypedConfigItem['rules']; overridesYamlRules?: TypedConfigItem['rules']; }; /** * Config for pnpm package manager * * @see {@link https://github.com/antfu/pnpm-workspace-utils/tree/main/packages/eslint-plugin-pnpm} * * @param options - {@link ConfigPnpmOptions} * @returns ESLint configs */ declare function createPnpmConfig(options?: ConfigPnpmOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/sort.d.ts /** * Options type of {@link createSortConfig} */ interface ConfigSortOptions { /** * JSON files to sort all properties alphabeta */ additionalJsonFiles?: string[]; /** * YAML files to sort all properties alphabeta */ additionalYamlFiles?: string[]; /** * @default true */ i18nLocale?: boolean; /** * @default true */ packageJson?: boolean; /** * @default true */ pnpmWorkspace?: boolean; /** * @default true */ tsconfig?: boolean; /** * @default true */ jsonSchema?: boolean; } /** * Creates a basic configuration for Perfectionist. * * @param options - {@link ConfigSortOptions} * @returns A list of flat config items. */ declare function createSortConfig(options?: ConfigSortOptions): TypedConfigItem[]; //#endregion //#region src/configs/test.d.ts /** * Options type of {@link configTest} */ type ConfigTestOptions = OptionsFiles & OptionsOverrides & { /** * Overrides built-in vitest rules */ overridesVitestRules?: TypedConfigItem['rules']; /** * enable vitest plugin rules * * @default true if vitest in deps */ vitest?: boolean; }; /** * Config for test files * * @see {@link https://github.com/vitest-dev/eslint-plugin-vitest} * * @param options - {@link ConfigTestOptions} * @returns ESLint configs */ declare function createTestConfig(options?: ConfigTestOptions): TypedConfigItem[]; //#endregion //#region src/configs/toml.d.ts /** * Options type of {@link createTomlConfig} */ type ConfigTomlOptions = OptionsOverrides & OptionsFiles; /** * Config for toml files * * @see {@link https://ota-meshi.github.io/eslint-plugin-toml} * * @param options - {@link ConfigTomlOptions} * @returns ESLint configs */ declare function createTomlConfig(options?: ConfigTomlOptions): TypedConfigItem[]; //#endregion //#region src/configs/yaml.d.ts /** * Options type of {@link createYamlConfig} */ type ConfigYmlOptions = OptionsOverrides & OptionsFiles & { /** * Whether disable prettier related rules */ prettier?: boolean; }; /** * Config for yml, yaml files * * @see {@link https://ota-meshi.github.io/eslint-plugin-yml} * * @param options - {@link ConfigYmlOptions} * @returns ESLint configs */ declare function createYamlConfig(options?: ConfigYmlOptions): TypedConfigItem[]; //#endregion //#region src/configs/astro.d.ts /** * Options type of {@link configAstro} */ type ConfigAstroOptions = OptionsFiles & OptionsOverrides & OptionsShareable; /** * Creates a basic configuration for Astro. * * @see {@link https://github.com/ota-meshi/eslint-plugin-astro} * * @param options - {@link ConfigAstroOptions} * @returns A list of flat config items. */ declare function createAstroConfig(options?: ConfigAstroOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/jsdoc.d.ts /** * Options type of {@link createJsdocConfig} */ type ConfigJsdocOptions = Pick<OptionsShareable, 'typescript'> & OptionsOverrides; /** * Creates a basic ESLint configuration for the JSDoc plugin. * * @see {@link https://github.com/gajus/eslint-plugin-jsdoc} * * @param options - {@link ConfigJsdocOptions} * @returns ESLint configs */ declare function createJsdocConfig(options?: ConfigJsdocOptions): TypedConfigItem[]; //#endregion //#region src/configs/jsonc.d.ts /** * Options type of {@link createJsoncConfig} */ type ConfigJsoncOptions = OptionsOverrides & OptionsFiles & { /** * Whether disable prettier related rules */ prettier?: boolean; }; /** * Create a configuration for jsonc. * * @see {@link https://ota-meshi.github.io/eslint-plugin-jsonc} * * @param options - {@link ConfigJsoncOptions} * @returns ESLint configs */ declare function createJsoncConfig(options?: ConfigJsoncOptions): TypedConfigItem[]; //#endregion //#region src/configs/react.d.ts /** * Options type of {@link createReactConfig} */ type ConfigReactOptions = OptionsFiles & OptionsOverrides & Pick<OptionsShareable, 'extraFileExtensions'> & { /** * Glob patterns for files that should be type aware. * @default ['**\/*.{ts,tsx}'] */ filesTypeAware?: string[]; /** * Glob patterns for files that should not be type aware. * @default ['**\/*.md\/**', '**\/*.astro/*.ts'] */ ignoresTypeAware?: string[]; /** * Overrides built-in type aware rules */ overridesTypeAwareRules?: TypedConfigItem['rules']; /** * Enable type aware check for TypeScript files */ tsconfigPath?: string; }; /** * Creates a basic configuration for React using ESLint plugins. * @see {@link https://github.com/Rel1cx/eslint-react} * * @param options - {@link ConfigReactOptions} * @returns A list of flat config items. */ declare function createReactConfig(options?: ConfigReactOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/solid.d.ts /** * Options type of {@link createSolidConfig} */ type ConfigSolidOptions = OptionsFiles & OptionsOverrides & OptionsShareable; /** * Creates a basic configuration for Solid. * * @see {@link https://github.com/solidjs-community/eslint-plugin-solid} * * @param options - {@link ConfigSolidOptions} * @returns A list of flat config items. */ declare function createSolidConfig(options?: ConfigSolidOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/regexp.d.ts /** * Options type of {@link createRegexpConfig} */ type ConfigRegexpOptions = OptionsOverrides & { /** * rule severity * * @default 'error' */ severity?: ESLintRuleSeverity; }; /** * Config for regexp * * @see {@link https://github.com/ota-meshi/eslint-plugin-regexp} * * @param options - {@link ConfigRegexpOptions} * @returns ESLint configs */ declare function createRegexpConfig(options?: ConfigRegexpOptions): TypedConfigItem[]; //#endregion //#region src/configs/svelte.d.ts /** * Options type of {@link createSvelteConfig} */ type ConfigSvelteOptions = OptionsFiles & OptionsOverrides & OptionsShareable; /** * Create a basic configuration for Svelte. * * @see {@link https://github.com/ota-meshi/eslint-plugin-svelte} * * @param options - {@link ConfigSvelteOptions} * @returns A list of flat config items. */ declare function createSvelteConfig(options?: ConfigSvelteOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/unocss.d.ts /** * Options type of {@link createUnoCssConfig} */ type ConfigUnoCSSOptions = OptionsOverrides & { /** * Enable attributify sort order * * @default false */ attributify?: boolean; }; /** * Creates a basic configuration for UnoCSS. * * @see {@link https://github.com/unocss/unocss/tree/main/packages-integrations/eslint-plugin} * * @param options - {@link ConfigUnoCSSOptions} * @returns A list of flat config items. */ declare function createUnoCssConfig(options?: ConfigUnoCSSOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/command.d.ts /** * Options type of {@link configCommand} */ type ConfigCommandOptions = ESLintPluginCommandOptions; /** * Config for use comments as commands * * @see {@link https://github.com/antfu/eslint-plugin-command} * * @param options - {@link ConfigCommandOptions} * @returns ESLint configs */ declare function createCommandConfig(options?: ConfigCommandOptions): TypedConfigItem[]; //#endregion //#region src/configs/ignores.d.ts /** * Options type for {@link createIgnoresConfig} */ type ConfigIgnoresOptions = string[]; /** * Config for ignore files from linting * * @see https://eslint.org/docs/latest/use/configure/configuration-files-new#globally-ignoring-files-with-ignores * * @param customIgnores - {@link ConfigIgnoresOptions} * @returns ESLint configs */ declare const createIgnoresConfig: (customIgnores?: ConfigIgnoresOptions) => TypedConfigItem[]; //#endregion //#region src/configs/imports.d.ts /** * Options type of {@link createImportsConfig} */ type ConfigImportOptions = Pick<OptionsShareable, 'typescript'> & OptionsOverrides & { /** * Use [eslint-import-resolver-typescript](https://github.com/import-js/eslint-import-resolver-typescript) if `typescript` is installed * * @default true */ preferTypeScriptResolver?: boolean; }; /** * Create a basic configuration for imports. * * @see {@link https://github.com/un-ts/eslint-plugin-import-x} * @param options - {@link ConfigImportOptions} * @returns A list of flat config items. */ declare function createImportsConfig(options?: ConfigImportOptions): TypedConfigItem[]; //#endregion //#region src/configs/unicorn.d.ts /** * Options type of {@link createUnicornConfig} */ type ConfigUnicornOptions = OptionsOverrides; /** * Creates a basic ESLint configuration for the Unicorn plugin. * * @see {@link https://github.com/sindresorhus/eslint-plugin-unicorn} * * @param options - {@link ConfigUnicornOptions} * @returns A list of flat config items with Unicorn plugin settings and rules. */ declare function createUnicornConfig(options?: ConfigUnicornOptions): TypedConfigItem[]; //#endregion //#region src/configs/comments.d.ts /** * Options type of {@link configESLintComments} */ type ConfigCommentsOptions = OptionsOverrides; /** * Config for eslint comments * * @see {@link https://github.com/eslint-community/eslint-plugin-eslint-comments} * * @param options - {@link ConfigCommentsOptions} * @returns ESLint configs */ declare function createCommentsConfig(options?: ConfigCommentsOptions): TypedConfigItem[]; //#endregion //#region src/configs/disables.d.ts /** * Options for {@link createDisablesConfig} */ interface ConfigDisablesOptions { /** * Overrides cli rules */ overridesCliRules?: TypedConfigItem['rules']; /** * Overrides bin rules */ overridesBinRules?: TypedConfigItem['rules']; /** * Overrides config files rules */ overridesConfigFileRules?: TypedConfigItem['rules']; /** * Overrides scripts rules */ overridesScriptsRules?: TypedConfigItem['rules']; /** * Overrides user scripts rules */ overridesUserScriptsRules?: TypedConfigItem['rules']; /** * More special case configs */ specialCaseConfigs?: TypedConfigItem[]; } /** * Create a list of flat config items to disable certain rules. * * @remarks * This function is not intended to be called directly. It is used by `createConfig` to generate a * configuration for ESLint. * @returns A list of flat config items. */ declare function createDisablesConfig(options?: ConfigDisablesOptions): TypedConfigItem[]; //#endregion //#region src/configs/markdown.d.ts /** * Options type of {@link createMarkdownConfig} */ type ConfigMarkdownOptions = OptionsFiles & OptionsOverrides & Pick<OptionsShareable, 'extraFileExtensions'>; /** * Config for markdown files * * @see {@link https://github.com/eslint/markdown} * * @param options - {@link ConfigMarkdownOptions} * @returns ESLint configs */ declare function createMarkdownConfig(options?: ConfigMarkdownOptions): TypedConfigItem[]; //#endregion //#region src/configs/prettier.d.ts /** * Options type of {@link createPrettierConfig} */ interface ConfigPrettierOptions extends OptionsOverrides { /** * Glob of built-in disabled files * * @default all svg, toml, svelte and astro files */ disabledFiles?: string[]; /** * rule severity * * @default `warn` */ severity?: ESLintRuleSeverity; /** * Glob of user custom disabled files * * @default [] */ userDisabledFiles?: string[]; } /** * Create a basic configuration for Prettier. * * @see {@link https://github.com/prettier/eslint-plugin-prettier} * * @param options - {@link ConfigPrettierOptions} * @returns A list of flat config items. */ declare function createPrettierConfig(options?: ConfigPrettierOptions): TypedConfigItem[]; //#endregion //#region src/configs/formatter.d.ts /** * Options type of {@link createFormatterConfig} */ interface ConfigFormatOptions { /** * Enable formatter support for css, less, scss, sass and etc. * * @default true */ css?: boolean; /** * Enable formatter support for html * * @default true */ html?: boolean; /** * Options for prettier */ prettierOptions?: PrettierOptions; } /** * Config to use a formatter * * @see {@link https://github.com/antfu/eslint-plugin-format} * * @param options - {@link ConfigFormatOptions} * @returns ESLint configs */ declare function createFormatterConfig(options?: ConfigFormatOptions): Promise<TypedConfigItem[]>; //#endregion //#region src/configs/gitignore.d.ts /** * Options type of {@link createGitIgnoresConfig} */ type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & { /** * Throw an error if gitignore file not found. * * @default false */ strict?: boolean; }; /** * Create a configuration for ignores. * * @param options Optional options for the config, either a boolean or an options object. * @returns A list of flat config items. */ declare function createGitIgnoresConfig(options?: ConfigGitIgnoreOptions): TypedConfigItem[]; //#endregion //#region src/configs/javascript.d.ts /** * Options type of {@link createJavascriptConfig} */ type ConfigJavaScriptOptions = OptionsOverrides & { /** * Enable strict checking for JavaScript files * @default false */ strict?: boolean; }; /** * Create a basic configuration for JavaScript. * * @see {@link https://github.com/eslint/eslint/tree/main/packages/js} * @param options - {@link ConfigJavaScriptOptions} * @returns A list of flat config items. */ declare function createJavaScriptConfig(options?: ConfigJavaScriptOptions): TypedConfigItem[]; declare const createJSXConfig: () => TypedConfigItem[]; //#endregion //#region src/configs/typescript.d.ts /** * Options type of {@link createTypescriptConfig} */ type ConfigTypeScriptOptions = OptionsFiles & OptionsOverrides & Pick<OptionsShareable, 'extraFileExtensions'> & { /** * Glob patterns for files that should be type aware. * @default ['**\/*.{ts,tsx}'] */ filesTypeAware?: string[]; /** * Glob patterns for files that should not be type aware. * @default ['**\/*.md\/**', '**\/*.astro/*.ts'] */ ignoresTypeAware?: string[]; /** * Overrides built-in type aware rules */ overridesTypeAwareRules?: TypedConfigItem['rules']; /** * Additional parser options */ parserOptions?: TSESLintParserOptions; /** * Enable type aware check for TypeScript files */ tsconfigPath?: string; /** * Globs of files to run with default project compiler */ allowDefaultProject?: string[]; }; /** * Create a basic configuration for TypeScript. * * @see {@link https://github.com/typescript-eslint/typescript-eslint} * @param options - {@link ConfigTypeScriptOptions} * @returns A list of flat config items. */ declare function createTypeScriptConfig(options?: ConfigTypeScriptOptions): TypedConfigItem[]; //#endregion //#region src/configs/perfectionist.d.ts /** * Option `partitionByComment` type * * @see {@link https://perfectionist.dev/rules/sort-imports#partitionbycomment} */ type PerfectionistPartitionByComment = boolean | string | string[] | { block?: boolean | string | string[]; line?: boolean | string | string[]; }; /** * Options type of {@link createPerfectionistConfig} */ type ConfigPerfectionistOptions = OptionsOverrides & { /** * Enable all perfectionist rule * * Once enabled, all `types`, `enums` and `constants` related options will be ignores * * @default false */ all?: boolean; /** * files for `constants`, will overrides default values */ filesConstants?: TypedConfigItem['files']; /** * files for `enums`, will overrides default values */ filesEnums?: TypedConfigItem['files']; /** * files for `types`, will overrides default values */ filesTypes?: TypedConfigItem['files']; /** * Overrides rules for `constants` */ overridesConstantsRules?: TypedConfigItem['rules']; /** * Overrides rules for `enums` */ overridesEnumsRules?: TypedConfigItem['rules']; /** * Overrides rules for `types` */ overridesTypesRules?: TypedConfigItem['rules']; /** * Shared `partitionByComment` option * * @default ['@pg', '@perfectionist-group'] */ partitionByComment?: PerfectionistPartitionByComment; /** * Enable sort `constants` * * @default true */ sortConstants?: boolean; /** * Enable sort `enums` * * @default true */ sortEnums?: boolean; /** * Enable sort `types` * * @default true */ sortTypes?: boolean; }; /** * Config for sorting imports, exports, objects and etc * * @see {@link https://github.com/azat-io/eslint-plugin-perfectionist} * * @param options - {@link ConfigPerfectionistOptions} * @returns ESLint configs */ declare function createPerfectionistConfig(options?: ConfigPerfectionistOptions): TypedConfigItem[]; //#endregion //#region src/types/typegen.d.ts interface RuleOptions { /** * require a `eslint-enable` comment for every `eslint-disable` comment * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html */ '@eslint-community/eslint-comments/disable-enable-pair'?: Linter.RuleEntry<EslintCommunityEslintCommentsDisableEnablePair>; /** * disallow a `eslint-enable` comment for multiple `eslint-disable` comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-aggregating-enable.html */ '@eslint-community/eslint-comments/no-aggregating-enable'?: Linter.RuleEntry<[]>; /** * disallow duplicate `eslint-disable` comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-duplicate-disable.html */ '@eslint-community/eslint-comments/no-duplicate-disable'?: Linter.RuleEntry<[]>; /** * disallow `eslint-disable` comments about specific rules * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-restricted-disable.html */ '@eslint-community/eslint-comments/no-restricted-disable'?: Linter.RuleEntry<EslintCommunityEslintCommentsNoRestrictedDisable>; /** * disallow `eslint-disable` comments without rule names * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unlimited-disable.html */ '@eslint-community/eslint-comments/no-unlimited-disable'?: Linter.RuleEntry<[]>; /** * disallow unused `eslint-disable` comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-disable.html */ '@eslint-community/eslint-comments/no-unused-disable'?: Linter.RuleEntry<[]>; /** * disallow unused `eslint-enable` comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-unused-enable.html */ '@eslint-community/eslint-comments/no-unused-enable'?: Linter.RuleEntry<[]>; /** * disallow ESLint directive-comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/no-use.html */ '@eslint-community/eslint-comments/no-use'?: Linter.RuleEntry<EslintCommunityEslintCommentsNoUse>; /** * require include descriptions in ESLint directive-comments * @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/require-description.html */ '@eslint-community/eslint-comments/require-description'?: Linter.RuleEntry<EslintCommunityEslintCommentsRequireDescription>; /** * Require that function overload signatures be consecutive * @see https://typescript-eslint.io/rules/adjacent-overload-signatures */ '@typescript-eslint/adjacent-overload-signatures'?: Linter.RuleEntry<[]>; /** * Require consistently using either `T[]` or `Array<T>` for arrays * @see https://typescript-eslint.io/rules/array-type */ '@typescript-eslint/array-type'?: Linter.RuleEntry<TypescriptEslintArrayType>; /** * Disallow awaiting a value that is not a Thenable * @see https://typescript-eslint.io/rules/await-thenable */ '@typescript-eslint/await-thenable'?: Linter.RuleEntry<[]>; /** * Disallow `@ts-<directive>` comments or require descriptions after directives * @see https://typescript-eslint.io/rules/ban-ts-comment */ '@typescript-eslint/ban-ts-comment'?: Linter.RuleEntry<TypescriptEslintBanTsComment>; /** * Disallow `// tslint:<rule-flag>` comments * @see https://typescript-eslint.io/rules/ban-tslint-comment */ '@typescript-eslint/ban-tslint-comment'?: Linter.RuleEntry<[]>; /** * Enforce that literals on classes are exposed in a consistent style * @see https://typescript-eslint.io/rules/class-literal-property-style */ '@typescript-eslint/class-literal-property-style'?: Linter.RuleEntry<TypescriptEslintClassLiteralPropertyStyle>; /** * Enforce that class methods utilize `this` * @see https://typescript-eslint.io/rules/class-methods-use-this */ '@typescript-eslint/class-methods-use-this'?: Linter.RuleEntry<TypescriptEslintClassMethodsUseThis>; /** * Enforce specifying generic type arguments on type annotation or constructor name of a constructor call * @see https://typescript-eslint.io/rules/consistent-generic-constructors */ '@typescript-eslint/consistent-generic-constructors'?: Linter.RuleEntry<TypescriptEslintConsistentGenericConstructors>; /** * Require or disallow the `Record` type * @see https://typescript-eslint.io/rules/consistent-indexed-object-style */ '@typescript-eslint/consistent-indexed-object-style'?: Linter.RuleEntry<TypescriptEslintConsistentIndexedObjectStyle>; /** * Require `return` statements to either always or never specify values * @see https://typescript-eslint.io/rules/consistent-return */ '@typescript-eslint/consistent-return'?: Linter.RuleEntry<TypescriptEslintConsistentReturn>; /** * Enforce consistent usage of type assertions * @see https://typescript-eslint.io/rules/consistent-type-assertions */ '@typescript-eslint/consistent-type-assertions'?: Linter.RuleEntry<TypescriptEslintConsistentTypeAssertions>; /** * Enforce type definitions to consistently use either `interface` or `type` * @see https://typescript-eslint.io/rules/consistent-type-definitions */ '@typescript-eslint/consistent-type-definitions'?: Linter.RuleEntry<TypescriptEslintConsistentTypeDefinitions>; /** * Enforce consistent usage of type exports * @see https://typescript-eslint.io/rules/consistent-type-exports */ '@typescript-eslint/consistent-type-exports'?: Linter.RuleEntry<TypescriptEslintConsistentTypeExports>; /** * Enforce consistent usage of type imports * @see https://typescript-eslint.io/rules/consistent-type-imports */ '@typescript-eslint/consistent-type-imports'?: Linter.RuleEntry<TypescriptEslintConsistentTypeImports>; /** * Enforce default parameters to be last * @see https://typescript-eslint.io/rules/default-param-last */ '@typescript-eslint/default-param-last'?: Linter.RuleEntry<[]>; /** * Enforce dot notation whenever possible * @see https://typescript-eslint.io/rules/dot-notation */ '@typescript-eslint/dot-notation'?: Linter.RuleEntry<TypescriptEslintDotNotation>; /** * Require explicit return types on functions and class methods * @see https://typescript-eslint.io/rules/explicit-function-return-type */ '@typescript-eslint/explicit-function-return-type'?: Linter.RuleEntry<TypescriptEslintExplicitFunctionReturnType>; /** * Require explicit accessibility modifiers on class properties and methods * @see https://typescript-eslint.io/rules/explicit-member-accessibility */ '@typescript-eslint/explicit-member-accessibility'?: Linter.RuleEntry<TypescriptEslintExplicitMemberAccessibility>; /** * Require explicit return and argument types on exported functions' and classes' public class methods * @see https://typescript-eslint.io/rules/explicit-module-boundary-types */ '@typescript-eslint/explicit-module-boundary-types'?: Linter.RuleEntry<TypescriptEslintExplicitModuleBoundaryTypes>; /** * Require or disallow initialization in variable declarations * @see https://typescript-eslint.io/rules/init-declarations */ '@typescript-eslint/init-declarations'?: Linter.RuleEntry<TypescriptEslintInitDeclarations>; /** * Enforce a maximum number of parameters in function definitions * @see https://typescript-eslint.io/rules/max-params */ '@typescript-eslint/max-params'?: Linter.RuleEntry<TypescriptEslintMaxParams>; /** * Require a consistent member declaration order * @see https://typescript-eslint.io/rules/member-ordering */ '@typescript-eslint/member-ordering'?: Linter.RuleEntry<TypescriptEslintMemberOrdering>; /** * Enforce using a particular method signature syntax * @see https://typescript-eslint.io/rules/method-signature-style */ '@typescript-eslint/method-signature-style'?: Linter.RuleEntry<TypescriptEslintMethodSignatureStyle>; /** * Enforce naming conventions for everything across a codebase * @see https://typescript-eslint.io/rules/naming-convention */ '@typescript-eslint/naming-convention'?: Linter.RuleEntry<TypescriptEslintNamingConvention>; /** * Disallow generic `Array` constructors * @see https://typescript-eslint.io/rules/no-array-constructor */ '@typescript-eslint/no-array-constructor'?: Linter.RuleEntry<[]>; /** * Disallow using the `delete` operator on array values * @see https://typescript-eslint.io/rules/no-array-delete */ '@typescript-eslint/no-array-delete'?: Linter.RuleEntry<[]>; /** * Require `.toString()` and `.toLocaleString()` to only be called on objects which provide useful information when stringified * @see https://typescript-eslint.io/rules/no-base-to-string */ '@typescript-eslint/no-base-to-string'?: Linter.RuleEntry<TypescriptEslintNoBaseToString>; /** * Disallow non-null assertion in locations that may be confusing * @see https://typescript-eslint.io/rules/no-confusing-non-null-assertion */ '@typescript-eslint/no-confusing-non-null-assertion'?: Linter.RuleEntry<[]>; /** * Require expressions of type void to appear in statement position * @see https://typescript-eslint.io/rules/no-confusing-void-expression */ '@typescript-eslint/no-confusing-void-expression'?: Linter.RuleEntry<TypescriptEslintNoConfusingVoidExpression>; /** * Disallow using code marked as `@deprecated` * @see https://typescript-eslint.io/rules/no-deprecated */ '@typescript-eslint/no-deprecated'?: Linter.RuleEntry<TypescriptEslintNoDeprecated>; /** * Disallow duplicate class members * @see https://typescript-eslint.io/rules/no-dupe-class-members */ '@typescript-eslint/no-dupe-class-members'?: Linter.RuleEntry<[]>; /** * Disallow duplicate enum member values * @see https://typescript-eslint.io/rules/no-duplicate-enum-values */ '@typescript-eslint/no-duplicate-enum-values'?: Linter.RuleEntry<[]>; /** * Disallow duplicate constituents of union or intersection types * @see https://typescript-eslint.io/rules/no-duplicate-type-constituents */ '@typescript-eslint/no-duplicate-type-constituents'?: Linter.RuleEntry<TypescriptEslintNoDuplicateTypeConstituents>; /** * Disallow using the `delete` operator on computed key expressions * @see https://typescript-eslint.io/rules/no-dynamic-delete */ '@typescript-eslint/no-dynamic-delete'?: Linter.RuleEntry<[]>; /** * Disallow empty functions * @see https://typescript-eslint.io/rules/no-empty-function */ '@typescript-eslint/no-empty-function'?: Linter.RuleEntry<TypescriptEslintNoEmptyFunction>; /** * Disallow the declaration of empty interfaces * @see https://typescript-eslint.io/rules/no-empty-interface * @deprecated */ '@typescript-eslint/no-empty-interface'?: Linter.RuleEntry<TypescriptEslintNoEmptyInterface>; /** * Disallow accidentally using the "empty object" type * @see https://typescript-eslint.io/rules/no-empty-object-type */ '@typescript-eslint/no-empty-object-type'?: Linter.RuleEntry<TypescriptEslintNoEmptyObjectType>; /** * Disallow the `any` type * @see https://typescript-eslint.io/rules/no-explicit-any */ '@typescript-eslint/no-explicit-any'?: Linter.RuleEntry<TypescriptEslintNoExplicitAny>; /** * Disallow extra non-null assertions * @see https://typescript-eslint.io/rules/no-extra-non-null-assertion */ '@typescript-eslint/no-extra-non-null-assertion'?: Linter.RuleEntry<[]>; /** * Disallow classes used as namespaces * @see https://typescript-eslint.io/rules/no-extraneous-class */ '@typescript-eslint/no-extraneous-class'?: Linter.RuleEntry<TypescriptEslintNoExtraneousClass>; /** * Require Promise-like statements to be handled appropriately * @see https://typescript-eslint.io/rules/no-floating-promises */ '@typescript-eslint/no-floating-promises'?: Linter.RuleEntry<TypescriptEslintNoFloatingPromises>; /** * Disallow iterating over an array with a for-in loop * @see https://typescript-eslint.io/rules/no-for-in-array */ '@typescript-eslint/no-for-in-array'?: Linter.RuleEntry<[]>; /** * Disallow the use of `eval()`-like functions * @see https://typescript-eslint.io/rules/no-implied-eval */ '@typescript-eslint/no-implied-eval'?: Linter.RuleEntry<[]>; /** * Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers * @see https://typescript-eslint.io/rules/no-import-type-side-effects */ '@typescript-eslint/no-import-type-side-effects'?: Linter.RuleEntry<[]>; /** * Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean * @see https://typescript-eslint.io/rules/no-inferrable-types */ '@typescript-eslint/no-inferrable-types'?: Linter.RuleEntry<TypescriptEslintNoInferrableTypes>; /** * Disallow `this` keywords outside of classes or class-like objects * @see https://typescript-eslint.io/rules/no-invalid-this */ '@typescript-eslint/no-invalid-this'?: Linter.RuleEntry<TypescriptEslintNoInvalidThis>; /** * Disallow `void` type outside of generic or return types * @see https://typescript-eslint.io/rules/no-invalid-void-type */ '@typescript-eslint/no-invalid-void-type'?: Linter.RuleEntry<TypescriptEslintNoInvalidVoidType>; /** * Disallow function declarations that contain unsafe references inside loop statements * @see https://typescript-eslint.io/rules/no-loop-func */ '@typescript-eslint/no-loop-func'?: Linter.RuleEntry<[]>; /** * Disallow literal numbers that lose precision * @see https://typescript-eslint.io/rules/no-loss-of-precision * @deprecated */ '@typescript-eslint/no-loss-of-precision'?: Linter.RuleEntry<[]>; /** * Disallow magic numbers * @see https://typescript-eslint.io/rules/no-magic-numbers */ '@typescript-eslint/no-magic-numbers'?: Linter.RuleEntry<TypescriptEslintNoMagicNumbers>; /** * Disallow the `void` operator except when used to discard a value * @see https://typescript-eslint.io/rules/no-meaningless-void-operator */ '@typescript-eslint/no-meaningless-void-operator'?: Linter.RuleEntry<TypescriptEslintNoMeaninglessVoidOperator>; /** * Enforce valid definition of `new` and `constructor` * @see https://typescript-eslint.io/rules/no-misused-new */ '@typescript-eslint/no-misused-new'?: Linter.RuleEntry<[]>; /** * Disallow Promises in places not designed to handle them * @see https://typescript-eslint.io/rules/no-misused-promises */ '@typescript-eslint/no-misused-promises'?: Linter.RuleEntry<TypescriptEslintNoMisusedPromises>; /** * Disallow using the spread operator when it might cause unexpected behavior * @see https://typescript-eslint.io/rules/no-misused-spread */ '@typescript-eslint/no-misused-spread'?: Linter.RuleEntry<TypescriptEslintNoMisusedSpread>; /** * Disallow enums from having both number and string members * @see https://typescript-eslint.io/rules/no-mixed-enums */ '@typescript-eslint/no-mixed-enums'?: Linter.RuleEntry<[]>; /** * Disallow TypeScript namespaces * @see https://typescript-eslint.io/rules/no-namespace */ '@typescript-eslint/no-namespace'?: Linter.RuleEntry<TypescriptEslintNoNamespace>; /** * Disallow non-null assertions in the left operand of a nullish coalescing operator * @see https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing */ '@typescript-eslint/no-non-null-asserted-nullish-coalescing'?: Linter.RuleEntry<[]>; /** * Disallow non-null assertions after an optional chain expression * @see https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain */ '@typescript-eslint/no-non-null-asserted-optional-chain'?: Linter.RuleEntry<[]>; /** * Disallow non-null assertions using the `!` postfix operator * @see https://typescript-eslint.io/rules/no-non-null-assertion */ '@typescript-eslint/no-non-null-assertion'?: Linter.RuleEntry<[]>; /** * Disallow variable redeclaration * @see https://typescript-eslint.io/rules/no-redeclare */ '@typescript-eslint/no-redeclare'?: Linter.RuleEntry<TypescriptEslintNoRedeclare>; /** * Disallow members of unions and intersections that do nothing or override type information * @see https://typescript-eslint.io/rules/no-redundant-type-constituents */ '@typescript-eslint/no-redundant-type-constituents'?: Linter.RuleEntry<[]>; /** * Disallow invocation of `require()` * @see https://typescript-eslint.io/rules/no-require-imports */ '@typescript-eslint/no-require-imports'?: Linter.RuleEntry<TypescriptEslintNoRequireImports>; /** * Disallow specified modules when loaded by `import` * @see https://typescript-eslint.io/rules/no-restricted-imports */ '@typescript-eslint/no-restricted-imports'?: Linter.RuleEntry<TypescriptEslintNoRestrictedImports>; /** * Disallow certain types * @see https://typescript-eslint.io/rules/no-restricted-types */ '@typescript-eslint/no-restricted-types'?: Linter.RuleEntry<TypescriptEslintNoRestrictedTypes>; /** * Disallow variable declarations from shadowing variables declared in the outer scope * @see https://typescript-eslint.io/rules/no-shadow */ '@typescript-eslint/no-shadow'?: Linter.RuleEntry<TypescriptEslintNoShadow>; /** * Disallow aliasing `this` * @see https://typescript-eslint.io/rules/no-this-alias */ '@typescript-eslint/no-this-alias'?: Linter.RuleEntry<TypescriptEslintNoThisAlias>; /** * Disallow type aliases * @see https://typescript-eslint.io/rules/no-type-alias * @deprecated */ '@typescript-eslint/no-type-alias'?: Linter.RuleEntry<TypescriptEslintNoTypeAlias>; /** * Disallow unnecessary equality comparisons against boolean literals * @see https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare */ '@typescript-eslint/no-unnecessary-boolean-literal-compare'?: Linter.RuleEntry<TypescriptEslintNoUnnecessaryBooleanLiteralCompare>; /** * Disallow conditionals where the type is always truthy or always falsy * @see https://typescript-eslint.io/rules/no-unnecessary-condition */ '@typescript-eslint/no-unnecessary-condition'?: Linter.RuleEntry<TypescriptEslintNoUnnecessaryCondition>; /** * Disallow unnecessary assignment of constructor property parameter * @see https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment */ '@typescript-eslint/no-unnecessary-parameter-property-assignment'?: Linter.RuleEntry<[]>; /** * Disallow unnecessary namespace qualifiers * @see https://typescript-eslint.io/rules/no-unnecessary-qualifier */ '@typescript-eslint/no-unnecessary-qualifier'?: Linter.RuleEntry<[]>; /** * Disallow unnecessary template expressions * @see https://typescript-eslint.io/rules/no-unnecessary-template-expression */ '@typescript-eslint/no-unnecessary-template-expression'?: Linter.RuleEntry<[]>; /** * Disallow type arguments that are equal to the default * @see https://typescript-eslint.io/rules/no-unnecessary-type-arguments */ '@typescript-eslint/no-unnecessary-type-arguments'?: Linter.RuleEntry<[]>; /** * Disallow type assertions that do not change the type of an expression * @see https://typescript-eslint.io/rules/no-unnecessary-type-assertion */ '@typescript-eslint/no-unnecessary-type-assertion'?: Linter.RuleEntry<TypescriptEslintNoUnnecessaryTypeAssertion>; /** * Disallow unnecessary constraints on generic types * @see https://typescript-eslint.io/rules/no-unnecessary-type-constraint */ '@typescript-eslint/no-unnecessary-type-constraint'?: Linter.RuleEntry<[]>; /** * Disallow conversion idioms when they do not change the type or value of the expression * @see https://typescript-eslint.io/rules/no-unnecessary-type-conversion */ '@typescript-eslint/no-unnecessary-type-conversion'?: Linter.RuleEntry<[]>; /** * Disallow type parameters that aren't used multiple times * @see https://typescript-eslint.io/rules/no-unnecessary-type-parameters */ '@typescript-eslint/no-unnecessary-type-parameters'?: Linter.RuleEntry<[]>; /** * Disallow calling a function with a value with type `any` * @see https://typescript-eslint.io/rules/no-unsafe-argument */ '@typescript-eslint/no-unsafe-argument'?: Linter.RuleEntry<[]>; /** * Disallow assigning a value with type `any` to variables and properties * @see https://typescript-eslint.io/rules/no-unsafe-assignment */ '@typescript-eslint/no-unsafe-assignment'?: Linter.RuleEntry<[]>; /** * Disallow calling a value with type `any` * @see https://typescript-eslint.io/rules/no-unsafe-call */ '@typescript-eslint/no-unsafe-call'?: Linter.RuleEntry<[]>; /** * Disallow unsafe declaration merging * @see https://typescript-eslint.io/rules/no-unsafe-declaration-merging */ '@typescript-eslint/no-unsafe-declaration-merging'?: Linter.RuleEntry<[]>; /** * Disallow comparing an enum value with a non-enum value * @see https://typescript-eslint.io/rules/no-unsafe-enum-comparison */ '@typescript-eslint/no-unsafe-enum-comparison'?: Linter.RuleEntry<[]>; /** * Disallow using the unsafe built-in Function type * @see https://typescript-eslint.io/rules/no-unsafe-function-type */ '@typescript-eslint/no-unsafe-function-type'?: Linter.RuleEntry<[]>; /** * Disallow member access on a value with type `any` * @see https://typescript-eslint.io/rules/no-unsafe-member-access */ '@typescript-eslint/no-unsafe-member-access'?: Linter.RuleEntry<[]>; /** * Disallow returning a value with type `any` from a function * @see https://typescript-eslint.io/rules/no-unsafe-return */ '@typescript-eslint/no-unsafe-return'?: Linter.RuleEntry<[]>; /** * Disallow type assertions that narrow a type * @see https://typescript-eslint.io/rules/no-unsafe-type-assertion */ '@typescript-eslint/no-unsafe-type-assertion'?: Linter.RuleEntry<[]>; /** * Require unary negation to take a number * @see https://typescript-eslint.io/rules/no-unsafe-unary-minus */ '@typescript-eslint/no-unsafe-unary-minus'?: Linter.RuleEntry<[]>; /** * Disallow unused expressions * @see https://typescript-eslint.io/rules/no-unused-expressions */ '@typescript-eslint/no-unused-expressions'?: Linter.RuleEntry<TypescriptEslintNoUnusedExpressions>; /** * Disallow unused variables * @see https://typescript-eslint.io/rules/no-unused-vars */ '@typescript-eslint/no-unused-vars'?: Linter.RuleEntry<TypescriptEslintNoUnusedVars>; /** * Disallow the use of variables before they are defined * @see https://typescript-eslint.io/rules/no-use-before-define */ '@typescript-eslint/no-use-before-define'?: Linter.RuleEntry<TypescriptEslintNoUseBeforeDefine>; /** * Disallow unnecessary constructors * @see https://typescript-eslint.io/rules/no-useless-constructor */ '@typescript-eslint/no-useless-constructor'?: Linter.RuleEntry<[]>; /** * Disallow empty exports that don't change anything in a module file * @see https://typescript-eslint.io/rules/no-useless-empty-export */ '@typescript-eslint/no-useless-empty-export'?: Linter.RuleEntry<[]>; /** * Disallow `require` statements except in import statements * @see https://typescript-eslint.io/rules/no-var-requires * @deprecated */ '@typescript-eslint/no-var-requires'?: Linter.RuleEntry<TypescriptEslintNoVarRequires>; /** * Disallow using confusing built-in primitive class wrappers * @see https://typescript-eslint.io/rules/no-wrapper-object-types */ '@typescript-eslint/no-wrapper-object-types'?: Linter.RuleEntry<[]>; /** * Enforce non-null assertions over explicit type assertions * @see https://typescript-eslint.io/rules/non-nullable-type-assertion-style */ '@typescript-eslint/non-nullable-type-assertion-style'?: Linter.RuleEntry<[]>; /** * Disallow throwing non-`Error` values as exceptions * @see https://typescript-eslint.io/rules/only-throw-error */ '@typescript-eslint/only-throw-error'?: Linter.RuleEntry<TypescriptEslintOnlyThrowError>; /** * Require or disallow parameter properties in class constructors * @see https://typescript-eslint.io/rules/parameter-properties */ '@typescript-eslint/parameter-properties'?: Linter.RuleEntry<TypescriptEslintParameterProperties>; /** * Enforce the use of `as const` over literal type * @see https://typescript-eslint.io/rules/prefer-as-const */ '@typescript-eslint/prefer-as-const'?: Linter.RuleEntry<[]>; /** * Require destructuring from arrays and/or objects * @see https://typescript-eslint.io/rules/prefer-destructuring */ '@typescript-eslint/prefer-destructuring'?: Linter.RuleEntry<TypescriptEslintPreferDestructuring>; /** * Require each enum member value to be explicitly initialized * @see https://typescript-eslint.io/rules/prefer-enum-initializers */ '@typescript-eslint/prefer-enum-initializers'?: Linter.RuleEntry<[]>; /** * Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result * @see https://typescript-eslint.io/rules/prefer-find */ '@typescript-eslint/prefer-find'?: Linter.RuleEntry<[]>; /** * Enforce the use of `for-of` loop over the standard `for` loop where possible * @see https://typescript-eslint.io/rules/prefer-for-of */ '@typescript-eslint/prefer-for-of'?: Linter.RuleEntry<[]>; /** * Enforce using function types instead of interfaces with call signatures * @see https://typescript-eslint.io/rules/prefer-function-type */ '@typescript-eslint/prefer-function-type'?: Linter.RuleEntry<[]>; /** * Enforce `includes` method over `indexOf` method * @see https://typescript-eslint.io/rules/prefer-includes */ '@typescript-eslint/prefer-includes'?: Linter.RuleEntry<[]>; /** * Require all enum members to be literal values * @see https://typescript-eslint.io/rules/prefer-literal-enum-member */ '@typescript-eslint/prefer-literal-enum-member'?: Linter.RuleEntry<TypescriptEslintPreferLiteralEnumMember>; /** * Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules * @see https://typescript-eslint.io/rules/prefer-namespace-keyword */ '@typescript-eslint/prefer-namespace-keyword'?: Linter.RuleEntry<[]>; /** * Enforce using the nullish coalescing operator instead of logical assignments or chaining * @see https://typescript-eslint.io/rules/prefer-nullish-coalescing */ '@typescript-eslint/prefer-nullish-coalescing'?: Linter.RuleEntry<TypescriptEslintPreferNullishCoalescing>; /** * Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects * @see https://typescript-eslint.io/rules/prefer-optional-chain */ '@typescript-eslint/prefer-optional-chain'?: Linter.RuleEntry<TypescriptEslintPreferOptionalChain>; /** * Require using Error objects as Promise rejection reasons * @see https://typescript-eslint.io/rules/prefer-promise-reject-errors */ '@typescript-eslint/prefer-promise-reject-errors'?: Linter.RuleEntry<TypescriptEslintPreferPromiseRejectErrors>; /** * Require private members to be marked as `readonly` if they're never modified outside of the constructor * @see https://typescript-eslint.io/rules/prefer-readonly */ '@typescript-eslint/prefer-readonly'?: Linter.RuleEntry<TypescriptEslintPreferReadonly>; /** * Require function parameters to be typed as `readonly` to prevent accidental mutation of inputs * @see https://typescript-eslint.io/rules/prefer-readonly-parameter-types */ '@typescript-eslint/prefer-readonly-parameter-types'?: Linter.RuleEntry<TypescriptEslintPreferReadonlyParameterTypes>; /** * Enforce using type parameter when calling `Array#reduce` instead of using a type assertion * @see https://typescript-eslint.io/rules/prefer-reduce-type-parameter */ '@typescript-eslint/prefer-reduce-type-parameter'?: Linter.RuleEntry<[]>; /** * Enforce `RegExp#exec` over `String#match` if no global flag is provided * @see https://typescript-eslint.io/rules/prefer-regexp-exec */ '@typescript-eslint/prefer-regexp-exec'?: Linter.RuleEntry<[]>; /** * Enforce that `this` is used when only `this` type is returned * @see https://typescript-eslint.io/rules/prefer-return-this-type */ '@typescript-eslint/prefer-return-this-type'?: Linter.RuleEntry<[]>; /** * Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings * @see https://typescript-eslint.io/rules/prefer-string-starts-ends-with */ '@typescript-eslint/prefer-string-starts-ends-with'?: Linter.RuleEntry<TypescriptEslintPreferStringStartsEndsWith>; /** * Enforce using `@ts-expect-error` over `@ts-ignore` * @see https://typescript-eslint.io/rules/prefer-ts-expect-error * @deprecated */ '@typescript-eslint/prefer-ts-expect-error'?: Linter.RuleEntry<[]>; /** * Require any function or method that returns a Promise to be marked async * @see https://typescript-eslint.io/rules/promise-function-async */ '@typescript-eslint/promise