UNPKG

eslint

Version:

An AST-based pattern checker for JavaScript.

2,067 lines (1,966 loc) 127 kB
/** * @fileoverview This file contains the rule types for ESLint. It was initially extracted * from the `@types/eslint` package. */ /* * MIT License * Copyright (c) Microsoft Corporation. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE */ //------------------------------------------------------------------------------ // Imports //------------------------------------------------------------------------------ import { Linter } from "./index"; //----------------------------------------------------------------------------- // Helper types //----------------------------------------------------------------------------- interface NoRestrictedImportPathCommonOptions { name: string; message?: string; } type EitherImportNamesOrAllowImportName = | { importNames?: string[]; allowImportNames?: never } | { allowImportNames?: string[]; importNames?: never }; type ValidNoRestrictedImportPathOptions = NoRestrictedImportPathCommonOptions & EitherImportNamesOrAllowImportName; interface NoRestrictedImportPatternCommonOptions { message?: string; caseSensitive?: boolean; } // Base type for group or regex constraint, ensuring mutual exclusivity type EitherGroupOrRegEx = | { group: string[]; regex?: never } | { regex: string; group?: never }; // Base type for import name specifiers, ensuring mutual exclusivity type EitherNameSpecifiers = | { importNames: string[]; allowImportNames?: never; importNamePattern?: never; allowImportNamePattern?: never; } | { importNamePattern: string; allowImportNames?: never; importNames?: never; allowImportNamePattern?: never; } | { allowImportNames: string[]; importNames?: never; importNamePattern?: never; allowImportNamePattern?: never; } | { allowImportNamePattern: string; importNames?: never; allowImportNames?: never; importNamePattern?: never; }; // Adds oneOf and not constraints, ensuring group or regex are present and mutually exclusive sets for importNames, allowImportNames, etc., as per the schema. type ValidNoRestrictedImportPatternOptions = NoRestrictedImportPatternCommonOptions & EitherGroupOrRegEx & EitherNameSpecifiers; //----------------------------------------------------------------------------- // Public types //----------------------------------------------------------------------------- export interface ESLintRules extends Linter.RulesRecord { /** * Rule to enforce getter and setter pairs in objects and classes. * * @since 0.22.0 * @see https://eslint.org/docs/latest/rules/accessor-pairs */ "accessor-pairs": Linter.RuleEntry< [ Partial<{ /** * @default true */ setWithoutGet: boolean; /** * @default false */ getWithoutSet: boolean; /** * @default true */ enforceForClassMembers: boolean; }>, ] >; /** * Rule to enforce linebreaks after opening and before closing array brackets. * * @since 4.0.0-alpha.1 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`array-bracket-newline`](https://eslint.style/rules/js/array-bracket-newline) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/array-bracket-newline */ "array-bracket-newline": Linter.RuleEntry< [ | "always" | "never" | "consistent" | Partial<{ /** * @default true */ multiline: boolean; /** * @default null */ minItems: number | null; }>, ] >; /** * Rule to enforce consistent spacing inside array brackets. * * @since 0.24.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`array-bracket-spacing`](https://eslint.style/rules/js/array-bracket-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/array-bracket-spacing */ "array-bracket-spacing": | Linter.RuleEntry< [ "never", Partial<{ /** * @default false */ singleValue: boolean; /** * @default false */ objectsInArrays: boolean; /** * @default false */ arraysInArrays: boolean; }>, ] > | Linter.RuleEntry< [ "always", Partial<{ /** * @default true */ singleValue: boolean; /** * @default true */ objectsInArrays: boolean; /** * @default true */ arraysInArrays: boolean; }>, ] >; /** * Rule to enforce `return` statements in callbacks of array methods. * * @since 2.0.0-alpha-1 * @see https://eslint.org/docs/latest/rules/array-callback-return */ "array-callback-return": Linter.RuleEntry< [ Partial<{ /** * @default false */ allowImplicit: boolean; /** * @default false */ checkForEach: boolean; /** * @default false */ allowVoid: boolean; }>, ] >; /** * Rule to enforce line breaks after each array element. * * @since 4.0.0-rc.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`array-element-newline`](https://eslint.style/rules/js/array-element-newline) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/array-element-newline */ "array-element-newline": Linter.RuleEntry< [ | "always" | "never" | "consistent" | Partial<{ /** * @default true */ multiline: boolean; /** * @default null */ minItems: number | null; }>, ] >; /** * Rule to require braces around arrow function bodies. * * @since 1.8.0 * @see https://eslint.org/docs/latest/rules/arrow-body-style */ "arrow-body-style": | Linter.RuleEntry< [ "as-needed", Partial<{ /** * @default false */ requireReturnForObjectLiteral: boolean; }>, ] > | Linter.RuleEntry<["always" | "never"]>; /** * Rule to require parentheses around arrow function arguments. * * @since 1.0.0-rc-1 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`arrow-parens`](https://eslint.style/rules/js/arrow-parens) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/arrow-parens */ "arrow-parens": | Linter.RuleEntry<["always"]> | Linter.RuleEntry< [ "as-needed", Partial<{ /** * @default false */ requireForBlockBody: boolean; }>, ] >; /** * Rule to enforce consistent spacing before and after the arrow in arrow functions. * * @since 1.0.0-rc-1 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`arrow-spacing`](https://eslint.style/rules/js/arrow-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/arrow-spacing */ "arrow-spacing": Linter.RuleEntry<[]>; /** * Rule to enforce the use of variables within the scope they are defined. * * @since 0.1.0 * @see https://eslint.org/docs/latest/rules/block-scoped-var */ "block-scoped-var": Linter.RuleEntry<[]>; /** * Rule to disallow or enforce spaces inside of blocks after opening block and before closing block. * * @since 1.2.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`block-spacing`](https://eslint.style/rules/js/block-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/block-spacing */ "block-spacing": Linter.RuleEntry<["always" | "never"]>; /** * Rule to enforce consistent brace style for blocks. * * @since 0.0.7 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`brace-style`](https://eslint.style/rules/js/brace-style) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/brace-style */ "brace-style": Linter.RuleEntry< [ "1tbs" | "stroustrup" | "allman", Partial<{ /** * @default false */ allowSingleLine: boolean; }>, ] >; /** * Rule to require `return` statements after callbacks. * * @since 1.0.0-rc-1 * @deprecated since 7.0.0. * Node.js rules were moved out of ESLint core. * Please, use [`callback-return`](https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/callback-return.md) in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n). * @see https://eslint.org/docs/latest/rules/callback-return */ "callback-return": Linter.RuleEntry<[string[]]>; /** * Rule to enforce camelcase naming convention. * * @since 0.0.2 * @see https://eslint.org/docs/latest/rules/camelcase */ camelcase: Linter.RuleEntry< [ Partial<{ /** * @default 'always' */ properties: "always" | "never"; /** * @default false */ ignoreDestructuring: boolean; /** * @since 6.7.0 * @default false */ ignoreImports: boolean; /** * @since 7.4.0 * @default false */ ignoreGlobals: boolean; /** * @remarks * Also accept for regular expression patterns */ allow: string[]; }>, ] >; /** * Rule to enforce or disallow capitalization of the first letter of a comment. * * @since 3.11.0 * @see https://eslint.org/docs/latest/rules/capitalized-comments */ "capitalized-comments": Linter.RuleEntry< [ "always" | "never", Partial<{ ignorePattern: string; /** * @default false */ ignoreInlineComments: boolean; /** * @default false */ ignoreConsecutiveComments: boolean; }>, ] >; /** * Rule to enforce that class methods utilize `this`. * * @since 3.4.0 * @see https://eslint.org/docs/latest/rules/class-methods-use-this */ "class-methods-use-this": Linter.RuleEntry< [ Partial<{ exceptMethods: string[]; }>, ] >; /** * Rule to require or disallow trailing commas. * * @since 0.16.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`comma-dangle`](https://eslint.style/rules/js/comma-dangle) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/comma-dangle */ "comma-dangle": Linter.RuleEntry< [ | "never" | "always" | "always-multiline" | "only-multiline" | Partial<{ /** * @default 'never' */ arrays: | "never" | "always" | "always-multiline" | "only-multiline"; /** * @default 'never' */ objects: | "never" | "always" | "always-multiline" | "only-multiline"; /** * @default 'never' */ imports: | "never" | "always" | "always-multiline" | "only-multiline"; /** * @default 'never' */ exports: | "never" | "always" | "always-multiline" | "only-multiline"; /** * @default 'never' */ functions: | "never" | "always" | "always-multiline" | "only-multiline"; }>, ] >; /** * Rule to enforce consistent spacing before and after commas. * * @since 0.9.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`comma-spacing`](https://eslint.style/rules/js/comma-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/comma-spacing */ "comma-spacing": Linter.RuleEntry< [ Partial<{ /** * @default false */ before: boolean; /** * @default true */ after: boolean; }>, ] >; /** * Rule to enforce consistent comma style. * * @since 0.9.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`comma-style`](https://eslint.style/rules/js/comma-style) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/comma-style */ "comma-style": Linter.RuleEntry< [ "last" | "first", Partial<{ exceptions: Record<string, boolean>; }>, ] >; /** * Rule to enforce a maximum cyclomatic complexity allowed in a program. * * @since 0.0.9 * @see https://eslint.org/docs/latest/rules/complexity */ complexity: Linter.RuleEntry< [ | Partial<{ /** * @default 20 */ max: number; /** * @deprecated * @default 20 */ maximum: number; /** * @default "classic" * @since 9.12.0 */ variant: "classic" | "modified"; }> | number, ] >; /** * Rule to enforce consistent spacing inside computed property brackets. * * @since 0.23.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`computed-property-spacing`](https://eslint.style/rules/js/computed-property-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/computed-property-spacing */ "computed-property-spacing": Linter.RuleEntry<["never" | "always"]>; /** * Rule to require `return` statements to either always or never specify values. * * @since 0.4.0 * @see https://eslint.org/docs/latest/rules/consistent-return */ "consistent-return": Linter.RuleEntry< [ Partial<{ /** * @default false */ treatUndefinedAsUnspecified: boolean; }>, ] >; /** * Rule to enforce consistent naming when capturing the current execution context. * * @since 0.0.9 * @see https://eslint.org/docs/latest/rules/consistent-this */ "consistent-this": Linter.RuleEntry<[...string[]]>; /** * Rule to require `super()` calls in constructors. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 0.24.0 * @see https://eslint.org/docs/latest/rules/constructor-super */ "constructor-super": Linter.RuleEntry<[]>; /** * Rule to enforce consistent brace style for all control statements. * * @since 0.0.2 * @see https://eslint.org/docs/latest/rules/curly */ curly: Linter.RuleEntry< ["all" | "multi" | "multi-line" | "multi-or-nest" | "consistent"] >; /** * Rule to require `default` cases in `switch` statements. * * @since 0.6.0 * @see https://eslint.org/docs/latest/rules/default-case */ "default-case": Linter.RuleEntry< [ Partial<{ /** * @default '^no default$' */ commentPattern: string; }>, ] >; /** * Rule to enforce `default` clauses in `switch` statements to be last. * * @since 7.0.0-alpha.0 * @see https://eslint.org/docs/latest/rules/default-case-last */ "default-case-last": Linter.RuleEntry<[]>; /** * Rule to enforce default parameters to be last. * * @since 6.4.0 * @see https://eslint.org/docs/latest/rules/default-param-last */ "default-param-last": Linter.RuleEntry<[]>; /** * Rule to enforce consistent newlines before and after dots. * * @since 0.21.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`dot-location`](https://eslint.style/rules/js/dot-location) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/dot-location */ "dot-location": Linter.RuleEntry<["object" | "property"]>; /** * Rule to enforce dot notation whenever possible. * * @since 0.0.7 * @see https://eslint.org/docs/latest/rules/dot-notation */ "dot-notation": Linter.RuleEntry< [ Partial<{ /** * @default true */ allowKeywords: boolean; allowPattern: string; }>, ] >; /** * Rule to require or disallow newline at the end of files. * * @since 0.7.1 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`eol-last`](https://eslint.style/rules/js/eol-last) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/eol-last */ "eol-last": Linter.RuleEntry< [ "always" | "never", // | 'unix' | 'windows' ] >; /** * Rule to require the use of `===` and `!==`. * * @since 0.0.2 * @see https://eslint.org/docs/latest/rules/eqeqeq */ eqeqeq: | Linter.RuleEntry< [ "always", Partial<{ /** * @default 'always' */ null: "always" | "never" | "ignore"; }>, ] > | Linter.RuleEntry<["smart" | "allow-null"]>; /** * Rule to enforce `for` loop update clause moving the counter in the right direction. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 4.0.0-beta.0 * @see https://eslint.org/docs/latest/rules/for-direction */ "for-direction": Linter.RuleEntry<[]>; /** * Rule to require or disallow spacing between function identifiers and their invocations. * * @since 3.3.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`function-call-spacing`](https://eslint.style/rules/js/function-call-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/func-call-spacing */ "func-call-spacing": Linter.RuleEntry<["never" | "always"]>; /** * Rule to require function names to match the name of the variable or property to which they are assigned. * * @since 3.8.0 * @see https://eslint.org/docs/latest/rules/func-name-matching */ "func-name-matching": | Linter.RuleEntry< [ "always" | "never", Partial<{ /** * @default false */ considerPropertyDescriptor: boolean; /** * @default false */ includeCommonJSModuleExports: boolean; }>, ] > | Linter.RuleEntry< [ Partial<{ /** * @default false */ considerPropertyDescriptor: boolean; /** * @default false */ includeCommonJSModuleExports: boolean; }>, ] >; /** * Rule to require or disallow named `function` expressions. * * @since 0.4.0 * @see https://eslint.org/docs/latest/rules/func-names */ "func-names": Linter.RuleEntry< [ "always" | "as-needed" | "never", Partial<{ generators: "always" | "as-needed" | "never"; }>, ] >; /** * Rule to enforce the consistent use of either `function` declarations or expressions assigned to variables. * * @since 0.2.0 * @see https://eslint.org/docs/latest/rules/func-style */ "func-style": Linter.RuleEntry< [ "expression" | "declaration", Partial<{ /** * @default false */ allowArrowFunctions: boolean; overrides: { namedExports: "declaration" | "expression" | "ignore"; }; }>, ] >; /** * Rule to enforce line breaks between arguments of a function call. * * @since 6.2.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`function-call-argument-newline`](https://eslint.style/rules/js/function-call-argument-newline) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/function-call-argument-newline */ "function-call-argument-newline": Linter.RuleEntry< [ /** * @default "always" */ "always" | "never" | "consistent", ] >; /** * Rule to enforce consistent line breaks inside function parentheses. * * @since 4.6.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`function-paren-newline`](https://eslint.style/rules/js/function-paren-newline) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/function-paren-newline */ "function-paren-newline": Linter.RuleEntry< [ | "always" | "never" | "multiline" | "multiline-arguments" | "consistent" | Partial<{ minItems: number; }>, ] >; /** * Rule to enforce consistent spacing around `*` operators in generator functions. * * @since 0.17.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`generator-star-spacing`](https://eslint.style/rules/js/generator-star-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/generator-star-spacing */ "generator-star-spacing": Linter.RuleEntry< [ | Partial<{ before: boolean; after: boolean; named: | Partial<{ before: boolean; after: boolean; }> | "before" | "after" | "both" | "neither"; anonymous: | Partial<{ before: boolean; after: boolean; }> | "before" | "after" | "both" | "neither"; method: | Partial<{ before: boolean; after: boolean; }> | "before" | "after" | "both" | "neither"; }> | "before" | "after" | "both" | "neither", ] >; /** * Rule to enforce `return` statements in getters. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 4.2.0 * @see https://eslint.org/docs/latest/rules/getter-return */ "getter-return": Linter.RuleEntry< [ Partial<{ /** * @default false */ allowImplicit: boolean; }>, ] >; /** * Rule to require `require()` calls to be placed at top-level module scope. * * @since 1.4.0 * @deprecated since 7.0.0. * Node.js rules were moved out of ESLint core. * Please, use [`global-require`](https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/global-require.md) in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n). * @see https://eslint.org/docs/latest/rules/global-require */ "global-require": Linter.RuleEntry<[]>; /** * Rule to require grouped accessor pairs in object literals and classes. * * @since 6.7.0 * @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs */ "grouped-accessor-pairs": Linter.RuleEntry< ["anyOrder" | "getBeforeSet" | "setBeforeGet"] >; /** * Rule to require `for-in` loops to include an `if` statement. * * @since 0.0.6 * @see https://eslint.org/docs/latest/rules/guard-for-in */ "guard-for-in": Linter.RuleEntry<[]>; /** * Rule to require error handling in callbacks. * * @since 0.4.5 * @deprecated since 7.0.0. * Node.js rules were moved out of ESLint core. * Please, use [`handle-callback-err`](https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/handle-callback-err.md) in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n). * @see https://eslint.org/docs/latest/rules/handle-callback-err */ "handle-callback-err": Linter.RuleEntry<[string]>; /** * Rule to disallow specified identifiers. * * @since 2.0.0-beta.2 * @deprecated since 7.5.0. * The rule was renamed. * Please, use [`id-denylist`](https://eslint.org/docs/rules/id-denylist). * @see https://eslint.org/docs/latest/rules/id-blacklist */ "id-blacklist": Linter.RuleEntry<[...string[]]>; /** * Rule to disallow specified identifiers. * * @since 7.4.0 * @see https://eslint.org/docs/latest/rules/id-denylist */ "id-denylist": Linter.RuleEntry<string[]>; /** * Rule to enforce minimum and maximum identifier lengths. * * @since 1.0.0 * @see https://eslint.org/docs/latest/rules/id-length */ "id-length": Linter.RuleEntry< [ Partial<{ /** * @default 2 */ min: number; /** * @default Infinity */ max: number; /** * @default 'always' */ properties: "always" | "never"; exceptions: string[]; }>, ] >; /** * Rule to require identifiers to match a specified regular expression. * * @since 1.0.0 * @see https://eslint.org/docs/latest/rules/id-match */ "id-match": Linter.RuleEntry< [ string, Partial<{ /** * @default false */ properties: boolean; /** * @default false */ onlyDeclarations: boolean; /** * @default false */ ignoreDestructuring: boolean; }>, ] >; /** * Rule to enforce the location of arrow function bodies. * * @since 4.12.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`implicit-arrow-linebreak`](https://eslint.style/rules/js/implicit-arrow-linebreak) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/implicit-arrow-linebreak */ "implicit-arrow-linebreak": Linter.RuleEntry<["beside" | "below"]>; /** * Rule to enforce consistent indentation. * * @since 0.14.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`indent`](https://eslint.style/rules/js/indent) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/indent */ indent: Linter.RuleEntry< [ number | "tab", Partial<{ /** * @default 0 */ SwitchCase: number; /** * @default 1 */ VariableDeclarator: | Partial<{ /** * @default 1 */ var: number | "first"; /** * @default 1 */ let: number | "first"; /** * @default 1 */ const: number | "first"; }> | number | "first"; /** * @default 1 */ outerIIFEBody: number; /** * @default 1 */ MemberExpression: number | "off"; /** * @default { parameters: 1, body: 1 } */ FunctionDeclaration: Partial<{ /** * @default 1 */ parameters: number | "first" | "off"; /** * @default 1 */ body: number; }>; /** * @default { parameters: 1, body: 1 } */ FunctionExpression: Partial<{ /** * @default 1 */ parameters: number | "first" | "off"; /** * @default 1 */ body: number; }>; /** * @default { arguments: 1 } */ CallExpression: Partial<{ /** * @default 1 */ arguments: number | "first" | "off"; }>; /** * @default 1 */ ArrayExpression: number | "first" | "off"; /** * @default 1 */ ObjectExpression: number | "first" | "off"; /** * @default 1 */ ImportDeclaration: number | "first" | "off"; /** * @default false */ flatTernaryExpressions: boolean; ignoredNodes: string[]; /** * @default false */ ignoreComments: boolean; }>, ] >; /** * Rule to enforce consistent indentation. * * @since 4.0.0-alpha.0 * @deprecated since 4.0.0. * Formatting rules are being moved out of ESLint core. * Please, use [`indent`](https://eslint.style/rules/js/indent) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/indent-legacy */ "indent-legacy": Linter.RuleEntry< [ number | "tab", Partial<{ /** * @default 0 */ SwitchCase: number; /** * @default 1 */ VariableDeclarator: | Partial<{ /** * @default 1 */ var: number | "first"; /** * @default 1 */ let: number | "first"; /** * @default 1 */ const: number | "first"; }> | number | "first"; /** * @default 1 */ outerIIFEBody: number; /** * @default 1 */ MemberExpression: number | "off"; /** * @default { parameters: 1, body: 1 } */ FunctionDeclaration: Partial<{ /** * @default 1 */ parameters: number | "first" | "off"; /** * @default 1 */ body: number; }>; /** * @default { parameters: 1, body: 1 } */ FunctionExpression: Partial<{ /** * @default 1 */ parameters: number | "first" | "off"; /** * @default 1 */ body: number; }>; /** * @default { arguments: 1 } */ CallExpression: Partial<{ /** * @default 1 */ arguments: number | "first" | "off"; }>; /** * @default 1 */ ArrayExpression: number | "first" | "off"; /** * @default 1 */ ObjectExpression: number | "first" | "off"; /** * @default 1 */ ImportDeclaration: number | "first" | "off"; /** * @default false */ flatTernaryExpressions: boolean; ignoredNodes: string[]; /** * @default false */ ignoreComments: boolean; }>, ] >; /** * Rule to require or disallow initialization in variable declarations. * * @since 1.0.0-rc-1 * @see https://eslint.org/docs/latest/rules/init-declarations */ "init-declarations": | Linter.RuleEntry<["always"]> | Linter.RuleEntry< [ "never", Partial<{ ignoreForLoopInit: boolean; }>, ] >; /** * Rule to enforce the consistent use of either double or single quotes in JSX attributes. * * @since 1.4.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`jsx-quotes`](https://eslint.style/rules/js/jsx-quotes) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/jsx-quotes */ "jsx-quotes": Linter.RuleEntry<["prefer-double" | "prefer-single"]>; /** * Rule to enforce consistent spacing between keys and values in object literal properties. * * @since 0.9.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`key-spacing`](https://eslint.style/rules/js/key-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/key-spacing */ "key-spacing": Linter.RuleEntry< [ | Partial< | { /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'strict' */ mode: "strict" | "minimum"; align: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'colon' */ on: "value" | "colon"; /** * @default 'strict' */ mode: "strict" | "minimum"; }> | "value" | "colon"; } | { singleLine?: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'strict' */ mode: "strict" | "minimum"; }> | undefined; multiLine?: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'strict' */ mode: "strict" | "minimum"; align: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'colon' */ on: "value" | "colon"; /** * @default 'strict' */ mode: "strict" | "minimum"; }> | "value" | "colon"; }> | undefined; } > | { align: Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'colon' */ on: "value" | "colon"; /** * @default 'strict' */ mode: "strict" | "minimum"; }>; singleLine?: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'strict' */ mode: "strict" | "minimum"; }> | undefined; multiLine?: | Partial<{ /** * @default false */ beforeColon: boolean; /** * @default true */ afterColon: boolean; /** * @default 'strict' */ mode: "strict" | "minimum"; }> | undefined; }, ] >; /** * Rule to enforce consistent spacing before and after keywords. * * @since 2.0.0-beta.1 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`keyword-spacing`](https://eslint.style/rules/js/keyword-spacing) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/keyword-spacing */ "keyword-spacing": Linter.RuleEntry< [ Partial<{ /** * @default true */ before: boolean; /** * @default true */ after: boolean; overrides: Record< string, Partial<{ before: boolean; after: boolean; }> >; }>, ] >; /** * Rule to enforce position of line comments. * * @since 3.5.0 * @deprecated since 9.3.0. * Formatting rules are being moved out of ESLint core. * Please, use [`line-comment-position`](https://eslint.style/rules/js/line-comment-position) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/line-comment-position */ "line-comment-position": Linter.RuleEntry< [ Partial<{ /** * @default 'above' */ position: "above" | "beside"; ignorePattern: string; /** * @default true */ applyDefaultIgnorePatterns: boolean; }>, ] >; /** * Rule to enforce consistent linebreak style. * * @since 0.21.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`linebreak-style`](https://eslint.style/rules/js/linebreak-style) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/linebreak-style */ "linebreak-style": Linter.RuleEntry<["unix" | "windows"]>; /** * Rule to require empty lines around comments. * * @since 0.22.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`lines-around-comment`](https://eslint.style/rules/js/lines-around-comment) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/lines-around-comment */ "lines-around-comment": Linter.RuleEntry< [ Partial<{ /** * @default true */ beforeBlockComment: boolean; /** * @default false */ afterBlockComment: boolean; /** * @default false */ beforeLineComment: boolean; /** * @default false */ afterLineComment: boolean; /** * @default false */ allowBlockStart: boolean; /** * @default false */ allowBlockEnd: boolean; /** * @default false */ allowObjectStart: boolean; /** * @default false */ allowObjectEnd: boolean; /** * @default false */ allowArrayStart: boolean; /** * @default false */ allowArrayEnd: boolean; /** * @default false */ allowClassStart: boolean; /** * @default false */ allowClassEnd: boolean; ignorePattern: string; /** * @default true */ applyDefaultIgnorePatterns: boolean; }>, ] >; /** * Rule to require or disallow newlines around directives. * * @since 3.5.0 * @deprecated since 4.0.0. * The rule was replaced with a more general rule. * Please, use [`padding-line-between-statements`](https://eslint.style/rules/js/padding-line-between-statements) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/lines-around-directive */ "lines-around-directive": Linter.RuleEntry<["always" | "never"]>; /** * Rule to require or disallow an empty line between class members. * * @since 4.9.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`lines-between-class-members`](https://eslint.style/rules/js/lines-between-class-members) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/lines-between-class-members */ "lines-between-class-members": Linter.RuleEntry< [ ( | "always" | "never" | { enforce: Array<{ blankLine: "always" | "never"; prev: "method" | "field" | "*"; next: "method" | "field" | "*"; }>; } ), Partial<{ /** * @default false */ exceptAfterSingleLine: boolean; }>, ] >; /** * Rule to require or disallow logical assignment operator shorthand. * * @since 8.24.0 * @see https://eslint.org/docs/latest/rules/logical-assignment-operators */ "logical-assignment-operators": | Linter.RuleEntry< [ "always", Partial<{ /** * @default false */ enforceForIfStatements: boolean; }>, ] > | Linter.RuleEntry<["never"]>; /** * Rule to enforce a maximum number of classes per file. * * @since 5.0.0-alpha.3 * @see https://eslint.org/docs/latest/rules/max-classes-per-file */ "max-classes-per-file": Linter.RuleEntry<[number]>; /** * Rule to enforce a maximum depth that blocks can be nested. * * @since 0.0.9 * @see https://eslint.org/docs/latest/rules/max-depth */ "max-depth": Linter.RuleEntry< [ Partial<{ /** * @default 4 */ max: number; }>, ] >; /** * Rule to enforce a maximum line length. * * @since 0.0.9 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`max-len`](https://eslint.style/rules/js/max-len) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/max-len */ "max-len": Linter.RuleEntry< [ Partial<{ /** * @default 80 */ code: number; /** * @default 4 */ tabWidth: number; comments: number; ignorePattern: string; /** * @default false */ ignoreComments: boolean; /** * @default false */ ignoreTrailingComments: boolean; /** * @default false */ ignoreUrls: boolean; /** * @default false */ ignoreStrings: boolean; /** * @default false */ ignoreTemplateLiterals: boolean; /** * @default false */ ignoreRegExpLiterals: boolean; }>, ] >; /** * Rule to enforce a maximum number of lines per file. * * @since 2.12.0 * @see https://eslint.org/docs/latest/rules/max-lines */ "max-lines": Linter.RuleEntry< [ | Partial<{ /** * @default 300 */ max: number; /** * @default false */ skipBlankLines: boolean; /** * @default false */ skipComments: boolean; }> | number, ] >; /** * Rule to enforce a maximum number of lines of code in a function. * * @since 5.0.0 * @see https://eslint.org/docs/latest/rules/max-lines-per-function */ "max-lines-per-function": Linter.RuleEntry< [ Partial<{ /** * @default 50 */ max: number; /** * @default false */ skipBlankLines: boolean; /** * @default false */ skipComments: boolean; /** * @default false */ IIFEs: boolean; }>, ] >; /** * Rule to enforce a maximum depth that callbacks can be nested. * * @since 0.2.0 * @see https://eslint.org/docs/latest/rules/max-nested-callbacks */ "max-nested-callbacks": Linter.RuleEntry< [ | Partial<{ /** * @default 10 */ max: number; }> | number, ] >; /** * Rule to enforce a maximum number of parameters in function definitions. * * @since 0.0.9 * @see https://eslint.org/docs/latest/rules/max-params */ "max-params": Linter.RuleEntry< [ | Partial<{ /** * @default 3 */ max: number; }> | number, ] >; /** * Rule to enforce a maximum number of statements allowed in function blocks. * * @since 0.0.9 * @see https://eslint.org/docs/latest/rules/max-statements */ "max-statements": Linter.RuleEntry< [ | Partial<{ /** * @default 10 */ max: number; /** * @default false */ ignoreTopLevelFunctions: boolean; }> | number, ] >; /** * Rule to enforce a maximum number of statements allowed per line. * * @since 2.5.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`max-statements-per-line`](https://eslint.style/rules/js/max-statements-per-line) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/max-statements-per-line */ "max-statements-per-line": Linter.RuleEntry< [ | Partial<{ /** * @default 1 */ max: number; }> | number, ] >; /** * Rule to enforce a particular style for multiline comments. * * @since 4.10.0 * @deprecated since 9.3.0. * Formatting rules are being moved out of ESLint core. * Please, use [`multiline-comment-style`](https://eslint.style/rules/js/multiline-comment-style) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/multiline-comment-style */ "multiline-comment-style": Linter.RuleEntry< ["starred-block" | "bare-block" | "separate-lines"] >; /** * Rule to enforce newlines between operands of ternary expressions. * * @since 3.1.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`multiline-ternary`](https://eslint.style/rules/js/multiline-ternary) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/multiline-ternary */ "multiline-ternary": Linter.RuleEntry< ["always" | "always-multiline" | "never"] >; /** * Rule to require constructor names to begin with a capital letter. * * @since 0.0.3-0 * @see https://eslint.org/docs/latest/rules/new-cap */ "new-cap": Linter.RuleEntry< [ Partial<{ /** * @default true */ newIsCap: boolean; /** * @default true */ capIsNew: boolean; newIsCapExceptions: string[]; newIsCapExceptionPattern: string; capIsNewExceptions: string[]; capIsNewExceptionPattern: string; /** * @default true */ properties: boolean; }>, ] >; /** * Rule to enforce or disallow parentheses when invoking a constructor with no arguments. * * @since 0.0.6 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`new-parens`](https://eslint.style/rules/js/new-parens) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/new-parens */ "new-parens": Linter.RuleEntry<["always" | "never"]>; /** * Rule to require or disallow an empty line after variable declarations. * * @since 0.18.0 * @deprecated since 4.0.0. * The rule was replaced with a more general rule. * Please, use [`padding-line-between-statements`](https://eslint.style/rules/js/padding-line-between-statements) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/newline-after-var */ "newline-after-var": Linter.RuleEntry<["always" | "never"]>; /** * Rule to require an empty line before `return` statements. * * @since 2.3.0 * @deprecated since 4.0.0. * The rule was replaced with a more general rule. * Please, use [`padding-line-between-statements`](https://eslint.style/rules/js/padding-line-between-statements) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/newline-before-return */ "newline-before-return": Linter.RuleEntry<[]>; /** * Rule to require a newline after each call in a method chain. * * @since 2.0.0-rc.0 * @deprecated since 8.53.0. * Formatting rules are being moved out of ESLint core. * Please, use [`newline-per-chained-call`](https://eslint.style/rules/js/newline-per-chained-call) in [`@stylistic/eslint-plugin-js`](https://eslint.style/packages/js). * @see https://eslint.org/docs/latest/rules/newline-per-chained-call */ "newline-per-chained-call": Linter.RuleEntry< [ { /** * @default 2 */ ignoreChainWithDepth: number; }, ] >; /** * Rule to disallow the use of `alert`, `confirm`, and `prompt`. * * @since 0.0.5 * @see https://eslint.org/docs/latest/rules/no-alert */ "no-alert": Linter.RuleEntry<[]>; /** * Rule to disallow `Array` constructors. * * @since 0.4.0 * @see https://eslint.org/docs/latest/rules/no-array-constructor */ "no-array-constructor": Linter.RuleEntry<[]>; /** * Rule to disallow using an async function as a Promise executor. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 5.3.0 * @see https://eslint.org/docs/latest/rules/no-async-promise-executor */ "no-async-promise-executor": Linter.RuleEntry<[]>; /** * Rule to disallow `await` inside of loops. * * @since 3.12.0 * @see https://eslint.org/docs/latest/rules/no-await-in-loop */ "no-await-in-loop": Linter.RuleEntry<[]>; /** * Rule to disallow bitwise operators. * * @since 0.0.2 * @see https://eslint.org/docs/latest/rules/no-bitwise */ "no-bitwise": Linter.RuleEntry< [ Partial<{ allow: string[]; /** * @default false */ int32Hint: boolean; }>, ] >; /** * Rule to disallow use of the `Buffer()` constructor. * * @since 4.0.0-alpha.0 * @deprecated since 7.0.0. * Node.js rules were moved out of ESLint core. * Please, use [`no-deprecated-api`](https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/no-deprecated-api.md) in [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n). * @see https://eslint.org/docs/latest/rules/no-buffer-constructor */ "no-buffer-constructor": Linter.RuleEntry<[]>; /** * Rule to disallow the use of `arguments.caller` or `arguments.callee`. * * @since 0.0.6 * @see https://eslint.org/docs/latest/rules/no-caller */ "no-caller": Linter.RuleEntry<[]>; /** * Rule to disallow lexical declarations in case clauses. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 1.9.0 * @see https://eslint.org/docs/latest/rules/no-case-declarations */ "no-case-declarations": Linter.RuleEntry<[]>; /** * Rule to disallow `catch` clause parameters from shadowing variables in the outer scope. * * @since 0.0.9 * @deprecated since 5.1.0. * This rule was renamed. * Please, use [`no-shadow`](https://eslint.org/docs/rules/no-shadow). * @see https://eslint.org/docs/latest/rules/no-catch-shadow */ "no-catch-shadow": Linter.RuleEntry<[]>; /** * Rule to disallow reassigning class members. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 1.0.0-rc-1 * @see https://eslint.org/docs/latest/rules/no-class-assign */ "no-class-assign": Linter.RuleEntry<[]>; /** * Rule to disallow comparing against `-0`. * * @remarks * Recommended by ESLint, the rule was enabled in `eslint:recommended`. * * @since 3.17.0 * @see https://eslint.org/docs/latest/rules/no-compare-neg-zero */ "no-compare-neg-zero": Linter.RuleEntry<[]>; /** * Ru