UNPKG

@datadayrepos/eslint-define-config

Version:

Provide a defineConfig function for .eslintrc.js files

2,003 lines (1,785 loc) 1.38 MB
import { ESLintMdxSettings } from 'eslint-plugin-mdx'; import { Linter, ESLint } from 'eslint'; /** * A literal type that supports custom further strings but preserves autocompletion in IDEs. * * @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609) */ type LiteralUnion<Union extends Base, Base = string> = | Union | (Base & { zz_IGNORE_ME?: never }); // Some types copied from `@types/eslint` `Linter.ParserOptions` /** * Any valid ECMAScript version number or 'latest': * * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ... * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ... * - 'latest' * * @see https://typescript-eslint.io/architecture/parser/#ecmaversion */ type EcmaVersion = | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 'latest'; /** * Set to "script" (default) or "module" if your code is in ECMAScript modules. */ type SourceType = 'script' | 'module'; /** * An object indicating which additional language features you'd like to use. * * @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options * @see https://typescript-eslint.io/architecture/parser#ecmafeatures */ interface EcmaFeatures extends Partial<Record<string, boolean>> { /** * Allow `return` statements in the global scope. */ globalReturn?: boolean; /** * Enable global [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) (if `ecmaVersion` is 5 or greater). */ impliedStrict?: boolean; /** * Enable [JSX](https://facebook.github.io/jsx). */ jsx?: boolean; } /** Lib. */ type Lib = LiteralUnion< | 'es5' | 'es6' | 'es2015' | 'es7' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'esnext' | 'dom' | 'dom.iterable' | 'webworker' | 'webworker.importscripts' | 'webworker.iterable' | 'scripthost' | 'es2015.core' | 'es2015.collection' | 'es2015.generator' | 'es2015.iterable' | 'es2015.promise' | 'es2015.proxy' | 'es2015.reflect' | 'es2015.symbol' | 'es2015.symbol.wellknown' | 'es2016.array.include' | 'es2017.object' | 'es2017.sharedmemory' | 'es2017.string' | 'es2017.intl' | 'es2017.typedarrays' | 'es2018.asyncgenerator' | 'es2018.asynciterable' | 'es2018.intl' | 'es2018.promise' | 'es2018.regexp' | 'es2019.array' | 'es2019.object' | 'es2019.string' | 'es2019.symbol' | 'es2020.bigint' | 'es2020.promise' | 'es2020.sharedmemory' | 'es2020.string' | 'es2020.symbol.wellknown' | 'es2020.intl' | 'esnext.array' | 'esnext.symbol' | 'esnext.asynciterable' | 'esnext.intl' | 'esnext.bigint' | 'esnext.string' | 'esnext.promise' | 'esnext.weakref' | 'es2016.full' | 'es2017.full' | 'es2018.full' | 'es2019.full' | 'es2020.full' | 'esnext.full' | 'lib' >; /** DebugLevel. */ type DebugLevel = | boolean | Array<'eslint' | 'typescript' | 'typescript-eslint'>; /** Parser. */ type Parser = LiteralUnion< | 'babel-eslint' | '@typescript-eslint/parser' | 'jsonc-eslint-parser' | 'vue-eslint-parser' >; /** * Parser options. * * @see [Specifying Parser Options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) */ interface ParserOptions extends Partial<Record<string, unknown>> { /** * Accepts any valid ECMAScript version number or `'latest'`: * * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or * - `'latest'` * * When it's a version or a year, the value must be a number - so do not include the `es` prefix. * * Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default * * @default 2018 * * @see https://typescript-eslint.io/architecture/parser/#ecmaversion */ ecmaVersion?: EcmaVersion; /** * Set to "script" (default) or "module" if your code is in ECMAScript modules. * * @default 'script' * * @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options */ sourceType?: SourceType; /** * An object indicating which additional language features you'd like to use. * * @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options * @see https://typescript-eslint.io/architecture/parser#ecmafeatures */ ecmaFeatures?: EcmaFeatures; /** * The identifier that's used for JSX Elements creation (after transpilation). * If you're using a library other than React (like `preact`), then you should change this value. * If you are using the [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) you can set this to `null`. * * This should not be a member expression - just the root identifier (i.e. use `"React"` instead of `"React.createElement"`). * * If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. * * @default 'React' * * @see [jsxPragma](https://typescript-eslint.io/architecture/parser#jsxpragma) */ jsxPragma?: string; /** * The identifier that's used for JSX fragment elements (after transpilation). * If `null`, assumes transpilation will always use a member of the configured `jsxPragma`. * This should not be a member expression - just the root identifier (i.e. use `"h"` instead of `"h.Fragment"`). * * If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. * * @default null * * @see [jsxFragmentName](https://typescript-eslint.io/architecture/parser#jsxfragmentname) */ jsxFragmentName?: string | null; /** * For valid options, see the [TypeScript compiler options](https://www.typescriptlang.org/tsconfig#lib). * * Specifies the TypeScript `libs` that are available. * This is used by the scope analyser to ensure there are global variables declared for the types exposed by TypeScript. * * If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. * * @default ['es2018'] * * @see [lib](https://typescript-eslint.io/architecture/parser/#lib) */ lib?: Lib[]; comment?: boolean; debugLevel?: DebugLevel; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; errorOnUnknownASTType?: boolean; /** * This option allows you to provide one or more additional file extensions which should be considered in the TypeScript Program compilation. * * The default extensions are `.ts`, `.tsx`, `.js`, and `.jsx`. Add extensions starting with `.`, followed by the file extension. * E.g. for a `.vue` file use `"extraFileExtensions: [".vue"]`. * * @see [extraFileExtensions](https://typescript-eslint.io/architecture/parser/#extrafileextensions) */ extraFileExtensions?: string[]; filePath?: string; loc?: boolean; /** * Parser. * * @see [Working with Custom Parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers) * @see [Specifying Parser](https://eslint.org/docs/user-guide/configuring/plugins#specifying-parser) */ parser?: Parser; /** * This option allows you to provide a path to your project's `tsconfig.json`. * **This setting is required if you want to use rules which require type information.** * Relative paths are interpreted relative to the current working directory if `tsconfigRootDir` is not set. * If you intend on running ESLint from directories other than the project root, you should consider using `tsconfigRootDir`. * * @default undefined * * @see [project](https://typescript-eslint.io/architecture/parser/#project) */ project?: string | string[] | true | null; /** * This option allows you to ignore folders from being included in your provided list of `project`s. * This is useful if you have configured glob patterns, but want to make sure you ignore certain folders. * * It accepts an array of globs to exclude from the `project` globs. * * For example, by default it will ensure that a glob like `./**‎/tsconfig.json` will not match any `tsconfigs` within your `node_modules` folder (some npm packages do not exclude their source files from their published packages). * * @default ['**‎/node_modules/**'] * * @see [projectFolderIgnoreList](https://typescript-eslint.io/architecture/parser/#projectfolderignorelist) */ projectFolderIgnoreList?: Array<string | RegExp>; range?: boolean; tokens?: boolean; /** * This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above. * * @see [tsconfigRootDir](https://typescript-eslint.io/architecture/parser/#tsconfigrootdir) */ tsconfigRootDir?: string; useJSXTextNode?: boolean; /** * This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported. * * @default true * * @see [warnOnUnsupportedTypeScriptVersion](https://typescript-eslint.io/architecture/parser/#warnonunsupportedtypescriptversion) */ warnOnUnsupportedTypeScriptVersion?: boolean; /** * This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/linting/typed-linting). * In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. * * @default undefined * * @see [emitDecoratorMetadata](https://typescript-eslint.io/architecture/parser/#emitdecoratormetadata) */ emitDecoratorMetadata?: boolean; /** * @see [vueFeatures](https://github.com/vuejs/vue-eslint-parser#parseroptionsvuefeatures) */ vueFeatures?: { /** * You can use `parserOptions.vueFeatures.filter` property to specify whether to parse the Vue2 filter. * * If you specify `false`, the parser does not parse `|` as a filter. * * @see [filter](https://github.com/vuejs/vue-eslint-parser#parseroptionsvuefeaturesfilter) */ filter?: boolean; /** * You can use `parserOptions.vueFeatures.interpolationAsNonHTML` property to specify whether to parse the interpolation as HTML. * * If you specify `true`, the parser handles the interpolation as non-HTML (However, you can use HTML escaping in the interpolation). * * @see [interpolationAsNonHTML](https://github.com/vuejs/vue-eslint-parser#parseroptionsvuefeaturesinterpolationasnonhtml) */ interpolationAsNonHTML?: boolean; }; /** * @see [templateTokenizer](https://github.com/rashfael/eslint-plugin-vue-pug#usage) */ templateTokenizer?: { pug?: LiteralUnion<'vue-eslint-parser-template-tokenizer-pug'>; }; } type Unprefix<T extends Record<string, any>, Pre extends string> = { [K in keyof T as K extends `${Pre}${infer U}` ? U : never]: T[K]; }; type Prefix<T extends Record<string, any>, Pre extends string> = { [K in keyof T as `${Pre}${K}`]: T[K]; }; type RenamePrefix<T extends Record<string, any>, Old extends string, New extends string> = Prefix<Unprefix<T, Old>, New>; type MergeIntersection<T extends Record<any, any>> = { [K in keyof T]: T[K]; }; // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/index.d.ts#L714-L716 /** * Rule ordinal severity. */ type Severity = 0 | 1 | 2; /** * Rule severity. */ type RuleLevel = Severity | 'off' | 'warn' | 'error'; /** * Rule severity. * * @alias RuleLevel */ type RuleSeverity = RuleLevel; // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/helpers.d.ts#L1-L3 type Prepend<Tuple extends any[], Addend> = (( _: Addend, ..._1: Tuple ) => any) extends (..._: infer Result) => any ? Result : never; // Synced to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/042141ce5f77f36df01c344ad09f32feda26c4fd/types/eslint/index.d.ts#L717-L719 /** * Rule configuration. */ type RuleLevelAndOptions<Options extends any[] = any[]> = Prepend< Partial<Options>, RuleLevel >; type RuleEntry<Options extends any[] = any[]> = | RuleLevel | RuleLevelAndOptions<Options>; /** * Rule configuration. * * @alias RuleEntry */ type RuleConfig<Options extends any[] = any[]> = RuleEntry<Options>; /** * Do not use deprecated APIs. * * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) */ type DeprecationRuleConfig = RuleConfig<[]>; /** * Do not use deprecated APIs. * * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) */ interface DeprecationRule { /** * Do not use deprecated APIs. * * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) */ 'deprecation/deprecation': DeprecationRuleConfig; } /** * All Deprecation rules. */ type DeprecationRules = DeprecationRule; /** * Option. */ interface AccessorPairsOption { getWithoutSet?: boolean; setWithoutGet?: boolean; enforceForClassMembers?: boolean; } /** * Options. */ type AccessorPairsOptions = [AccessorPairsOption?]; /** * Enforce getter and setter pairs in objects and classes. * * @see [accessor-pairs](https://eslint.org/docs/latest/rules/accessor-pairs) */ type AccessorPairsRuleConfig = RuleConfig<AccessorPairsOptions>; /** * Enforce getter and setter pairs in objects and classes. * * @see [accessor-pairs](https://eslint.org/docs/latest/rules/accessor-pairs) */ interface AccessorPairsRule { /** * Enforce getter and setter pairs in objects and classes. * * @see [accessor-pairs](https://eslint.org/docs/latest/rules/accessor-pairs) */ 'accessor-pairs': AccessorPairsRuleConfig; } /** * Option. */ type ArrayBracketNewlineOption$2 = | ('always' | 'never' | 'consistent') | { multiline?: boolean; minItems?: number | null; }; /** * Options. */ type ArrayBracketNewlineOptions$2 = [ArrayBracketNewlineOption$2?]; /** * Enforce linebreaks after opening and before closing array brackets. * * @see [array-bracket-newline](https://eslint.org/docs/latest/rules/array-bracket-newline) */ type ArrayBracketNewlineRuleConfig$2 = RuleConfig<ArrayBracketNewlineOptions$2>; /** * Enforce linebreaks after opening and before closing array brackets. * * @see [array-bracket-newline](https://eslint.org/docs/latest/rules/array-bracket-newline) */ interface ArrayBracketNewlineRule$2 { /** * Enforce linebreaks after opening and before closing array brackets. * * @see [array-bracket-newline](https://eslint.org/docs/latest/rules/array-bracket-newline) */ 'array-bracket-newline': ArrayBracketNewlineRuleConfig$2; } /** * Config. */ interface ArrayBracketSpacingConfig$2 { singleValue?: boolean; objectsInArrays?: boolean; arraysInArrays?: boolean; } /** * Option. */ type ArrayBracketSpacingOption$2 = 'always' | 'never'; /** * Options. */ type ArrayBracketSpacingOptions$2 = [ ArrayBracketSpacingOption$2?, ArrayBracketSpacingConfig$2?, ]; /** * Enforce consistent spacing inside array brackets. * * @see [array-bracket-spacing](https://eslint.org/docs/latest/rules/array-bracket-spacing) */ type ArrayBracketSpacingRuleConfig$2 = RuleConfig<ArrayBracketSpacingOptions$2>; /** * Enforce consistent spacing inside array brackets. * * @see [array-bracket-spacing](https://eslint.org/docs/latest/rules/array-bracket-spacing) */ interface ArrayBracketSpacingRule$2 { /** * Enforce consistent spacing inside array brackets. * * @see [array-bracket-spacing](https://eslint.org/docs/latest/rules/array-bracket-spacing) */ 'array-bracket-spacing': ArrayBracketSpacingRuleConfig$2; } /** * Option. */ interface ArrayCallbackReturnOption { allowImplicit?: boolean; checkForEach?: boolean; allowVoid?: boolean; } /** * Options. */ type ArrayCallbackReturnOptions = [ArrayCallbackReturnOption?]; /** * Enforce `return` statements in callbacks of array methods. * * @see [array-callback-return](https://eslint.org/docs/latest/rules/array-callback-return) */ type ArrayCallbackReturnRuleConfig = RuleConfig<ArrayCallbackReturnOptions>; /** * Enforce `return` statements in callbacks of array methods. * * @see [array-callback-return](https://eslint.org/docs/latest/rules/array-callback-return) */ interface ArrayCallbackReturnRule { /** * Enforce `return` statements in callbacks of array methods. * * @see [array-callback-return](https://eslint.org/docs/latest/rules/array-callback-return) */ 'array-callback-return': ArrayCallbackReturnRuleConfig; } /** * Option. */ type ArrayElementNewlineOption$2 = | [] | [ | BasicConfig$3 | { ArrayExpression?: BasicConfig$3; ArrayPattern?: BasicConfig$3; }, ]; type BasicConfig$3 = | ('always' | 'never' | 'consistent') | { multiline?: boolean; minItems?: number | null; }; /** * Options. */ type ArrayElementNewlineOptions$2 = ArrayElementNewlineOption$2; /** * Enforce line breaks after each array element. * * @see [array-element-newline](https://eslint.org/docs/latest/rules/array-element-newline) */ type ArrayElementNewlineRuleConfig$2 = RuleConfig<ArrayElementNewlineOptions$2>; /** * Enforce line breaks after each array element. * * @see [array-element-newline](https://eslint.org/docs/latest/rules/array-element-newline) */ interface ArrayElementNewlineRule$2 { /** * Enforce line breaks after each array element. * * @see [array-element-newline](https://eslint.org/docs/latest/rules/array-element-newline) */ 'array-element-newline': ArrayElementNewlineRuleConfig$2; } /** * Option. */ type ArrowBodyStyleOption = | [] | ['always' | 'never'] | [] | ['as-needed'] | [ 'as-needed', { requireReturnForObjectLiteral?: boolean; }, ]; /** * Options. */ type ArrowBodyStyleOptions = ArrowBodyStyleOption; /** * Require braces around arrow function bodies. * * @see [arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style) */ type ArrowBodyStyleRuleConfig = RuleConfig<ArrowBodyStyleOptions>; /** * Require braces around arrow function bodies. * * @see [arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style) */ interface ArrowBodyStyleRule { /** * Require braces around arrow function bodies. * * @see [arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style) */ 'arrow-body-style': ArrowBodyStyleRuleConfig; } /** * Config. */ interface ArrowParensConfig { requireForBlockBody?: boolean; } /** * Option. */ type ArrowParensOption = 'always' | 'as-needed'; /** * Options. */ type ArrowParensOptions = [ArrowParensOption?, ArrowParensConfig?]; /** * Require parentheses around arrow function arguments. * * @see [arrow-parens](https://eslint.org/docs/latest/rules/arrow-parens) */ type ArrowParensRuleConfig = RuleConfig<ArrowParensOptions>; /** * Require parentheses around arrow function arguments. * * @see [arrow-parens](https://eslint.org/docs/latest/rules/arrow-parens) */ interface ArrowParensRule { /** * Require parentheses around arrow function arguments. * * @see [arrow-parens](https://eslint.org/docs/latest/rules/arrow-parens) */ 'arrow-parens': ArrowParensRuleConfig; } /** * Option. */ interface ArrowSpacingOption$1 { before?: boolean; after?: boolean; } /** * Options. */ type ArrowSpacingOptions$1 = [ArrowSpacingOption$1?]; /** * Enforce consistent spacing before and after the arrow in arrow functions. * * @see [arrow-spacing](https://eslint.org/docs/latest/rules/arrow-spacing) */ type ArrowSpacingRuleConfig$1 = RuleConfig<ArrowSpacingOptions$1>; /** * Enforce consistent spacing before and after the arrow in arrow functions. * * @see [arrow-spacing](https://eslint.org/docs/latest/rules/arrow-spacing) */ interface ArrowSpacingRule$1 { /** * Enforce consistent spacing before and after the arrow in arrow functions. * * @see [arrow-spacing](https://eslint.org/docs/latest/rules/arrow-spacing) */ 'arrow-spacing': ArrowSpacingRuleConfig$1; } /** * Enforce the use of variables within the scope they are defined. * * @see [block-scoped-var](https://eslint.org/docs/latest/rules/block-scoped-var) */ type BlockScopedVarRuleConfig = RuleConfig<[]>; /** * Enforce the use of variables within the scope they are defined. * * @see [block-scoped-var](https://eslint.org/docs/latest/rules/block-scoped-var) */ interface BlockScopedVarRule { /** * Enforce the use of variables within the scope they are defined. * * @see [block-scoped-var](https://eslint.org/docs/latest/rules/block-scoped-var) */ 'block-scoped-var': BlockScopedVarRuleConfig; } /** * Option. */ type BlockSpacingOption$2 = 'always' | 'never'; /** * Options. */ type BlockSpacingOptions$2 = [BlockSpacingOption$2?]; /** * Disallow or enforce spaces inside of blocks after opening block and before closing block. * * @see [block-spacing](https://eslint.org/docs/latest/rules/block-spacing) */ type BlockSpacingRuleConfig$2 = RuleConfig<BlockSpacingOptions$2>; /** * Disallow or enforce spaces inside of blocks after opening block and before closing block. * * @see [block-spacing](https://eslint.org/docs/latest/rules/block-spacing) */ interface BlockSpacingRule$2 { /** * Disallow or enforce spaces inside of blocks after opening block and before closing block. * * @see [block-spacing](https://eslint.org/docs/latest/rules/block-spacing) */ 'block-spacing': BlockSpacingRuleConfig$2; } /** * Config. */ interface BraceStyleConfig$2 { allowSingleLine?: boolean; } /** * Option. */ type BraceStyleOption$2 = '1tbs' | 'stroustrup' | 'allman'; /** * Options. */ type BraceStyleOptions$2 = [BraceStyleOption$2?, BraceStyleConfig$2?]; /** * Enforce consistent brace style for blocks. * * @see [brace-style](https://eslint.org/docs/latest/rules/brace-style) */ type BraceStyleRuleConfig$2 = RuleConfig<BraceStyleOptions$2>; /** * Enforce consistent brace style for blocks. * * @see [brace-style](https://eslint.org/docs/latest/rules/brace-style) */ interface BraceStyleRule$2 { /** * Enforce consistent brace style for blocks. * * @see [brace-style](https://eslint.org/docs/latest/rules/brace-style) */ 'brace-style': BraceStyleRuleConfig$2; } /** * Option. */ type CallbackReturnOption$2 = string[]; /** * Options. */ type CallbackReturnOptions$2 = [CallbackReturnOption$2?]; /** * Require `return` statements after callbacks. * * @deprecated * * @see [callback-return](https://eslint.org/docs/latest/rules/callback-return) */ type CallbackReturnRuleConfig$2 = RuleConfig<CallbackReturnOptions$2>; /** * Require `return` statements after callbacks. * * @deprecated * * @see [callback-return](https://eslint.org/docs/latest/rules/callback-return) */ interface CallbackReturnRule$2 { /** * Require `return` statements after callbacks. * * @deprecated * * @see [callback-return](https://eslint.org/docs/latest/rules/callback-return) */ 'callback-return': CallbackReturnRuleConfig$2; } /** * Option. */ interface CamelcaseOption$1 { ignoreDestructuring?: boolean; ignoreImports?: boolean; ignoreGlobals?: boolean; properties?: 'always' | 'never'; /** * @minItems 0 */ allow?: [] | [string]; } /** * Options. */ type CamelcaseOptions$1 = [CamelcaseOption$1?]; /** * Enforce camelcase naming convention. * * @see [camelcase](https://eslint.org/docs/latest/rules/camelcase) */ type CamelcaseRuleConfig$1 = RuleConfig<CamelcaseOptions$1>; /** * Enforce camelcase naming convention. * * @see [camelcase](https://eslint.org/docs/latest/rules/camelcase) */ interface CamelcaseRule$1 { /** * Enforce camelcase naming convention. * * @see [camelcase](https://eslint.org/docs/latest/rules/camelcase) */ camelcase: CamelcaseRuleConfig$1; } /** * Config. */ type CapitalizedCommentsConfig = | { ignorePattern?: string; ignoreInlineComments?: boolean; ignoreConsecutiveComments?: boolean; } | { line?: { ignorePattern?: string; ignoreInlineComments?: boolean; ignoreConsecutiveComments?: boolean; }; block?: { ignorePattern?: string; ignoreInlineComments?: boolean; ignoreConsecutiveComments?: boolean; }; }; /** * Option. */ type CapitalizedCommentsOption = 'always' | 'never'; /** * Options. */ type CapitalizedCommentsOptions = [ CapitalizedCommentsOption?, CapitalizedCommentsConfig?, ]; /** * Enforce or disallow capitalization of the first letter of a comment. * * @see [capitalized-comments](https://eslint.org/docs/latest/rules/capitalized-comments) */ type CapitalizedCommentsRuleConfig = RuleConfig<CapitalizedCommentsOptions>; /** * Enforce or disallow capitalization of the first letter of a comment. * * @see [capitalized-comments](https://eslint.org/docs/latest/rules/capitalized-comments) */ interface CapitalizedCommentsRule { /** * Enforce or disallow capitalization of the first letter of a comment. * * @see [capitalized-comments](https://eslint.org/docs/latest/rules/capitalized-comments) */ 'capitalized-comments': CapitalizedCommentsRuleConfig; } /** * Option. */ interface ClassMethodsUseThisOption$1 { exceptMethods?: string[]; enforceForClassFields?: boolean; } /** * Options. */ type ClassMethodsUseThisOptions$1 = [ClassMethodsUseThisOption$1?]; /** * Enforce that class methods utilize `this`. * * @see [class-methods-use-this](https://eslint.org/docs/latest/rules/class-methods-use-this) */ type ClassMethodsUseThisRuleConfig$1 = RuleConfig<ClassMethodsUseThisOptions$1>; /** * Enforce that class methods utilize `this`. * * @see [class-methods-use-this](https://eslint.org/docs/latest/rules/class-methods-use-this) */ interface ClassMethodsUseThisRule$1 { /** * Enforce that class methods utilize `this`. * * @see [class-methods-use-this](https://eslint.org/docs/latest/rules/class-methods-use-this) */ 'class-methods-use-this': ClassMethodsUseThisRuleConfig$1; } /** * Option. */ type CommaDangleOption$3 = | [] | [ | Value$4 | { arrays?: ValueWithIgnore$3; objects?: ValueWithIgnore$3; imports?: ValueWithIgnore$3; exports?: ValueWithIgnore$3; functions?: ValueWithIgnore$3; }, ]; type Value$4 = 'always-multiline' | 'always' | 'never' | 'only-multiline'; type ValueWithIgnore$3 = | 'always-multiline' | 'always' | 'ignore' | 'never' | 'only-multiline'; /** * Options. */ type CommaDangleOptions$3 = CommaDangleOption$3; /** * Require or disallow trailing commas. * * @see [comma-dangle](https://eslint.org/docs/latest/rules/comma-dangle) */ type CommaDangleRuleConfig$3 = RuleConfig<CommaDangleOptions$3>; /** * Require or disallow trailing commas. * * @see [comma-dangle](https://eslint.org/docs/latest/rules/comma-dangle) */ interface CommaDangleRule$3 { /** * Require or disallow trailing commas. * * @see [comma-dangle](https://eslint.org/docs/latest/rules/comma-dangle) */ 'comma-dangle': CommaDangleRuleConfig$3; } /** * Option. */ interface CommaSpacingOption$2 { before?: boolean; after?: boolean; } /** * Options. */ type CommaSpacingOptions$2 = [CommaSpacingOption$2?]; /** * Enforce consistent spacing before and after commas. * * @see [comma-spacing](https://eslint.org/docs/latest/rules/comma-spacing) */ type CommaSpacingRuleConfig$2 = RuleConfig<CommaSpacingOptions$2>; /** * Enforce consistent spacing before and after commas. * * @see [comma-spacing](https://eslint.org/docs/latest/rules/comma-spacing) */ interface CommaSpacingRule$2 { /** * Enforce consistent spacing before and after commas. * * @see [comma-spacing](https://eslint.org/docs/latest/rules/comma-spacing) */ 'comma-spacing': CommaSpacingRuleConfig$2; } /** * Config. */ interface CommaStyleConfig$2 { exceptions?: { [k: string]: boolean; }; } /** * Option. */ type CommaStyleOption$2 = 'first' | 'last'; /** * Options. */ type CommaStyleOptions$2 = [CommaStyleOption$2?, CommaStyleConfig$2?]; /** * Enforce consistent comma style. * * @see [comma-style](https://eslint.org/docs/latest/rules/comma-style) */ type CommaStyleRuleConfig$2 = RuleConfig<CommaStyleOptions$2>; /** * Enforce consistent comma style. * * @see [comma-style](https://eslint.org/docs/latest/rules/comma-style) */ interface CommaStyleRule$2 { /** * Enforce consistent comma style. * * @see [comma-style](https://eslint.org/docs/latest/rules/comma-style) */ 'comma-style': CommaStyleRuleConfig$2; } /** * Option. */ type ComplexityOption = | number | { maximum?: number; max?: number; }; /** * Options. */ type ComplexityOptions = [ComplexityOption?]; /** * Enforce a maximum cyclomatic complexity allowed in a program. * * @see [complexity](https://eslint.org/docs/latest/rules/complexity) */ type ComplexityRuleConfig = RuleConfig<ComplexityOptions>; /** * Enforce a maximum cyclomatic complexity allowed in a program. * * @see [complexity](https://eslint.org/docs/latest/rules/complexity) */ interface ComplexityRule { /** * Enforce a maximum cyclomatic complexity allowed in a program. * * @see [complexity](https://eslint.org/docs/latest/rules/complexity) */ complexity: ComplexityRuleConfig; } /** * Config. */ interface ComputedPropertySpacingConfig { enforceForClassMembers?: boolean; } /** * Option. */ type ComputedPropertySpacingOption = 'always' | 'never'; /** * Options. */ type ComputedPropertySpacingOptions = [ ComputedPropertySpacingOption?, ComputedPropertySpacingConfig?, ]; /** * Enforce consistent spacing inside computed property brackets. * * @see [computed-property-spacing](https://eslint.org/docs/latest/rules/computed-property-spacing) */ type ComputedPropertySpacingRuleConfig = RuleConfig<ComputedPropertySpacingOptions>; /** * Enforce consistent spacing inside computed property brackets. * * @see [computed-property-spacing](https://eslint.org/docs/latest/rules/computed-property-spacing) */ interface ComputedPropertySpacingRule { /** * Enforce consistent spacing inside computed property brackets. * * @see [computed-property-spacing](https://eslint.org/docs/latest/rules/computed-property-spacing) */ 'computed-property-spacing': ComputedPropertySpacingRuleConfig; } /** * Option. */ interface ConsistentReturnOption { treatUndefinedAsUnspecified?: boolean; } /** * Options. */ type ConsistentReturnOptions = [ConsistentReturnOption?]; /** * Require `return` statements to either always or never specify values. * * @see [consistent-return](https://eslint.org/docs/latest/rules/consistent-return) */ type ConsistentReturnRuleConfig = RuleConfig<ConsistentReturnOptions>; /** * Require `return` statements to either always or never specify values. * * @see [consistent-return](https://eslint.org/docs/latest/rules/consistent-return) */ interface ConsistentReturnRule { /** * Require `return` statements to either always or never specify values. * * @see [consistent-return](https://eslint.org/docs/latest/rules/consistent-return) */ 'consistent-return': ConsistentReturnRuleConfig; } /** * Option. */ type ConsistentThisOption = string[]; /** * Options. */ type ConsistentThisOptions = ConsistentThisOption; /** * Enforce consistent naming when capturing the current execution context. * * @see [consistent-this](https://eslint.org/docs/latest/rules/consistent-this) */ type ConsistentThisRuleConfig = RuleConfig<ConsistentThisOptions>; /** * Enforce consistent naming when capturing the current execution context. * * @see [consistent-this](https://eslint.org/docs/latest/rules/consistent-this) */ interface ConsistentThisRule { /** * Enforce consistent naming when capturing the current execution context. * * @see [consistent-this](https://eslint.org/docs/latest/rules/consistent-this) */ 'consistent-this': ConsistentThisRuleConfig; } /** * Require `super()` calls in constructors. * * @see [constructor-super](https://eslint.org/docs/latest/rules/constructor-super) */ type ConstructorSuperRuleConfig = RuleConfig<[]>; /** * Require `super()` calls in constructors. * * @see [constructor-super](https://eslint.org/docs/latest/rules/constructor-super) */ interface ConstructorSuperRule { /** * Require `super()` calls in constructors. * * @see [constructor-super](https://eslint.org/docs/latest/rules/constructor-super) */ 'constructor-super': ConstructorSuperRuleConfig; } /** * Option. */ type CurlyOption = | [] | ['all'] | [] | ['multi' | 'multi-line' | 'multi-or-nest'] | ['multi' | 'multi-line' | 'multi-or-nest', 'consistent']; /** * Options. */ type CurlyOptions = CurlyOption; /** * Enforce consistent brace style for all control statements. * * @see [curly](https://eslint.org/docs/latest/rules/curly) */ type CurlyRuleConfig = RuleConfig<CurlyOptions>; /** * Enforce consistent brace style for all control statements. * * @see [curly](https://eslint.org/docs/latest/rules/curly) */ interface CurlyRule { /** * Enforce consistent brace style for all control statements. * * @see [curly](https://eslint.org/docs/latest/rules/curly) */ curly: CurlyRuleConfig; } /** * Option. */ interface DefaultCaseOption { commentPattern?: string; } /** * Options. */ type DefaultCaseOptions = [DefaultCaseOption?]; /** * Require `default` cases in `switch` statements. * * @see [default-case](https://eslint.org/docs/latest/rules/default-case) */ type DefaultCaseRuleConfig = RuleConfig<DefaultCaseOptions>; /** * Require `default` cases in `switch` statements. * * @see [default-case](https://eslint.org/docs/latest/rules/default-case) */ interface DefaultCaseRule { /** * Require `default` cases in `switch` statements. * * @see [default-case](https://eslint.org/docs/latest/rules/default-case) */ 'default-case': DefaultCaseRuleConfig; } /** * Enforce default clauses in switch statements to be last. * * @see [default-case-last](https://eslint.org/docs/latest/rules/default-case-last) */ type DefaultCaseLastRuleConfig = RuleConfig<[]>; /** * Enforce default clauses in switch statements to be last. * * @see [default-case-last](https://eslint.org/docs/latest/rules/default-case-last) */ interface DefaultCaseLastRule { /** * Enforce default clauses in switch statements to be last. * * @see [default-case-last](https://eslint.org/docs/latest/rules/default-case-last) */ 'default-case-last': DefaultCaseLastRuleConfig; } /** * Enforce default parameters to be last. * * @see [default-param-last](https://eslint.org/docs/latest/rules/default-param-last) */ type DefaultParamLastRuleConfig$1 = RuleConfig<[]>; /** * Enforce default parameters to be last. * * @see [default-param-last](https://eslint.org/docs/latest/rules/default-param-last) */ interface DefaultParamLastRule$1 { /** * Enforce default parameters to be last. * * @see [default-param-last](https://eslint.org/docs/latest/rules/default-param-last) */ 'default-param-last': DefaultParamLastRuleConfig$1; } /** * Option. */ type DotLocationOption$1 = 'object' | 'property'; /** * Options. */ type DotLocationOptions$1 = [DotLocationOption$1?]; /** * Enforce consistent newlines before and after dots. * * @see [dot-location](https://eslint.org/docs/latest/rules/dot-location) */ type DotLocationRuleConfig$1 = RuleConfig<DotLocationOptions$1>; /** * Enforce consistent newlines before and after dots. * * @see [dot-location](https://eslint.org/docs/latest/rules/dot-location) */ interface DotLocationRule$1 { /** * Enforce consistent newlines before and after dots. * * @see [dot-location](https://eslint.org/docs/latest/rules/dot-location) */ 'dot-location': DotLocationRuleConfig$1; } /** * Option. */ interface DotNotationOption$2 { allowKeywords?: boolean; allowPattern?: string; } /** * Options. */ type DotNotationOptions$2 = [DotNotationOption$2?]; /** * Enforce dot notation whenever possible. * * @see [dot-notation](https://eslint.org/docs/latest/rules/dot-notation) */ type DotNotationRuleConfig$2 = RuleConfig<DotNotationOptions$2>; /** * Enforce dot notation whenever possible. * * @see [dot-notation](https://eslint.org/docs/latest/rules/dot-notation) */ interface DotNotationRule$2 { /** * Enforce dot notation whenever possible. * * @see [dot-notation](https://eslint.org/docs/latest/rules/dot-notation) */ 'dot-notation': DotNotationRuleConfig$2; } /** * Option. */ type EolLastOption = 'always' | 'never' | 'unix' | 'windows'; /** * Options. */ type EolLastOptions = [EolLastOption?]; /** * Require or disallow newline at the end of files. * * @see [eol-last](https://eslint.org/docs/latest/rules/eol-last) */ type EolLastRuleConfig = RuleConfig<EolLastOptions>; /** * Require or disallow newline at the end of files. * * @see [eol-last](https://eslint.org/docs/latest/rules/eol-last) */ interface EolLastRule { /** * Require or disallow newline at the end of files. * * @see [eol-last](https://eslint.org/docs/latest/rules/eol-last) */ 'eol-last': EolLastRuleConfig; } /** * Option. */ type EqeqeqOption$1 = | [] | ['always'] | [ 'always', { null?: 'always' | 'never' | 'ignore'; }, ] | [] | ['smart' | 'allow-null']; /** * Options. */ type EqeqeqOptions$1 = EqeqeqOption$1; /** * Require the use of `===` and `!==`. * * @see [eqeqeq](https://eslint.org/docs/latest/rules/eqeqeq) */ type EqeqeqRuleConfig$1 = RuleConfig<EqeqeqOptions$1>; /** * Require the use of `===` and `!==`. * * @see [eqeqeq](https://eslint.org/docs/latest/rules/eqeqeq) */ interface EqeqeqRule$1 { /** * Require the use of `===` and `!==`. * * @see [eqeqeq](https://eslint.org/docs/latest/rules/eqeqeq) */ eqeqeq: EqeqeqRuleConfig$1; } /** * Enforce "for" loop update clause moving the counter in the right direction. * * @see [for-direction](https://eslint.org/docs/latest/rules/for-direction) */ type ForDirectionRuleConfig = RuleConfig<[]>; /** * Enforce "for" loop update clause moving the counter in the right direction. * * @see [for-direction](https://eslint.org/docs/latest/rules/for-direction) */ interface ForDirectionRule { /** * Enforce "for" loop update clause moving the counter in the right direction. * * @see [for-direction](https://eslint.org/docs/latest/rules/for-direction) */ 'for-direction': ForDirectionRuleConfig; } /** * Option. */ type FuncCallSpacingOption$2 = | [] | ['never'] | [] | ['always'] | [ 'always', { allowNewlines?: boolean; }, ]; /** * Options. */ type FuncCallSpacingOptions$2 = FuncCallSpacingOption$2; /** * Require or disallow spacing between function identifiers and their invocations. * * @see [func-call-spacing](https://eslint.org/docs/latest/rules/func-call-spacing) */ type FuncCallSpacingRuleConfig$2 = RuleConfig<FuncCallSpacingOptions$2>; /** * Require or disallow spacing between function identifiers and their invocations. * * @see [func-call-spacing](https://eslint.org/docs/latest/rules/func-call-spacing) */ interface FuncCallSpacingRule$2 { /** * Require or disallow spacing between function identifiers and their invocations. * * @see [func-call-spacing](https://eslint.org/docs/latest/rules/func-call-spacing) */ 'func-call-spacing': FuncCallSpacingRuleConfig$2; } /** * Option. */ type FuncNameMatchingOption = | [] | ['always' | 'never'] | [ 'always' | 'never', { considerPropertyDescriptor?: boolean; includeCommonJSModuleExports?: boolean; }, ] | [] | [ { considerPropertyDescriptor?: boolean; includeCommonJSModuleExports?: boolean; }, ]; /** * Options. */ type FuncNameMatchingOptions = FuncNameMatchingOption; /** * Require function names to match the name of the variable or property to which they are assigned. * * @see [func-name-matching](https://eslint.org/docs/latest/rules/func-name-matching) */ type FuncNameMatchingRuleConfig = RuleConfig<FuncNameMatchingOptions>; /** * Require function names to match the name of the variable or property to which they are assigned. * * @see [func-name-matching](https://eslint.org/docs/latest/rules/func-name-matching) */ interface FuncNameMatchingRule { /** * Require function names to match the name of the variable or property to which they are assigned. * * @see [func-name-matching](https://eslint.org/docs/latest/rules/func-name-matching) */ 'func-name-matching': FuncNameMatchingRuleConfig; } /** * Option. */ type FuncNamesOption = | [] | [Value$3] | [ Value$3, { generators?: Value$3; }, ]; type Value$3 = 'always' | 'as-needed' | 'never'; /** * Options. */ type FuncNamesOptions = FuncNamesOption; /** * Require or disallow named `function` expressions. * * @see [func-names](https://eslint.org/docs/latest/rules/func-names) */ type FuncNamesRuleConfig = RuleConfig<FuncNamesOptions>; /** * Require or disallow named `function` expressions. * * @see [func-names](https://eslint.org/docs/latest/rules/func-names) */ interface FuncNamesRule { /** * Require or disallow named `function` expressions. * * @see [func-names](https://eslint.org/docs/latest/rules/func-names) */ 'func-names': FuncNamesRuleConfig; } /** * Config. */ interface FuncStyleConfig { allowArrowFunctions?: boolean; } /** * Option. */ type FuncStyleOption = 'declaration' | 'expression'; /** * Options. */ type FuncStyleOptions = [FuncStyleOption?, FuncStyleConfig?]; /** * Enforce the consistent use of either `function` declarations or expressions. * * @see [func-style](https://eslint.org/docs/latest/rules/func-style) */ type FuncStyleRuleConfig = RuleConfig<FuncStyleOptions>; /** * Enforce the consistent use of either `function` declarations or expressions. * * @see [func-style](https://eslint.org/docs/latest/rules/func-style) */ interface FuncStyleRule { /** * Enforce the consistent use of either `function` declarations or expressions. * * @see [func-style](https://eslint.org/docs/latest/rules/func-style) */ 'func-style': FuncStyleRuleConfig; } /** * Option. */ type FunctionCallArgumentNewlineOption = | 'always' | 'never' | 'consistent'; /** * Options. */ type FunctionCallArgumentNewlineOptions = [ FunctionCallArgumentNewlineOption?, ]; /** * Enforce line breaks between arguments of a function call. * * @see [function-call-argument-newline](https://eslint.org/docs/latest/rules/function-call-argument-newline) */ type FunctionCallArgumentNewlineRuleConfig = RuleConfig<FunctionCallArgumentNewlineOptions>; /** * Enforce line breaks between arguments of a function call. * * @see [function-call-argument-newline](https://eslint.org/docs/latest/rules/function-call-argument-newline) */ interface FunctionCallArgumentNewlineRule { /** * Enforce line breaks between arguments of a function call. * * @see [function-call-argument-newline](https://eslint.org/docs/latest/rules/function-call-argument-newline) */ 'function-call-argument-newline': FunctionCallArgumentNewlineRuleConfig; } /** * Option. */ type FunctionParenNewlineOption = | ('always' | 'never' | 'consistent' | 'multiline' | 'multiline-arguments') | { minItems?: number; }; /** * Options. */ type FunctionParenNewlineOptions = [FunctionParenNewlineOption?]; /** * Enforce consistent line breaks inside function parentheses. * * @see [function-paren-newline](https://eslint.org/docs/latest/rules/function-paren-newline) */ type FunctionParenNewlineRuleConfig = RuleConfig<FunctionParenNewlineOptions>; /** * Enforce consistent line breaks inside function parentheses. * * @see [function-paren-newline](https://eslint.org/docs/latest/rules/function-paren-newline) */ interface FunctionParenNewlineRule { /** * Enforce consistent line breaks inside function parentheses. * * @see [function-paren-newline](https://eslint.org/docs/latest/rules/function-paren-newline) */ 'function-paren-newline': FunctionParenNewlineRuleConfig; } /** * Option. */ type GeneratorStarSpacingOption = | ('before' | 'after' | 'both' | 'neither') | { before?: boolean; after?: boolean; named?: | ('before' | 'after' | 'both' | 'neither') | { before?: boolean; after?: boolean; }; anonymous?: | ('before' | 'after' | 'both' | 'neither') | { before?: boolean; after?: boolean; }; method?: | ('before' | 'after' | 'both' | 'neither') | { before?: boolean; after?: boolean; }; }; /** * Options. */ type GeneratorStarSpacingOptions = [GeneratorStarSpacingOption?]; /** * Enforce consistent spacing around `*` operators in generator functions. * * @see [generator-star-spacing](https://eslint.org/docs/latest/rules/generator-star-spacing) */ type GeneratorStarSpacingRuleConfig = RuleConfig<GeneratorStarSpacingOptions>; /** * Enforce consistent spacing around `*` operators in generator functions. * * @see [generator-star-spacing](https://eslint.org/docs/latest/rules/generator-star-spacing) */ interface GeneratorStarSpacingRule { /** * Enforce consistent spacing around `*` operators in generator functions. * * @see [generator-star-spacing](https://eslint.org/docs/latest/rules/generator-star-spacing) */ 'generator-star-spacing': GeneratorStarSpacingRuleConfig; } /** * Option. */ interface GetterReturnOption { allowImplicit?: boolean; } /** * Options. */ type GetterReturnOptions = [GetterReturnOption?]; /** * Enforce `return` statements in getters. * * @see [getter-return](https://eslint.org/docs/latest/rules/getter-return) */ type GetterReturnRuleConfig = RuleConfig<GetterReturnOptions>; /** * Enforce `return` statements in getters. * * @see [getter-return](https://eslint.org/docs/latest/rules/getter-return) */ interface GetterReturnRule { /** * Enforce `return` statements in getters. * * @see [getter-return](https://eslint.org/docs/latest/rules/getter-return) */ 'getter-return': GetterReturnRuleConfig; } /** * Require `require()` calls to be placed at top-level module scope. * * @deprecated * * @see [global-require](https://eslint.org/docs/latest/rules/global-require) */ type GlobalRequireRuleConfig$2 = RuleConfig<[]>; /** * Require `require()` calls to be placed at top-level module scope. * * @deprecated * * @see [global-require](https://eslint.org/docs/latest/rules/global-require) */ interface GlobalRequireRule$2 { /** * Require `require()` calls to be placed at top-level module scope. * * @deprecated * * @see [global-require](https://eslint.org/docs/latest/rules/global-require) */ 'global-require': GlobalRequireRuleConfig$2; } /** * Option. */ type GroupedAccessorPairsOption = | 'anyOrder' | 'getBeforeSet' | 'setBeforeGet'; /** * Options. */ type GroupedAccessorPairsOptions = [GroupedAccessorPairsOption?]; /** * Require grouped accessor pairs in object literals and classes. * * @see [grouped-accessor-pairs](https://eslint.org/docs/latest/rules/grouped-accessor-pairs) */ type GroupedAccessorPairsRuleConfig = RuleConfig<GroupedAccessorPairsOptions>; /** * Require grouped accessor pairs in object literals and classes. * * @see [grouped-accessor-pairs](https://eslint.org/docs/latest/rules/grouped-accessor-pairs) */ interface GroupedAccessorPairsRule { /** * Require grouped accessor pairs in object literals and classes. * * @see [grouped-accessor-pairs](https://eslint.org/docs/latest/rules/grouped-accessor-pairs) */ 'grouped-accessor-pairs': GroupedAccessorPairsRuleConfig; } /** * Require `for-in` loops to include an `if` statement. * * @see [guard-for-in](https://eslint.org/docs/latest/rules/guard-for-in) */ type GuardForInRuleConfig = RuleConfig<[]>; /** * Require `for-in` loops to include an `if` statement. * * @see [guard-for-in](https://eslint.org/docs/latest/rules/guard-for-in) */ interface GuardForInRule { /** * Require `for-in` loops to include an `if` statement. * * @see [guard-for-in](https://eslint.org/docs/latest/rules/guard-for-in) */ 'guard-for-in': GuardForInRuleConfig; } /** * Option. */ type HandleCallbackErrOption$2 = string; /** * Options. */ type HandleCallbackErrOptions$2 = [HandleCallbackErrOption$2?]; /** * Require error handling in callbacks. * * @deprecated * * @see [handle-callback-err](https://eslint.org/docs/latest/rules/handle-callback-err) */ type HandleCallbackErrRuleConfig$2 = RuleConfig<HandleCallbackErrOptions$2>; /** * Require error handling in callbacks. * * @deprecated * * @see [handle-callback-err](https://eslint.org/docs/latest/rules/handle-callback-err) */ interface HandleCallbackErrRule$2 { /** * Require error handling in cal