eslint-plugin-unicorn
Version:
More than 300 powerful ESLint rules
391 lines • 209 kB
JavaScript
// Generated file, DO NOT edit
import createPlugin from '../create-plugin.js';
import {createLazyRule} from '../rules/rule/to-eslint-rule.js';
import rule28 from '../rules/expiring-todo-comments.js';
import rule32 from '../rules/id-match.js';
import rule38 from '../rules/logical-assignment-operators.js';
import rule215 from '../rules/operator-assignment.js';
export default createPlugin({
'better-dom-traversing': createLazyRule('better-dom-traversing', { type: 'suggestion', docs: { description: 'Prefer better DOM traversal APIs.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'first-child': 'Prefer `.firstChild` over `.childNodes[0]`.', 'first-element-child': 'Prefer `.firstElementChild` over `.children[0]`.', 'query-selector': 'Consider `.querySelector()` over positional child traversal.', closest: 'Consider `.closest()` over chaining `.parentElement`.', 'merge-query-selector': 'Consider merging chained `.querySelector()` calls.', 'suggestion-first-child': 'Switch to `.firstChild`.', 'suggestion-first-element-child': 'Switch to `.firstElementChild`.', 'suggestion-merge-query-selector': 'Merge the `.querySelector()` calls.' }, languages: [ 'js/js' ] }),
'catch-error-name': createLazyRule('catch-error-name', { type: 'suggestion', docs: { description: 'Enforce a specific parameter name in catch clauses.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { name: { type: 'string', description: 'The expected name for the error variable.' }, ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Patterns to ignore.' } } } ], defaultOptions: [ { name: 'error', ignore: [] } ], messages: { 'catch-error-name': 'The catch parameter `{{originalName}}` should be named `{{fixedName}}`.' }, languages: [ 'js/js' ] }),
'class-reference-in-static-methods': createLazyRule('class-reference-in-static-methods', { type: 'suggestion', docs: { description: 'Enforce consistent class references in static methods.', recommended: true }, hasSuggestions: true, schema: [ { type: 'object', properties: { preferThis: { type: 'boolean', description: 'Prefer `this` over the current class name in static methods.' }, preferSuper: { type: 'boolean', description: 'Prefer `super` over the superclass name in static methods.' } }, additionalProperties: false } ], defaultOptions: [ { preferThis: true, preferSuper: true } ], messages: { this: 'Use `this` instead of `{{name}}` in static methods.', class: 'Use `{{name}}` instead of `this` in static methods.', 'class-unavailable': 'Use the class name instead of `this` in static methods.', super: 'Use `super` instead of `{{name}}` in static methods.', 'super-class': 'Use `{{name}}` instead of `super` in static methods.', 'super-class-unavailable': 'Use the superclass name instead of `super` in static methods.', suggestion: 'Replace `{{source}}` with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'comma-spacing': createLazyRule('comma-spacing', { type: 'layout', docs: { description: 'Enforce consistent spacing before and after commas in JSON and SOML.', recommended: false }, fixable: 'whitespace', schema: [], messages: { 'comma-spacing/before': 'Do not add whitespace before commas.', 'comma-spacing/after': 'Expected exactly one space after commas.' }, languages: [ 'json/json', 'json/jsonc', 'json/json5', 'soml/soml' ] }),
'comment-content': createLazyRule('comment-content', { type: 'suggestion', docs: { description: 'Enforce better comment content.', recommended: false }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, description: 'Patterns matching comment regions to ignore.' }, checkUniformCase: { type: 'boolean', description: 'Whether to also re-case all-lowercase and all-uppercase tokens. When `false`, only tokens that already mix upper- and lower-case (for example, `Github`) are corrected.' }, extendDefaultReplacements: { type: 'boolean', description: 'Whether to extend the default replacements.' }, replacements: { type: 'object', propertyNames: { minLength: 1 }, additionalProperties: { anyOf: [ { enum: [ false ] }, { type: 'string', minLength: 1 }, { type: 'object', required: [ 'replacement' ], properties: { replacement: { type: 'string', minLength: 1 }, caseSensitive: { type: 'boolean' } }, additionalProperties: false } ] }, description: 'Custom comment content replacements.' } } } ], defaultOptions: [ { checkUniformCase: true, extendDefaultReplacements: true, replacements: {}, ignore: [] } ], messages: { 'comment-content': 'Prefer `{{replacement}}` over `{{value}}`.' }, languages: [ '*' ] }),
'consistent-arrow-return-style': createLazyRule('consistent-arrow-return-style', { type: 'suggestion', docs: { description: 'Enforce a consistent return style for multiline arrow function bodies.', recommended: false }, fixable: 'code', schema: [], messages: { useExplicitReturn: 'Use an explicit return for a multiline arrow function body.', useImplicitReturn: 'Use an implicit return for a single-line return expression.' }, languages: [ 'js/js' ] }),
'consistent-assert': createLazyRule('consistent-assert', { type: 'problem', docs: { description: 'Enforce consistent assertion style with `node:assert`.', recommended: true }, fixable: 'code', messages: { 'consistent-assert/error': 'Prefer `{{name}}.ok(…)` over `{{name}}(…)`.' }, languages: [ 'js/js' ] }),
'consistent-boolean-name': createLazyRule('consistent-boolean-name', { type: 'suggestion', docs: { description: 'Enforce consistent naming for boolean names.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', description: 'Rule options.', additionalProperties: false, patternProperties: { '^checkProperties$': {} }, properties: { checkVariables: { enum: [ 'always', 'prohibit', 'never' ], description: 'How to check variable names.' }, checkArguments: { enum: [ 'always', 'prohibit', 'never' ], description: 'How to check parameter names.' }, checkFunctions: { enum: [ 'always', 'prohibit', 'never' ], description: 'How to check function names.' }, checkMethods: { enum: [ 'always', 'prohibit', 'never' ], description: 'How to check object and class methods, getters, and TypeScript method signatures. Setter names are ignored because setters do not return values.' }, checkFields: { enum: [ 'always', 'prohibit', 'never' ], description: 'How to check object properties, class fields, TypeScript property signatures, and constructor parameter properties.' }, prefixes: { type: 'object', description: 'Boolean name prefixes to allow or disallow.', additionalProperties: { type: 'boolean', description: 'Whether the prefix is allowed.' }, propertyNames: { description: 'Prefix name.', pattern: '^[a-z][a-zA-Z0-9]*$' } }, wrappers: { type: 'object', description: 'Wrapper type names and their boolean-like value members.', additionalProperties: { type: 'string', description: 'The property or method that provides the wrapped value.', minLength: 1 } }, ignore: { type: 'array', uniqueItems: true, description: 'Patterns to ignore.' } } } ], defaultOptions: [ { checkVariables: 'always', checkArguments: 'always', checkFunctions: 'always', checkMethods: 'never', checkFields: 'never', ignore: [], wrappers: {} } ], messages: { 'consistent-boolean-name': 'Boolean name `{{name}}` should start with {{prefixes}}.', 'non-boolean-prefix': '`{{name}}` starts with `{{prefix}}`, so it should be boolean.', rename: 'Rename to `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'consistent-class-member-order': createLazyRule('consistent-class-member-order', { type: 'suggestion', docs: { description: 'Enforce consistent class member order.', recommended: true }, hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { order: { type: 'array', description: 'The class member group order.', items: { enum: [ 'static-field', 'static-block', 'static-method', 'private-field', 'public-field', 'constructor', 'private-method', 'public-method' ] }, minItems: 8, maxItems: 8, uniqueItems: true } } } ], defaultOptions: [ { order: [ 'static-field', 'static-block', 'static-method', 'private-field', 'public-field', 'constructor', 'private-method', 'public-method' ] } ], messages: { 'consistent-class-member-order': 'Expected {{current}} to come before {{previous}}.', 'consistent-class-member-order-suggestion': 'Reorder class members by group.' }, languages: [ 'js/js' ] }),
'consistent-compound-words': createLazyRule('consistent-compound-words', { type: 'suggestion', docs: { description: 'Enforce consistent spelling of compound words in identifiers.', recommended: 'unopinionated' }, hasSuggestions: true, schema: { type: 'array', additionalItems: false, items: [ { type: 'object', additionalProperties: false, properties: { checkProperties: { type: 'boolean', description: 'Whether to check property names.' }, checkVariables: { type: 'boolean', description: 'Whether to check variable names.' }, checkDefaultAndNamespaceImports: { anyOf: [ { type: 'boolean' }, { enum: [ 'internal' ] } ], description: 'Whether to check default and namespace import names.' }, checkShorthandImports: { anyOf: [ { type: 'boolean' }, { enum: [ 'internal' ] } ], description: 'Whether to check shorthand import names.' }, checkShorthandProperties: { type: 'boolean', description: 'Whether to check shorthand property names.' }, extendDefaultReplacements: { type: 'boolean', description: 'Whether to extend the default replacements.' }, replacements: { '$ref': '#/definitions/replacements', description: 'Custom compound word replacements.' }, allowList: { '$ref': '#/definitions/trueObject', description: 'Custom allow list of names.' } } } ], definitions: { replacements: { type: 'object', propertyNames: { minLength: 1 }, additionalProperties: { anyOf: [ { enum: [ false ] }, { type: 'string', minLength: 1 } ] } }, trueObject: { type: 'object', propertyNames: { minLength: 1 }, additionalProperties: { enum: [ true ] } } } }, defaultOptions: [ {} ], messages: { 'consistent-compound-words/error': 'Prefer `{{replacement}}` over `{{name}}`.', 'consistent-compound-words/rename': 'Rename to `{{replacement}}`.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'html/html', 'soml/soml', 'yml/yaml', 'toml/toml' ] }),
'consistent-conditional-object-spread': createLazyRule('consistent-conditional-object-spread', { type: 'suggestion', docs: { description: 'Enforce consistent conditional object spread style.', recommended: true }, fixable: 'code', schema: [ { description: 'The conditional object spread style to enforce.', enum: [ 'logical', 'ternary' ] } ], defaultOptions: [ 'logical' ], messages: { 'consistent-conditional-object-spread': 'Prefer {{expectedStyle}} conditional object spreads.', 'unnecessary-boolean-cast': 'Unnecessary boolean cast. A falsy value spreads nothing.' }, languages: [ 'js/js' ] }),
'consistent-date-clone': createLazyRule('consistent-date-clone', { type: 'suggestion', docs: { description: 'Prefer passing `Date` directly to the constructor when cloning.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'consistent-date-clone/error': 'Unnecessary `.getTime()` call.' }, languages: [ 'js/js' ] }),
'consistent-destructuring': createLazyRule('consistent-destructuring', { type: 'suggestion', docs: { description: 'Use destructured variables over properties.', recommended: false }, hasSuggestions: true, messages: { consistentDestructuring: 'Use destructured variables over properties.', consistentDestructuringSuggest: 'Replace `{{expression}}` with destructured property `{{property}}`.' }, languages: [ 'js/js' ] }),
'consistent-empty-array-spread': createLazyRule('consistent-empty-array-spread', { type: 'suggestion', docs: { description: 'Prefer consistent types when spreading a ternary in an array literal.', recommended: true }, fixable: 'code', messages: { 'consistent-empty-array-spread': 'Prefer using empty {{replacementDescription}} since the {{anotherNodePosition}} is {{anotherNodeDescription}}.' }, languages: [ 'js/js' ] }),
'consistent-existence-index-check': createLazyRule('consistent-existence-index-check', { type: 'problem', docs: { description: 'Enforce consistent style for element existence checks with `indexOf()`, `lastIndexOf()`, `findIndex()`, and `findLastIndex()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'consistent-existence-index-check': 'Prefer `{{replacementOperator}} {{replacementValue}}` over `{{originalOperator}} {{originalValue}}` to check {{existenceOrNonExistence}}.' }, languages: [ 'js/js' ] }),
'consistent-export-decorator-position': createLazyRule('consistent-export-decorator-position', { type: 'suggestion', docs: { description: 'Enforce consistent decorator position on exported classes.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { enum: [ 'above', 'before', 'after' ], description: 'Decorator position relative to the export declaration.' } ], defaultOptions: [ 'above' ], messages: { 'consistent-export-decorator-position': 'Expected export decorators to be positioned `{{expected}}`, but found `{{actual}}`.' }, languages: [ 'js/js' ] }),
'consistent-function-scoping': createLazyRule('consistent-function-scoping', { type: 'suggestion', docs: { description: 'Move function definitions to the highest possible scope.', recommended: true }, schema: [ { type: 'object', additionalProperties: false, properties: { checkArrowFunctions: { type: 'boolean', description: 'Whether to check arrow functions.' } } } ], defaultOptions: [ { checkArrowFunctions: true } ], messages: { 'consistent-function-scoping': 'Move {{functionNameWithKind}} to the outer scope.' }, languages: [ 'js/js' ] }),
'consistent-function-style': createLazyRule('consistent-function-style', { type: 'suggestion', docs: { description: 'Enforce function syntax by role.', recommended: false }, hasSuggestions: true, schema: [ { type: 'object', properties: { default: { enum: [ 'declaration', 'function-expression', 'arrow-function', 'ignore' ] }, defaultExport: { enum: [ 'declaration', 'function-expression', 'arrow-function', 'ignore' ] }, namedFunctions: { enum: [ 'declaration', 'function-expression', 'arrow-function', 'ignore' ] }, namedExports: { enum: [ 'declaration', 'function-expression', 'arrow-function', 'ignore' ] }, callbacks: { enum: [ 'function-expression', 'arrow-function', 'ignore' ] }, objectProperties: { enum: [ 'method', 'function-expression', 'arrow-function', 'ignore' ] }, reassignedVariables: { enum: [ 'function-expression', 'arrow-function', 'ignore' ] }, typedVariables: { enum: [ 'function-expression', 'arrow-function', 'ignore' ] } }, additionalProperties: false } ], defaultOptions: [ { default: 'ignore', namedFunctions: 'ignore', namedExports: 'ignore', callbacks: 'ignore', objectProperties: 'ignore', reassignedVariables: 'ignore', typedVariables: 'ignore' } ], messages: { 'consistent-function-style': 'Expected {{expected}} for this {{role}}, but found {{actual}}.', 'consistent-function-style/suggestion': 'Replace with {{expected}}.' }, languages: [ 'js/js' ] }),
'consistent-json-file-read': createLazyRule('consistent-json-file-read', { type: 'suggestion', docs: { description: 'Enforce consistent JSON file reads before `JSON.parse()`.', recommended: true }, fixable: 'code', schema: [ { enum: [ 'string', 'buffer' ], description: 'Whether to prefer reading JSON files as strings or buffers before passing them to `JSON.parse()`.' } ], defaultOptions: [ 'string' ], messages: { 'consistent-json-file-read/string': 'Prefer reading the JSON file as a string.', 'consistent-json-file-read/buffer': 'Prefer reading the JSON file as a buffer.' }, languages: [ 'js/js' ] }),
'consistent-optional-chaining': createLazyRule('consistent-optional-chaining', { type: 'suggestion', docs: { description: 'Enforce consistent optional chaining for same-base member access.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'consistent-optional-chaining/remove-optional': 'Remove unnecessary optional chaining.', 'consistent-optional-chaining/use-optional': 'Use optional chaining consistently.', 'consistent-optional-chaining/suggest-remove-optional': 'Remove optional chaining.', 'consistent-optional-chaining/suggest-use-optional': 'Use optional chaining.' }, languages: [ 'js/js' ] }),
'consistent-template-literal-escape': createLazyRule('consistent-template-literal-escape', { type: 'suggestion', docs: { description: 'Enforce consistent style for escaping `${` in template literals.', recommended: true }, fixable: 'code', messages: { 'consistent-template-literal-escape': 'Use `\\${` instead of `$\\{` to escape in template literals.' }, languages: [ 'js/js' ] }),
'consistent-tuple-labels': createLazyRule('consistent-tuple-labels', { type: 'suggestion', docs: { description: 'Enforce consistent labels on tuple type elements.', recommended: true }, messages: { 'consistent-tuple-labels': 'This tuple element should have a label, just like the other elements.' }, languages: [ 'js/js' ] }),
'custom-error-definition': createLazyRule('custom-error-definition', { type: 'problem', docs: { description: 'Enforce correct `Error` subclassing.', recommended: false }, fixable: 'code', messages: { invalidExport: 'Exported error name should match error class', doNotPassMessageToSuper: 'Do not pass the error message to `super()` when the class defines a `message` accessor.', doNotAssignMessageWithoutSetter: 'Do not assign to `this.message` when the class defines a `message` getter without a setter.', missingOptionsParameter: 'Error constructors should accept an `options` parameter.', invalidOptionsParameter: 'Error constructors should use a non-rest parameter named `options`.', passMessageToSuper: 'Pass the error message to `super()` as the first argument.', passOptionsToSuper: 'Pass `options` to `super()` as the second argument.' }, languages: [ 'js/js' ] }),
'default-export-style': createLazyRule('default-export-style', { type: 'suggestion', docs: { description: 'Enforce consistent default export declarations.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', properties: { functions: { enum: [ 'inline', 'separate', 'ignore' ] }, classes: { enum: [ 'inline', 'separate', 'ignore' ] } }, additionalProperties: false } ], defaultOptions: [ { functions: 'inline', classes: 'inline' } ], messages: { 'default-export-style/inline': 'Prefer declaring this default-exported {{kind}} inline.', 'default-export-style/separate': 'Prefer declaring this default-exported {{kind}} as a separate {{style}}.', 'default-export-style/suggestion-inline': 'Use an inline default {{kind}} declaration.', 'default-export-style/suggestion-separate': 'Use a separate const arrow function default export.' }, languages: [ 'js/js' ] }),
'dom-node-dataset': createLazyRule('dom-node-dataset', { type: 'suggestion', docs: { description: 'Enforce consistent style for DOM element dataset access.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { preferAttributes: { type: 'boolean', description: 'Prefer attribute methods over named `.dataset` access.' } } } ], defaultOptions: [ { preferAttributes: false } ], messages: { 'prefer-dataset': 'Prefer `.dataset` over `{{method}}(…)`.', 'prefer-dataset/suggestion': 'Switch to `.dataset`.', 'prefer-attributes': 'Prefer `.{{method}}(…)` over `.dataset`.', 'prefer-attributes/suggestion': 'Switch to `getAttribute()`.' }, languages: [ 'js/js' ] }),
'empty-brace-spaces': createLazyRule('empty-brace-spaces', { type: 'layout', docs: { description: 'Enforce no spaces between braces.', recommended: true }, fixable: 'whitespace', messages: { 'empty-brace-spaces': 'Do not add spaces between braces.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'toml/toml', 'soml/soml', 'yml/yaml' ] }),
'error-message': createLazyRule('error-message', { type: 'problem', docs: { description: 'Enforce passing a `message` value when creating a built-in error.', recommended: 'unopinionated' }, messages: { 'missing-message': 'Pass a message to the `{{constructorName}}` constructor.', 'message-is-empty-string': 'Error message should not be an empty string.', 'message-is-not-a-string': 'Error message should be a string.' }, languages: [ 'js/js' ] }),
'escape-case': createLazyRule('escape-case', { type: 'suggestion', docs: { description: 'Require escape sequences to use uppercase or lowercase values.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { enum: [ 'uppercase', 'lowercase' ], description: 'The case style for escape sequences.' } ], defaultOptions: [ 'uppercase' ], messages: { 'escape-uppercase': 'Use uppercase characters for the value of the escape sequence.', 'escape-lowercase': 'Use lowercase characters for the value of the escape sequence.' }, languages: [ 'js/js', 'soml/soml', 'yml/yaml', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'toml/toml' ] }),
'expiring-todo-comments': rule28,
'explicit-length-check': createLazyRule('explicit-length-check', { type: 'problem', docs: { description: 'Enforce explicitly comparing the `length` or `size` property of a value.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { 'non-zero': { enum: [ 'greater-than', 'not-equal' ], default: 'greater-than' } } } ], defaultOptions: [ { 'non-zero': 'greater-than' } ], messages: { 'non-zero': 'Use `.{{property}} {{code}}` when checking {{property}} is not zero.', zero: 'Use `.{{property}} {{code}}` when checking {{property}} is zero.', suggestion: 'Replace `.{{property}}` with `.{{property}} {{code}}`.' }, hasSuggestions: true, languages: [ 'js/js' ] }),
'explicit-timer-delay': createLazyRule('explicit-timer-delay', { type: 'suggestion', docs: { description: 'Enforce or disallow explicit `delay` argument for `setTimeout()` and `setInterval()`.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { enum: [ 'always', 'never' ], description: 'Whether to always require an explicit `delay` argument, or disallow an explicit `0` delay.' } ], defaultOptions: [ 'always' ], messages: { 'missing-delay': '`{{name}}` should have an explicit delay argument.', 'redundant-delay': '`{{name}}` should not have an explicit delay of `0`.' }, languages: [ 'js/js' ] }),
'filename-case': createLazyRule('filename-case', { type: 'suggestion', docs: { description: 'Enforce a case style for filenames and directory names.', recommended: true }, schema: [ { description: 'The rule options.', anyOf: [ { type: 'object', properties: { case: { enum: [ 'camelCase', 'camelCaseWithAcronyms', 'snakeCase', 'kebabCase', 'pascalCase' ], description: 'The filename and directory name case style.' }, ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Path segment patterns to ignore.' }, multipleFileExtensions: { type: 'boolean', description: 'Whether to treat additional, dot-separated parts of a filename as file extensions.' }, checkDirectories: { type: 'boolean', description: 'Whether to check directory names.' }, directoryRoots: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Directory root paths or patterns, relative to the current working directory.' } }, additionalProperties: false }, { type: 'object', properties: { cases: { type: 'object', properties: { camelCase: { type: 'boolean', description: 'Whether to allow camelCase filenames and directory names.' }, camelCaseWithAcronyms: { type: 'boolean', description: 'Whether to allow camelCase filenames and directory names with acronym segments.' }, snakeCase: { type: 'boolean', description: 'Whether to allow snake_case filenames and directory names.' }, kebabCase: { type: 'boolean', description: 'Whether to allow kebab-case filenames and directory names.' }, pascalCase: { type: 'boolean', description: 'Whether to allow PascalCase filenames and directory names.' } }, additionalProperties: false, description: 'The allowed filename and directory name case styles.' }, ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Path segment patterns to ignore.' }, multipleFileExtensions: { type: 'boolean', description: 'Whether to treat additional, dot-separated parts of a filename as file extensions.' }, checkDirectories: { type: 'boolean', description: 'Whether to check directory names.' }, directoryRoots: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Directory root paths or patterns, relative to the current working directory.' } }, additionalProperties: false } ] } ], defaultOptions: [], messages: { 'filename-case': 'Filename is not in {{chosenCases}}. Rename it to {{renamedFilenames}}.', 'directory-case': 'Directory name `{{directory}}` is not in {{chosenCases}}. Rename it to {{renamedDirectories}}.', 'filename-extension': 'File extension `{{extension}}` is not in lowercase. Rename it to `{{filename}}`.' }, languages: [ '*' ] }),
'id-match': rule32,
'import-style': createLazyRule('import-style', { type: 'problem', docs: { description: 'Enforce specific import styles per module.', recommended: 'unopinionated' }, schema: { type: 'array', additionalItems: false, items: [ { type: 'object', additionalProperties: false, properties: { checkImport: { type: 'boolean', description: 'Whether to check `import` statements.' }, checkDynamicImport: { type: 'boolean', description: 'Whether to check dynamic `import()` expressions.' }, checkExportFrom: { type: 'boolean', description: 'Whether to check `export … from` statements.' }, checkRequire: { type: 'boolean', description: 'Whether to check `require()` calls.' }, extendDefaultStyles: { type: 'boolean', description: 'Whether to extend the default styles.' }, styles: { '$ref': '#/definitions/moduleStyles', description: 'Module import styles.' } } } ], definitions: { moduleStyles: { type: 'object', additionalProperties: { '$ref': '#/definitions/styles' } }, styles: { anyOf: [ { enum: [ false ] }, { '$ref': '#/definitions/booleanObject' } ] }, booleanObject: { type: 'object', additionalProperties: { type: 'boolean' } } } }, defaultOptions: [ {} ], messages: { importStyle: 'Use {{allowedStyles}} import for module `{{moduleName}}`.', importStyleBanned: 'All import styles are disabled for module `{{moduleName}}`. Use the `no-restricted-imports` rule to disallow a module.' }, languages: [ 'js/js' ] }),
'indent': createLazyRule('indent', { type: 'layout', docs: { description: 'Enforce consistent indentation in JSON and CSS.', recommended: false }, fixable: 'whitespace', schema: [ { type: 'object', additionalProperties: false, properties: { indent: { oneOf: [ { enum: [ 'tab' ], description: 'Use tabs.' }, { type: 'integer', minimum: 1, description: 'Number of spaces per indentation unit.' } ], description: 'Use tabs or the specified number of spaces per indentation unit.' }, tabWidth: { type: 'integer', minimum: 1, description: 'Tab stop width used when converting CSS indentation.' } } } ], defaultOptions: [ { indent: 'tab', tabWidth: 4 } ], messages: { indent: 'Expected indentation of {{expected}} {{unit}}.' }, languages: [ 'css/css', 'json/json', 'json/jsonc', 'json/json5' ] }),
'isolated-functions': createLazyRule('isolated-functions', { type: 'problem', docs: { description: 'Prevent usage of variables from outside the scope of isolated functions.', recommended: true }, schema: [ { type: 'object', additionalProperties: false, properties: { overrideGlobals: { additionalProperties: { anyOf: [ { type: 'boolean' }, { type: 'string', enum: [ 'readonly', 'writable', 'writeable', 'off' ] } ] }, description: 'Override which global variables are allowed inside isolated scopes.' }, functions: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Function names that mark a scope as isolated.' }, selectors: { type: 'array', uniqueItems: true, items: { type: 'string', minLength: 1, pattern: '\\S' }, description: 'AST selectors that mark a scope as isolated.' }, comments: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Comment patterns that mark a scope as isolated.' } } } ], defaultOptions: [ { functions: [ 'makeSynchronous', 'workerize' ], selectors: [], comments: [ '@isolated' ], overrideGlobals: {} } ], messages: { 'externally-scoped-variable': 'Variable {{name}} not defined in scope of isolated function. Function is isolated because: {{reason}}.', super: 'Unexpected `super` in isolated function. Function is isolated because: {{reason}}.', 'this-expression': 'Unexpected `this` in isolated function. Function is isolated because: {{reason}}.' }, languages: [ 'js/js' ] }),
'iteration-fallback-style': createLazyRule('iteration-fallback-style', { type: 'suggestion', docs: { description: 'Enforce a consistent style for optional loop sources.', recommended: false }, fixable: 'code', schema: [ { enum: [ 'guard', 'fallback' ], description: 'The preferred style for optional loop sources.' } ], defaultOptions: [ 'guard' ], messages: { preferGuard: 'Prefer an `if` guard over the empty {{type}} fallback.', preferFallback: 'Prefer an empty {{type}} fallback over the `if` guard.' }, languages: [ 'js/js' ] }),
'key-name-casing': createLazyRule('key-name-casing', { type: 'suggestion', docs: { description: 'Enforce a case style for data keys.', recommended: false }, schema: [ { type: 'object', additionalProperties: false, properties: { camelCase: { type: 'boolean', description: 'Whether to allow camelCase keys.' }, PascalCase: { type: 'boolean', description: 'Whether to allow PascalCase keys.' }, SCREAMING_SNAKE_CASE: { type: 'boolean', description: 'Whether to allow SCREAMING_SNAKE_CASE keys.' }, 'kebab-case': { type: 'boolean', description: 'Whether to allow kebab-case keys.' }, snake_case: { type: 'boolean', description: 'Whether to allow snake_case keys.' }, ignore: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Regular expression patterns for keys to ignore.' } } } ], defaultOptions: [ { camelCase: true, PascalCase: false, SCREAMING_SNAKE_CASE: false, 'kebab-case': false, snake_case: false, ignore: [] } ], messages: { 'key-name-casing': 'Key `{{name}}` must be in {{cases}}.' }, languages: [ 'json/json', 'json/jsonc', 'json/json5', 'soml/soml', 'yml/yaml', 'toml/toml' ] }),
'logical-assignment-operators': rule38,
'max-nested-calls': createLazyRule('max-nested-calls', { type: 'suggestion', docs: { description: 'Limit the depth of nested calls.', recommended: true }, schema: [ { type: 'object', additionalProperties: false, properties: { max: { type: 'integer', minimum: 1, description: 'The maximum allowed nested call depth.' } } } ], defaultOptions: [ { max: 3 } ], messages: { 'max-nested-calls': 'Call is nested too deeply. Maximum allowed is {{max}}.' }, languages: [ 'js/js' ] }),
'name-replacements': createLazyRule('name-replacements', { type: 'suggestion', docs: { description: 'Enforce replacements for variable, property, and filenames.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: { type: 'array', additionalItems: false, items: [ { type: 'object', additionalProperties: false, properties: { checkProperties: { type: 'boolean', description: 'Whether to check property names.' }, checkVariables: { type: 'boolean', description: 'Whether to check variable names.' }, checkDefaultAndNamespaceImports: { type: [ 'boolean', 'string' ], pattern: 'internal', description: 'Whether to check default and namespace import names.' }, checkShorthandImports: { type: [ 'boolean', 'string' ], pattern: 'internal', description: 'Whether to check shorthand import names.' }, checkShorthandProperties: { type: 'boolean', description: 'Whether to check shorthand property names.' }, checkFilenames: { type: 'boolean', description: 'Whether to check filenames.' }, extendDefaultReplacements: { type: 'boolean', description: 'Whether to extend the default replacements.' }, replacements: { '$ref': '#/definitions/nameReplacements', description: 'Custom name replacements.' }, extendDefaultAllowList: { type: 'boolean', description: 'Whether to extend the default allow list.' }, allowList: { '$ref': '#/definitions/booleanObject', description: 'Custom allow list of names.' }, ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Patterns to ignore.' } } } ], definitions: { nameReplacements: { type: 'object', additionalProperties: { '$ref': '#/definitions/replacements' } }, replacements: { anyOf: [ { enum: [ false ] }, { '$ref': '#/definitions/booleanObject' } ] }, booleanObject: { type: 'object', additionalProperties: { type: 'boolean' } } } }, defaultOptions: [ {} ], messages: { replace: 'The {{nameTypeText}} `{{discouragedName}}` should be named `{{replacement}}`. A more descriptive name will do too.', suggestion: 'Please rename the {{nameTypeText}} `{{discouragedName}}`. Suggested names are: {{replacementsText}}. A more descriptive name will do too.', rename: 'Rename to `{{replacement}}`.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'html/html', 'markdown/commonmark', 'markdown/gfm', 'soml/soml', 'yml/yaml', 'toml/toml' ] }),
'new-for-builtins': createLazyRule('new-for-builtins', { type: 'suggestion', docs: { description: 'Enforce correct use of `new` for builtin constructors.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { enforce: 'Use `new {{name}}()` instead of `{{name}}()`.', disallow: 'Use `{{name}}()` instead of `new {{name}}()`.', disallowCallOrNew: '`{{name}}` is not a function or constructor.', 'error-date': 'Use `String(new Date())` instead of `Date()`.', 'suggestion-date': 'Switch to `String(new Date())`.' }, languages: [ 'js/js' ] }),
'no-abusive-eslint-disable': createLazyRule('no-abusive-eslint-disable', { type: 'suggestion', docs: { description: 'Enforce specifying rules to disable in `eslint-disable` comments.', recommended: 'unopinionated' }, messages: { 'no-abusive-eslint-disable': 'Specify the rules you want to disable.' }, languages: [ '*' ] }),
'no-accessor-recursion': createLazyRule('no-accessor-recursion', { type: 'problem', docs: { description: 'Disallow recursive access to `this` within getters and setters.', recommended: 'unopinionated' }, defaultOptions: [], messages: { 'no-accessor-recursion/error': 'Disallow recursive access to `this` within {{kind}}ters.' }, languages: [ 'js/js' ] }),
'no-accidental-bitwise-operator': createLazyRule('no-accidental-bitwise-operator', { type: 'problem', docs: { description: 'Disallow bitwise operators where a logical operator was likely intended.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-accidental-bitwise-operator/error': 'Unexpected bitwise operator `{{bitwiseOperator}}`. Did you mean the logical operator `{{logicalOperator}}`?', 'no-accidental-bitwise-operator/suggestion': 'Replace `{{bitwiseOperator}}` with `{{logicalOperator}}`.' }, languages: [ 'js/js' ] }),
'no-anonymous-default-export': createLazyRule('no-anonymous-default-export', { type: 'suggestion', docs: { description: 'Disallow anonymous functions and classes as the default export.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-anonymous-default-export/error': 'The {{description}} should be named.', 'no-anonymous-default-export/suggestion': 'Name it as `{{name}}`.' }, languages: [ 'js/js' ] }),
'no-array-callback-reference': createLazyRule('no-array-callback-reference', { type: 'problem', docs: { description: 'Prevent passing a function reference directly to iterator methods.', recommended: true }, hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { ignore: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Callees to ignore.' } } } ], defaultOptions: [ { ignore: [] } ], messages: { 'error-with-name': 'Do not pass function `{{name}}` directly to `.{{method}}(…)`.', 'error-without-name': 'Do not pass function directly to `.{{method}}(…)`.', 'replace-with-name': 'Replace function `{{name}}` with `… => {{name}}({{parameters}})`.', 'replace-without-name': 'Replace function with `… => …({{parameters}})`.' }, languages: [ 'js/js' ] }),
'no-array-concat-in-loop': createLazyRule('no-array-concat-in-loop', { type: 'suggestion', docs: { description: 'Disallow array accumulation with `Array#concat()` in loops.', recommended: true }, schema: [], messages: { 'no-array-concat-in-loop': 'Do not use `Array#concat()` to accumulate an array in a loop.' }, languages: [ 'js/js' ] }),
'no-array-fill-with-reference-type': createLazyRule('no-array-fill-with-reference-type', { type: 'problem', docs: { description: 'Disallow using reference values as `Array#fill()` values.', recommended: 'unopinionated' }, messages: { 'no-array-fill-with-reference-type': 'Do not use a reference value as the fill value.' }, languages: [ 'js/js' ] }),
'no-array-from-fill': createLazyRule('no-array-from-fill', { type: 'suggestion', docs: { description: 'Disallow `.fill()` after `Array.from({length: …})`.', recommended: 'unopinionated' }, messages: { 'no-array-from-fill': 'Use the `Array.from(…, mapFunction)` argument instead of chaining `.fill()`.' }, languages: [ 'js/js' ] }),
'no-array-front-mutation': createLazyRule('no-array-front-mutation', { type: 'suggestion', docs: { description: 'Disallow front-of-array mutation.', recommended: false }, schema: [], messages: { 'no-array-front-mutation': 'Avoid front-of-array mutation with `Array#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-array-method-this-argument': createLazyRule('no-array-method-this-argument', { type: 'suggestion', docs: { description: 'Disallow using the `this` argument in array methods.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'error-prototype-method': 'Do not use the `this` argument in `Array#{{method}}()`.', 'error-static-method': 'Do not use the `this` argument in `Array.{{method}}()`.', 'suggestion-remove': 'Remove this argument.', 'suggestion-bind': 'Use a bound function.' }, languages: [ 'js/js' ] }),
'no-array-reduce': createLazyRule('no-array-reduce', { type: 'suggestion', docs: { description: 'Disallow `Array#reduce()` and `Array#reduceRight()`.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { allowSimpleOperations: { type: 'boolean', description: 'Whether to allow simple reduce operations whose callback body is a single binary expression.' } } } ], defaultOptions: [ { allowSimpleOperations: true } ], messages: { reduce: '`Array#reduce()` is not allowed. Prefer other types of loop for readability.', reduceRight: '`Array#reduceRight()` is not allowed. Prefer other types of loop for readability. You may want to call `Array#toReversed()` before looping it.', 'sum-precise': 'Switch to `Math.sumPrecise()`.' }, languages: [ 'js/js' ] }),
'no-array-reverse': createLazyRule('no-array-reverse', { type: 'suggestion', docs: { description: 'Prefer `Array#toReversed()` over `Array#reverse()`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { allowExpressionStatement: { type: 'boolean' } } } ], defaultOptions: [ { allowExpressionStatement: true } ], messages: { error: 'Use `Array#toReversed()` instead of `Array#reverse()`.', 'suggestion-apply-replacement': 'Switch to `.toReversed()`.', 'suggestion-spreading-array': 'The spreading object is an array.', 'suggestion-not-spreading-array': 'The spreading object is NOT an array.' }, languages: [ 'js/js' ] }),
'no-array-sort': createLazyRule('no-array-sort', { type: 'suggestion', docs: { description: 'Prefer `Array#toSorted()` over `Array#sort()`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { allowExpressionStatement: { type: 'boolean' } } } ], defaultOptions: [ { allowExpressionStatement: true } ], messages: { error: 'Use `Array#toSorted()` instead of `Array#sort()`.', 'suggestion-apply-replacement': 'Switch to `.toSorted()`.', 'suggestion-spreading-array': 'The spreading object is an array.', 'suggestion-not-spreading-array': 'The spreading object is NOT an array.' }, languages: [ 'js/js' ] }),
'no-array-sort-for-min-max': createLazyRule('no-array-sort-for-min-max', { type: 'suggestion', docs: { description: 'Disallow sorting arrays to get the minimum or maximum value.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-array-sort-for-min-max/error': 'Use `Math.{{method}}()` instead of sorting to get the {{extreme}} value.', 'no-array-sort-for-min-max/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-array-splice': createLazyRule('no-array-splice', { type: 'suggestion', docs: { description: 'Prefer `Array#toSpliced()` over `Array#splice()`.', recommended: true }, hasSuggestions: true, schema: [], messages: { error: 'Use `Array#toSpliced()` instead of `Array#splice()`.', suggestion: 'Assign the `.toSpliced()` result back to the array.' }, languages: [ 'js/js' ] }),
'no-asterisk-prefix-in-documentation-comments': createLazyRule('no-asterisk-prefix-in-documentation-comments', { type: 'layout', docs: { description: 'Disallow asterisk prefixes and shared indentation in multiline comments.', recommended: true }, fixable: 'whitespace', schema: [], messages: { 'no-asterisk-prefix-in-documentation-comments': 'Remove asterisk prefixes and shared indentation from this comment.' }, languages: [ 'js/js', 'css/css', 'json/json', 'json/jsonc', 'json/json5', 'soml/soml' ] }),
'no-async-iterator-callback': createLazyRule('no-async-iterator-callback', { type: 'problem', docs: { description: 'Disallow asynchronous callbacks in synchronous iterator helpers.', recommended: 'unopinionated' }, schema: [], messages: { 'no-async-iterator-callback': 'Do not pass an asynchronous callback to `Iterator#{{method}}()`; returned promises are not awaited.' }, languages: [ 'js/js' ] }),
'no-async-promise-finally': createLazyRule('no-async-promise-finally', { type: 'suggestion', docs: { description: 'Disallow async functions as `Promise#finally()` callbacks.', recommended: false }, messages: { 'no-async-promise-finally': 'Do not pass an async function to `Promise#finally()`.' }, languages: [ 'js/js' ] }),
'no-await-expression-member': createLazyRule('no-await-expression-member', { type: 'suggestion', docs: { description: 'Disallow member access from await expression.', recommended: true }, fixable: 'code', messages: { 'no-await-expression-member': 'Do not access a member directly from an await expression.' }, languages: [ 'js/js' ] }),
'no-await-in-promise-methods': createLazyRule('no-await-in-promise-methods', { type: 'suggestion', docs: { description: 'Disallow using `await` in `Promise` method parameters.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-await-in-promise-methods/error': 'Avoid `await` inside `Promise.{{method}}()` arguments to prevent delaying the call.', 'no-await-in-promise-methods/suggestion': 'Remove `await`.' }, languages: [ 'js/js' ] }),
'no-barrel-files': createLazyRule('no-barrel-files', { type: 'suggestion', docs: { description: 'Disallow barrel files.', recommended: false }, schema: [], messages: { 'no-barrel-files': 'Barrel files are not allowed.' }, languages: [ 'js/js' ] }),
'no-blob-to-file': createLazyRule('no-blob-to-file', { type: 'suggestion', docs: { description: 'Disallow unnecessary `Blob` to `File` conversion.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-blob-to-file': 'Use the original `Blob` instead of converting it to a `File`.', suggestion: 'Replace the `File` with the original `Blob`.' }, languages: [ 'js/js' ] }),
'no-boolean-sort-comparator': createLazyRule('no-boolean-sort-comparator', { type: 'problem', docs: { description: 'Disallow boolean-returning sort comparators.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-boolean-sort-comparator': 'Do not return a boolean from a sort comparator.', 'no-boolean-sort-comparator/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-break-in-nested-loop': createLazyRule('no-break-in-nested-loop', { type: 'suggestion', docs: { description: 'Disallow `break` and optionally `continue` in nested loops and switches inside loops.', recommended: true }, schema: [ { type: 'object', additionalProperties: false, properties: { checkContinue: { type: 'boolean', description: 'Whether to also check unlabeled `continue` statements in nested loops and switches inside loops.' } } } ], defaultOptions: [ { checkContinue: false } ], messages: { 'no-break-in-nested-loop': 'Move this nested loop or switch into a function instead of using `{{keyword}}` here.', 'switch-continue': 'An unlabeled `continue` inside a `switch` continues the surrounding loop, not the next `case`. Use a labeled `continue` if that is intentional.' }, languages: [ 'js/js' ] }),
'no-canvas-to-image': createLazyRule('no-canvas-to-image', { type: 'suggestion', docs: { description: 'Prefer drawing canvases directly instead of converting them to images.', recommended: 'unopinionated' }, messages: { 'no-canvas-to-image': 'Prefer drawing the canvas directly with `drawImage()`.' }, languages: [ 'js/js' ] }),
'no-chained-comparison': createLazyRule('no-chained-comparison', { type: 'problem', docs: { description: 'Disallow chained comparisons such as `a < b < c`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-chained-comparison/error': 'Comparison operators cannot be chained. The inner comparison evaluates to a boolean, which is then compared instead of the operands.', 'no-chained-comparison/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-collection-bracket-access': createLazyRule('no-collection-bracket-access', { type: 'problem', docs: { description: 'Disallow accessing `Map`, `Set`, `WeakMap`, and `WeakSet` entries with bracket notation.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-collection-bracket-access/read': 'Do not read from a `{{type}}` using bracket notation.', 'no-collection-bracket-access/write': 'Do not write to a `{{type}}` using bracket notation.', 'no-collection-bracket-access/delete': 'Do not delete from a `{{type}}` using bracket notation.', 'no-collection-bracket-access/suggestion-set': 'Switch to `{{type}}#set()`.', 'no-collection-bracket-access/suggestion-delete': 'Switch to `{{type}}#delete()`.' }, languages: [ 'js/js' ] }),
'no-computed-property-existence-check': createLazyRule('no-computed-property-existence-check', { type: 'problem', docs: { description: 'Disallow dynamic object property existence checks.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'no-computed-property-existence-check/error': 'Do not use a dynamic object property existence check.', 'no-computed-property-existence-check/suggestion': 'Use `Object.hasOwn()`.' }, languages: [ 'js/js' ] }),
'no-conflicting-constraints': createLazyRule('no-conflicting-constraints', { type: 'problem', docs: { description: 'Disallow conflicting CSS query and HTML form constraints.', recommended: 'unopinionated' }, schema: [], messages: { 'no-conflicting-constraints/css': 'Conflicting constraints for `{{feature}}`: `{{lower}}` and `{{upper}}` cannot both be satisfied.', 'no-conflicting-constraints/html': '`{{minimum}}` must not be greater than `{{maximum}}`.' }, languages: [ 'js/js', 'css/css', 'html/html' ] }),
'no-confusing-array-splice': createLazyRule('no-confusing-array-splice', { type: 'suggestion', docs: { description: 'Disallow confusing uses of `Array#{splice,toSpliced}()`.', recommended: true }, hasSuggestions: true, messages: { 'replace-one-element': 'Prefer a direct element replacement instead of `{{method}}()`.', 'insert-at-negative-one': 'Avoid using `{{method}}()` to insert at `-1`.', 'suggestion-replace-one-element': 'Use direct element replacement.', 'suggestion-insert-at-negative-one': 'Resolve the insertion index explicitly.' }, languages: [ 'js/js' ] }),
'no-confusing-array-with': createLazyRule('no-confusing-array-with', { type: 'suggestion', docs: { description: 'Disallow confusing uses of `Array#with()`.', recommended: true }, schema: [], messages: { 'negative-index': 'Avoid using a negative index with `Array#with()`.', 'length-index': 'Avoid using `.length` as the index in `Array#with()`.' }, languages: [ 'js/js' ] }),
'no-console-spaces': createLazyRule('no-console-spaces', { type: 'suggestion', docs: { description: 'Do not use leading/trailing space between `console.log` parameters.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-console-spaces': 'Do not use {{position}} space between `console.{{method}}` parameters.' }, languages: [ 'js/js' ] }),
'no-constant-zero-expression': createLazyRule('no-constant-zero-expression', { type: 'problem', docs: { description: 'Disallow arithmetic and bitwise operations that always evaluate to `0`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-constant-zero-expression/error': 'This operation always evaluates to `0` (or `-0`/`NaN`), which is likely a mistake.', 'no-constant-zero-expression/suggestion': 'Replace this expression with `0`.' }, languages: [ 'js/js' ] }),
'no-declarations-before-early-exit': createLazyRule('no-declarations-before-early-exit', { type: 'suggestion', docs: { description: 'Disallow declarations before conditional early exits when they are only used after the exit.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'no-declarations-before-early-exit': 'Move this declaration after the early exit.' }, languages: [ 'js/js' ] }),
'no-document-cookie': createLazyRule('no-document-cookie', { type: 'problem', docs: { description: 'Do not use `document.cookie` directly.', recommended: 'unopinionated' }, messages: { 'no-document-cookie': 'Do not use `document.cookie` directly.' }, languages: [ 'js/js' ] }),
'no-double-comparison': createLazyRule('no-double-comparison', { type: 'suggestion', docs: { description: 'Disallow two comparisons of the same operands that can be combined into one.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-double-comparison': 'These comparisons can be simplified to `{{replacement}}`.', 'no-double-comparison/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-duplicate-if-branches': createLazyRule('no-duplicate-if-branches', { type: 'problem', docs: { description: 'Disallow duplicate adjacent branches in if chains.', recommended: true }, schema: [], messages: { 'no-duplicate-if-branches': 'This branch has the same body as the branch on line {{line}}.' }, languages: [ 'js/js' ] }),
'no-duplicate-logical-operands': createLazyRule('no-duplicate-logical-operands', { type: 'problem', docs: { description: 'Disallow adjacent duplicate operands in logical expressions.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'no-duplicate-logical-operands': 'This operand duplicates the left operand.', 'no-duplicate-logical-operands/suggestion': 'Remove the duplicate operand.' }, languages: [ 'js/js' ] }),
'no-duplicate-loops': createLazyRule('no-duplicate-loops', { type: 'suggestion', docs: { description: 'Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.', recommended: true }, messages: { 'no-duplicate-loops': 'Do not use `.{{method}}()` directly in a `{{loopKind}}` loop header. It creates an intermediate array before the loop.' }, languages: [ 'js/js' ] }),
'no-duplicate-set-values': createLazyRule('no-duplicate-set-values', { type: 'suggestion', docs: { description: 'Disallow duplicate values in `Set` constructor array literals.', recommended: true }, messages: { 'no-duplicate-set-values': 'Remove duplicate value `{{value}}` from the Set.' }, languages: [ 'js/js' ] }),
'no-empty-file': createLazyRule('no-empty-file', { type: 'suggestion', docs: { description: 'Disallow empty files.', recommended: 'unopinionated' }, schema: [ { type: 'object', additionalProperties: false, properties: { allowComments: { type: 'boolean', description: 'Whether to allow files that only contain comments.' } } } ], defaultOptions: [ { allowComments: false } ], messages: { 'no-empty-file': 'Empty files are not allowed.' }, languages: [ 'js/js', 'css/css', 'html/html', 'json/json', 'json/jsonc', 'json/json5', 'markdown/commonmark', 'markdown/gfm', 'toml/toml', 'yml/yaml' ] }),
'no-empty-link-text': createLazyRule('no-empty-link-text', { type: 'problem', docs: { description: 'Disallow empty link text in Markdown.', recommended: 'unopinionated' }, schema: [], messages: { 'no-empty-link-text': 'Link text must not be empty.' }, languages: [ 'markdown/commonmark', 'markdown/gfm' ] }),
'no-error-property-assignment': createLazyRule('no-error-property-assignment', { type: 'problem', docs: { description: 'Disallow assigning to built-in error properties.', recommended: 'unopinionated' }, schema: [], messages: { 'no-error-property-assignment': 'Do not assign to `{{property}}` on a built-in error.' }, languages: [ 'js/js' ] }),
'no-exports-in-scripts': createLazyRule('no-exports-in-scripts', { type: 'suggestion', docs: { description: 'Disallow exports in scripts.', recommended: 'unopinionated' }, schema: [], messages: { 'no-exports-in-scripts': 'Do not use exports in scripts.' }, languages: [ 'js/js' ] }),
'no-for-each': createLazyRule('no-for-each', { type: 'suggestion', docs: { description: 'Prefer `for…of` over the `forEach` method.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-for-each/error': 'Use `for…of` instead of `.forEach(…)`.', 'no-for-each/suggestion': 'Switch to `for…of`.' }, languages: [ 'js/js' ] }),
'no-for-loop': createLazyRule('no-for-loop', { type: 'suggestion', docs: { description: 'Do not use a `for` loop that can be replaced with a `for-of` loop.', recommended: true }, fixable: 'code', messages: { 'no-for-loop': 'Use a `for-of` loop instead of this `for` loop.' }, languages: [ 'js/js' ] }),
'no-global-object-property-assignment': createLazyRule('no-global-object-property-assignment', { type: 'problem', docs: { description: 'Disallow assigning properties on the global object.', recommended: 'unopinionated' }, schema: [], messages: { 'no-global-object-property-assignment': 'Do not assign properties on the global object.' }, languages: [ 'js/js' ] }),
'no-immediate-mutation': createLazyRule('no-immediate-mutation', { type: 'suggestion', docs: { description: 'Disallow immediate mutation after assignment and initialization immediately after declaration.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', properties: { checkCollections: { type: 'boolean', description: 'Whether to check mutations of Map, Set, WeakMap, and WeakSet.' }, checkConditionals: { type: 'boolean', description: 'Whether to check conditional mutations.' } }, additionalProperties: false } ], defaultOptions: [ { checkCollections: true, checkConditionals: false } ], messages: { error: 'Immediate mutation on {{objectType}} is not allowed.', initialization: 'Combine this initialization with the preceding declaration.', 'suggestion/initialization': 'Combine the initialization and declaration.', 'suggestion/array': '{{operation}} the elements to the {{assignType}}.', 'suggestion/object': 'Move this property to the {{assignType}}.', 'suggestion/object-assign': '{{description}} the {{assignType}}.', 'suggestion/set': 'Move the element to the {{assignType}}.', 'suggestion/map': 'Move the entry to the {{assignType}}.', 'suggestion/conditional': 'Move the conditional mutation to the {{assignType}}.' }, languages: [ 'js/js' ] }),
'no-impossible-length-comparison': createLazyRule('no-impossible-length-comparison', { type: 'problem', docs: { description: 'Disallow impossible comparisons against `.length` or `.size`.', recommended: 'unopinionated' }, messages: { 'no-impossible-length-comparison': 'This comparison is always {{result}} because `.{{property}}` is always a non-negative integer.' }, languages: [ 'js/js' ] }),
'no-incomplete-accessor-override': createLazyRule('no-incomplete-accessor-override', { type: 'problem', docs: { description: 'Disallow class accessors that hide an inherited getter or setter.', recommended: 'unopinionated' }, messages: { 'no-incomplete-accessor-override': 'This {{kind}}ter hides the inherited {{oppositeKind}}ter for `{{name}}`. Define both accessors in this class.' }, languages: [ 'js/js' ] }),
'no-incorrect-query-selector': createLazyRule('no-incorrect-query-selector', { type: 'suggestion', docs: { description: 'Disallow incorrect `querySelector()` and `querySelectorAll()` usage.', recommended: true }, fixable: 'code', schema: [], messages: { 'first-match': 'Prefer `.querySelector()` when only the first match is used.', 'id-selector': 'Prefer `.querySelector()` for a simple ID selector.', 'length-check': 'Check `.length` instead of the `NodeList` object itself.', 'query-selector-all-nullish': 'Check `.length` instead of comparing the `NodeList` object with `null` or `undefined`.', 'query-selector-undefined': 'Compare the result of `.querySelector()` with `null` instead of `undefined`.' }, languages: [ 'js/js' ] }),
'no-incorrect-template-string-interpolation': createLazyRule('no-incorrect-template-string-interpolation', { type: 'problem', docs: { description: 'Disallow incorrect template literal interpolation syntax.', recommended: true }, hasSuggestions: true, messages: { 'no-incorrect-template-string-interpolation': 'Use `{{correct}}` for template literal interpolation.', 'no-incorrect-template-string-interpolation/suggestion': 'Replace `{{incorrect}}` with `{{correct}}`.' }, languages: [ 'js/js' ] }),
'no-ineffective-csp-directives': createLazyRule('no-ineffective-csp-directives', { type: 'problem', docs: { description: 'Disallow ineffective CSP directives in `<meta>` elements.', recommended: 'unopinionated' }, schema: [], messages: { 'no-ineffective-csp-directives': 'The CSP directive `{{directive}}` is ignored in `<meta>` elements. Deliver it through the `Content-Security-Policy` HTTP response header instead.' }, languages: [ 'js/js', 'html/html' ] }),
'no-instanceof-builtins': createLazyRule('no-instanceof-builtins', { type: 'problem', docs: { description: 'Disallow `instanceof` with built-in objects', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', properties: { useErrorIsError: { type: 'boolean' }, strategy: { enum: [ 'loose', 'strict' ] }, include: { type: 'array', items: { type: 'string' } }, exclude: { type: 'array', items: { type: 'string' } } }, additionalProperties: false } ], defaultOptions: [ { useErrorIsError: false, strategy: 'loose', include: [], exclude: [] } ], hasSuggestions: true, messages: { 'no-instanceof-builtins': 'Avoid using `instanceof` for type checking as it can lead to unreliable results.', 'switch-to-type-of': "Switch to `typeof … === '{{type}}'`." }, languages: [ 'js/js' ] }),
'no-invalid-argument-count': createLazyRule('no-invalid-argument-count', { type: 'problem', docs: { description: 'Disallow calling functions and constructors with an invalid number of arguments.', recommended: 'unopinionated' }, schema: [ { type: 'object', description: 'Additional call and constructor patterns to check.', propertyNames: { pattern: '^(?:new )?(?:\\*|[A-Za-z_$][\\w$]*)(?:\\.(?:\\*|[A-Za-z_$][\\w$]*))*$' }, additionalProperties: { anyOf: [ { type: 'integer', minimum: 0 }, { type: 'array', items: { type: 'integer', minimum: 0 }, minItems: 1, uniqueItems: true }, { type: 'object', properties: { min: { type: 'integer', minimum: 0 }, max: { type: 'integer', minimum: 0 } }, additionalProperties: false, minProperties: 1 } ] } } ], defaultOptions: [ {} ], messages: { 'no-invalid-argument-count': 'Expected {{expected}}, but got {{actual}}.' }, languages: [ 'js/js' ] }),
'no-invalid-boolean-attribute-value': createLazyRule('no-invalid-boolean-attribute-value', { type: 'problem', docs: { description: 'Disallow invalid values for HTML boolean attributes.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-invalid-boolean-attribute-value': 'Invalid value for boolean attribute `{{attribute}}`. Use an empty string or the attribute name; remove the attribute to represent false.', 'no-invalid-boolean-attribute-value/remove': 'Remove the `{{attribute}}` attribute.', 'no-invalid-boolean-attribute-value/empty': 'Set the `{{attribute}}` attribute to an empty string.' }, languages: [ 'js/js' ] }),
'no-invalid-character-comparison': createLazyRule('no-invalid-character-comparison', { type: 'problem', docs: { description: 'Disallow comparing a single character from a string to a multi-character string.', recommended: 'unopinionated' }, schema: [], messages: { 'no-invalid-character-comparison': 'A single character can never equal the multi-character string `{{string}}`, so this comparison is always {{result}}.' }, languages: [ 'js/js' ] }),
'no-invalid-dom-token': createLazyRule('no-invalid-dom-token', { type: 'problem', docs: { description: 'Disallow invalid DOM tokens.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-invalid-dom-token/empty': 'DOM tokens must not be empty.', 'no-invalid-dom-token/whitespace': 'DOM tokens must not contain ASCII whitespace.', 'no-invalid-dom-token/suggestion': 'Replace with separate tokens.' }, languages: [ 'js/js' ] }),
'no-invalid-fetch-options': createLazyRule('no-invalid-fetch-options', { type: 'problem', docs: { description: 'Disallow invalid options in `fetch()` and `new Request()`.', recommended: 'unopinionated' }, messages: { 'no-invalid-fetch-options': '"body" is not allowed when method is "{{method}}".' }, languages: [ 'js/js' ] }),
'no-invalid-file-input-accept': createLazyRule('no-invalid-file-input-accept', { type: 'problem', docs: { description: 'Disallow invalid `accept` values on file inputs.', recommended: false }, fixable: 'code', messages: { 'no-invalid-file-input-accept/invalid': 'Invalid file input `accept` value: {{reason}}', 'no-invalid-file-input-accept/static': 'The file input `accept` value must be static.', 'no-invalid-file-input-accept/normalize': 'Prefer `{{replacement}}` as the file input `accept` value.' }, languages: [ 'js/js', 'html/html' ] }),
'no-invalid-integrity': createLazyRule('no-invalid-integrity', { type: 'problem', docs: { description: 'Disallow invalid subresource integrity metadata.', recommended: 'unopinionated' }, schema: [], messages: { invalid: 'Invalid `integrity` metadata `{{token}}`: {{reason}}', unrecognized: 'The `integrity` value must contain at least one recognized algorithm: `sha256`, `sha384`, `sha512`, or `ed25519`.' }, languages: [ 'js/js', 'html/html' ] }),
'no-invalid-intl-options': createLazyRule('no-invalid-intl-options', { type: 'problem', docs: { description: 'Disallow invalid or ignored Intl options.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { unknown: '`{{option}}` is not a recognized {{api}} option.', invalid: '`{{option}}` must be {{expected}}.', required: 'The `{{required}}` option is required {{reason}}.', conflicting: '`{{option}}` {{reason}}.', ignored: '`{{option}}` is ignored {{reason}}.', rename: 'Rename `{{option}}` to `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-invalid-property-descriptor': createLazyRule('no-invalid-property-descriptor', { type: 'problem', docs: { description: 'Disallow invalid property descriptors.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'incompatible-fields': 'A property descriptor cannot combine `get` or `set` with `value` or `writable`.', 'non-object-descriptor': 'A property descriptor must be an object.', 'non-callable-accessor': 'The `{{name}}` field must be a function or `undefined`.', 'unknown-field': 'Unknown property descriptor field `{{name}}`.', 'rename-writeable': 'Rename `writeable` to `writable`.' }, languages: [ 'js/js' ] }),
'no-invalid-remove-event-listener': createLazyRule('no-invalid-remove-event-listener', { type: 'problem', docs: { description: 'Prevent calling `EventTarget#removeEventListener()` with the result of an expression.', recommended: 'unopinionated' }, messages: { 'no-invalid-remove-event-listener': 'The listener argument should be a function reference.' }, languages: [ 'js/js' ] }),
'no-invalid-response-options': createLazyRule('no-invalid-response-options', { type: 'problem', docs: { description: 'Disallow invalid options in `new Response()`, `Response.json()`, and `Response.redirect()`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'invalid-status': 'Response status must be in the range 200 to 599.', 'body-with-null-body-status': 'A response with status {{status}} cannot have a body.', 'invalid-redirect-status': '`Response.redirect()` status must be 301, 302, 303, 307, or 308.', 'remove-body': 'Replace the response body with `undefined`.' }, languages: [ 'js/js' ] }),
'no-invalid-style-set-property': createLazyRule('no-invalid-style-set-property', { type: 'problem', docs: { description: 'Disallow invalid arguments to `CSSStyleDeclaration#setProperty()`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-invalid-style-set-property/property': 'Use the CSS property name `{{replacement}}` instead of `{{property}}` in `setProperty()`.', 'no-invalid-style-set-property/value': 'Pass `important` as the priority argument instead of including `!important` in the value.', 'no-invalid-style-set-property/priority': 'The `setProperty()` priority must be an empty string or `important` (case-insensitive).', 'no-invalid-style-set-property/replace': 'Replace with `{{replacement}}`.', 'no-invalid-style-set-property/move-important': 'Move `!important` to the priority argument.' }, languages: [ 'js/js' ] }),
'no-invalid-temporal-arithmetic': createLazyRule('no-invalid-temporal-arithmetic', { type: 'problem', docs: { description: 'Disallow statically known invalid Temporal arithmetic.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'instant-calendar-unit': '`Temporal.Instant.{{method}}()` does not support nonzero years, months, weeks, or days. Use elapsed time units or calendar arithmetic on a `Temporal.ZonedDateTime`.', 'duration-calendar-unit': '`Temporal.Duration.{{method}}()` does not support nonzero years, months, or weeks. Use date arithmetic relative to a starting point.', 'year-month-unit': '`Temporal.PlainYearMonth.{{method}}()` does not support nonzero weeks, days, or time units. Use years or months, or date arithmetic on a `Temporal.PlainDate`.', 'relative-to': '`Temporal.Duration.{{method}}()` requires `relativeTo` for calendar units.', 'invalid-option': 'Invalid `{{option}}` for `Temporal.{{type}}.{{method}}()`.', 'missing-unit': '`Temporal.{{type}}.{{method}}()` requires {{required}}.', 'unit-order': '`largestUnit` must be at least as large as `smallestUnit`.', 'invalid-increment': 'Invalid `roundingIncrement` for `Temporal.{{type}}.{{method}}()` and the selected units.', 'correct-unit-key': 'Use `{{expected}}` instead of `{{actual}}`.', 'elapsed-days': 'Treat each day as 24 elapsed hours.' }, languages: [ 'js/js' ] }),
'no-invalid-url-protocol-comparison': createLazyRule('no-invalid-url-protocol-comparison', { type: 'problem', docs: { description: 'Disallow invalid protocol strings in comparisons with `URL#protocol`.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'no-invalid-url-protocol-comparison': '`URL#protocol` values are lowercase and end with `:`. Compare with `{{protocol}}`.' }, languages: [ 'js/js' ] }),
'no-invalid-well-known-symbol-methods': createLazyRule('no-invalid-well-known-symbol-methods', { type: 'problem', docs: { description: 'Disallow invalid implementations of well-known symbol methods.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-invalid-well-known-symbol-methods/async-dispose': '`Symbol.dispose` must not return a Promise. Use `Symbol.asyncDispose` instead.', 'no-invalid-well-known-symbol-methods/dispose-generator': '`Symbol.dispose` must not be a generator. Use a normal method for synchronous disposal or `Symbol.asyncDispose` for asynchronous disposal.', 'no-invalid-well-known-symbol-methods/sync-iterator': '`Symbol.iterator` must return a sync iterator. Use `Symbol.asyncIterator` for async iterators.', 'no-invalid-well-known-symbol-methods/async-iterator': '`Symbol.asyncIterator` must return an async iterator directly. Use an async generator or return the iterator synchronously.', 'no-invalid-well-known-symbol-methods/suggestion': 'Use `Symbol.{{replacement}}` instead.' }, languages: [ 'js/js' ] }),
'no-javascript-url': createLazyRule('no-javascript-url', { type: 'problem', docs: { description: 'Disallow `javascript:` URLs in Markdown.', recommended: false }, schema: [], messages: { 'no-javascript-url': 'Do not use `javascript:` URLs.' }, languages: [ 'markdown/commonmark', 'markdown/gfm' ] }),
'no-keyword-prefix': createLazyRule('no-keyword-prefix', { type: 'suggestion', docs: { description: 'Disallow identifiers starting with `new` or `class`.', recommended: false }, schema: [ { type: 'object', additionalProperties: false, properties: { disallowedPrefixes: { type: 'array', items: { type: 'string' }, minItems: 0, uniqueItems: true, description: 'The prefixes to disallow.' }, checkProperties: { type: 'boolean', description: 'Whether to check property names.' }, onlyCamelCase: { type: 'boolean', description: 'Whether to only check camelCase names.' } } } ], defaultOptions: [ {} ], messages: { noKeywordPrefix: 'Do not prefix identifiers with keyword `{{keyword}}`.' }, languages: [ 'js/js' ] }),
'no-late-current-target-access': createLazyRule('no-late-current-target-access', { type: 'problem', docs: { description: 'Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.', recommended: true }, messages: { 'after-suspension': '`{{name}}.currentTarget` is `null` after the handler suspends. It is only set during synchronous event dispatch; save it to a variable beforehand.', 'in-nested-function': '`{{name}}.currentTarget` is `null` inside this nested function. It is only set during synchronous event dispatch; save it to a variable in the outer function.' }, languages: [ 'js/js' ] }),
'no-late-event-control': createLazyRule('no-late-event-control', { type: 'problem', docs: { description: 'Disallow event-control method calls after the synchronous event dispatch has finished.', recommended: true }, schema: [], messages: { 'after-suspension': '`{{name}}.{{method}}()` has no effect after the handler suspends. Call it before `await` or `yield` while the event is still being dispatched.', 'in-generator': '`{{name}}.{{method}}()` is not called during event dispatch inside a generator function. Use a normal function handler instead.', 'in-nested-function': '`{{name}}.{{method}}()` may run after synchronous event dispatch has finished. Call it in the outer handler before deferring work.' }, languages: [ 'js/js' ] }),
'no-leading-empty-lines': createLazyRule('no-leading-empty-lines', { type: 'layout', docs: { description: 'Disallow empty lines at the beginning of a file.', recommended: true }, fixable: 'whitespace', schema: [], messages: { 'no-leading-empty-lines': 'Do not use empty lines at the beginning of a file.' }, languages: [ '*' ] }),
'no-lonely-if': createLazyRule('no-lonely-if', { type: 'suggestion', docs: { description: 'Disallow `if` statements as the only statement in `if` blocks without `else`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-lonely-if': 'Unexpected `if` as the only statement in a `if` block without `else`.' }, languages: [ 'js/js' ] }),
'no-loop-iterable-mutation': createLazyRule('no-loop-iterable-mutation', { type: 'problem', docs: { description: 'Disallow mutating a loop iterable during iteration.', recommended: true }, schema: [], messages: { 'no-loop-iterable-mutation': 'Do not mutate `{{iterable}}` while iterating over it.' }, languages: [ 'js/js' ] }),
'no-loss-of-precision': createLazyRule('no-loss-of-precision', { type: 'problem', docs: { description: 'Disallow numeric literals that lose precision when represented as IEEE 754 binary64 values.', recommended: false }, schema: [], messages: { 'no-loss-of-precision': 'This numeric literal loses precision when represented as an IEEE 754 binary64 value.' }, languages: [ 'css/css', 'json/json', 'json/jsonc', 'json/json5', 'toml/toml', 'soml/soml' ] }),
'no-magic-array-flat-depth': createLazyRule('no-magic-array-flat-depth', { type: 'suggestion', docs: { description: 'Disallow a magic number as the `depth` argument in `Array#flat(…).`', recommended: 'unopinionated' }, messages: { 'no-magic-array-flat-depth': 'Magic number as depth is not allowed.' }, languages: [ 'js/js' ] }),
'no-manually-wrapped-comments': createLazyRule('no-manually-wrapped-comments', { type: 'layout', docs: { description: 'Disallow manually wrapped comments.', recommended: false }, fixable: 'whitespace', messages: { 'no-manually-wrapped-comments': 'Avoid manually wrapping comments.' }, languages: [ 'js/js', 'css/css', 'json/json', 'json/jsonc', 'json/json5', 'toml/toml', 'soml/soml', 'yml/yaml' ] }),
'no-mismatched-map-key': createLazyRule('no-mismatched-map-key', { type: 'problem', docs: { description: 'Disallow checking a Map key before accessing a different key.', recommended: true }, schema: [], messages: { 'no-mismatched-map-key': 'Do not check a Map key before accessing a different key.' }, languages: [ 'js/js' ] }),
'no-misrefactored-assignment': createLazyRule('no-misrefactored-assignment', { type: 'problem', docs: { description: 'Disallow misrefactored compound assignments where the target is duplicated in the right-hand side.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-misrefactored-assignment/error': '`{{target}}` is duplicated in the right-hand side, which is likely a refactoring mistake.', 'no-misrefactored-assignment/suggestion': 'Remove the duplicated `{{target}}`.' }, languages: [ 'js/js' ] }),
'no-missing-local-resource': createLazyRule('no-missing-local-resource', { type: 'problem', docs: { description: 'Disallow references to missing local resources.', recommended: false }, fixable: 'code', schema: [], messages: { missing: 'Resource `{{resource}}` does not exist.', 'incorrect-case': 'Resource path has incorrect casing. Use `{{resource}}`.' }, languages: [ 'js/js', 'css/css', 'html/html', 'markdown/commonmark', 'markdown/gfm' ] }),
'no-multiple-promise-resolver-calls': createLazyRule('no-multiple-promise-resolver-calls', { type: 'problem', docs: { description: 'Disallow calling Promise executor resolver functions more than once on the same execution path.', recommended: 'unopinionated' }, messages: { 'no-multiple-promise-resolver-calls': 'Promise executor resolver functions may be called multiple times on the same execution path.' }, languages: [ 'js/js' ] }),
'no-named-default': createLazyRule('no-named-default', { type: 'suggestion', docs: { description: 'Disallow named usage of default import and export.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-named-default': 'Prefer using the default {{type}} over named {{type}}.' }, languages: [ 'js/js' ] }),
'no-negated-array-predicate': createLazyRule('no-negated-array-predicate', { type: 'suggestion', docs: { description: 'Disallow negated array predicate calls.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-negated-array-predicate': 'Prefer `Array#{{replacement}}()` with a negated predicate over negating `Array#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-negated-comparison': createLazyRule('no-negated-comparison', { type: 'suggestion', docs: { description: 'Disallow negated comparisons.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { checkLogicalExpressions: { type: 'boolean', description: 'Check logical expressions that only contain equality comparisons.' } } } ], defaultOptions: [ { checkLogicalExpressions: false } ], messages: { 'no-negated-comparison/error': 'Prefer the opposite comparison instead of negating the whole comparison.', 'no-negated-comparison/logical-error': 'Prefer the opposite comparisons instead of negating the whole logical expression.' }, languages: [ 'js/js' ] }),
'no-negated-condition': createLazyRule('no-negated-condition', { type: 'suggestion', docs: { description: 'Disallow negated conditions.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-negated-condition': 'Unexpected negated condition.' }, languages: [ 'js/js' ] }),
'no-negation-in-equality-check': createLazyRule('no-negation-in-equality-check', { type: 'problem', docs: { description: 'Disallow negated expression in equality check.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-negation-in-equality-check/error': 'Negated expression is not allowed in equality check.', 'no-negation-in-equality-check/suggestion': "Switch to '{{operator}}' check." }, languages: [ 'js/js' ] }),
'no-nested-ternary': createLazyRule('no-nested-ternary', { type: 'suggestion', docs: { description: 'Disallow nested ternary expressions.', recommended: true }, fixable: 'code', messages: { 'too-deep': 'Do not nest ternary expressions.', 'should-parenthesized': 'Nested ternary expression should be parenthesized.' }, languages: [ 'js/js' ] }),
'no-new-array': createLazyRule('no-new-array', { type: 'suggestion', docs: { description: 'Disallow `new Array()`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { error: '`new Array()` is unclear in intent; use an array literal or `Array.from()`.', spread: 'Spread the argument.' }, languages: [ 'js/js' ] }),
'no-new-buffer': createLazyRule('no-new-buffer', { type: 'problem', docs: { description: 'Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { error: '`new Buffer()` is deprecated, use `Buffer.{{method}}()` instead.', 'error-unknown': '`new Buffer()` is deprecated, use `Buffer.alloc()` or `Buffer.from()` instead.', suggestion: 'Switch to `Buffer.{{replacement}}()`.' }, languages: [ 'js/js' ] }),
'no-non-function-verb-prefix': createLazyRule('no-non-function-verb-prefix', { type: 'suggestion', docs: { description: 'Disallow non-function values with function-style verb prefixes.', recommended: true, requiresTypeChecking: true }, schema: [ { type: 'object', additionalProperties: false, properties: { verbs: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 0, uniqueItems: true, description: 'Function-style verb prefixes to check.' }, ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Patterns to ignore.' } } } ], defaultOptions: [ { verbs: [ 'get', 'set', 'unset', 'delete', 'add', 'remove', 'destroy', 'create' ], ignore: [] } ], messages: { 'no-non-function-verb-prefix': '`{{name}}` starts with `{{verb}}`, so it should be a function.' }, languages: [ 'js/js' ] }),
'no-nonstandard-builtin-properties': createLazyRule('no-nonstandard-builtin-properties', { type: 'problem', docs: { description: 'Disallow non-standard properties on built-in objects.', recommended: 'unopinionated' }, schema: [], messages: { 'no-nonstandard-builtin-properties/nonstandard': '`{{property}}` is not a standard property of `{{receiver}}`.', 'no-nonstandard-builtin-properties/noncallable': '`{{property}}` is not a callable property of `{{receiver}}`.', 'no-nonstandard-builtin-properties/nonconstructible': '`{{property}}` is not a constructible property of `{{receiver}}`.' }, languages: [ 'js/js' ] }),
'no-null': createLazyRule('no-null', { type: 'suggestion', docs: { description: 'Disallow the use of the `null` literal.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkArguments: { type: 'boolean', description: 'Whether to check `null` used as a direct function call or constructor argument.' }, checkStrictEquality: { type: 'boolean', description: 'Whether to check strict equality comparisons against `null`.' } } } ], defaultOptions: [ { checkArguments: true, checkStrictEquality: false } ], messages: { error: 'Use `undefined` instead of `null`.', replace: 'Replace `null` with `undefined`.', remove: 'Remove `null`.' }, languages: [ 'js/js' ] }),
'no-object-as-default-parameter': createLazyRule('no-object-as-default-parameter', { type: 'problem', docs: { description: 'Disallow the use of objects as default parameters.', recommended: 'unopinionated' }, messages: { identifier: 'Do not use an object literal as default for parameter `{{parameter}}`.', 'non-identifier': 'Do not use an object literal as default.' }, languages: [ 'js/js' ] }),
'no-object-methods-with-collections': createLazyRule('no-object-methods-with-collections', { type: 'problem', docs: { description: 'Disallow `Object` methods with `Map` or `Set`.', recommended: true }, hasSuggestions: true, messages: { 'no-object-methods-with-collections/error': '`Object.{{method}}()` does not return {{type}} contents.', 'no-object-methods-with-collections/suggestion': 'Use `Array.from({{replacement}})`.' }, languages: [ 'js/js' ] }),
'no-optional-chaining-on-undeclared-variable': createLazyRule('no-optional-chaining-on-undeclared-variable', { type: 'problem', docs: { description: 'Disallow optional chaining on undeclared variables.', recommended: true }, schema: [], messages: { 'no-optional-chaining-on-undeclared-variable': 'Optional chaining on undeclared variable `{{name}}` throws a ReferenceError.' }, languages: [ 'js/js' ] }),
'no-prevent-default-in-passive-listener': createLazyRule('no-prevent-default-in-passive-listener', { type: 'problem', docs: { description: 'Disallow ineffective `preventDefault()` calls in passive event listeners.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-prevent-default-in-passive-listener/error': '`preventDefault()` has no effect in a passive event listener.', 'no-prevent-default-in-passive-listener/suggestion': 'Change `passive` to `false` to allow event cancellation.' }, languages: [ 'js/js' ] }),
'no-process-exit': createLazyRule('no-process-exit', { type: 'suggestion', docs: { description: 'Disallow `process.exit()`.', recommended: 'unopinionated' }, messages: { 'no-process-exit': 'Only use `process.exit()` in CLI apps. Throw an error instead.' }, languages: [ 'js/js' ] }),
'no-redundant-comparison': createLazyRule('no-redundant-comparison', { type: 'suggestion', docs: { description: 'Disallow comparisons made redundant by an equality check in the same logical AND.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-redundant-comparison': 'This comparison is redundant because it is already implied by the other conditions.', 'no-redundant-comparison/suggestion': 'Remove this redundant comparison.' }, languages: [ 'js/js' ] }),
'no-repeated-call-wrappers': createLazyRule('no-repeated-call-wrappers', { type: 'suggestion', docs: { description: 'Disallow repeating the same wrapper at every call to a function.', recommended: false }, schema: [], messages: { 'no-repeated-call-wrappers': 'Every call wraps the result of this function in `{{wrapper}}`. Consider returning the wrapped value directly.' }, languages: [ 'js/js' ] }),
'no-return-array-push': createLazyRule('no-return-array-push', { type: 'problem', docs: { description: 'Disallow using the return value of `Array#push()` and `Array#unshift()`.', recommended: true }, hasSuggestions: true, messages: { 'no-return-array-push/error': 'Do not use the return value of `.{{method}}(…)`.', 'no-return-array-push/suggestion': 'Separate the `{{method}}()` call from `return`.' }, languages: [ 'js/js' ] }),
'no-selector-as-dom-name': createLazyRule('no-selector-as-dom-name', { type: 'problem', docs: { description: 'Disallow selector syntax in DOM names.', recommended: true }, fixable: 'code', messages: { 'no-selector-as-dom-name': 'Do not use selector syntax in DOM names.' }, languages: [ 'js/js' ] }),
'no-shorthand-property-overrides': createLazyRule('no-shorthand-property-overrides', { type: 'problem', docs: { description: 'Disallow shorthand properties that override related longhand properties.', recommended: 'unopinionated' }, messages: { 'no-shorthand-property-overrides': 'The shorthand property `{{shorthand}}` overrides the previously declared `{{longhand}}` property.' }, languages: [ 'js/js', 'css/css' ] }),
'no-single-promise-in-promise-methods': createLazyRule('no-single-promise-in-promise-methods', { type: 'suggestion', docs: { description: 'Disallow passing single-element arrays to `Promise` methods.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-single-promise-in-promise-methods/error': 'Wrapping single-element array with `Promise.{{method}}()` is unnecessary.', 'no-single-promise-in-promise-methods/unwrap': 'Use the value directly.', 'no-single-promise-in-promise-methods/use-promise-resolve': 'Switch to `Promise.resolve(…)`.' }, languages: [ 'js/js' ] }),
'no-static-only-class': createLazyRule('no-static-only-class', { type: 'suggestion', docs: { description: 'Disallow classes that only have static members.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-static-only-class': 'Use an object instead of a class with only static members.' }, languages: [ 'js/js' ] }),
'no-subtraction-comparison': createLazyRule('no-subtraction-comparison', { type: 'suggestion', docs: { description: 'Prefer comparing values directly over subtracting and comparing to `0`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-subtraction-comparison/error': 'Prefer comparing the values directly over comparing the difference with `0`.', 'no-subtraction-comparison/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'no-thenable': createLazyRule('no-thenable', { type: 'problem', docs: { description: 'Disallow `then` property.', recommended: 'unopinionated' }, messages: { 'no-thenable-object': 'Do not add `then` to an object.', 'no-thenable-export': 'Do not export `then`.', 'no-thenable-class': 'Do not add `then` to a class.' }, languages: [ 'js/js' ] }),
'no-this-assignment': createLazyRule('no-this-assignment', { type: 'suggestion', docs: { description: 'Disallow assigning `this` to a variable.', recommended: 'unopinionated' }, messages: { 'no-this-assignment': 'Do not assign `this` to `{{name}}`.' }, languages: [ 'js/js' ] }),
'no-this-outside-of-class': createLazyRule('no-this-outside-of-class', { type: 'problem', docs: { description: 'Disallow `this` outside of classes.', recommended: true }, schema: [], messages: { 'no-this-outside-of-class': 'Do not use `this` outside of classes.' }, languages: [ 'js/js' ] }),
'no-top-level-assignment-in-function': createLazyRule('no-top-level-assignment-in-function', { type: 'problem', docs: { description: 'Disallow assigning to top-level variables from inside functions.', recommended: true }, schema: [], messages: { 'no-top-level-assignment-in-function': 'Do not assign to top-level variable `{{name}}` from inside a function.' }, languages: [ 'js/js' ] }),
'no-top-level-side-effects': createLazyRule('no-top-level-side-effects', { type: 'problem', docs: { description: 'Disallow top-level side effects in exported modules.', recommended: true }, schema: [ { type: 'object', properties: { checkUnknownCalls: { type: 'boolean', description: 'Check invocations whose side effects are unknown.' }, allow: { type: 'object', description: 'Additional pure export names or member paths by import source.', additionalProperties: { type: 'array', items: { type: 'string' } } } }, additionalProperties: false } ], defaultOptions: [ { allow: {}, checkUnknownCalls: false } ], messages: { 'no-top-level-side-effects': 'This invocation may cause side effects when the module is imported.', 'global-mutation': 'Do not modify global state when the module is imported.' }, languages: [ 'js/js' ] }),
'no-transition-all': createLazyRule('no-transition-all', { type: 'problem', docs: { description: 'Disallow `all` as a transition property.', recommended: 'unopinionated' }, messages: { 'no-transition-all': 'Do not use `all` as a transition property.' }, languages: [ 'js/js', 'css/css' ] }),
'no-typeof-undefined': createLazyRule('no-typeof-undefined', { type: 'suggestion', docs: { description: 'Disallow comparing `undefined` using `typeof`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkGlobalVariables: { type: 'boolean', description: 'Whether to also check `typeof` comparisons against global variables.' } } } ], defaultOptions: [ { checkGlobalVariables: false } ], messages: { 'no-typeof-undefined/error': 'Compare with `undefined` directly instead of using `typeof`.', 'no-typeof-undefined/suggestion': 'Switch to `… {{operator}} undefined`.' }, languages: [ 'js/js' ] }),
'no-uncalled-method': createLazyRule('no-uncalled-method', { type: 'problem', docs: { description: 'Disallow referencing methods without calling them.', recommended: true }, messages: { 'no-uncalled-method': 'Call `{{method}}()` instead of referencing the method.' }, languages: [ 'js/js' ] }),
'no-undeclared-class-members': createLazyRule('no-undeclared-class-members', { type: 'problem', docs: { description: 'Require class members to be declared.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'no-undeclared-class-members': 'Class member `{{name}}` is used but not declared.', 'no-undeclared-class-members/suggestion': 'Declare `{{name}}` as a class field.' }, languages: [ 'js/js' ] }),
'no-unnecessary-array-flat-depth': createLazyRule('no-unnecessary-array-flat-depth', { type: 'suggestion', docs: { description: 'Disallow using `1` as the `depth` argument of `Array#flat()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-unnecessary-array-flat-depth': 'Passing `1` as the `depth` argument is unnecessary.' }, languages: [ 'js/js' ] }),
'no-unnecessary-array-flat-map': createLazyRule('no-unnecessary-array-flat-map', { type: 'suggestion', docs: { description: 'Disallow unnecessary use of `Array#flatMap()`.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'no-unnecessary-array-flat-map': 'Prefer `.{{method}}(…)` over `.flatMap(…)` for this single-item array callback.', 'no-unnecessary-array-flat-map/filter-map-suggestion': 'Replace `.flatMap(…)` with `.filter(…).map(…)`.', 'no-unnecessary-array-flat-map/array-wrapper': 'Wrapping this value in an array is unnecessary.', 'no-unnecessary-array-flat-map/array-wrapper-suggestion': 'Remove the array wrapper.' }, languages: [ 'js/js' ] }),
'no-unnecessary-array-splice-count': createLazyRule('no-unnecessary-array-splice-count', { type: 'suggestion', docs: { description: 'Disallow using `.length` or `Infinity` as the `deleteCount` or `skipCount` argument of `Array#{splice,toSpliced}()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-unnecessary-array-splice-count': 'Passing `{{description}}` as the `{{argumentName}}` argument is unnecessary.' }, languages: [ 'js/js' ] }),
'no-unnecessary-await': createLazyRule('no-unnecessary-await', { type: 'suggestion', docs: { description: 'Disallow awaiting non-promise values.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-unnecessary-await': 'Do not `await` non-promise value.' }, languages: [ 'js/js' ] }),
'no-unnecessary-boolean-comparison': createLazyRule('no-unnecessary-boolean-comparison', { type: 'suggestion', docs: { description: 'Disallow unnecessary comparisons against boolean literals.', recommended: true }, fixable: 'code', schema: [], messages: { 'no-unnecessary-boolean-comparison': 'Do not compare a boolean expression against a boolean literal.' }, languages: [ 'js/js' ] }),
'no-unnecessary-default-arguments': createLazyRule('no-unnecessary-default-arguments', { type: 'suggestion', docs: { description: 'Disallow arguments that match their parameter defaults.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [], messages: { arguments: 'Omit trailing arguments that match their parameter defaults.', property: 'Property `{{name}}` matches its destructuring default.', 'remove-arguments': 'Remove these arguments (requires type review).', 'remove-property': 'Remove this property (requires type review).' }, languages: [ 'js/js' ] }),
'no-unnecessary-fetch-options': createLazyRule('no-unnecessary-fetch-options', { type: 'suggestion', docs: { description: 'Disallow unnecessary options in `fetch()` and `new Request()`.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'empty-options': 'Remove unnecessary empty fetch options.', property: 'Remove unnecessary `{{property}}` fetch option.' }, languages: [ 'js/js' ] }),
'no-unnecessary-global-this': createLazyRule('no-unnecessary-global-this', { type: 'suggestion', docs: { description: 'Disallow unnecessary `globalThis` references.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'no-unnecessary-global-this': 'Use `{{name}}` directly instead of `globalThis.{{name}}`.' }, languages: [ 'js/js' ] }),
'no-unnecessary-nested-ternary': createLazyRule('no-unnecessary-nested-ternary', { type: 'suggestion', docs: { description: 'Disallow unnecessary nested ternary expressions.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'no-unnecessary-nested-ternary': 'Do not use unnecessary nested ternary expressions.', simplify: 'Simplify this ternary expression (requires review).' }, languages: [ 'js/js' ] }),
'no-unnecessary-parameters': createLazyRule('no-unnecessary-parameters', { type: 'suggestion', docs: { description: 'Disallow parameters that receive the same value at every call.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', properties: { minimumCallCount: { type: 'integer', minimum: 1, description: 'Minimum number of external call sites required to check a function.' } }, additionalProperties: false } ], defaultOptions: [ { minimumCallCount: 2 } ], messages: { 'same-value': 'Parameter `{{name}}` receives the same value at every call.', 'always-default': 'Parameter `{{name}}` always receives its default value.', 'always-undefined': 'Parameter `{{name}}` is always `undefined`.', 'remove-parameter': 'Remove parameter `{{name}}` and its arguments (requires type review).' }, languages: [ 'js/js' ] }),
'no-unnecessary-polyfills': createLazyRule('no-unnecessary-polyfills', { type: 'suggestion', docs: { description: 'Enforce the use of built-in methods instead of unnecessary polyfills.', recommended: 'unopinionated' }, schema: [ { type: 'object', additionalProperties: false, properties: { targets: { oneOf: [ { type: 'string', description: 'A browserslist query string.' }, { type: 'array', items: { type: 'string' }, description: 'An array of browserslist query strings.' }, { type: 'object', additionalProperties: true, description: 'A browserslist targets object.' } ], description: 'The target environments.' } } } ], defaultOptions: [ {} ], messages: { unnecessaryPolyfill: 'Use built-in instead.', unnecessaryCoreJsModule: 'All polyfilled features imported from `{{coreJsModule}}` are available as built-ins. Use the built-ins instead.' }, languages: [ 'js/js' ] }),
'no-unnecessary-slice-end': createLazyRule('no-unnecessary-slice-end', { type: 'suggestion', docs: { description: 'Disallow using `.length` or `Infinity` as the `end` argument of `{Array,String,TypedArray}#slice()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-unnecessary-slice-end': 'Passing `{{description}}` as the `end` argument is unnecessary.' }, languages: [ 'js/js' ] }),
'no-unnecessary-splice': createLazyRule('no-unnecessary-splice', { type: 'suggestion', docs: { description: 'Disallow `Array#splice()` when simpler alternatives exist.', recommended: true }, fixable: 'code', schema: [], messages: { 'no-op': 'This `splice()` call does not change the array.', shift: 'Prefer `.shift()` over `.splice()`.', unshift: 'Prefer `.unshift()` over `.splice()`.', pop: 'Prefer `.pop()` over `.splice()`.', push: 'Prefer `.push()` over `.splice()`.', empty: 'Prefer setting `.length = 0` over `.splice()` to empty an array.' }, languages: [ 'js/js' ] }),
'no-unnecessary-string-trim': createLazyRule('no-unnecessary-string-trim', { type: 'suggestion', docs: { description: 'Disallow `String#trim()` before `String#startsWith()` or `String#endsWith()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-unnecessary-string-trim': 'Prefer `String#{{replacement}}()` before `String#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-unreadable-array-destructuring': createLazyRule('no-unreadable-array-destructuring', { type: 'suggestion', docs: { description: 'Disallow unreadable array destructuring.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { maximumIgnoredElements: { type: 'integer', minimum: 0, description: 'Maximum number of consecutive ignored elements allowed.' } } } ], defaultOptions: [ { maximumIgnoredElements: 1 } ], messages: { 'ignored-elements': 'Array destructuring may not contain consecutive ignored values.', 'property-assignment': 'Do not assign destructured values to object properties.' }, languages: [ 'js/js' ] }),
'no-unreadable-for-of-expression': createLazyRule('no-unreadable-for-of-expression', { type: 'suggestion', docs: { description: 'Disallow unreadable iterable expressions in `for…of` and `for await…of` loop headers.', recommended: true }, messages: { 'no-unreadable-for-of-expression': 'Move the complex iterable expression out of the `{{loopKind}}` loop header.' }, languages: [ 'js/js' ] }),
'no-unreadable-iife': createLazyRule('no-unreadable-iife', { type: 'suggestion', docs: { description: 'Disallow unreadable IIFEs.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-unreadable-iife': 'IIFE with parenthesized arrow function body is considered unreadable.', suggestion: 'Use a block statement body.' }, languages: [ 'js/js' ] }),
'no-unreadable-new-expression': createLazyRule('no-unreadable-new-expression', { type: 'suggestion', docs: { description: 'Disallow unreadable `new` expressions.', recommended: false }, messages: { 'member-access': 'Do not access members directly from a `new` expression.', 'complex-constructor': 'Do not use a complex expression as a constructor.' }, languages: [ 'js/js' ] }),
'no-unreadable-object-destructuring': createLazyRule('no-unreadable-object-destructuring', { type: 'suggestion', docs: { description: 'Disallow unreadable object destructuring.', recommended: 'unopinionated' }, schema: [], messages: { 'computed-key': 'Do not use computed keys in object destructuring.', 'nested-array': 'Do not use array destructuring inside object destructuring.', 'deep-object': 'Do not use object destructuring deeper than two levels.', 'property-assignment': 'Do not assign destructured values to object properties.' }, languages: [ 'js/js' ] }),
'no-unsafe-buffer-conversion': createLazyRule('no-unsafe-buffer-conversion', { type: 'problem', docs: { description: 'Prevent unsafe use of ArrayBuffer view `.buffer`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-unsafe-buffer-conversion/error': 'Preserve `byteOffset` and `byteLength` when converting an ArrayBuffer view through `.buffer`.', 'no-unsafe-buffer-conversion/suggestion': 'Preserve `byteOffset` and `byteLength`.' }, languages: [ 'js/js' ] }),
'no-unsafe-dom-html': createLazyRule('no-unsafe-dom-html', { type: 'problem', docs: { description: 'Disallow unsafe DOM HTML APIs.', recommended: false }, schema: [], messages: { 'no-unsafe-dom-html': 'Do not use unsafe DOM HTML APIs.' }, languages: [ 'js/js' ] }),
'no-unsafe-json-serialization': createLazyRule('no-unsafe-json-serialization', { type: 'problem', docs: { description: 'Disallow known values that JSON serialization cannot represent faithfully.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'no-unsafe-json-serialization': '`{{method}}()` cannot faithfully serialize {{type}} values.', 'no-unsafe-json-serialization/array': 'Convert the {{type}} to an array.', 'no-unsafe-json-serialization/object': 'Convert the Map to an object (requires string keys).', 'no-unsafe-json-serialization/string': 'Convert the BigInt to a string.' }, languages: [ 'js/js' ] }),
'no-unsafe-promise-all-settled-values': createLazyRule('no-unsafe-promise-all-settled-values', { type: 'problem', docs: { description: 'Disallow reading `.value` from `Promise.allSettled()` results without a fulfilled status guard.', recommended: 'unopinionated' }, schema: [], messages: { 'no-unsafe-promise-all-settled-values': 'Do not read `.value` from `Promise.allSettled()` results without checking that the result is fulfilled.' }, languages: [ 'js/js' ] }),
'no-unsafe-property-key': createLazyRule('no-unsafe-property-key', { type: 'problem', docs: { description: 'Disallow unsafe values as property keys.', recommended: true }, schema: [], messages: { 'no-unsafe-property-key': 'Do not use an unsafe value as a property key. Use an explicit string or symbol key instead.' }, languages: [ 'js/js' ] }),
'no-unsafe-sqlite-interpolation': createLazyRule('no-unsafe-sqlite-interpolation', { type: 'problem', docs: { description: 'Disallow interpolation into SQL strings passed to Node’s `node:sqlite` APIs.', recommended: 'unopinionated' }, schema: [], messages: { 'no-unsafe-sqlite-interpolation': 'Do not interpolate values into `node:sqlite` SQL strings.' }, languages: [ 'js/js' ] }),
'no-unsafe-string-replacement': createLazyRule('no-unsafe-string-replacement', { type: 'problem', docs: { description: 'Disallow non-literal replacement values in `String#replace()` and `String#replaceAll()`.', recommended: true }, messages: { 'no-unsafe-string-replacement': 'Do not use a non-literal replacement value with `String#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-unused-builtin-method-return': createLazyRule('no-unused-builtin-method-return', { type: 'suggestion', docs: { description: 'Disallow ignoring the return value of selected built-in methods.', recommended: 'unopinionated' }, messages: { 'no-unused-builtin-method-return': 'Do not ignore the return value of `.{{method}}(…)`.' }, languages: [ 'js/js' ] }),
'no-unused-iterator-helper': createLazyRule('no-unused-iterator-helper', { type: 'problem', docs: { description: 'Disallow discarding lazy iterator helpers.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-unused-iterator-helper': 'Consume the iterator returned by `.{{method}}(…)`; iterator helpers are lazy.', 'no-unused-iterator-helper/suggestion': 'Use `.forEach()` to run the callback.' }, languages: [ 'js/js' ] }),
'no-unused-properties': createLazyRule('no-unused-properties', { type: 'suggestion', docs: { description: 'Disallow unused object properties.', recommended: false }, messages: { 'no-unused-properties': 'Property `{{name}}` is defined but never used.' }, languages: [ 'js/js' ] }),
'no-url-in-search-params': createLazyRule('no-url-in-search-params', { type: 'problem', docs: { description: 'Disallow passing full URLs to `URLSearchParams`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'no-url-in-search-params': '`URLSearchParams` does not parse full URLs.', 'parse-url': 'Parse the URL and use its `searchParams`.', 'detached-copy': "Construct a detached copy from the URL's query string.", 'live-search-params': "Use the URL's live `searchParams` (mutations update the URL)." }, languages: [ 'js/js' ] }),
'no-useless-boolean-cast': createLazyRule('no-useless-boolean-cast', { type: 'suggestion', docs: { description: 'Disallow unnecessary `Boolean()` casts in array predicate callbacks.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-boolean-cast': '`Boolean()` is unnecessary in `Array#{{method}}()` callbacks.' }, languages: [ 'js/js' ] }),
'no-useless-coercion': createLazyRule('no-useless-coercion', { type: 'suggestion', docs: { description: 'Disallow useless type coercions of values that are already of the target type.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-useless-coercion': '{{description}} is unnecessary because the value is already a {{type}}.', 'remove-double-negation': 'Remove the double negation.' }, languages: [ 'js/js' ] }),
'no-useless-collection-argument': createLazyRule('no-useless-collection-argument', { type: 'suggestion', docs: { description: 'Disallow useless values or fallbacks in `Set`, `Map`, `WeakSet`, or `WeakMap`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-useless-collection-argument/error': 'The {{description}} is useless.', 'no-useless-collection-argument/suggestion': 'Remove the {{description}}' }, languages: [ 'js/js' ] }),
'no-useless-compound-assignment': createLazyRule('no-useless-compound-assignment', { type: 'suggestion', docs: { description: 'Disallow useless compound assignments such as `x += 0`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-useless-compound-assignment/error': 'This compound assignment is useless as `{{operator}} {{value}}` does not change the value.', 'no-useless-compound-assignment/remove': 'Remove the useless assignment.', 'no-useless-compound-assignment/replace': 'Replace the useless assignment with `{{left}}`.' }, languages: [ 'js/js' ] }),
'no-useless-concat': createLazyRule('no-useless-concat', { type: 'suggestion', docs: { description: 'Disallow useless concatenation of literals.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-concat': 'Do not concatenate two literals, combine them into one.' }, languages: [ 'js/js' ] }),
'no-useless-continue': createLazyRule('no-useless-continue', { type: 'suggestion', docs: { description: 'Disallow useless `continue` statements.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-continue': 'Unnecessary `continue` statement.' }, languages: [ 'js/js' ] }),
'no-useless-delete-check': createLazyRule('no-useless-delete-check', { type: 'suggestion', docs: { description: 'Disallow unnecessary existence checks before deletion.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'no-useless-delete-check': 'The existence check before deletion is unnecessary.', removeCheck: 'Remove the existence check.' }, languages: [ 'js/js' ] }),
'no-useless-else': createLazyRule('no-useless-else', { type: 'suggestion', docs: { description: 'Disallow `else` after a statement that exits.', recommended: true }, fixable: 'code', messages: { 'no-useless-else': 'Unexpected `else` after a statement that exits.' }, languages: [ 'js/js' ] }),
'no-useless-error-capture-stack-trace': createLazyRule('no-useless-error-capture-stack-trace', { type: 'suggestion', docs: { description: 'Disallow unnecessary `Error.captureStackTrace(…)`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-error-capture-stack-trace/error': 'Unnecessary `Error.captureStackTrace(…)` call.' }, languages: [ 'js/js' ] }),
'no-useless-fallback-in-spread': createLazyRule('no-useless-fallback-in-spread', { type: 'suggestion', docs: { description: 'Disallow useless fallback when spreading in object literals.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-fallback-in-spread': 'The empty object is useless.' }, languages: [ 'js/js' ] }),
'no-useless-iterator-to-array': createLazyRule('no-useless-iterator-to-array', { type: 'suggestion', docs: { description: 'Disallow unnecessary `.toArray()` on iterators.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'iterable-accepting': '`{{description}}` accepts an iterable, `.toArray()` is unnecessary.', 'for-of': '`for…of`/`for await…of` can iterate over an iterable, `.toArray()` is unnecessary.', 'yield-star': '`yield*` can delegate to an iterable, `.toArray()` is unnecessary.', spread: 'Spread works on iterables, `.toArray()` is unnecessary.', 'iterator-method': '`Iterator` has a `.{{method}}()` method, `.toArray()` is unnecessary.', 'iterable-accepting/suggestion': 'Remove `.toArray()`.', 'iterator-method/suggestion': 'Remove `.toArray()` and use `Iterator#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-useless-length-check': createLazyRule('no-useless-length-check', { type: 'suggestion', docs: { description: 'Disallow useless array length check.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'for-of': 'The non-empty check is useless as `for…of` does not iterate over an empty array.', 'non-zero': 'The non-empty check is useless as `Array#some()` returns `false` for an empty array.', zero: 'The empty check is useless as `Array#every()` returns `true` for an empty array.', 'remove-length-check': 'Remove the length check.' }, languages: [ 'js/js' ] }),
'no-useless-logical-operand': createLazyRule('no-useless-logical-operand', { type: 'suggestion', docs: { description: 'Disallow unnecessary operands in logical expressions involving boolean literals.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'no-useless-logical-operand': 'Simplify this `{{operator}}` expression.' }, languages: [ 'js/js' ] }),
'no-useless-override': createLazyRule('no-useless-override', { type: 'suggestion', docs: { description: 'Disallow useless overrides of class methods.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'no-useless-override': 'Useless override; this method only forwards to `{{superCall}}(…)`.' }, languages: [ 'js/js' ] }),
'no-useless-promise-resolve-reject': createLazyRule('no-useless-promise-resolve-reject', { type: 'suggestion', docs: { description: 'Disallow returning/yielding `Promise.resolve/reject()` in async functions or promise callbacks', recommended: 'unopinionated' }, fixable: 'code', messages: { resolve: 'Prefer `{{type}} value` over `{{type}} Promise.resolve(value)`.', reject: 'Prefer `throw error` over `{{type}} Promise.reject(error)`.' }, languages: [ 'js/js' ] }),
'no-useless-re-export': createLazyRule('no-useless-re-export', { type: 'suggestion', docs: { description: 'Disallow redundant re-exports.', recommended: 'unopinionated' }, schema: [], messages: { 'no-useless-re-export': 'This export is redundant because the same module is already exported with `export *`.' }, languages: [ 'js/js' ] }),
'no-useless-recursion': createLazyRule('no-useless-recursion', { type: 'suggestion', docs: { description: 'Disallow simple recursive function calls that can be replaced with a loop.', recommended: true }, messages: { 'no-useless-recursion': 'Use a loop instead of this recursive function call.' }, languages: [ 'js/js' ] }),
'no-useless-set-construction': createLazyRule('no-useless-set-construction', { type: 'suggestion', docs: { description: 'Disallow unnecessary `Set` construction around `Set` methods.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'no-useless-set-construction': 'This `Set` construction is unnecessary for `Set#{{method}}()`.' }, languages: [ 'js/js' ] }),
'no-useless-spread': createLazyRule('no-useless-spread', { type: 'suggestion', docs: { description: 'Disallow unnecessary spread.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'spread-in-list': 'Spread an {{argumentType}} literal in {{parentDescription}} is unnecessary.', 'iterable-to-array': "`{{parentDescription}}` accepts an iterable as an argument, it's unnecessary to convert to an array.", 'iterable-to-array-in-for-of': "`for…of` can iterate over an iterable, it's unnecessary to convert to an array.", 'iterable-to-array-in-yield-star': "`yield*` can delegate to an iterable, it's unnecessary to convert to an array.", 'spread-in-collection-constructor': '`{{constructorName}}` accepts a single iterable argument, spreading is misleading.', 'spread-in-object-assign': '`Object.assign(…)` source object with only spread properties is unnecessary.', 'clone-array': 'Unnecessarily cloning an array.', 'suggestion/remove-object-assign-spread': 'Remove the object literal wrapper.', 'suggestion/remove-iterable-array': 'Remove the array conversion.' }, languages: [ 'js/js' ] }),
'no-useless-switch-case': createLazyRule('no-useless-switch-case', { type: 'suggestion', docs: { description: 'Disallow useless case in switch statements.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-useless-switch-case/error': 'Useless case in switch statement.', 'no-useless-switch-case/suggestion': 'Remove this case.' }, languages: [ 'js/js' ] }),
'no-useless-template-literals': createLazyRule('no-useless-template-literals', { type: 'suggestion', docs: { description: 'Disallow useless template literal expressions.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'no-useless-template-literals': 'Do not use unnecessary template literal expressions.', 'no-useless-template-literals/suggestion': 'Use `{{replacement}}` instead.' }, languages: [ 'js/js' ] }),
'no-useless-undefined': createLazyRule('no-useless-undefined', { type: 'suggestion', docs: { description: 'Disallow useless `undefined`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkArguments: { type: 'boolean', description: 'Whether to check function arguments.' }, checkArrowFunctionBody: { type: 'boolean', description: 'Whether to check arrow function bodies.' } } } ], defaultOptions: [ { checkArguments: true, checkArrowFunctionBody: true } ], messages: { 'no-useless-undefined': 'Do not use useless `undefined`.', 'no-useless-undefined/suggestion': 'Use the indexed access directly.' }, languages: [ 'js/js' ] }),
'no-using-resource-escape': createLazyRule('no-using-resource-escape', { type: 'problem', docs: { description: 'Disallow returning or exporting resources declared with `using`, including through capturing functions.', recommended: 'unopinionated' }, schema: [], messages: { 'no-using-resource-escape': 'Do not {{action}} resource `{{name}}` or a value that contains or captures it. The resource is disposed when its owning scope exits.' }, languages: [ 'js/js' ] }),
'no-xor-as-exponentiation': createLazyRule('no-xor-as-exponentiation', { type: 'problem', docs: { description: 'Disallow the bitwise XOR operator where exponentiation was likely intended.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'no-xor-as-exponentiation/error': 'Unexpected bitwise XOR operator `^`. Did you mean the exponentiation operator `**`?', 'no-xor-as-exponentiation/suggestion': 'Replace `^` with `**`.' }, languages: [ 'js/js' ] }),
'no-zero-fractions': createLazyRule('no-zero-fractions', { type: 'suggestion', docs: { description: 'Require consistent decimal numbers without redundant zeros.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'leading-zero': 'Use a leading zero before the decimal point.', 'zero-fraction': "Don't use a zero fraction in the number.", 'dangling-dot': "Don't use a dangling dot in the number." }, languages: [ 'js/js', 'soml/soml', 'yml/yaml', 'toml/toml', 'json/json', 'json/jsonc', 'json/json5', 'css/css' ] }),
'number-literal-case': createLazyRule('number-literal-case', { type: 'suggestion', docs: { description: 'Enforce proper case for numeric literals.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { hexadecimalValue: { enum: [ 'uppercase', 'lowercase' ] } } } ], defaultOptions: [ { hexadecimalValue: 'uppercase' } ], messages: { 'number-literal-case': 'Invalid number literal casing.' }, languages: [ 'js/js', 'soml/soml', 'yml/yaml', 'toml/toml', 'json/json', 'json/jsonc', 'json/json5', 'css/css' ] }),
'numeric-separators-style': createLazyRule('numeric-separators-style', { type: 'suggestion', docs: { description: 'Enforce the style of numeric separators by correctly grouping digits.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { binary: { type: 'object', additionalProperties: false, properties: { onlyIfContainsSeparator: { type: 'boolean', description: 'Whether to only enforce the style if the number already contains a separator.' }, minimumDigits: { type: 'integer', minimum: 0, description: 'The minimum number of digits before separators are enforced.' }, groupLength: { type: 'integer', minimum: 1, description: 'The number of digits in each group.' } } }, octal: { type: 'object', additionalProperties: false, properties: { onlyIfContainsSeparator: { type: 'boolean', description: 'Whether to only enforce the style if the number already contains a separator.' }, minimumDigits: { type: 'integer', minimum: 0, description: 'The minimum number of digits before separators are enforced.' }, groupLength: { type: 'integer', minimum: 1, description: 'The number of digits in each group.' } } }, hexadecimal: { type: 'object', additionalProperties: false, properties: { onlyIfContainsSeparator: { type: 'boolean', description: 'Whether to only enforce the style if the number already contains a separator.' }, minimumDigits: { type: 'integer', minimum: 0, description: 'The minimum number of digits before separators are enforced.' }, groupLength: { type: 'integer', minimum: 1, description: 'The number of digits in each group.' } } }, number: { type: 'object', additionalProperties: false, properties: { onlyIfContainsSeparator: { type: 'boolean', description: 'Whether to only enforce the style if the number already contains a separator.' }, minimumDigits: { type: 'integer', minimum: 0, description: 'The minimum number of digits before separators are enforced.' }, groupLength: { type: 'integer', minimum: 1, description: 'The number of digits in each group.' }, fractionGroupLength: { type: 'integer', minimum: 1, description: 'The number of digits in each group after the decimal point. Defaults to no grouping.' } } }, onlyIfContainsSeparator: { type: 'boolean', description: 'Whether to only enforce the style if the number already contains a separator.' } } } ], defaultOptions: [ { onlyIfContainsSeparator: false, binary: { minimumDigits: 0, groupLength: 4 }, octal: { minimumDigits: 0, groupLength: 4 }, hexadecimal: { minimumDigits: 0, groupLength: 2 }, number: { minimumDigits: 5, groupLength: 3, fractionGroupLength: Infinity } } ], messages: { 'numeric-separators-style': 'Invalid group length in numeric value.' }, languages: [ 'js/js', 'toml/toml', 'soml/soml' ] }),
'operator-assignment': rule215,
'prefer-abort-signal-any': createLazyRule('prefer-abort-signal-any', { type: 'suggestion', docs: { description: 'Prefer `AbortSignal.any()` over manually forwarding abort events between signals.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-abort-signal-any': 'Prefer `AbortSignal.any()` over manually forwarding abort events between signals.', 'prefer-abort-signal-any/suggestion': 'Replace with `AbortSignal.any()`.' }, languages: [ 'js/js' ] }),
'prefer-abort-signal-timeout': createLazyRule('prefer-abort-signal-timeout', { type: 'suggestion', docs: { description: 'Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-abort-signal-timeout': 'Prefer `AbortSignal.timeout()` over manually aborting an `AbortController` with `setTimeout()`.', 'prefer-abort-signal-timeout/suggestion': 'Replace with `AbortSignal.timeout()`.' }, languages: [ 'js/js' ] }),
'prefer-add-event-listener': createLazyRule('prefer-add-event-listener', { type: 'suggestion', docs: { description: 'Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { excludedPackages: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Packages to exclude from checking.' } } } ], defaultOptions: [ { excludedPackages: [ 'koa', 'sax' ] } ], messages: { 'prefer-add-event-listener': 'Prefer `{{replacement}}` over `{{method}}`.{{extra}}' }, languages: [ 'js/js' ] }),
'prefer-add-event-listener-options': createLazyRule('prefer-add-event-listener-options', { type: 'suggestion', docs: { description: 'Prefer an options object over a boolean in `.addEventListener()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-add-event-listener-options': 'Prefer `{{replacement}}` over `{{value}}`.' }, languages: [ 'js/js' ] }),
'prefer-aggregate-error': createLazyRule('prefer-aggregate-error', { type: 'suggestion', docs: { description: 'Prefer `AggregateError` when throwing collected errors.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-aggregate-error': 'Use `AggregateError` when throwing collected errors.' }, languages: [ 'js/js' ] }),
'prefer-array-find': createLazyRule('prefer-array-find', { type: 'suggestion', docs: { description: 'Prefer `.find(…)` and `.findLast(…)` over the first or last element from `.filter(…)`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkFromLast: { type: 'boolean', description: 'Whether to also check for patterns that can be replaced with `findLast()`.' } } } ], defaultOptions: [ { checkFromLast: true } ], messages: { 'error-variable': 'Prefer `.find(…)` over `.filter(…)`.', 'error-zero-index': 'Prefer `.find(…)` over `.filter(…)[0]`.', 'error-at-zero': 'Prefer `.find(…)` over `.filter(…).at(0)`.', 'error-shift': 'Prefer `.find(…)` over `.filter(…).shift()`.', 'error-pop': 'Prefer `.findLast(…)` over `.filter(…).pop()`.', 'error-at-minus-one': 'Prefer `.findLast(…)` over `.filter(…).at(-1)`.', 'error-slice-minus-one': 'Prefer `.findLast(…)` over `.filter(…).slice(-1)`.', 'error-destructuring-declaration': 'Prefer `.find(…)` over destructuring `.filter(…)`.', 'error-destructuring-assignment': 'Prefer `.find(…)` over destructuring `.filter(…)`.', 'prefer-array-find/suggestion': 'Use `.{{method}}(…)`.' }, languages: [ 'js/js' ] }),
'prefer-array-flat': createLazyRule('prefer-array-flat', { type: 'suggestion', docs: { description: 'Prefer `Array#flat()` over legacy techniques to flatten arrays.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { functions: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Additional functions to check.' } } } ], defaultOptions: [ { functions: [] } ], messages: { 'prefer-array-flat': 'Prefer `Array#flat()` over `{{description}}` to flatten an array.' }, languages: [ 'js/js' ] }),
'prefer-array-flat-map': createLazyRule('prefer-array-flat-map', { type: 'suggestion', docs: { description: 'Prefer `.flatMap(…)` over `.map(…).flat()` and `.filter(…).flatMap(…)`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-array-flat-map': 'Prefer `.flatMap(…)` over `.map(…).flat()`.', 'prefer-array-flat-map/suggestion': 'Replace `.map(…).flat()` with `.flatMap(…)`.', 'prefer-array-flat-map/filter-flat-map': 'Prefer a single `.flatMap(…)` over `.filter(…).flatMap(…)`.', 'prefer-array-flat-map/filter-flat-map-suggestion': 'Replace `.filter(…).flatMap(…)` with a single `.flatMap(…)`.' }, languages: [ 'js/js' ] }),
'prefer-array-from-async': createLazyRule('prefer-array-from-async', { type: 'suggestion', docs: { description: 'Prefer `Array.fromAsync()` over array accumulation loops.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-array-from-async': 'Prefer `Array.fromAsync()` over array accumulation loops.', 'prefer-array-from-async/suggestion': 'Replace the loop with `Array.fromAsync()`.' }, languages: [ 'js/js' ] }),
'prefer-array-from-map': createLazyRule('prefer-array-from-map', { type: 'suggestion', docs: { description: 'Prefer using the `Array.from()` mapping function argument.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-array-from-map/error': 'Pass the mapping function to `Array.from()` directly.', 'prefer-array-from-map/suggestion': 'Use the `Array.from()` mapping function argument.' }, languages: [ 'js/js' ] }),
'prefer-array-from-range': createLazyRule('prefer-array-from-range', { type: 'suggestion', docs: { description: 'Prefer `Array.from({length}, …)` when creating range arrays.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-array-from-range': 'Prefer `Array.from({length}, …)` when creating range arrays.' }, languages: [ 'js/js' ] }),
'prefer-array-index-of': createLazyRule('prefer-array-index-of', { type: 'suggestion', docs: { description: 'Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-indexOf-over-findIndex/error': 'Use `.indexOf()` instead of `.findIndex()` when looking for the index of an item.', 'prefer-indexOf-over-findIndex/suggestion': 'Replace `.findIndex()` with `.indexOf()`.', 'prefer-lastIndexOf-over-findLastIndex/error': 'Use `.lastIndexOf()` instead of `.findLastIndex()` when looking for the index of an item.', 'prefer-lastIndexOf-over-findLastIndex/suggestion': 'Replace `.findLastIndex()` with `.lastIndexOf()`.' }, languages: [ 'js/js' ] }),
'prefer-array-iterable-methods': createLazyRule('prefer-array-iterable-methods', { type: 'suggestion', docs: { description: 'Prefer iterating an array directly or with `Array#keys()` over `Array#entries()` when the index or value is unused.', recommended: true }, fixable: 'code', schema: [], messages: { 'unused-index': 'Prefer iterating the array directly over `Array#entries()` when the index is unused.', 'unused-value': 'Prefer `Array#keys()` over `Array#entries()` when the value is unused.' }, languages: [ 'js/js' ] }),
'prefer-array-last-methods': createLazyRule('prefer-array-last-methods', { type: 'suggestion', docs: { description: 'Prefer last-oriented array methods over `Array#reverse()` or `Array#toReversed()` followed by a method.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-array-last-methods': 'Prefer `Array#{{replacement}}()` over `Array#{{reversingMethod}}().{{method}}()`.', replace: 'Replace `.{{reversingMethod}}().{{method}}()` with `.{{replacement}}()`.' }, languages: [ 'js/js' ] }),
'prefer-array-slice': createLazyRule('prefer-array-slice', { type: 'suggestion', docs: { description: 'Prefer `Array#slice()` over `Array#splice()` when reading from the returned array.', recommended: true }, hasSuggestions: true, messages: { 'prefer-array-slice/error': 'Prefer `Array#slice()` over `Array#splice()` when reading from the returned array.', 'prefer-array-slice/suggestion': 'Use `Array#slice()`.' }, languages: [ 'js/js' ] }),
'prefer-array-some': createLazyRule('prefer-array-some', { type: 'suggestion', docs: { description: 'Prefer `.some(…)` over `.filter(…).length` check and `.{find,findLast,findIndex,findLastIndex}(…)`.', recommended: 'unopinionated' }, fixable: 'code', messages: { some: 'Prefer `.some(…)` over `.{{method}}(…)`.', 'some-suggestion': 'Replace `.{{method}}(…)` with `.some(…)`.', filter: 'Prefer `.some(…)` over non-zero length check from `.filter(…)`.' }, hasSuggestions: true, languages: [ 'js/js' ] }),
'prefer-at': createLazyRule('prefer-at', { type: 'suggestion', docs: { description: 'Prefer `.at()` method for index access and `String#charAt()`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { getLastElementFunctions: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Additional functions that return the last element.' }, checkAllIndexAccess: { type: 'boolean', description: 'Whether to also check non-negative integer index access.' } } } ], defaultOptions: [ { getLastElementFunctions: [], checkAllIndexAccess: false } ], messages: { 'negative-index': 'Prefer `.at(…)` over `[….length - index]`.', index: 'Prefer `.at(…)` over index access.', 'string-char-at-negative': 'Prefer `String#at(…)` over `String#charAt(….length - index)`.', 'string-char-at': 'Prefer `String#at(…)` over `String#charAt(…)`.', 'string-substring': 'Prefer `String#at(…)` over `String#substring(…)` when getting one character.', slice: 'Prefer `.at(…)` over the first element from `.slice(…)`.', 'get-last-function': 'Prefer `.at(-1)` over `{{description}}(…)` to get the last element.', 'use-at': 'Use `.at(…)`.' }, languages: [ 'js/js' ] }),
'prefer-await': createLazyRule('prefer-await', { type: 'suggestion', docs: { description: 'Prefer `await` over promise chaining.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-await': 'Prefer `await` over promise chaining with `.{{method}}()`.', 'prefer-await/suggestion': 'Rewrite as an async IIFE.' }, languages: [ 'js/js' ] }),
'prefer-bigint-literals': createLazyRule('prefer-bigint-literals', { type: 'suggestion', docs: { description: 'Prefer `BigInt` literals over the constructor.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-bigint-literals/error': 'Prefer using bigint literal over `BigInt(…)`.', 'prefer-bigint-literals/suggestion': 'Replace with {{replacement}}.' }, languages: [ 'js/js' ] }),
'prefer-blob-reading-methods': createLazyRule('prefer-blob-reading-methods', { type: 'suggestion', docs: { description: 'Prefer `Blob#arrayBuffer()` over `FileReader#readAsArrayBuffer(…)` and `Blob#text()` over `FileReader#readAsText(…)`.', recommended: 'unopinionated' }, messages: { error: 'Prefer `Blob#{{replacement}}()` over `FileReader#{{method}}(blob)`.' }, languages: [ 'js/js' ] }),
'prefer-block-statement-over-iife': createLazyRule('prefer-block-statement-over-iife', { type: 'suggestion', docs: { description: 'Prefer block statements over IIFEs used only for scoping.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-block-statement-over-iife': 'Prefer a block statement over an IIFE used only for scoping.' }, languages: [ 'js/js' ] }),
'prefer-boolean-return': createLazyRule('prefer-boolean-return', { type: 'suggestion', docs: { description: 'Prefer directly returning boolean expressions over `if` statements.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-boolean-return': 'Return the boolean expression directly.' }, languages: [ 'js/js' ] }),
'prefer-class-fields': createLazyRule('prefer-class-fields', { type: 'suggestion', docs: { description: 'Prefer class field declarations over `this` assignments in constructors.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-class-fields/error': 'Prefer class field declaration over `this` assignment in constructor for static values.', 'prefer-class-fields/suggestion': 'Encountered same-named class field declaration and `this` assignment in constructor. Replace the class field declaration with the value from `this` assignment.' }, languages: [ 'js/js' ] }),
'prefer-classlist-toggle': createLazyRule('prefer-classlist-toggle', { type: 'suggestion', docs: { description: 'Prefer using `Element#classList.toggle()` to toggle class names.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-classlist-toggle/error': 'Prefer using `Element#classList.toggle()` to toggle class names.', 'prefer-classlist-toggle/suggestion': 'Replace with `Element#classList.toggle()`.' }, languages: [ 'js/js' ] }),
'prefer-code-point': createLazyRule('prefer-code-point', { type: 'suggestion', docs: { description: 'Prefer `String#codePointAt(…)` over `String#charCodeAt(…)` and `String.fromCodePoint(…)` over `String.fromCharCode(…)`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'error/charCodeAt': 'Prefer `String#codePointAt()` over `String#charCodeAt()`.', 'error/fromCharCode': 'Prefer `String.fromCodePoint()` over `String.fromCharCode()`.', 'suggestion/codePointAt': 'Use `String#codePointAt()`.', 'suggestion/fromCodePoint': 'Use `String.fromCodePoint()`.' }, languages: [ 'js/js' ] }),
'prefer-combined-guards': createLazyRule('prefer-combined-guards', { type: 'suggestion', docs: { description: 'Prefer combining consecutive guards with identical exit statements.', recommended: true }, fixable: 'code', schema: [ { type: 'object', properties: { checkCompoundConditions: { type: 'boolean', description: 'Check guards with compound conditions.' }, checkMultiStatementBodies: { type: 'boolean', description: 'Check guards whose bodies run the same statements before the exit.' } }, additionalProperties: false } ], defaultOptions: [ { checkCompoundConditions: false, checkMultiStatementBodies: false } ], messages: { 'prefer-combined-guards': 'Combine this guard with the previous one using `||`.' }, languages: [ 'js/js' ] }),
'prefer-continue': createLazyRule('prefer-continue', { type: 'suggestion', docs: { description: 'Prefer early continues over conditionals wrapping the remainder of the loop body.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { maximumStatements: { type: 'integer', minimum: 0, description: 'Maximum number of statements allowed in a conditional wrapping the remainder of the loop body.' }, checkShortBodies: { type: 'boolean', description: 'Enforce conditional wrapping when the body after a guard, or its else body, has between one and maximumStatements statements.' } } } ], defaultOptions: [ { maximumStatements: 1, checkShortBodies: false } ], messages: { 'prefer-continue/short-body': 'Prefer conditional wrapping over an early continue for a short body.', 'prefer-continue': 'Prefer an early continue over wrapping the remainder of the loop body in an `if` statement.', 'prefer-continue/opposite-comparison': 'Rewrite to an early continue using the opposite comparison (changes behavior for NaN and values coerced to NaN).' }, languages: [ 'js/js' ] }),
'prefer-date-now': createLazyRule('prefer-date-now', { type: 'suggestion', docs: { description: 'Prefer `Date.now()` to get the number of milliseconds since the Unix Epoch.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-date': 'Prefer `Date.now()` over `new Date()`.', 'prefer-date-now-over-methods': 'Prefer `Date.now()` over `Date#{{method}}()`.', 'prefer-date-now-over-number-data-object': 'Prefer `Date.now()` over `Number(new Date())`.' }, languages: [ 'js/js' ] }),
'prefer-default-parameters': createLazyRule('prefer-default-parameters', { type: 'suggestion', docs: { description: 'Prefer default parameters and destructuring defaults over reassignment and fallback expressions.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [ { type: 'object', properties: { checkFallbackExpressions: { type: 'boolean', description: 'Check fallback reads in parameters and destructured variables.' } }, additionalProperties: false } ], defaultOptions: [ { checkFallbackExpressions: true } ], messages: { preferDefaultParameters: 'Prefer default parameters over reassignment.', preferDefaultParametersSuggest: 'Replace reassignment with a default parameter. This changes fallback behavior to apply only to undefined.', preferDefaultParameterOverFallback: 'Prefer a default parameter over fallback expressions.', preferDestructuringDefaultOverFallback: 'Prefer a destructuring default over fallback expressions.', moveDefaultToDeclaration: 'Move the default value to the declaration. This changes fallback behavior to apply only to undefined.' }, languages: [ 'js/js' ] }),
'prefer-direct-iteration': createLazyRule('prefer-direct-iteration', { type: 'suggestion', docs: { description: 'Prefer direct iteration over default iterator method calls.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-direct-iteration': 'Prefer direct iteration instead of `.{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-dispose': createLazyRule('prefer-dispose', { type: 'suggestion', docs: { description: 'Prefer using `using`/`await using` over manual `try`/`finally` resource disposal.', recommended: false }, hasSuggestions: true, messages: { 'prefer-dispose/error': 'Prefer `{{keyword}}` (Explicit Resource Management) over the `try`/`finally` disposal pattern.', 'prefer-dispose/suggestion': 'Replace the `try`/`finally` with `{{keyword}}`.' }, languages: [ 'js/js' ] }),
'prefer-dom-node-append': createLazyRule('prefer-dom-node-append', { type: 'suggestion', docs: { description: 'Prefer `Element#append()` over `Node#appendChild()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-dom-node-append': 'Prefer `Element#append()` over `Node#appendChild()`.' }, languages: [ 'js/js' ] }),
'prefer-dom-node-html-methods': createLazyRule('prefer-dom-node-html-methods', { type: 'suggestion', docs: { description: 'Prefer `.getHTML()` and `.setHTML()` over `.innerHTML`.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkGetHTML: { type: 'boolean', description: 'Whether to check reads from `.innerHTML`.' }, checkSetHTML: { type: 'boolean', description: 'Whether to check assignments to `.innerHTML`.' } } } ], defaultOptions: [ { checkGetHTML: true, checkSetHTML: false } ], messages: { 'prefer-dom-node-html-methods/read': 'Prefer `.getHTML()` over `.innerHTML`.', 'prefer-dom-node-html-methods/write': 'Prefer `.setHTML()` over assigning to `.innerHTML`.', 'prefer-dom-node-html-methods/write-suggestion': 'Switch to `.setHTML()`.' }, languages: [ 'js/js' ] }),
'prefer-dom-node-remove': createLazyRule('prefer-dom-node-remove', { type: 'suggestion', docs: { description: 'Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { error: 'Prefer `childNode.remove()` over `parentNode.removeChild(childNode)`.', suggestion: 'Replace `parentNode.removeChild(childNode)` with `childNode{{dotOrQuestionDot}}remove()`.' }, languages: [ 'js/js' ] }),
'prefer-dom-node-replace-children': createLazyRule('prefer-dom-node-replace-children', { type: 'suggestion', docs: { description: 'Prefer `.replaceChildren()` when replacing DOM children.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-dom-node-replace-children': 'Prefer `{{replacement}}` over manually emptying DOM children.', 'prefer-dom-node-replace-children/replace-and-add': 'Prefer one `.replaceChildren(…)` call over emptying and then adding DOM children.', 'prefer-dom-node-replace-children/replace-and-add-suggestion': 'Replace the two calls with one `.replaceChildren(…)` call.' }, languages: [ 'js/js' ] }),
'prefer-dom-node-text-content': createLazyRule('prefer-dom-node-text-content', { type: 'suggestion', docs: { description: 'Prefer `.textContent` over `.innerText`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { error: 'Prefer `.textContent` over `.innerText`.', suggestion: 'Switch to `.textContent`.' }, languages: [ 'js/js' ] }),
'prefer-early-return': createLazyRule('prefer-early-return', { type: 'suggestion', docs: { description: 'Prefer early returns over conditionals wrapping the remainder of the function body.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { maximumStatements: { type: 'integer', minimum: 0, description: 'Maximum number of statements allowed in a conditional wrapping the remainder of the function body.' }, checkShortBodies: { type: 'boolean', description: 'Enforce conditional wrapping when the body after a guard, or its else body, has between one and maximumStatements statements.' } } } ], defaultOptions: [ { maximumStatements: 1, checkShortBodies: false } ], messages: { 'prefer-early-return/short-body': 'Prefer conditional wrapping over an early return for a short body.', 'prefer-early-return': 'Prefer an early return over wrapping the remainder of the function body in an `if` statement.', 'prefer-early-return/suggestion': 'Rewrite to an early return.', 'prefer-early-return/opposite-comparison': 'Rewrite to an early return using the opposite comparison (changes behavior for NaN and values coerced to NaN).' }, languages: [ 'js/js' ] }),
'prefer-else-if': createLazyRule('prefer-else-if', { type: 'suggestion', docs: { description: 'Prefer `else if` over adjacent `if` statements with related conditions.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-else-if': 'Prefer `else if` over an adjacent `if` with a related condition.', suggestion: 'Insert `else` before this `if`.' }, languages: [ 'js/js' ] }),
'prefer-error-is-error': createLazyRule('prefer-error-is-error', { type: 'suggestion', docs: { description: 'Prefer `Error.isError()` when checking for errors.', recommended: false }, fixable: 'code', schema: [], messages: { 'prefer-error-is-error': 'Prefer `Error.isError(…)`.' }, languages: [ 'js/js' ] }),
'prefer-escaped-irregular-whitespace': createLazyRule('prefer-escaped-irregular-whitespace', { type: 'suggestion', docs: { description: 'Prefer escape sequences for irregular whitespace characters.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-escaped-irregular-whitespace': 'Prefer escape sequences for irregular whitespace characters.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'toml/toml', 'soml/soml' ] }),
'prefer-event-target': createLazyRule('prefer-event-target', { type: 'suggestion', docs: { description: 'Prefer `EventTarget` over `EventEmitter`.', recommended: 'unopinionated' }, messages: { 'prefer-event-target': 'Prefer `EventTarget` over `EventEmitter`.' }, languages: [ 'js/js' ] }),
'prefer-export-from': createLazyRule('prefer-export-from', { type: 'suggestion', docs: { description: 'Prefer `export…from` when re-exporting.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkUsedVariables: { type: 'boolean', description: 'Whether to check variables that are used in the module.' } } } ], defaultOptions: [ { checkUsedVariables: true } ], messages: { error: 'Use `export…from` to re-export `{{exported}}`.', suggestion: 'Switch to `export…from`.' }, languages: [ 'js/js' ] }),
'prefer-flat-math-min-max': createLazyRule('prefer-flat-math-min-max', { type: 'suggestion', docs: { description: 'Prefer flat `Math.min()` and `Math.max()` calls over nested calls.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-flat-math-min-max': 'Prefer a flat `Math.{{method}}()` call instead of nested calls.' }, languages: [ 'js/js' ] }),
'prefer-get-or-insert-computed': createLazyRule('prefer-get-or-insert-computed', { type: 'suggestion', docs: { description: 'Prefer `.getOrInsertComputed()` when the default value has side effects.', recommended: true }, fixable: 'code', messages: { 'prefer-get-or-insert-computed': 'Prefer `.getOrInsertComputed()` when the default value has side effects.' }, languages: [ 'js/js' ] }),
'prefer-global-number-constants': createLazyRule('prefer-global-number-constants', { type: 'suggestion', docs: { description: 'Prefer global numeric constants over `Number` static properties.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-global-number-constants': 'Prefer `{{replacement}}` over `Number.{{property}}`.' }, languages: [ 'js/js' ] }),
'prefer-global-this': createLazyRule('prefer-global-this', { type: 'suggestion', docs: { description: 'Prefer `globalThis` over `window`, `self`, and `global`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: false, messages: { 'prefer-global-this/error': 'Prefer `{{replacement}}` over `{{value}}`.' }, languages: [ 'js/js' ] }),
'prefer-group-by': createLazyRule('prefer-group-by', { type: 'suggestion', docs: { description: 'Prefer `Object.groupBy()` or `Map.groupBy()` over manual grouping.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-group-by': 'Prefer `{{method}}()` over `Array#reduce()`.', 'prefer-group-by-loop': 'Prefer `{{method}}()` over a `for-of` loop.', 'replace-loop-with-group-by': 'Replace the loop with `{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-has-check': createLazyRule('prefer-has-check', { type: 'suggestion', docs: { description: 'Prefer `.has()` when checking existence.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-has-check': 'Prefer `.has(…)` when checking existence.' }, languages: [ 'js/js' ] }),
'prefer-hoisting-branch-code': createLazyRule('prefer-hoisting-branch-code', { type: 'suggestion', docs: { description: 'Prefer moving code shared by all branches of an `if` statement out of the branches.', recommended: true }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-hoisting-branch-code/start': 'These branches start with the same code. Move it before the `if` statement.', 'prefer-hoisting-branch-code/end': 'These branches end with the same code. Move it after the `if` statement.', 'prefer-hoisting-branch-code/suggestion': 'Move the shared code out of the branches.' }, languages: [ 'js/js' ] }),
'prefer-https': createLazyRule('prefer-https', { type: 'suggestion', docs: { description: 'Prefer HTTPS over HTTP.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Exact URLs and regular expressions to ignore.' } } } ], defaultOptions: [ { ignore: [] } ], messages: { 'prefer-https': 'Prefer HTTPS over HTTP.' }, languages: [ '*' ] }),
'prefer-identifier-import-export-specifiers': createLazyRule('prefer-identifier-import-export-specifiers', { type: 'suggestion', docs: { description: 'Prefer identifiers over string literals in import and export specifiers.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-identifier-import-export-specifiers': 'Prefer identifier `{{identifier}}` over string literal `{{literal}}`.' }, languages: [ 'js/js' ] }),
'prefer-import-meta-properties': createLazyRule('prefer-import-meta-properties', { type: 'suggestion', docs: { description: 'Prefer `import.meta.{dirname,filename}` over legacy techniques for getting file paths.', recommended: false }, fixable: 'code', messages: { 'error/calculate-dirname': 'Do not construct dirname.', 'error/calculate-filename': 'Do not construct filename using `fileURLToPath()`.' }, languages: [ 'js/js' ] }),
'prefer-includes': createLazyRule('prefer-includes', { type: 'suggestion', docs: { description: 'Prefer `.includes()` over `.indexOf()`, `.lastIndexOf()`, and `Array#some()` when checking for existence or non-existence.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-includes': 'Use `.includes()`, rather than `.{{method}}()`, when checking for existence.', 'prefer-includes-over-some/error': 'Use `.includes()` instead of `.some()` when checking value existence.', 'prefer-includes-over-some/suggestion': 'Replace `.some()` with `.includes()`.' }, languages: [ 'js/js' ] }),
'prefer-includes-over-repeated-comparisons': createLazyRule('prefer-includes-over-repeated-comparisons', { type: 'suggestion', docs: { description: 'Prefer `.includes()` over repeated equality comparisons.', recommended: true }, schema: [ { type: 'object', additionalProperties: false, properties: { minimumComparisons: { type: 'integer', minimum: 2, description: 'The minimum number of equality comparisons before reporting.' } } } ], defaultOptions: [ { minimumComparisons: 3 } ], messages: { 'prefer-includes-over-repeated-comparisons': 'Use `.includes()` instead of repeated equality checks.' }, languages: [ 'js/js' ] }),
'prefer-iterable-in-constructor': createLazyRule('prefer-iterable-in-constructor', { type: 'suggestion', docs: { description: 'Prefer passing iterables directly to constructors instead of filling empty collections.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-iterable-in-constructor': 'Pass `{{source}}` directly to `new {{constructorName}}()`.', 'prefer-iterable-in-constructor/suggestion': 'Pass the iterable directly to `new {{constructorName}}()`.' }, languages: [ 'js/js' ] }),
'prefer-iterator-concat': createLazyRule('prefer-iterator-concat', { type: 'suggestion', docs: { description: 'Prefer `Iterator.concat(…)` over temporary spread arrays.', recommended: false }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-iterator-concat': 'Use `Iterator.concat(…)` instead of creating a temporary array from spreads.', 'prefer-iterator-concat/suggestion': 'Use `Iterator.concat(…)`.' }, languages: [ 'js/js' ] }),
'prefer-iterator-helpers': createLazyRule('prefer-iterator-helpers', { type: 'suggestion', docs: { description: 'Prefer iterator helpers over temporary arrays from iterators.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-iterator-helpers': 'Prefer `Iterator#{{method}}()` over materializing an array.', 'prefer-iterator-helpers/suggestion': 'Use `Iterator#{{method}}()`.', 'prefer-iterator-helpers/slice': 'Prefer `{{replacement}}` before materializing the iterator instead of slicing the array.', 'prefer-iterator-helpers/slice-suggestion': 'Use `{{replacement}}.toArray()`.' }, languages: [ 'js/js' ] }),
'prefer-iterator-to-array': createLazyRule('prefer-iterator-to-array', { type: 'suggestion', docs: { description: 'Prefer `Iterator#toArray()` over temporary arrays from iterator spreads.', recommended: true }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-iterator-to-array': 'Prefer `Iterator#toArray()` over a temporary spread array.', 'prefer-iterator-to-array/suggestion': 'Use `Iterator#toArray()`.' }, languages: [ 'js/js' ] }),
'prefer-iterator-to-array-at-end': createLazyRule('prefer-iterator-to-array-at-end', { type: 'suggestion', docs: { description: 'Prefer moving `.toArray()` to the end of iterator helper chains.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-iterator-to-array-at-end': 'Move `.toArray()` after `.{{method}}(…)`.' }, languages: [ 'js/js' ] }),
'prefer-iterator-zip': createLazyRule('prefer-iterator-zip', { type: 'suggestion', docs: { description: 'Prefer `Iterator.zip()` over parallel-array indexing.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-iterator-zip': 'Use `Iterator.zip(…)` to iterate over these arrays together.', 'prefer-iterator-zip/suggestion': 'Use `Iterator.zip(…)`.' }, languages: [ 'js/js' ] }),
'prefer-json-import': createLazyRule('prefer-json-import', { type: 'suggestion', docs: { description: 'Prefer JSON imports over reading and parsing JSON files.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-json-import': 'Prefer a JSON import over reading and parsing a JSON file.', 'prefer-json-import/suggestion': 'Replace the declaration with a JSON import (changes loading time and caches the data).' }, languages: [ 'js/js' ] }),
'prefer-keyboard-event-key': createLazyRule('prefer-keyboard-event-key', { type: 'suggestion', docs: { description: 'Prefer `KeyboardEvent#key` over deprecated keyboard event properties.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-keyboard-event-key': 'Use `.key` instead of `.{{name}}`.', 'prefer-keyboard-event-key/suggestion': 'Use `.key` with `{{key}}`.' }, languages: [ 'js/js' ] }),
'prefer-literal-ascii': createLazyRule('prefer-literal-ascii', { type: 'suggestion', docs: { description: 'Prefer literal printable ASCII characters over escape sequences.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-literal-ascii': 'Prefer literal printable ASCII characters over escape sequences.' }, languages: [ 'js/js', 'css/css', 'json/json', 'json/jsonc', 'json/json5', 'soml/soml' ] }),
'prefer-location-assign': createLazyRule('prefer-location-assign', { type: 'suggestion', docs: { description: 'Prefer `location.assign()` over assigning to `location.href`.', recommended: true }, fixable: 'code', schema: [], messages: { 'prefer-location-assign': 'Prefer `Location#assign()` over assigning to `Location#href`.' }, languages: [ 'js/js' ] }),
'prefer-logical-operator-over-ternary': createLazyRule('prefer-logical-operator-over-ternary', { type: 'suggestion', docs: { description: 'Prefer using a logical operator over a ternary.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-logical-operator-over-ternary/error': 'Prefer using a logical operator over a ternary.', 'prefer-logical-operator-over-ternary/optional-chain-error': 'Prefer using optional chaining over a ternary.', 'prefer-logical-operator-over-ternary/suggestion': 'Switch to `{{operator}}` operator.', 'prefer-logical-operator-over-ternary/optional-chain-suggestion': 'Switch to optional chaining.' }, languages: [ 'js/js' ] }),
'prefer-map-from-entries': createLazyRule('prefer-map-from-entries', { type: 'suggestion', docs: { description: 'Prefer `new Map()` over `Object.fromEntries()` when using the result as a map.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-map-from-entries': 'Prefer `new Map()` over `Object.fromEntries()` when using the result as a map.' }, languages: [ 'js/js' ] }),
'prefer-math-abs': createLazyRule('prefer-math-abs', { type: 'suggestion', docs: { description: 'Prefer `Math.abs()` over manual absolute value expressions and symmetric range checks.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-math-abs': 'Prefer `Math.abs()` to simplify this expression.', 'prefer-math-abs/suggestion': 'Replace with `Math.abs()`.' }, languages: [ 'js/js' ] }),
'prefer-math-constants': createLazyRule('prefer-math-constants', { type: 'suggestion', docs: { description: 'Prefer `Math` constants over their approximate numeric values.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-math-constants/error': 'Prefer `{{constant}}` over the approximate value `{{value}}`.', 'prefer-math-constants/suggestion': 'Replace `{{value}}` with `{{constant}}`.' }, languages: [ 'js/js' ] }),
'prefer-math-min-max': createLazyRule('prefer-math-min-max', { type: 'problem', docs: { description: 'Prefer `Math.min()` and `Math.max()` over ternaries for simple comparisons.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-math-min-max': 'Prefer `Math.{{method}}()` to simplify ternary expressions.', 'replace-with-math-min-max': 'Replace with `Math.{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-math-trunc': createLazyRule('prefer-math-trunc', { type: 'suggestion', docs: { description: 'Prefer `Math.trunc()` for truncating numbers.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'error-bitwise': 'Use `Math.trunc` instead of `{{operator}} {{value}}`.', 'error-bitwise-not': 'Use `Math.trunc` instead of `~~`.', 'error-parse-int': 'Use `Math.trunc` instead of `{{name}}(String(...), 10)`.', 'suggestion-bitwise': 'Replace `{{operator}} {{value}}` with `Math.trunc`.', 'suggestion-bitwise-not': 'Replace `~~` with `Math.trunc`.', 'suggestion-parse-int': 'Replace `{{name}}(String(...), 10)` with `Math.trunc`.' }, languages: [ 'js/js' ] }),
'prefer-minimal-ternary': createLazyRule('prefer-minimal-ternary', { type: 'suggestion', docs: { description: 'Prefer moving ternaries into the minimal varying part of an expression.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkVaryingBase: { type: 'boolean', description: 'Also report expressions that differ only by the base of a call or member access, whose minimization moves the ternary into the base (`(test ? a : b).foo`).' }, checkComputedMemberAccess: { type: 'boolean', description: 'Whether to also report static property or method name differences on a shared receiver, including member chains, requiring computed member access.' } } } ], defaultOptions: [ { checkVaryingBase: false, checkComputedMemberAccess: false } ], messages: { 'prefer-minimal-ternary': 'Move the ternary into the varying part of the expression.' }, languages: [ 'js/js' ] }),
'prefer-modern-dom-apis': createLazyRule('prefer-modern-dom-apis', { type: 'suggestion', docs: { description: 'Prefer modern DOM APIs.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { replaceChildOrInsertBefore: 'Prefer `{{oldChildNode}}.{{preferredMethod}}({{newChildNode}})` over `{{parentNode}}.{{method}}({{newChildNode}}, {{oldChildNode}})`.', replaceChildOrInsertBeforeSuggestion: 'Switch to `{{oldChildNode}}.{{preferredMethod}}({{newChildNode}})`.', insertAdjacentTextOrInsertAdjacentElement: 'Prefer `{{reference}}.{{preferredMethod}}({{content}})` over `{{reference}}.{{method}}({{position}}, {{content}})`.', replaceChildren: 'Prefer `{{parentNode}}.replaceChildren()` over directly removing `.{{childNodeProperty}}` in a loop.' }, languages: [ 'js/js' ] }),
'prefer-modern-math-apis': createLazyRule('prefer-modern-math-apis', { type: 'suggestion', docs: { description: 'Prefer modern `Math` APIs over legacy patterns.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-modern-math-apis': 'Prefer `{{replacement}}` over `{{description}}`.', suggestion: 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'prefer-module': createLazyRule('prefer-module', { type: 'suggestion', docs: { description: 'Prefer JavaScript modules (ESM) over CommonJS.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'error/use-strict-directive': 'Do not use "use strict" directive.', 'error/global-return': '"return" should be used inside a function.', 'error/identifier': 'Do not use "{{name}}".', 'suggestion/use-strict-directive': 'Remove "use strict" directive.', 'suggestion/import-meta-dirname': 'Replace `__dirname` with `import.meta.dirname`.', 'suggestion/import-meta-url-to-dirname': 'Replace `__dirname` with `…(import.meta.url)`.', 'suggestion/import-meta-filename': 'Replace `__filename` with `import.meta.filename`.', 'suggestion/import-meta-url-to-filename': 'Replace `__filename` with `…(import.meta.url)`.', 'suggestion/import': 'Switch to `import`.', 'suggestion/export': 'Switch to `export`.' }, languages: [ 'js/js' ] }),
'prefer-native-coercion-functions': createLazyRule('prefer-native-coercion-functions', { type: 'suggestion', docs: { description: 'Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-native-coercion-functions': '{{functionNameWithKind}} is equivalent to `{{replacementFunction}}`. Use `{{replacementFunction}}` directly.', 'prefer-native-coercion-functions/suggestion': 'Replace with `{{replacementFunction}}`.' }, languages: [ 'js/js' ] }),
'prefer-negative-index': createLazyRule('prefer-negative-index', { type: 'suggestion', docs: { description: 'Prefer negative index over `.length - index` when possible.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-negative-index': 'Prefer negative index over length minus index for `{{method}}`.', 'prefer-negative-index/suggestion': 'Use a negative index.' }, languages: [ 'js/js' ] }),
'prefer-node-protocol': createLazyRule('prefer-node-protocol', { type: 'suggestion', docs: { description: 'Prefer using the `node:` protocol when importing Node.js builtin modules.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-node-protocol': 'Prefer `node:{{moduleName}}` over `{{moduleName}}`.' }, languages: [ 'js/js' ] }),
'prefer-number-coercion': createLazyRule('prefer-number-coercion', { type: 'suggestion', docs: { description: 'Prefer `Number()` over `parseFloat()` and base-10 `parseInt()`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'parse-float': 'Prefer `Number()` over `{{method}}()`.', 'parse-int': 'Prefer `Number()` with explicit integer conversion over `{{method}}()` with radix `10`.', 'suggestion-number': 'Use `Number()` when the whole value should be numeric.', 'suggestion-trunc': 'Replace `{{method}}()` with `Math.trunc(Number())`.' }, languages: [ 'js/js' ] }),
'prefer-number-is-safe-integer': createLazyRule('prefer-number-is-safe-integer', { type: 'suggestion', docs: { description: 'Prefer `Number.isSafeInteger()` over integer checks.', recommended: true }, hasSuggestions: true, messages: { 'prefer-number-is-safe-integer/error': 'Prefer `Number.isSafeInteger()` over `Number.isInteger()`.', 'prefer-number-is-safe-integer/suggestion': 'Replace `Number.isInteger()` with `Number.isSafeInteger()`.', 'prefer-number-is-safe-integer/integer-check-error': 'Prefer `Number.isSafeInteger()` over this integer check.', 'prefer-number-is-safe-integer/integer-check-suggestion': 'Replace this integer check with `Number.isSafeInteger()`.' }, languages: [ 'js/js' ] }),
'prefer-number-properties': createLazyRule('prefer-number-properties', { type: 'suggestion', docs: { description: 'Prefer `Number` static methods over global functions and optionally static properties over global constants.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkInfinity: { type: 'boolean', description: 'Whether to check usage of the global `Infinity`.' }, checkNaN: { type: 'boolean', description: 'Whether to check usage of the global `NaN`.' } } } ], defaultOptions: [ { checkInfinity: false, checkNaN: false } ], messages: { error: 'Prefer `Number.{{property}}` over `{{description}}`.', suggestion: 'Replace `{{description}}` with `Number.{{property}}`.' }, languages: [ 'js/js' ] }),
'prefer-object-define-properties': createLazyRule('prefer-object-define-properties', { type: 'suggestion', docs: { description: 'Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-object-define-properties': 'Prefer `Object.defineProperties()` over multiple `Object.defineProperty()` calls.' }, languages: [ 'js/js' ] }),
'prefer-object-destructuring-defaults': createLazyRule('prefer-object-destructuring-defaults', { type: 'suggestion', docs: { description: 'Prefer object destructuring defaults over default object literals with spread.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-object-destructuring-defaults': 'Prefer object destructuring defaults over default object literals with spread.', 'prefer-object-destructuring-defaults/suggestion': 'Use object destructuring defaults.' }, languages: [ 'js/js' ] }),
'prefer-object-from-entries': createLazyRule('prefer-object-from-entries', { type: 'suggestion', docs: { description: 'Prefer using `Object.fromEntries(…)` to transform a list of key-value pairs into an object.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { functions: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Additional functions to check.' } } } ], defaultOptions: [ { functions: [] } ], messages: { reduce: 'Prefer `Object.fromEntries()` over `Array#reduce()`.', function: 'Prefer `Object.fromEntries()` over `{{functionName}}()`.', loop: 'Prefer `Object.fromEntries()` over a `for-of` loop.' }, languages: [ 'js/js' ] }),
'prefer-object-iterable-methods': createLazyRule('prefer-object-iterable-methods', { type: 'suggestion', docs: { description: 'Prefer the most specific `Object` iterable method.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-object-iterable-methods': 'Prefer `Object.{{preferredMethod}}()` over `Object.{{currentMethod}}()`.' }, languages: [ 'js/js' ] }),
'prefer-observer-apis': createLazyRule('prefer-observer-apis', { type: 'suggestion', docs: { description: 'Prefer observer APIs over resize and scroll listeners with layout reads.', recommended: true }, schema: [], messages: { resize: 'Prefer ResizeObserver over a resize listener with layout reads.', scroll: 'Prefer IntersectionObserver over a scroll listener with layout reads.' }, languages: [ 'js/js' ] }),
'prefer-optional-catch-binding': createLazyRule('prefer-optional-catch-binding', { type: 'suggestion', docs: { description: 'Prefer omitting the `catch` binding parameter.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'with-name': 'Remove unused catch binding `{{name}}`.', 'without-name': 'Remove unused catch binding.' }, languages: [ 'js/js' ] }),
'prefer-options-parameter': createLazyRule('prefer-options-parameter', { type: 'suggestion', docs: { description: 'Prefer an options object over optional positional parameters.', recommended: true }, schema: [ { type: 'object', properties: { checkWithoutOptionsObject: { type: 'boolean', description: 'Whether to check functions without an existing options object parameter.' } }, additionalProperties: false } ], defaultOptions: [ { checkWithoutOptionsObject: false } ], messages: { 'prefer-options-parameter': 'Prefer an options object over optional positional parameters.' }, languages: [ 'js/js' ] }),
'prefer-path2d': createLazyRule('prefer-path2d', { type: 'suggestion', docs: { description: 'Prefer `Path2D` for repeatedly drawn canvas paths.', recommended: 'unopinionated' }, messages: { 'prefer-path2d': 'Prefer reusing a `Path2D` object instead of rebuilding the canvas path in repeated draws.' }, languages: [ 'js/js' ] }),
'prefer-private-class-fields': createLazyRule('prefer-private-class-fields', { type: 'suggestion', docs: { description: 'Prefer private class fields over the underscore-prefix convention.', recommended: true }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-private-class-fields': 'Prefer the private class field `{{replacement}}` over the underscore-prefixed `{{original}}`.', 'prefer-private-class-fields/bound-method': 'Convert to a private arrow-function field.' }, languages: [ 'js/js' ] }),
'prefer-promise-static-methods': createLazyRule('prefer-promise-static-methods', { type: 'suggestion', docs: { description: 'Prefer `Promise.resolve()` and `Promise.reject()` over trivial `new Promise()` calls.', recommended: 'unopinionated' }, fixable: 'code', messages: { resolve: 'Prefer `Promise.resolve()` over a trivial `new Promise()`.', reject: 'Prefer `Promise.reject()` over a trivial `new Promise()`.' }, languages: [ 'js/js' ] }),
'prefer-promise-try': createLazyRule('prefer-promise-try', { type: 'suggestion', docs: { description: 'Prefer `Promise.try()` over promise-wrapping boilerplate.', recommended: true }, fixable: 'code', messages: { 'prefer-promise-try': 'Prefer `Promise.try()` over promise-wrapping boilerplate.' }, languages: [ 'js/js' ] }),
'prefer-promise-with-resolvers': createLazyRule('prefer-promise-with-resolvers', { type: 'suggestion', docs: { description: 'Prefer `Promise.withResolvers()` when extracting resolver functions from `new Promise()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-promise-with-resolvers': 'Prefer `Promise.withResolvers()` over extracting resolver functions from `new Promise()`.' }, languages: [ 'js/js' ] }),
'prefer-prototype-methods': createLazyRule('prefer-prototype-methods', { type: 'suggestion', docs: { description: 'Prefer borrowing methods from the prototype instead of the instance.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'known-method': 'Prefer using `{{constructorName}}.prototype.{{methodName}}`.', 'unknown-method': 'Prefer using method from `{{constructorName}}.prototype`.' }, languages: [ 'js/js' ] }),
'prefer-query-selector': createLazyRule('prefer-query-selector', { type: 'suggestion', docs: { description: 'Prefer `.querySelector()` and `.querySelectorAll()` over older DOM query methods.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { allowWithVariables: { type: 'boolean', description: 'Allow using the old APIs when called with non-literal arguments (variables, expressions, etc.).' } } } ], defaultOptions: [ { allowWithVariables: false } ], messages: { 'prefer-query-selector': 'Prefer `.{{replacement}}()` over `.{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-queue-microtask': createLazyRule('prefer-queue-microtask', { type: 'suggestion', docs: { description: 'Prefer `queueMicrotask()` over `process.nextTick()`, `setImmediate()`, and `setTimeout(…, 0)`.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { checkSetImmediate: { type: 'boolean', description: 'Whether to also check `setImmediate()`.' }, checkSetTimeout: { type: 'boolean', description: 'Whether to also check `setTimeout(…, 0)`.' } } } ], defaultOptions: [ { checkSetImmediate: false, checkSetTimeout: false } ], messages: { 'prefer-queue-microtask': 'Prefer `queueMicrotask()` over `{{name}}`.' }, languages: [ 'js/js' ] }),
'prefer-reflect-apply': createLazyRule('prefer-reflect-apply', { type: 'suggestion', docs: { description: 'Prefer `Reflect.apply()` over `Function#apply()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-reflect-apply': 'Prefer `Reflect.apply()` over `Function#apply()`.' }, languages: [ 'js/js' ] }),
'prefer-regexp-escape': createLazyRule('prefer-regexp-escape', { type: 'suggestion', docs: { description: 'Prefer `RegExp.escape()` for escaping strings to use in regular expressions.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-regexp-escape': 'Prefer `RegExp.escape()` for escaping strings to use in regular expressions.', replaceWithRegExpEscape: 'Replace with `RegExp.escape()`.' }, languages: [ 'js/js' ] }),
'prefer-regexp-exec': createLazyRule('prefer-regexp-exec', { type: 'suggestion', docs: { description: 'Prefer `RegExp#exec()` over `String#match()` for non-global regular expressions.', recommended: true }, fixable: 'code', messages: { 'prefer-regexp-exec': 'Prefer `RegExp#exec()` over `String#match()`.' }, languages: [ 'js/js' ] }),
'prefer-regexp-test': createLazyRule('prefer-regexp-test', { type: 'suggestion', docs: { description: 'Prefer `RegExp#test()` over `String#match()`, `String#search()`, and `RegExp#exec()`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'regexp-exec': 'Prefer `.test(…)` over `.exec(…)`.', 'string-match': 'Prefer `RegExp#test(…)` over `String#match(…)`.', 'string-search': 'Prefer `RegExp#test(…)` over `String#search(…)` when checking for existence.', suggestion: 'Switch to `RegExp#test(…)`.' }, languages: [ 'js/js' ] }),
'prefer-response-static-json': createLazyRule('prefer-response-static-json', { type: 'suggestion', docs: { description: 'Prefer `Response.json()` over `new Response(JSON.stringify())`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-response-static-json': 'Prefer using `Response.json(…)` over `JSON.stringify()`.' }, languages: [ 'js/js' ] }),
'prefer-scoped-selector': createLazyRule('prefer-scoped-selector', { type: 'suggestion', docs: { description: 'Prefer `:scope` when using element query selector methods.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-scoped-selector/error': 'Use `:scope` in element selector queries.', 'prefer-scoped-selector/suggestion': 'Prefix the selector with `:scope`.' }, languages: [ 'js/js' ] }),
'prefer-set-has': createLazyRule('prefer-set-has', { type: 'suggestion', docs: { description: 'Prefer `Set#has()` over `Array#includes()` when checking for existence or non-existence.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { minimumItems: { type: 'integer', minimum: 0, description: 'The minimum known array size before `Set#has()` is enforced.' } } } ], defaultOptions: [ { minimumItems: 0 } ], messages: { error: '`{{name}}` should be a `Set`, and use `{{name}}.has()` to check existence or non-existence.', suggestion: 'Switch `{{name}}` to `Set`.' }, languages: [ 'js/js' ] }),
'prefer-set-methods': createLazyRule('prefer-set-methods', { type: 'suggestion', docs: { description: 'Prefer `Set` methods for Set operations.', recommended: true }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-set-methods/union': 'Use `Set#union()` instead of spreading Sets into a new Set.', 'prefer-set-methods/intersection': 'Use `Set#intersection()` instead of filtering by `Set#has()`.', 'prefer-set-methods/intersection-suggestion': 'Use `Set#intersection()`.', 'prefer-set-methods/difference': 'Use `Set#difference()` instead of filtering by `Set#has()`.', 'prefer-set-methods/difference-suggestion': 'Use `Set#difference()`.', 'prefer-set-methods/is-subset-of': 'Use `Set#isSubsetOf()` to check whether a Set is a subset of another Set.', 'prefer-set-methods/is-disjoint-from': 'Use `Set#isDisjointFrom()` to check whether Sets have any elements in common.' }, languages: [ 'js/js' ] }),
'prefer-set-size': createLazyRule('prefer-set-size', { type: 'suggestion', docs: { description: 'Prefer using `Set#size` instead of `Array#length`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-set-size': 'Prefer using `Set#size` instead of `Array#length`.' }, languages: [ 'js/js' ] }),
'prefer-short-arrow-method': createLazyRule('prefer-short-arrow-method', { type: 'suggestion', docs: { description: 'Prefer arrow function properties over methods with a single return.', recommended: false }, fixable: 'code', schema: [ { description: 'Mode to use when reporting methods.', enum: [ 'always', 'consistent-as-needed' ] } ], defaultOptions: [ 'always' ], messages: { 'prefer-short-arrow-method': 'Prefer an arrow function property over a method with a single return.' }, languages: [ 'js/js' ] }),
'prefer-short-escape-sequences': createLazyRule('prefer-short-escape-sequences', { type: 'suggestion', docs: { description: 'Prefer shorter alternatives to Unicode escape sequences.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-short-escape-sequences': 'Prefer shorter alternatives to Unicode escape sequences.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'toml/toml', 'soml/soml' ] }),
'prefer-simple-condition-first': createLazyRule('prefer-simple-condition-first', { type: 'suggestion', docs: { description: 'Prefer simple conditions first in logical expressions.', recommended: true }, fixable: 'code', messages: { 'prefer-simple-condition-first': 'Prefer this simple condition first in the `{{operator}}` expression.', 'prefer-simple-condition-first/unsafe': 'Consider moving this simple condition first after verifying short-circuit behavior.' }, languages: [ 'js/js' ] }),
'prefer-simple-sort-comparator': createLazyRule('prefer-simple-sort-comparator', { type: 'suggestion', docs: { description: 'Prefer a simple comparison function for `Array#sort()`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-simple-sort-comparator/error': 'Prefer a simple comparison function for `Array#sort()`.', 'prefer-simple-sort-comparator/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'prefer-simplified-conditions': createLazyRule('prefer-simplified-conditions', { type: 'suggestion', docs: { description: 'Prefer simplified conditions.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { negatedConditions: { enum: [ 'simplify', 'expand' ], description: 'Whether to expand negated logical conditions only when it reduces negations or regardless of negation count.' } } } ], defaultOptions: [ { negatedConditions: 'simplify' } ], messages: { 'prefer-simplified-conditions': 'Prefer a simplified condition.', suggestion: 'Simplify the condition.' }, languages: [ 'js/js' ] }),
'prefer-single-array-predicate': createLazyRule('prefer-single-array-predicate', { type: 'suggestion', docs: { description: 'Prefer a single `Array#some()` or `Array#every()` with a combined predicate.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-single-array-predicate/error': 'Prefer a single `Array#{{method}}()` with a combined predicate.', 'prefer-single-array-predicate/suggestion': 'Merge predicates into one `Array#{{method}}()` call.' }, languages: [ 'js/js' ] }),
'prefer-single-call': createLazyRule('prefer-single-call', { type: 'suggestion', docs: { description: 'Enforce combining multiple `Array#{push,unshift}()`, `Element#classList.{add,remove}()`, and `importScripts()` into one call.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { ignore: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Methods to ignore.' } } } ], defaultOptions: [ { ignore: [] } ], messages: { 'error/array-push': 'Do not call `{{description}}` multiple times.', suggestion: 'Merge with previous one.' }, languages: [ 'js/js' ] }),
'prefer-single-object-destructuring': createLazyRule('prefer-single-object-destructuring', { type: 'suggestion', docs: { description: 'Prefer a single object destructuring declaration per local const source.', recommended: true }, fixable: 'code', schema: [], messages: { 'prefer-single-object-destructuring': 'Prefer a single object destructuring declaration from `{{source}}`.', 'prefer-direct-object-destructuring': 'Prefer destructuring directly from the initializer of `{{source}}`.' }, languages: [ 'js/js' ] }),
'prefer-single-replace': createLazyRule('prefer-single-replace', { type: 'suggestion', docs: { description: 'Enforce combining multiple single-character replacements into a single `String#replaceAll()` with a regular expression.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-single-replace': 'Combine these single-character replacements into a single `replaceAll()` with a regular expression.' }, languages: [ 'js/js' ] }),
'prefer-smaller-scope': createLazyRule('prefer-smaller-scope', { type: 'suggestion', docs: { description: 'Prefer declaring variables and type aliases in the smallest possible scope.', recommended: true }, fixable: 'code', schema: [ { type: 'object', properties: { checkTypeAliases: { type: 'boolean', description: 'Check TypeScript type aliases.' } }, additionalProperties: false } ], defaultOptions: [ { checkTypeAliases: true } ], messages: { 'prefer-smaller-scope': 'Move `{{name}}` into the block where it is used.' }, languages: [ 'js/js' ] }),
'prefer-split-limit': createLazyRule('prefer-split-limit', { type: 'suggestion', docs: { description: 'Prefer `String#split()` with a limit.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-split-limit': 'Prefer `String#split()` with a limit.' }, languages: [ 'js/js' ] }),
'prefer-spread': createLazyRule('prefer-spread', { type: 'suggestion', docs: { description: 'Prefer the spread operator over `Array.from(…)`, `Array#concat(…)`, `Array#{slice,toSpliced}()`, and trivial `for…of` copies.', recommended: true }, fixable: 'code', hasSuggestions: true, messages: { 'array-from': 'Prefer the spread operator over `Array.from(…)`.', 'array-concat': 'Prefer the spread operator over `Array#concat(…)`.', 'array-slice': 'Prefer the spread operator over `Array#slice()`.', 'array-to-spliced': 'Prefer the spread operator over `Array#toSpliced()`.', 'for-of': 'Prefer the spread operator over this `for…of` loop.', spread: 'Use the spread operator.', 'argument-is-spreadable': 'First argument is an `array`.', 'argument-is-not-spreadable': 'First argument is not an `array`.', 'test-argument': 'Test first argument with `Array.isArray(…)`.', 'spread-all-arguments': 'Spread all unknown arguments.' }, languages: [ 'js/js' ] }),
'prefer-string-match-all': createLazyRule('prefer-string-match-all', { type: 'suggestion', docs: { description: 'Prefer `String#matchAll()` over `RegExp#exec()` loops.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-string-match-all': 'Prefer `String#matchAll()` over a `RegExp#exec()` loop.' }, languages: [ 'js/js' ] }),
'prefer-string-pad-start-end': createLazyRule('prefer-string-pad-start-end', { type: 'suggestion', docs: { description: 'Prefer `String#padStart()` and `String#padEnd()` over manual string padding.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-string-pad-start-end': 'Prefer `String#{{method}}()` over manual string padding.', 'suggest-padding-method': 'Replace with `String#{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-string-raw': createLazyRule('prefer-string-raw', { type: 'suggestion', docs: { description: 'Prefer using the `String.raw` tag to avoid escaping `\\`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-string-raw': '`String.raw` should be used to avoid escaping `\\`.', 'prefer-string-raw/suggestion': 'Use `String.raw`. This may widen the string literal type to `string`.', 'unnecessary-string-raw': 'Using `String.raw` is unnecessary as the string does not contain any `\\`.' }, languages: [ 'js/js' ] }),
'prefer-string-repeat': createLazyRule('prefer-string-repeat', { type: 'suggestion', docs: { description: 'Prefer `String#repeat()` for repeated whitespace.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { minimumRepetitions: { type: 'integer', minimum: 2, description: 'The minimum number of repeated whitespace characters before `String#repeat()` is enforced.' } } } ], defaultOptions: [ { minimumRepetitions: 3 } ], messages: { 'prefer-string-repeat': 'Use `String#repeat()` for repeated whitespace.' }, languages: [ 'js/js' ] }),
'prefer-string-replace-all': createLazyRule('prefer-string-replace-all', { type: 'suggestion', docs: { description: 'Prefer `String#replaceAll()` over regex searches with the global flag and `String#split().join()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { method: 'Prefer `String#replaceAll()` over `String#replace()`.', pattern: 'This pattern can be replaced with {{replacement}}.', 'split-join': 'Prefer `String#replaceAll()` over `String#split().join()`.' }, languages: [ 'js/js' ] }),
'prefer-string-slice': createLazyRule('prefer-string-slice', { type: 'suggestion', docs: { description: 'Prefer `String#slice()` over `String#substr()` and `String#substring()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { substr: 'Prefer `String#slice()` over `String#substr()`.', substring: 'Prefer `String#slice()` over `String#substring()`.' }, languages: [ 'js/js' ] }),
'prefer-string-starts-ends-with': createLazyRule('prefer-string-starts-ends-with', { type: 'suggestion', docs: { description: 'Prefer `String#startsWith()` & `String#endsWith()` over regexes, `String#indexOf() === 0`, and slice checks.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-starts-with': 'Prefer `String#startsWith()` over a regex with `^`.', 'prefer-ends-with': 'Prefer `String#endsWith()` over a regex with `$`.', 'prefer-starts-with-indexOf': 'Prefer `String#startsWith()` over `String#indexOf() === 0`.', 'prefer-starts-with-slice': 'Prefer `String#startsWith()` over comparing a string slice.', 'prefer-ends-with-slice': 'Prefer `String#endsWith()` over comparing a string slice.', 'prefer-string-starts-ends-with/slice-suggestion': 'Replace with `String#{{method}}()`.', useStringCasting: 'Convert to string `String(…).{{method}}()`.', useOptionalChaining: 'Use optional chaining `…?.{{method}}()`.', useNullishCoalescing: "Use nullish coalescing `(… ?? '').{{method}}()`." }, languages: [ 'js/js' ] }),
'prefer-string-trim-start-end': createLazyRule('prefer-string-trim-start-end', { type: 'suggestion', docs: { description: 'Prefer `String#trimStart()` / `String#trimEnd()` over `String#trimLeft()` / `String#trimRight()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-string-trim-start-end': 'Prefer `String#{{replacement}}()` over `String#{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-structured-clone': createLazyRule('prefer-structured-clone', { type: 'suggestion', docs: { description: 'Prefer using `structuredClone` to create a deep clone.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { functions: { type: 'array', items: { type: 'string' }, uniqueItems: true, description: 'Additional functions to check.' } } } ], defaultOptions: [ { functions: [] } ], messages: { 'prefer-structured-clone/error': 'Prefer `structuredClone(…)` over `{{description}}` to create a deep clone.', 'prefer-structured-clone/suggestion': 'Switch to `structuredClone(…)`.' }, languages: [ 'js/js' ] }),
'prefer-switch': createLazyRule('prefer-switch', { type: 'suggestion', docs: { description: 'Prefer `switch` over multiple `else-if`.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { minimumCases: { type: 'integer', minimum: 2, description: 'The minimum number of `if`/`else if` cases before suggesting a `switch` statement.' }, emptyDefaultCase: { enum: [ 'no-default-comment', 'do-nothing-comment', 'no-default-case' ], description: 'How to handle an empty `default` case.' } } } ], defaultOptions: [ { minimumCases: 3, emptyDefaultCase: 'no-default-comment' } ], messages: { 'prefer-switch': 'Use `switch` instead of multiple `else-if`.' }, languages: [ 'js/js' ] }),
'prefer-temporal': createLazyRule('prefer-temporal', { type: 'suggestion', docs: { description: 'Prefer `Temporal` over `Date`.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { checkDateNow: { type: 'boolean', description: 'Whether to also flag `Date.now()`.' }, checkReferences: { type: 'boolean', description: 'Whether to also flag bare references to `Date`, such as `x instanceof Date`.' }, checkMethods: { type: 'boolean', description: 'Whether to also flag methods called on `Date` instances, such as `date.getFullYear()`. Requires TypeScript type information.' } } } ], defaultOptions: [ { checkDateNow: false, checkReferences: false, checkMethods: false } ], messages: { 'prefer-temporal': 'Prefer `Temporal` over `{{description}}`.', 'prefer-temporal/parse': 'Prefer `Temporal` over `{{description}}`. Parsing date strings with `Date` is inconsistent across implementations.', 'prefer-temporal/month': 'Prefer `Temporal` over `{{description}}`. The month argument of `Date` is zero-indexed, which is error-prone.', 'prefer-temporal/suggestion': 'Replace with `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'prefer-temporal-conversion': createLazyRule('prefer-temporal-conversion', { type: 'suggestion', docs: { description: 'Prefer direct Temporal conversion methods.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [], messages: { 'prefer-temporal-conversion': 'Prefer `.{{method}}()` when converting to `Temporal.{{target}}`.', 'prefer-temporal-conversion/suggestion': 'Replace with `.{{method}}()`.' }, languages: [ 'js/js' ] }),
'prefer-ternary': createLazyRule('prefer-ternary', { type: 'suggestion', docs: { description: 'Prefer ternary expressions over simple `if` statements.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { enum: [ 'always', 'only-single-line' ], description: 'Whether to always prefer ternary, or only for single-line expressions.' }, { type: 'object', additionalProperties: false, properties: { checkVaryingBase: { type: 'boolean', description: 'Also report expressions that differ only by the base of a call or member access, whose minimization moves the ternary into the base (`(test ? a : b).foo`).' }, checkComputedMemberAccess: { type: 'boolean', description: 'Whether to also report static property or method name differences on a shared receiver, including member chains, requiring computed member access.' }, checkNestedTernaries: { type: 'boolean', description: 'Whether to report merges whose conditions or values contain ternary expressions.' } } } ], defaultOptions: [ 'always', { checkVaryingBase: false, checkComputedMemberAccess: false, checkNestedTernaries: false } ], messages: { 'prefer-ternary': 'This `if` statement can be replaced by a ternary expression.', 'prefer-ternary/suggestion': 'Use a ternary expression.' }, languages: [ 'js/js' ] }),
'prefer-then-catch': createLazyRule('prefer-then-catch', { type: 'problem', docs: { description: 'Prefer `.then().catch()` over `.then(…, …)` for error handling.', recommended: true }, hasSuggestions: true, schema: [], messages: { 'prefer-then-catch': 'Prefer `.then(…).catch(…)` over passing a rejection handler to `.then()`.', 'prefer-then-catch/suggestion': 'Move the rejection handler to `.catch()`.' }, languages: [ 'js/js' ] }),
'prefer-toggle-attribute': createLazyRule('prefer-toggle-attribute', { type: 'suggestion', docs: { description: 'Prefer using `Element#toggleAttribute()` to toggle attributes.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-toggle-attribute/error': 'Prefer using `Element#toggleAttribute()` to toggle attributes.', 'prefer-toggle-attribute/suggestion': 'Replace with `Element#toggleAttribute()`.' }, languages: [ 'js/js' ] }),
'prefer-top-level-await': createLazyRule('prefer-top-level-await', { type: 'suggestion', docs: { description: 'Prefer top-level await over top-level promises and async function calls.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { promise: 'Prefer top-level await over using a promise chain.', iife: 'Prefer top-level await over an async IIFE.', identifier: 'Prefer top-level await over an async function `{{name}}` call.', 'add-await': 'Insert `await`.' }, languages: [ 'js/js' ] }),
'prefer-type-error': createLazyRule('prefer-type-error', { type: 'suggestion', docs: { description: 'Enforce throwing `TypeError` in type checking conditions.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-type-error': '`new Error()` is too unspecific for a type check. Use `new TypeError()` instead.' }, languages: [ 'js/js' ] }),
'prefer-type-literal-last': createLazyRule('prefer-type-literal-last', { type: 'suggestion', docs: { description: 'Require type literals to be last in union types.', recommended: true }, fixable: 'code', messages: { 'prefer-type-literal-last': 'Move type literals to the end of this union.' }, languages: [ 'js/js' ] }),
'prefer-uint8array-base64': createLazyRule('prefer-uint8array-base64', { type: 'suggestion', docs: { description: 'Prefer `Uint8Array#toBase64()` and `Uint8Array.fromBase64()` over legacy base64 conversions and manual postprocessing.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', properties: { checkBufferDecoding: { type: 'boolean', description: 'Whether to check `Buffer.from()` decoding calls.' } }, additionalProperties: false } ], defaultOptions: [ { checkBufferDecoding: true } ], messages: { 'prefer-uint8array-base64/options': 'Prefer native `toBase64()` options over manual base64 postprocessing.', 'prefer-uint8array-base64/error': 'Prefer `{{replacement}}` over `{{value}}`.', 'prefer-uint8array-base64/suggestion': 'Replace `{{value}}` with `{{replacement}}`.', 'prefer-uint8array-base64/buffer-decoding': 'Prefer `Uint8Array.{{method}}()` over `Buffer.{{method}}()`, which returns a `Uint8Array`.' }, languages: [ 'js/js' ] }),
'prefer-uint8array-hex': createLazyRule('prefer-uint8array-hex', { type: 'suggestion', docs: { description: 'Prefer `Uint8Array#toHex()` and `Uint8Array.fromHex()` over manual and Buffer hex conversions.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', properties: { checkBufferDecoding: { type: 'boolean', description: 'Whether to check `Buffer.from()` decoding calls.' } }, additionalProperties: false } ], defaultOptions: [ { checkBufferDecoding: true } ], messages: { 'prefer-uint8array-hex/error': 'Prefer `{{replacement}}` over {{description}}.', 'prefer-uint8array-hex/suggestion': 'Replace with `{{replacement}}`.', 'prefer-uint8array-hex/buffer-decoding': 'Prefer `Uint8Array.{{method}}()` over `Buffer.{{method}}()`, which returns a `Uint8Array`.' }, languages: [ 'js/js' ] }),
'prefer-unary-minus': createLazyRule('prefer-unary-minus', { type: 'suggestion', docs: { description: 'Prefer the unary minus operator over multiplying or dividing by `-1`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-unary-minus': 'Prefer the unary minus operator over {{operation}} by `-1`.' }, languages: [ 'js/js' ] }),
'prefer-unicode-code-point-escapes': createLazyRule('prefer-unicode-code-point-escapes', { type: 'suggestion', docs: { description: 'Prefer Unicode code point escapes over legacy escape sequences.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { 'prefer-unicode-code-point-escapes': 'Prefer Unicode code point escapes.', 'prefer-unicode-code-point-escapes/add-unicode-flag': 'Use Unicode code point escapes and add the `u` flag.' }, languages: [ 'js/js' ] }),
'prefer-url-can-parse': createLazyRule('prefer-url-can-parse', { type: 'suggestion', docs: { description: 'Prefer `URL.canParse()` over constructing a `URL` in a try/catch for validation.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-url-can-parse': 'Prefer `URL.canParse()` over constructing a `URL` in a try/catch for validation.' }, languages: [ 'js/js' ] }),
'prefer-url-href': createLazyRule('prefer-url-href', { type: 'suggestion', docs: { description: 'Prefer `URL#href` over stringifying a `URL`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'prefer-url-href': 'Prefer `URL#href` over stringifying a `URL`.' }, languages: [ 'js/js' ] }),
'prefer-url-search-parameters': createLazyRule('prefer-url-search-parameters', { type: 'suggestion', docs: { description: 'Prefer `URLSearchParams` over manually splitting query strings.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'prefer-url-search-parameters/error': 'Prefer `URLSearchParams` over manually splitting query strings.', 'prefer-url-search-parameters/suggestion': 'Use `{{replacement}}`.' }, languages: [ 'js/js' ] }),
'prefer-while-loop-condition': createLazyRule('prefer-while-loop-condition', { type: 'suggestion', docs: { description: 'Prefer putting the condition in the while statement.', recommended: 'unopinionated' }, fixable: 'code', schema: [], messages: { 'prefer-while-loop-condition': 'Prefer putting the condition in the `while` statement.' }, languages: [ 'js/js' ] }),
'relative-url-style': createLazyRule('relative-url-style', { type: 'suggestion', docs: { description: 'Enforce consistent relative URL style.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { enum: [ 'never', 'always' ], description: 'Whether to never or always use a leading `./` for relative URLs.' } ], defaultOptions: [ 'never' ], messages: { never: 'Remove the `./` prefix from the relative URL.', always: 'Add a `./` prefix to the relative URL.', remove: 'Remove leading `./`.' }, languages: [ 'js/js', 'css/css', 'html/html', 'markdown/commonmark', 'markdown/gfm' ] }),
'require-array-join-separator': createLazyRule('require-array-join-separator', { type: 'suggestion', docs: { description: 'Enforce using the separator argument with `Array#join()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'require-array-join-separator': 'Missing the separator argument.' }, languages: [ 'js/js' ] }),
'require-array-sort-compare': createLazyRule('require-array-sort-compare', { type: 'problem', docs: { description: 'Require a compare function when calling `Array#sort()` or `Array#toSorted()`.', recommended: 'unopinionated' }, hasSuggestions: true, messages: { 'require-array-sort-compare': 'Pass a compare function to avoid sorting elements as strings.', 'require-array-sort-compare/numeric': 'Sort numerically.', 'require-array-sort-compare/string': 'Sort strings with `String#localeCompare()`.' }, languages: [ 'js/js' ] }),
'require-css-escape': createLazyRule('require-css-escape', { type: 'suggestion', docs: { description: 'Require `CSS.escape()` for interpolated values in CSS selectors.', recommended: 'unopinionated' }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { checkAllSelectors: { type: 'boolean', description: 'Check all selector interpolations instead of only attribute selector interpolations.' } } } ], defaultOptions: [ { checkAllSelectors: false } ], messages: { 'require-css-escape': 'Use `CSS.escape()` for interpolated values in CSS selectors.' }, languages: [ 'js/js' ] }),
'require-frontmatter-fields': createLazyRule('require-frontmatter-fields', { type: 'suggestion', docs: { description: 'Require configured YAML frontmatter fields.', recommended: false }, schema: [ { type: 'object', additionalProperties: false, properties: { fields: { type: 'array', uniqueItems: true, items: { type: 'string', minLength: 1 }, description: 'Top-level YAML frontmatter fields that are required.' } } } ], defaultOptions: [ { fields: [] } ], messages: { 'missing-field': 'Missing required frontmatter field `{{field}}`.' }, languages: [ 'markdown/commonmark', 'markdown/gfm' ] }),
'require-module-attributes': createLazyRule('require-module-attributes', { type: 'suggestion', docs: { description: 'Require non-empty module attributes for imports and exports', recommended: 'unopinionated' }, fixable: 'code', messages: { 'require-module-attributes': '{{type}} with empty attribute list is not allowed.' }, languages: [ 'js/js' ] }),
'require-module-specifiers': createLazyRule('require-module-specifiers', { type: 'suggestion', docs: { description: 'Require non-empty specifier list in import and export statements.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, messages: { error: '{{type}} statement without specifiers is not allowed.', 'suggestion/remove-declaration': 'Remove this {{type}} statement.', 'suggestion/to-side-effect-import': 'Switch to side effect import.' }, languages: [ 'js/js' ] }),
'require-number-to-fixed-digits-argument': createLazyRule('require-number-to-fixed-digits-argument', { type: 'suggestion', docs: { description: 'Enforce using the digits argument with `Number#toFixed()`.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'require-number-to-fixed-digits-argument': 'Missing the digits argument.' }, languages: [ 'js/js' ] }),
'require-passive-events': createLazyRule('require-passive-events', { type: 'suggestion', docs: { description: 'Require passive event listeners for high-frequency events.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'require-passive-events': 'Use `{passive: true}` for this high-frequency event listener.' }, languages: [ 'js/js' ] }),
'require-post-message-target-origin': createLazyRule('require-post-message-target-origin', { type: 'problem', docs: { description: 'Enforce using the `targetOrigin` argument with `window.postMessage()`.', recommended: false }, hasSuggestions: true, messages: { error: 'Missing the `targetOrigin` argument.', suggestion: 'Use `{{code}}`.' }, languages: [ 'js/js' ] }),
'require-proxy-trap-boolean-return': createLazyRule('require-proxy-trap-boolean-return', { type: 'problem', docs: { description: 'Require boolean-returning Proxy traps to return booleans.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'require-proxy-trap-boolean-return': 'Proxy trap `{{name}}` should return a boolean.' }, languages: [ 'js/js' ] }),
'require-spread-parentheses': createLazyRule('require-spread-parentheses', { type: 'layout', docs: { description: 'Require parentheses around complex spread arguments.', recommended: true }, fixable: 'code', schema: [], messages: { 'require-spread-parentheses': 'Wrap the spread argument in parentheses.' }, languages: [ 'js/js' ] }),
'require-text-decoder-streaming': createLazyRule('require-text-decoder-streaming', { type: 'problem', docs: { description: 'Require streaming decoding of fetch-body chunks with `TextDecoder`.', recommended: 'unopinionated' }, hasSuggestions: true, schema: [], messages: { 'require-text-decoder-streaming/error': 'Decode fetch-body chunks with `{stream: true}` using the same decoder, then consume a final `decode()` flush, or use `TextDecoderStream`.', 'require-text-decoder-streaming/suggestion': 'Enable streaming decoding and consume the final flush.' }, languages: [ 'js/js' ] }),
'single-line-block-comment-style': createLazyRule('single-line-block-comment-style', { type: 'layout', docs: { description: 'Enforce a consistent style for single-line block comments.', recommended: true }, fixable: 'whitespace', schema: [ { enum: [ 'multiline', 'single-line' ], description: 'The style for block comments with one line of content.' }, { type: 'object', additionalProperties: false, properties: { ignore: { type: 'array', items: { type: [ 'string', 'object' ], additionalProperties: true }, uniqueItems: true, description: 'Regular expressions to ignore.' } } } ], defaultOptions: [ 'multiline', { ignore: [] } ], messages: { 'single-line-block-comment-style': 'Use a {{style}} block comment.' }, languages: [ 'js/js', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'soml/soml' ] }),
'string-content': createLazyRule('string-content', { type: 'suggestion', docs: { description: 'Enforce better string content.', recommended: false }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { patterns: { type: 'object', description: 'Patterns to replace in string content.', additionalProperties: { anyOf: [ { type: 'string' }, { type: 'object', required: [ 'suggest' ], properties: { suggest: { type: 'string' }, fix: { type: 'boolean' }, caseSensitive: { type: 'boolean' }, message: { type: 'string' } }, additionalProperties: false } ] } }, selectors: { type: 'array', uniqueItems: true, items: { type: 'string', minLength: 1, pattern: '\\S' }, description: 'AST selectors for string nodes to check.' } } } ], defaultOptions: [ { patterns: {}, selectors: [] } ], messages: { replace: 'Replace `{{match}}` with `{{suggest}}`.' }, languages: [ 'js/js', 'soml/soml', 'yml/yaml', 'json/json', 'json/jsonc', 'json/json5', 'css/css', 'toml/toml' ] }),
'switch-case-braces': createLazyRule('switch-case-braces', { type: 'layout', docs: { description: 'Enforce consistent brace style for `case` clauses.', recommended: true }, fixable: 'code', schema: [ { enum: [ 'always', 'avoid', 'single-statement' ], description: 'Whether to always require braces, avoid them when possible, or require one statement per case.' } ], defaultOptions: [ 'always' ], messages: { 'switch-case-braces/empty': 'Unexpected braces in empty case clause.', 'switch-case-braces/missing': 'Missing braces in case clause.', 'switch-case-braces/unnecessary': 'Unnecessary braces in case clause.' }, languages: [ 'js/js' ] }),
'switch-case-break-position': createLazyRule('switch-case-break-position', { type: 'layout', docs: { description: 'Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.', recommended: true }, fixable: 'code', messages: { 'switch-case-break-position': 'Move `{{keyword}}` inside the block statement.' }, languages: [ 'js/js' ] }),
'template-indent': createLazyRule('template-indent', { type: 'suggestion', docs: { description: 'Fix whitespace-insensitive template indentation.', recommended: true }, fixable: 'code', schema: [ { type: 'object', additionalProperties: false, properties: { indent: { oneOf: [ { type: 'string', pattern: '^\\s+$', description: 'Whitespace string to use as indentation.' }, { type: 'integer', minimum: 1, description: 'Number of spaces to use as indentation.' } ], description: 'The indentation to use inside the template literal.' }, tags: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Tagged template names to check.' }, functions: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Function names whose template literal arguments to check.' }, selectors: { type: 'array', uniqueItems: true, items: { type: 'string', minLength: 1, pattern: '\\S' }, description: 'AST selectors for template literals to check.' }, comments: { type: 'array', uniqueItems: true, items: { type: 'string' }, description: 'Comment patterns to mark template literals for checking.' } } } ], defaultOptions: [ { tags: [ 'outdent', 'dedent', 'gql', 'sql', 'html', 'styled' ], functions: [ 'dedent', 'stripIndent' ], selectors: [], comments: [ 'HTML', 'indent' ] } ], messages: { 'template-indent': 'Templates should be properly indented.' }, languages: [ 'js/js' ] }),
'text-encoding-identifier-case': createLazyRule('text-encoding-identifier-case', { type: 'suggestion', docs: { description: 'Enforce consistent case for text encoding identifiers.', recommended: 'unopinionated' }, fixable: 'code', hasSuggestions: true, schema: [ { type: 'object', additionalProperties: false, properties: { withDash: { type: 'boolean', description: 'Whether to prefer identifiers with a dash, like `utf-8` instead of `utf8`.' } } } ], defaultOptions: [ { withDash: false } ], messages: { 'text-encoding-identifier/error': 'Prefer `{{replacement}}` over `{{value}}`.', 'text-encoding-identifier/suggestion': 'Replace `{{value}}` with `{{replacement}}`.' }, languages: [ 'js/js', 'css/css', 'html/html' ] }),
'throw-new-error': createLazyRule('throw-new-error', { type: 'suggestion', docs: { description: 'Require `new` when creating an error.', recommended: 'unopinionated' }, fixable: 'code', messages: { 'throw-new-error': 'Use `new` when creating an error.' }, languages: [ 'js/js' ] }),
'try-complexity': createLazyRule('try-complexity', { type: 'suggestion', docs: { description: 'Limit the complexity of `try` blocks.', recommended: false }, schema: [ { type: 'object', additionalProperties: false, properties: { max: { type: 'integer', minimum: 1, description: 'The maximum allowed complexity of a `try` block.' } } } ], defaultOptions: [ { max: 1 } ], messages: { 'try-complexity': 'Try block has a complexity of {{complexity}}. Maximum allowed is {{max}}.' }, languages: [ 'js/js' ] }),
});