Lint rules
Every rule of every ESLint and Stylelint block of lint/, generated from the sources: its setting, what it checks (as the rule describes itself), the reason written above it (Custom: a project choice, Off: disabled on purpose, Deprecated: replaced, Warn: the exception that justifies disabling it) and a link to its documentation. An error is a real mistake or a style the autofix applies: it cannot be disabled. A warn is a style without autofix: it may be disabled for one line, with a reason. Search a rule name with CtrlK.
| Block | Rules | What it covers |
|---|---|---|
| eslint/rules/angular-components | 59 | Angular (angular-eslint): components, directives, pipes and services, every TypeScript rule listed, plus the TypeScript rules Angular code needs differently. Templates are in angular-templates. |
| eslint/rules/angular-templates | 43 | Angular templates (.html files and inline templates): control flow, bindings, complexity. Screen-reader accessibility and @angular/localize are not used (simulators, Transloco): their rules are off, except what is odd anyway (autofocus, a positive tabindex). |
| eslint/rules/arrays | 26 | Arrays: Array methods, array creation, sorting and searching. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/async | 22 | Async code: Promises, async / await, timers and generators: nothing floating, nothing forgotten. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/browser-apis | 6 | Browser: DOM, events, CSS-in-JS, web APIs and the console. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/browser | 7 | Browser: the mode of a project's sources (a library, an application), after rules/node: browser globals, no Node module, imports of a neighbour or a folder without extension, devDependencies only in the files never shipped (specs, stories), no console output left behind. |
| eslint/rules/classes | 47 | Classes: Constructors, members, accessors, this and inheritance. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/comments | 11 | Comments: TODO / FIXME, commented-out code, ts-ignore and the style of comments. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/complexity | 9 | Complexity: Size and complexity limits: lines, statements, nesting, cognitive complexity. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/conditions | 60 | Conditions: if / else, ternaries, booleans, comparisons, equality and switch: explicit, simple and exhaustive branches. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/dead-code | 16 | Dead code: Unused, unreachable, useless, empty or duplicated code. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/disable-comments | 3 | Disable comments (// eslint-disable-next-line <rule> -- <reason>): a rule set to warn may be disabled for one line, with a reason; a rule set to error cannot be disabled at all. A disable that is no longer needed is an error too (linterOptions, setup/javascript). |
| eslint/rules/errors | 13 | Errors: throw, try / catch and Error objects. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/exports | 1 | Exports: a source file exports one function or class, named after the file (format-count.ts exports formatCount, button.component.ts exports ButtonComponent); small exported types and constants may sit next to it. Entry points, stories and test code are left out. |
| eslint/rules/file-names | 1 | File names: kebab-case files and folders (local/kebab-case-path). The one export per file is in rules/exports. |
| eslint/rules/formatting | 6 | Formatting: Prettier formats the code (eslint-plugin-prettier reports unformatted code, eslint-config-prettier turns off the layout rules that would conflict), plus the few layout rules outside Prettier. Spread it first: the blocks after it set the rules they need again. |
| eslint/rules/functions | 46 | Functions: Declarations, parameters, return values and callbacks: consistent, small and predictable functions. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/imports | 48 | Imports (eslint-plugin-import-x): module boundaries, declared dependencies, cycles, order. import-x/no-cycle is the costliest rule of the block: it follows every import. |
| eslint/rules/library | 2 | Library: the sources of a library, whose generic API may write any (a constructor type) and void in a union (a callback returning T | void). Using an any value stays an error (no-unsafe-*). |
| eslint/rules/loops | 24 | Loops: for, while, iteration and labels: the right loop for the job, no mutation of what is iterated. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/modern-syntax | 9 | Modern syntax: Modern JavaScript: spread, at(), operator assignment, standard built-ins. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/modules | 20 | Modules: import, export, require and module boundaries (the import-x plugin has its own block). Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/naming | 13 | Naming: Names of identifiers, the naming convention of TypeScript and forbidden abbreviations. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/node-apis | 1 | Node apis: Node-only APIs: process, Buffer, globalThis, JSON files. Rules of SonarJS on this subject (the Sonar way profile of SonarQube), every rule listed. |
| eslint/rules/node | 7 | Node: the mode of a workspace root and of everything around the projects (tool configs, scripts, specs run by Node): Node globals and modules, default exports for the tools, imports by path with their extension (Node ESM needs it), devDependencies, console output. rules/browser turns a project's sources back to the browser. |
| eslint/rules/numbers | 22 | Numbers and dates: Arithmetic, precision, magic numbers, bitwise operators and dates. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/objects-and-collections | 17 | Objects and collections: Object literals, properties, Map and Set. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/other-frameworks | 34 | Other frameworks: Rules for frameworks this stack does not use (React, Vue, jQuery, Cypress, Lodash, AWS CDK): kept listed so that a plugin update never enables them silently. Rules of SonarJS on this subject (the Sonar way profile of SonarQube), every rule listed. |
| eslint/rules/regular-expressions | 32 | Regular expressions (core rules): The regular expression rules of ESLint, SonarJS and Unicorn; the regexp plugin has its own block. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/security | 57 | Security: Injection (XSS, SQL, commands), weak cryptography, secrets, insecure protocols and the sanitizer. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/storybook | 21 | Storybook (any framework: Angular, HTML + Vite…), kept light: the rules that catch a story that breaks or a test that lies, and the relaxations stories need (default export, PascalCase story names, devDependencies). The style rules of the plugin are off: stories are documentation, not a place to argue about form. |
| eslint/rules/strings | 17 | Strings: String methods, templates, quotes and character handling. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/test-code | 39 | Test code: the SonarJS rules on tests (they apply where a test framework is used), then the relaxations test code needs (specs, testing/ helpers, benchmarks): literal tables, mutable fixtures, long describe callbacks. |
| eslint/rules/types | 79 | Types: any, unsafe values, assertions, enums, interfaces, void and null: the type safety of TypeScript. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| eslint/rules/variables | 55 | Variables: Declarations, scope, shadowing, assignments and destructuring. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only. |
| stylelint/rules/at-rules | 24 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. At-rules: @media, @import, @layer, @container and the other at-rules. |
| stylelint/rules/colors | 14 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Colors: notations, named colors, invalid hex, color functions. |
| stylelint/rules/comments | 5 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Comments: empty comments, patterns. |
| stylelint/rules/declarations | 25 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Declarations and properties: duplicates, shorthands, !important, custom properties. |
| stylelint/rules/disable-comments | 1 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Disable comments (// stylelint-disable-next-line <rule> -- <reason>): a rule set to warning may be disabled for one line, with a reason; a rule set to error cannot be disabled at all. A disable that is no longer needed is an error too. |
| stylelint/rules/fonts | 4 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Fonts: families, weights. |
| stylelint/rules/general | 21 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. General: empty sources, nesting depth, animations, grid areas and the other rules. |
| stylelint/rules/order | 3 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Order (stylelint-order): custom properties, variables, declarations, then rules; properties by role. |
| stylelint/rules/prettier | 1 | on save (never disabled); warning = a choice to justify (disabled for one line, with a reason). Prettier (stylelint-prettier): the formatting, checked by Stylelint and fixed on save, like eslint-plugin-prettier. |
| stylelint/rules/scss | 71 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. SCSS (stylelint-scss): @use, variables, mixins, placeholders, operators. |
| stylelint/rules/selectors | 38 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Selectors: validity, specificity, patterns, nesting of selectors, Angular custom elements and ::ng-deep. |
| stylelint/rules/values-and-units | 19 | on save: the property order, the Prettier formatting (never disabled); warning = a choice to justify (disabled for one line, with a reason). Notations are free. Values and units: units, lengths, numbers, functions, strings, and rem without decimals. |