An ESLint config that supports 100+ plugins. Every rule of every supported plugin already has a severity, and many of them have options set too. You can change any of that without rewriting the defaults by hand.
- 100+ plugins supported:
Vanilla JS rules,
typescript-eslint, π¦unicorn, βregexp,
node,
vue,
angular,
react and 5 sister plugins,
solid,
tailwind,
css,
yaml and many more. The most commonly used ones are direct dependencies of this package, while the rest are optional peer dependencies;
- Zero configuration by default: exporting
eslintConfig()from youreslint.config.tsis enough to get started. Configs for the frameworks and tools you use are enabled automatically; you only need to install the respective plugins; - Strictly typed: every option and every rule name is covered by TypeScript types;
- Well documented: every config and all of its options are documented with JSDoc, available right in your editor;
- Respects your
.gitignore: files listed in.gitignore, including nested ones, are excluded from linting by default; - Works great with Prettier and oxfmt: conflicting rules are automatically disabled if you use any of them;
- Rename plugin prefixes if you want to; many of them are shortened by default;
- Bring your own plugins and their rules will also be typed as much as possible.
-
Changing one option of a rule usually means repeating all the others. Here you get the severity and the options this config has already set, so you only write what you want to change:
overrides: { 'import/order': (severity, options) => [severity, {...options?.[0], 'newlines-between': 'always'}], },
-
Rule options are not always convenient to write. Configs come with options of their own which are often simpler and can cover several rules at once: one
jestoption sets up all thejest/padding-around-*rules. -
A rule whose autofix you don't trust has to be turned off entirely. ESLint has no way to turn off the autofix of a single rule, so this config does it for you, either for a rule as a whole or per file. Autofixes that are known to be unsafe are already disabled by default, and you can turn them back on.
-
Limiting a rule to certain files means writing another config block. Every rule entry accepts its own
filesandignores. -
Rules requiring type information need a config and a parser of their own. Every such rule is moved into a separate config for TypeScript files, with the parser set up.
Minimum supported versions:
- Node.js:
^22.23.1 || ^24.18.0 || >=26.4.0 - ESLint (peer dependency):
^10
npm i -D eslint-config-un eslint@latest
pnpm i -D eslint-config-un eslint@latest
yarn add -D eslint-config-un eslint@latestCommonly used plugins are direct dependencies of this package, so you don't need to install them separately. We aim to update these dependencies within a month of their release.
Many plugins (usually the framework or library specific ones) are optional peer dependencies, which means you have to install them yourself once a config that needs them is enabled. Run ESLint with this config to see which plugins are missing, and repeat until it gets past the loading stage and starts linting.
You can always replace a plugin's implementation with the plugins.<pluginName>.plugin option or with your package manager's overrides.
In your eslint.config.ts:
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
// ... optional configuration ...
});Note
We strongly recommend a TypeScript config file.
If you stay with JavaScript, add the @ts-check directive at the start of the file instead.
eslint-config-un is built around Configs and Sub-configs (both are called Configs in this section). They are similar to ESLint flat config objects, but with a few useful extensions. Every Config is usually tied to one or more ESLint plugins, and produces one or more ESLint flat config items.
You can enable any Config by setting it to true or an object with the Config's options.
A Config can also be set to a string, which is a shorthand for its files with only this pattern: node: 'backend/**' is the same as node: {files: ['backend/**']}.
Passing false disables the Config.
Passing an empty array to files disables the Config, but not its Sub-configs.
A Sub-config is a Config located within another Config's options.
If the parent Config is disabled by passing false, all its Sub-configs are disabled too.
Once every flat config is built, eslint-config-un loads only the plugins that are actually used, unless the loadPluginsOnDemand option is set to false.
A Config has the following interface (the real types are simplified here for readability):
type Severity = 0 | 1 | 2 | 'off' | 'warn' | 'error';
type RuleOptions = {/* ... pre-generated options of all rules, each being an array */};
type UnRuleEntry<RuleName extends string> =
| Severity
| [Severity, ...RuleOptions[RuleName]]
| {
severity: Severity;
options?: RuleOptions[RuleName];
disableAutofix?: boolean;
files?: string[];
ignores?: string[];
};
type UnConfig =
| boolean
| string // Same as `{files: [string]}`
| {
files?: string[] | ((params: {filesDefault: string[]}) => string[] | undefined);
ignores?:
| string[]
| ((params: {ignoresDefault: string[]; ignoresImplicit: string[]}) => string[] | undefined);
[OverridesType in ('overrides' | 'overridesAny')]?: {
[RuleName in string]:
| UnRuleEntry<RuleName>
| ((
// The severity and options eslint-config-un has set for this rule.
// The severity is 0 if the rule is not configured by this config at all
unRuleSeverity: 0 | 1 | 2,
unRuleOptions?: RuleOptions[RuleName],
) => UnRuleEntry<RuleName>);
};
forceSeverity?: 2 | 'error' | 1 | 'warn';
[`config${string}`]: UnConfig; // These are Sub-configs
[customOptions: string]: unknown; // Custom options, individual for each Config
};They mean exactly the same as the matching ESLint flat config item properties, except for how an empty array [] is treated:
- An empty array for
filesdisables the Config, but leaves its Sub-configs alone. - An empty array for
ignoresdrops the default ignore list.
Both options also accept a function.
It is called with the patterns the option would have resolved to if it were not passed, and the patterns it returns completely replace them, unless it returns undefined.
This is handy for configs like import/allowDefaultExport, where you usually want to add your own patterns to the list of files export default is allowed in, rather than replace it.
These are similar to ESLint's rules, with one important addition: instead of a rule entry you can pass a function, which is called with the severity and options eslint-config-un has set for that rule.
This lets you change a single option or the severity without repeating the rest.
overridesAnyaccepts any rule name, whileoverridesonly accepts the rules tied to this config. The difference is purely a TypeScript one: at runtime both accept any rule.overridesAnyis applied afteroverrides.
Sub-configs are the same as Configs, but live in another Config's options.
Every Sub-config is an option whose name starts with config, such as configPinia in the vue config.
Sets the severity of every rule this Config configures, including the rules it turns off.
Rules set through overrides or overridesAny keep the severity you gave them.
Custom options differ from Config to Config and are documented with JSDoc.
Normal ESLint severity and rule options.
Applies a copy of the rule with the disable-autofix/ prefix and all autofixes disabled.
Limit the files this one rule applies to. They only work if:
- at least one of
filesorignoresis provided and is not empty; filesof the current Config is not an empty array.
When both conditions hold, a separate flat config item is created with:
name: the current Config's name plus a/@rule/<rule name with its prefix>suffix;files: the ones given here, intersected with the Config'sfilesif the Config has any;ignores: the Config's ones plus the ones given here.
In the following tables, Sub-configs have / in their names.
Configs mentioning misc-enabled in the second column are disabled by default and can all be enabled at once by setting the defaultConfigsStatus option to that value.
Note
Many configs are enabled automatically when your project uses a certain package. Read more about how that is checked below.
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
js |
β | Vanilla ESLint rules | - |
ts |
β
(typescript is installed) |
typescript-eslint (ts) |
Only rules not requiring type information |
ts/typeAware |
β | ^ | Only rules requiring type information |
ts/disableNoUnsafe |
β | ^ | Disables all the no-unsafe-* rules |
ts/sortTsconfigKeys |
β | - | Sorts top-level and compilerOptions keys in tsconfig files |
π¦ unicorn |
β | eslint-plugin-unicorn (unicorn) |
- |
π¦ unicorn/anyLanguage |
β | ^ | Rules the plugin declares as supporting any file type; applied to all files |
π¦ unicorn/css |
β
(css config is enabled) |
^ | Applies the CSS-supporting rules to .css files |
π¦ unicorn/html |
β
(html config is enabled) |
^ | Applies the HTML-supporting rules to .htm(l) files |
π¦ unicorn/json |
β
(json or jsonc config is enabled) |
^ | Applies the JSON-supporting rules to .json, .jsonc and .json5 files |
π¦ unicorn/markdown |
β
(any of markdown* configs are enabled) |
^ | Applies the Markdown-supporting rules to .md and .mdx files |
π¦ unicorn/soml |
β
(soml config is enabled) |
^ | Applies the SOML-supporting rules to .soml files |
π¦ unicorn/toml |
β
(toml config is enabled) |
^ | Applies the TOML-supporting rules to .toml files |
π¦ unicorn/yaml |
β
(yaml config is enabled) |
^ | Applies the YAML-supporting rules to .y(a)ml files |
β regexp |
β | eslint-plugin-regexp (regexp) |
- |
promise |
β | eslint-plugin-promise (promise) |
- |
import |
β | eslint-plugin-import-x (import) |
- |
import/allowDefaultExport |
β | - | Since v1.0.0 Config that allows default exports in config files, dotfiles and Storybook stories |
sonar |
β
(if misc-enabled) |
eslint-plugin-sonarjs (sonar) |
- |
eslintComments |
β | @eslint-community/eslint-plugin-eslint-comments (eslint-comments) |
Since v0.1.3 |
jsdoc |
β | eslint-plugin-jsdoc (jsdoc) |
Since v0.3.1 |
jsdoc/typescript |
β
(ts config is enabled) |
- | Config for enabling and disabling certain rules for TypeScript files |
tsdoc |
β | eslint-plugin-tsdoc (tsdoc) |
- |
stylistic |
β | @stylistic/eslint-plugin (stylistic) |
Since v1.0.0 Only a small number of rules are enabled by default |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
vue |
β
(vue is installed) |
eslint-plugin-vue (vue) |
- |
vue/a11y |
β | eslint-plugin-vuejs-accessibility (vuejs-accessibility) |
- |
vue/nuxt |
β
(nuxt is installed) |
@nuxt/eslint-plugin (nuxt) |
Since v1.0.0 |
vue/nuxt/nuxtConfig |
β | @nuxt/eslint-plugin (nuxt) |
Rules related to Nuxt config file Since v1.0.0 |
vue/pinia |
β
(pinia is installed) |
eslint-plugin-pinia (pinia) |
- |
vue/i18n |
β
(vue-i18n is installed) |
@intlify/eslint-plugin-vue-i18n (vue-i18n) |
Since v1.0.0vue-i18n specific rules |
vue/scopedCss |
β | eslint-plugin-vue-scoped-css (vue-scoped-css) |
Since v1.0.0 |
vue/enforceTypescriptInScriptSection |
β
(ts config is enabled) |
eslint-plugin-vue (vue) |
Since v1.0.0 Enforces lang="ts" in <script> sections via vue/block-lang |
angular |
β
(@angular/core is installed) |
@angular-eslint/eslint-plugin (angular) |
Since v0.7.0 |
angular/template |
β | @angular-eslint/eslint-plugin-template (angular-template) |
- |
angular/template/html |
β (Angular version >=18) | @html-eslint/eslint-plugin-angular-template (html-angular) |
Since v1.0.0 |
ngrx |
β
(@ngrx/store is installed) |
@ngrx/eslint-plugin (ngrx) |
Since v1.0.0 |
rxAngular |
β
(@rx-angular/{cdk,state,template} is installed) |
@rx-angular/eslint-plugin (rx-angular) |
Since v1.0.0 |
react |
β
(react is installed) |
eslint-plugin-react (react) |
Since v0.8.0 |
react/reactX |
β | @eslint-react/eslint-plugin (eslint-react) |
- |
react/reactX/typeAwareRules |
β
(ts config is enabled) |
@eslint-react/eslint-plugin (eslint-react) |
Since v1.0.0 Type-aware rules from @eslint-react/eslint-plugin |
react/hooks |
β | eslint-plugin-react-hooks (react-hooks)@eslint-react/eslint-plugin (eslint-react) |
Includes rules with @eslint-react/hooks-extra prefix from @eslint-react/eslint-plugin |
react/dom |
β
(react-dom is installed) |
@eslint-react/eslint-plugin (eslint-react)eslint-plugin-react |
Includes rules with @eslint-react/dom prefix from @eslint-react/eslint-plugin and DOM related rules from eslint-plugin-react |
react/refresh |
β | eslint-plugin-react-refresh (react-refresh) |
- |
react/youMightNotNeedAnEffect |
β | eslint-plugin-react-you-might-not-need-an-effect (react-you-might-not-need-an-effect) |
Since v1.0.0 |
react/html |
β | @html-eslint/eslint-plugin-react (html-react) |
Since v1.0.0 |
react/allowDefaultExportsInJsxFiles |
β | - | Config that allows default exports in all JSX files |
reactDoctor |
β | eslint-plugin-react-doctor (react-doctor) |
Since v1.0.0 Has copies of about 100 rules of the jsxA11y and react configs, so with them on, some problems are reported twice |
reactDoctor/nextJs |
β
(next is installed) |
^ | Since v1.0.0 |
reactDoctor/reactNative |
β
(react-native or expo is installed) |
^ | Since v1.0.0 |
reactDoctor/tanstackStart |
β
(@tanstack/react-start is installed) |
^ | Since v1.0.0 |
reactDoctor/tanstackQuery |
β
(@tanstack/query-core is installed) |
^ | Since v1.0.0 |
reactDoctor/preact |
β
(preact is installed) |
^ | Since v1.0.0 |
nextJs |
β
(next is installed) |
@next/eslint-plugin-next (nextjs) |
Since v0.9.0 |
expo |
β
(expo is installed) |
eslint-plugin-expo (expo) |
Since v1.0.0 |
solid |
β
(solid-js is installed) |
eslint-plugin-solid (solid) |
Since v0.10.0 |
qwik |
β
(@builder.io/qwik or @qwik.dev/core is installed) |
eslint-plugin-qwik (qwik) |
Since v0.6.0 |
tsrx |
β
(@tsrx/core or ripple is installed) |
@tsrx/eslint-plugin (tsrx) |
Since v1.0.0 |
astro |
β
(astro is installed) |
eslint-plugin-astro (astro) |
Since v0.9.0 Without A11Y rules |
astro/jsxA11y |
β
(eslint-plugin-jsx-a11y(-x) can be loaded) |
^ | Only A11Y rules from eslint-plugin-astro |
svelte |
β
(svelte is installed) |
eslint-plugin-svelte (svelte) |
Since v0.10.0 |
svelte/enforceTypescriptInScriptSection |
β
(ts config is enabled) |
^ | Since v1.0.0 Enforces lang="ts" in <script> blocks via svelte/block-lang |
svelte/html |
β | @html-eslint/eslint-plugin-svelte (html-svelte) |
Since v1.0.0 |
svelte/kitAppTemplate |
β
(@sveltejs/kit is installed, html is enabled) |
- | Since v1.0.0 Disables the rules that wrongly report the SvelteKit app template, src/app.html |
ember |
β
(ember-source is installed) |
eslint-plugin-ember (ember) |
Since v1.0.0 |
ember/testFiles |
β | ^ | Since v1.0.0 |
ember/testFiles/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
lit |
β
(lit is installed) |
eslint-plugin-lit (lit) |
Since v1.0.0 |
lit/a11y |
β | eslint-plugin-lit-a11y (lit-a11y) |
Since v1.0.0 |
betterTailwind |
β
(tailwindcss is installed) |
eslint-plugin-better-tailwindcss (better-tailwindcss) |
Since v1.0.0 Supports Tailwind v4 and v3 |
betterTailwind/css |
β
(parent config's files is not set) |
^ | Since v1.0.0 Lints Tailwind classes in CSS files |
tailwind |
β | eslint-plugin-tailwindcss (tailwindcss) |
Only supports Tailwind v4 |
nestJs |
β
(@nestjs/core is installed) |
@darraghor/eslint-plugin-nestjs-typed (nestjs) |
Since v1.0.0 |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
node |
β | eslint-plugin-n (node) |
Applies to all files, see the notes |
packageJson |
β | eslint-plugin-package-json (package-json) |
Since v0.1.5 π Supports multiple configs |
nodeDependencies |
β
(if misc-enabled) |
eslint-plugin-node-dependencies (node-dependencies) |
Since v0.10.0 |
depend |
β | eslint-plugin-depend (depend) |
Since v1.0.0 |
pnpm |
β (pnpm is detected as a package manager) | eslint-plugin-pnpm (pnpm) |
Since v0.8.0 Does nothing itself, split into Sub-configs |
pnpm/packageJson |
β | ^ | Plugin rules related to package.json files |
pnpm/pnpmWorkspace |
β | ^ | Plugin rules related to pnpm-workspace.yaml file |
cloudfrontFunctions |
β | - | Since v0.10.0 For linting Amazon CloudFront Functions written for JavaScript Runtime v2 |
cloudfrontFunctions/v1 |
β | - | Same, but for JavaScript Runtime v1 functions |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
markdown |
β | @eslint/markdown (markdown) |
Since v0.2.0 Configured to also lint fenced code blocks inside .md files |
markdown/changesets |
β
(@changesets/cli is installed) |
^ | Since v1.0.0 Turns off the rules that misjudge changesets |
markdown/codeBlocks |
β | ^ | Since v1.0.0 Lints fenced code blocks inside Markdown files |
markdown/sentencesPerLine |
β | eslint-plugin-sentences-per-line (sentences-per-line) |
Since v1.0.0 |
markdownPreferences |
β | eslint-plugin-markdown-preferences (markdown-preferences) |
Since v1.0.0 |
markdownLinks |
β | eslint-plugin-markdown-links (markdown-links) |
Since v1.0.0 |
mdx |
β | eslint-plugin-mdx (mdx) |
Since v1.0.0 Configured to also lint fenced code blocks inside .mdx files |
mdx/codeBlocks |
β | ^ | Since v1.0.0 Lints fenced code blocks inside MDX files |
css |
β
(unless stylelint is installed) |
@eslint/css (css) |
Since v0.7.0 |
css/scss |
β (a Sass compiler is installed) | ^ | Lints .scss files using @humanwhocodes/scsstree, an optional peer dependency |
css/unicorn |
β | eslint-cssicorn (cssicorn) |
CSS rules from the author of eslint-plugin-unicorn; some of them were moved there from it |
cssInJs |
β | eslint-plugin-css (css-in-js) |
Since v0.2.0 Lints inlined CSS |
jsxA11y |
β | eslint-plugin-jsx-a11y-x (jsx-a11y) |
Since v1.0.0 Since v0.8.0 and until v1.0.0, eslint-plugin-jsx-a11y was used |
yaml |
β
(if misc-enabled) |
eslint-plugin-yml (yaml) |
Since v0.1.0 |
json |
β | @eslint/json (json) |
Since v1.0.0 Lints JSON, JSONC and JSON5 via the official plugin |
json/jsonc |
β | ^ | Lints .jsonc files; enabled by default when json is enabled |
json/json5 |
β | ^ | Lints .json5 files; enabled by default when json is enabled |
jsonc |
β
(if misc-enabled) |
eslint-plugin-jsonc (jsonc) |
Since v0.1.4 Supports JSON, JSON5, JSONC |
jsonc/json |
β | ^ | Config exclusively for .json files, does nothing by default |
jsonc/jsonc |
β | ^ | Config exclusively for .jsonc files, does nothing by default |
jsonc/json5 |
β | ^ | Config exclusively for .json5 files, does nothing by default |
jsonSchemaValidator |
β
(if misc-enabled) |
eslint-plugin-json-schema-validator (json-schema-validator) |
Since v0.6.0 |
jsonSchemaValidator/{json,yaml,toml} |
β | ^ | Since v1.0.0 |
toml |
β
(if misc-enabled) |
eslint-plugin-toml (toml) |
Since v0.1.3 |
soml |
β
(soml-lang is installed) |
eslint-soml (soml) |
Since v1.0.0 Lints SOML files |
mermaid |
β
(mermaid is installed) |
@mmd-toolkit/eslint-plugin (mermaid) |
Since v1.0.0 Lints Mermaid diagrams, including Markdown and MDX code blocks |
postgresql |
β (a PostgreSQL client is installed) | eslint-plugin-postgresql (postgresql) |
Since v1.0.0 Lints PostgreSQL .sql files, including Markdown and MDX code blocks |
postgresql/embeddedSql |
β | ^ | Since v1.0.0 Lints SQL in tagged template literals in JS/TS files |
html |
β
(unless angular config is enabled) |
@html-eslint/eslint-plugin (html) |
Since v0.10.0 |
graphql |
β
(graphql@>=16 is installed) |
@graphql-eslint/eslint-plugin (graphql) |
Since v1.0.0 |
graphql/jsProcessor |
β | ^ | Since v1.0.0 Runs the GraphQL processor on JS/TS files |
civet |
β
(@danielx/civet is installed) |
eslint-plugin-civet (civet) |
Since v1.0.0 Lints .civet files by compiling them to TypeScript/JavaScript first |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
security |
β
(if misc-enabled) |
eslint-plugin-security (security) |
- |
unusedImports |
β | eslint-plugin-unused-imports (unused-imports) |
Since v0.7.0 |
unusedImports/noUnusedVars |
β | ^ | Disables no-unused-vars, ts/no-unused-vars and sonar/no-unused-vars rules in favor of unused-imports/no-unused-vars |
preferArrowFunctions |
β | eslint-plugin-prefer-arrow-functions (prefer-arrow-functions) |
Since v0.1.0 |
perfectionist |
β | eslint-plugin-perfectionist (perfectionist) |
Since v0.4.0 Supports sub-configs for each rule from the plugin since v1.0.0 |
perfectionist/sort* |
β | ^ | Since v1.0.0 One sub-config per sort-* rule (e.g. sortObjects), all off by default. See Perfectionist |
deMorgan |
β | eslint-plugin-de-morgan (de-morgan) |
Since v0.5.0 |
es |
β | eslint-plugin-es-x (es) |
Since v0.10.0 |
htmlScripts |
β | Built-in eslint-plugin-un-html-scripts (html-scripts) |
Since v0.10.0 For linting inlined JS in HTML files. See HTML |
math |
β | eslint-plugin-math (math) |
Since v1.0.0 |
erasableSyntaxOnly |
β | eslint-plugin-erasable-syntax-only (erasable-syntax-only) |
Since v1.0.0 |
unnecessaryAbstractions |
β | eslint-plugin-unnecessary-abstractions (unnecessary-abstractions) |
Since v1.0.0 |
importIntegrity |
β | import-integrity-lint (import-integrity) |
Since v1.0.0 Faster eslint-plugin-import(-x) semi-alternative |
moduleInterop |
β | eslint-plugin-module-interop (module-interop) |
Since v1.0.0 |
treeShaking |
β | eslint-plugin-tree-shaking (tree-shaking) |
Since v1.0.0 |
e18e |
β
(if misc-enabled) |
@e18e/eslint-plugin (e18e) |
Since v1.0.0 |
e18e/modernization |
β | ^ | |
e18e/moduleReplacements |
β | ^ | |
e18e/performanceImprovements |
β | ^ | |
barrelFiles |
β | eslint-plugin-barrel-files (barrel-files) |
Since v1.0.0 |
arrowReturnStyle |
β | eslint-plugin-arrow-return-style-x (arrow-return-style) |
Since v1.0.0 |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
jest |
β
(jest is installed) |
eslint-plugin-jest (jest) |
Since v0.3.0 |
jest/jestExtended |
β
(jest-extended is installed) |
eslint-plugin-jest-extended (jest-extended) |
- |
jest/typescript |
β
(ts config is enabled) |
eslint-plugin-jest (jest) |
Only TypeScript-specific rules from eslint-plugin-jest |
jest/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
vitest |
β
(vitest is installed) |
@vitest/eslint-plugin (vitest) |
Since v0.3.0 |
vitest/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
jestDom |
β
(@testing-library/jest-dom is installed) |
eslint-plugin-jest-dom (jest-dom) |
Since v1.0.0 |
ava |
β
(ava is installed) |
eslint-plugin-ava (ava) |
Since v1.0.0 |
ava/packageJson |
β | ^ | Since v1.0.0 Rules for package.json files |
ava/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
awsCdk |
β
(aws-cdk-lib is installed) |
eslint-plugin-awscdk (awscdk) |
Since v1.0.0 |
qunit |
β
(qunit is installed) |
eslint-plugin-qunit (qunit) |
Since v1.0.0 |
qunit/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
testingLibrary |
β
(@testing-library/dom is installed) |
eslint-plugin-testing-library (testing-library) |
Since v1.0.0 |
testingLibrary/angular |
β
(angular config is enabled) |
^ | Since v1.0.0 |
testingLibrary/marko |
β
(marko is installed) |
^ | Since v1.0.0 |
testingLibrary/react |
β
(react config is enabled) |
^ | Since v1.0.0 |
testingLibrary/svelte |
β
(svelte config is enabled) |
^ | Since v1.0.0 |
testingLibrary/vue |
β
(vue config is enabled) |
^ | Since v1.0.0 |
testingLibrary/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
testingLibrary/*/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
tanstackQuery |
β
(@tanstack/query-core is installed) |
@tanstack/eslint-plugin-query (tanstack-query) |
Since v1.0.0 |
tanstackRouter |
β
(@tanstack/react-router or @tanstack/solid-router is installed) |
@tanstack/eslint-plugin-router (tanstack-router) |
Since v1.0.0 |
tanstackStart |
β
(@tanstack/react-start or @tanstack/solid-start is installed) |
@tanstack/eslint-plugin-start (tanstack-start) |
Since v1.0.0 |
storybook |
β
(storybook is installed) |
eslint-plugin-storybook (storybook) |
Since v1.0.0 |
cypress |
β
(cypress is installed) |
eslint-plugin-cypress (cypress) |
Since v1.0.0 |
cypress/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
mocha |
β
(mocha is installed) |
eslint-plugin-mocha (mocha) |
Since v1.0.0 |
mocha/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
turbo |
β
(turbo is installed) |
eslint-plugin-turbo (turbo) |
Since v1.0.0 |
playwright |
β
(@playwright/test is installed) |
eslint-plugin-playwright (playwright) |
Since v1.0.0 |
playwright/noOnlyTests |
β | eslint-plugin-no-only-tests (no-only-tests) |
Since v1.0.0 |
youDontNeedLodashUnderscore |
β
(lodash, lodash-es or lodash.* is installed) |
eslint-plugin-you-dont-need-lodash-underscore (you-dont-need-lodash-underscore) |
Since v1.0.0 |
rxjs |
β
(rxjs is installed) |
@smarttools/eslint-plugin-rxjs (rxjs) |
Since v1.0.0 |
nx |
β
(nx is installed) |
@nx/eslint-plugin (nx) |
Since v1.0.0 |
importZod |
β | eslint-plugin-import-zod (import-zod) |
Enforces namespace imports for zod. You should probably use the zod config instead.Since v1.0.0 |
unocss |
β
(unocss is installed) |
@unocss/eslint-plugin (unocss) |
Since v1.0.0 |
vanillaExtract |
β
(@vanilla-extract/css is installed) |
@antebudimir/eslint-plugin-vanilla-extract (vanilla-extract) |
Since v1.0.0 |
pandacss |
β
(@pandacss/dev is installed) |
@pandacss/eslint-plugin (pandacss) |
Since v1.0.0 Requires a Panda CSS config file to exist |
zod |
β
(zod@^3||^4 is installed) |
eslint-plugin-zod (zod) |
Since v1.0.0 |
zod/mini |
β | eslint-plugin-zod-mini (zod-mini) |
Since v1.0.0 Rules for zod/mini |
zod/core |
β | eslint-plugin-zod-core (zod-core) |
Since v1.0.0 Rules for zod/v4/core |
zodOpenapi |
β
(zod-openapi is installed) |
eslint-plugin-zod-openapi (zod-openapi) |
Since v1.0.0 Rules for zod-openapi |
valibot |
β
(valibot@^1 is installed) |
eslint-plugin-valibot (valibot) |
Since v1.0.0 |
formatJs |
β
(@formatjs/icu-messageformat-parser is installed) |
eslint-plugin-formatjs (formatjs) |
Since v1.0.0 |
i18next |
β
(i18next or its React/Next.js/Remix/Vue binding is installed) |
eslint-plugin-i18next (i18next) |
Since v1.0.0 |
i18next/vue |
β
(vue config is enabled) |
^ | Since v1.0.0 Rule options adjusted for Vue templates |
docusaurus |
β
(@docusaurus/core is installed) |
@docusaurus/eslint-plugin (docusaurus) |
Since v1.0.0 |
drizzle |
β
(drizzle-orm is installed) |
eslint-plugin-drizzle (drizzle) |
Since v1.0.0 |
mobx |
β
(mobx is installed) |
eslint-plugin-mobx (mobx) |
Since v1.0.0 |
remeda |
β
(remeda is installed) |
eslint-plugin-remeda (remeda) |
Since v1.0.0 |
clsx |
β
(clsx is installed) |
eslint-plugin-clsx (clsx) |
Since v1.0.0 |
unhead |
β
(unhead@>=3.4.3 is installed) |
@unhead/eslint-plugin (unhead) |
Since v1.0.0 |
| Un config name | Enabled by default? (optional condition) |
Primary plugin(s) (default-prefix) |
Description/Notes |
|---|---|---|---|
casePolice |
β | eslint-plugin-case-police (case-police) |
Since v0.9.0 |
noPrettierIncompatibleRules |
β
(prettier or oxfmt is installed) |
- | Since v1.0.0 Disables rules that are unnecessary or conflict with Prettier Replaces eslint-config-prettier |
noStylisticRules |
β | - | Since v1.0.0 Disables most of the stylistic rules Useful when adopting eslint-config-un in an existing project |
noRelativeImportPaths |
β | eslint-plugin-no-relative-import-paths (no-relative-import-paths) |
Since v1.0.0 |
noUnsanitized |
β | eslint-plugin-no-unsanitized (no-unsanitized) |
Since v1.0.0 |
cspell |
β | @cspell/eslint-plugin (cspell) |
Since v1.0.0 |
eslintPlugin |
β | eslint-plugin-eslint-plugin (eslint-plugin) |
Since v1.0.0 For linting ESLint plugins |
eslintPlugin/ruleTests |
β | ^ | Since v1.0.0 Rules for ESLint rule test files |
fileProgress |
β | eslint-plugin-file-progress (file-progress) |
Since v1.0.0 An ESLint plugin that prints file progress |
compat |
β | eslint-plugin-compat (compat) |
Since v1.0.0 |
webComponents |
β | eslint-plugin-wc (wc) |
Since v1.0.0 |
header |
β | eslint-plugin-header (header) |
Since v1.0.0 |
headers |
β | eslint-plugin-headers (headers) |
Since v1.0.0 |
checkFile |
β | eslint-plugin-check-file (check-file) |
Since v1.0.0 |
checkFile/enableCheckFileProcessor |
β | ^ | Since v1.0.0 Applies the check-file processor to the specified files |
boundaries |
β | eslint-plugin-boundaries (boundaries) |
Since v1.0.0 |
noSecrets |
β | eslint-plugin-no-secrets (no-secrets) |
Since v1.0.0 |
noSecrets/json |
β | ^ | Applied only to .json files by default |
expectType |
β | eslint-plugin-expect-type (expect-type) |
Since v1.0.0 |
command |
β | eslint-plugin-command (command) |
Since v1.0.0 |
antfu |
β | eslint-plugin-antfu (antfu) |
Since v1.0.0 Anthony Fu's personal collection of rules |
sql |
β | eslint-plugin-sql (sql) |
Since v1.0.0 |
safeql |
β
(@ts-safeql/sql-tag is installed) |
@ts-safeql/eslint-plugin (safeql) |
Since v1.0.0 Validates raw PostgreSQL queries and infers the TypeScript types of their results |
format |
β | Built-in eslint-plugin-un-format (format) |
Since v1.0.0 π Supports multiple configs |
format/fencedCodeBlocks |
β | ^ | Since v1.0.0 Formats fenced code blocks inside Markdown and MDX files |
lockfile |
β
(if misc-enabled) |
eslint-plugin-lockfile (lockfile) |
Since v1.0.0 |
lockfile/packageJson |
β | ^ | Since v1.0.0 Rules for package.json files |
githubActions |
β
(.github/workflows directory exists) |
eslint-plugin-github-action (github-actions) |
Since v1.0.0 |
functional |
β | eslint-plugin-functional (functional) |
Since v1.0.0 Rules enforcing functional programming patterns |
un |
β | Built-in eslint-plugin-un (un) |
Since v1.0.0 Rules of our own, not present in any other plugin |
cli |
β | - | Since v0.4.2 Allows process.exit() and console methods in bin, scripts and cli directories |
tests |
β | - | Since v1.0.0 Disables mostly performance rules for the well-known test file patterns |
An example:
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
configs: {
// This is a Config
node: {
// By default `node` rules are applied to all files, so let's narrow the file list down
files: ['backend/**'],
},
vue: {
// We're not ready to lint *.vue files yet, but the Sub-config below stays on
files: [],
// This is a Sub-config
configPinia: {
ignores: ['./path/to/pinia/store/with-many-errors.ts'],
},
},
// This config is disabled by default, but passing an options object enables it
perfectionist: {
files: ['src/big-list-of-something.ts'],
overrides: {
'perfectionist/sort-objects': 2,
},
},
// This config is enabled by default, but we don't write JSDoc, so we don't need it
jsdoc: false,
// This one is the opposite: disabled by default, but we want it
security: true,
},
});Pass your own flat configs in the extraConfigs option.
They are placed after all of eslint-config-un's configs, except the last two: the one that disables the rules incompatible with Prettier, and the one that disables the stylistic rules.
This way you always have the final say, and those two can still do their job.
An example:
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
configs: {/* ... */},
extraConfigs: [
{
files: ['src/big-list-of-something.ts'],
rules: {
'perfectionist/sort-objects': 2,
'perfectionist/sort-object-types': 2,
},
},
// More flat configs ...
],
});ESLint plugins are registered under a prefix of your choosing, such as unicorn or vue.
A rule name is then the prefix plus the rule's own name, for example unicorn/no-useless-undefined.
eslint-config-un lets you change the prefix of any registered plugin.
Some plugins are also registered under a different prefix than their own documentation suggests.
To rename those back, or to rename any other plugin, set plugins.<canonical prefix>.prefix to the prefix you want.
| Plugin | Suggested prefix | Our prefix | Reason |
|---|---|---|---|
@angular-eslint/eslint-plugin |
@angular-eslint |
angular |
More concise and convenient to use; @ feels redundant |
@angular-eslint/eslint-plugin-template |
@angular-eslint/template |
angular-template |
Similar reason ^ |
@cspell/eslint-plugin |
@cspell |
cspell |
Similar reason ^ |
@darraghor/eslint-plugin-nestjs-typed |
@darraghor/nestjs-typed |
nestjs |
Similar reason ^ |
@docusaurus/eslint-plugin |
@docusaurus |
docusaurus |
Similar reason ^ |
@eslint-community/eslint-plugin-eslint-comments |
@eslint-community/eslint-comments |
eslint-comments |
Similar reason ^ |
@graphql-eslint/eslint-plugin |
@graphql-eslint |
graphql |
Similar reason ^ |
@html-eslint/eslint-plugin |
@html-eslint |
html |
Similar reason ^ |
@html-eslint/eslint-plugin-angular-template |
@html-eslint/angular-template |
html-angular |
Similar reason ^ |
@html-eslint/eslint-plugin-react |
@html-eslint/react |
html-react |
Similar reason ^ |
@html-eslint/eslint-plugin-svelte |
@html-eslint/svelte |
html-svelte |
Similar reason ^ |
@intlify/eslint-plugin-vue-i18n |
@intlify/vue-i18n |
vue-i18n |
Similar reason ^ |
@ngrx/eslint-plugin |
@ngrx |
ngrx |
Similar reason ^ |
@nx/eslint-plugin |
@nx |
nx |
Similar reason ^ |
@pandacss/eslint-plugin |
@pandacss |
pandacss |
Similar reason ^ |
@rx-angular/eslint-plugin |
@rx-angular |
rx-angular |
Similar reason ^ |
@smarttools/eslint-plugin-rxjs |
@smarttools/rxjs |
rxjs |
Similar reason ^ |
@stylistic/eslint-plugin |
@stylistic |
stylistic |
Similar reason ^ |
@tanstack/eslint-plugin-query |
@tanstack/query |
tanstack-query |
Similar reason ^ |
@tanstack/eslint-plugin-router |
@tanstack/router |
tanstack-router |
Similar reason ^ |
@tanstack/eslint-plugin-start |
@tanstack/start |
tanstack-start |
Similar reason ^ |
@ts-safeql/eslint-plugin |
@ts-safeql |
safeql |
Similar reason ^ |
@unhead/eslint-plugin |
@unhead |
unhead |
Similar reason ^ |
@unocss/eslint-plugin |
@unocss |
unocss |
Similar reason ^ |
typescript-eslint |
@typescript-eslint |
ts |
Similar reason ^ |
eslint-plugin-arrow-return-style-x |
arrow-return-style-x |
arrow-return-style |
A fork meant to replace the original plugin, so it keeps the original prefix |
eslint-plugin-es-x |
es-x |
es |
Similar reason ^ |
eslint-plugin-import-x |
import-x |
import |
Similar reason ^ |
eslint-plugin-jsx-a11y-x |
jsx-a11y-x |
jsx-a11y |
Similar reason ^ |
eslint-plugin-n |
n |
node |
Similar reason ^ |
@next/eslint-plugin-next |
@next/next |
nextjs |
@next/next is redundant; consistent with the framework name |
eslint-plugin-css |
css |
css-in-js |
Conflicts with @eslint/css, and our prefix describes the plugin better |
@mmd-toolkit/eslint-plugin |
@mmd-toolkit |
mermaid |
Consistent with the language name; @mmd-toolkit is the name of the project |
eslint-plugin-yml |
yml |
yaml |
Consistent with the official language name (and eslint-plugin-yaml is far less popular) |
eslint-plugin-github-action |
github-action |
github-actions |
Consistent with the platform name (and eslint-plugin-github-actions looks unmaintained) |
eslint-plugin-sonarjs |
sonarjs |
sonar |
More concise and convenient to use |
@eslint-react/eslint-plugin |
@eslint-react |
eslint-react |
More concise and convenient to use; @ feels redundant; react is already taken by eslint-plugin-react |
Note
Inside overrides, overridesAny and extraConfigs you still write rules with the original prefix, even after a rename.
eslint-config-un renames them for you.
Warning
Rules inside eslint-disable-* comments are not renamed for you: after a rename you have to update those comments yourself.
Any rule of a built-in plugin, except the rules of ESLint itself, can run another implementation under its own name.
Our Configs keep configuring it as usual, and you keep using the same name in overrides and in eslint-disable comments.
Some rules have built-in replacements, and a few of those are on by default.
To change that, or to replace a rule yourself, use plugins.<canonical prefix>.replacements, keyed by the rule names without the prefix:
import {defineRuleReplacements, eslintConfig} from 'eslint-config-un';
export default eslintConfig({
plugins: {
unicorn: {
replacements: {
// Turns a built-in replacement off
'no-array-sort': false,
// The name of any other known rule, written with the canonical prefix
'no-null': 'my-plugin/no-null',
// A rule object
'no-for-loop': myRule,
// A function returning a rule, called only if the plugin is used
'prefer-at': () => import('./rules/prefer-at.js').then((module) => module.default),
// The object form adds some settings to any of the above
'no-nested-ternary': {
rule: 'my-plugin/no-nested-ternary',
traits: {stylistic: true},
dropOptionsSetByConfigs: true,
},
},
},
// `false` turns off every built-in replacement of the plugin
import: {replacements: false},
},
});A function that declares a parameter gets the plugin's own rule, so it can wrap it.
TypeScript can't type that parameter inside eslintConfig(...), so build such an object with defineRuleReplacements first:
const unicornReplacements = defineRuleReplacements('unicorn', {
'no-null': (original) => ({...original, meta: {...original.meta, fixable: undefined}}),
});
export default eslintConfig({plugins: {unicorn: {replacements: unicornReplacements}}});Some things to know:
- A rule given by name is always the rule of its own plugin, even when that rule is replaced itself. Its plugin is loaded when the plugin of the replaced rule is.
- The types of the rule options in
overrides,overridesAnyandextraConfigsfollow the replacement. A rule that declares no options accepts any options, and ignores them. dropOptionsSetByConfigs: truedrops the options our Configs set for the rule, for when the replacement takes different options. The options you set inoverridesandoverridesAnyare always kept.- Our Configs decide what to do with a rule by its traits: whether it is stylistic, requires type information, makes network requests and so on.
A rule given by the name of a built-in plugin rule takes the traits of that rule.
Any other rule keeps the traits of the rule it replaces, except for one: an autofix disabled by default.
That trait belongs to the implementation, so only a function wrapping the original rule keeps it.
traitschanges them in every case. - The replacements that are on by default are not applied to a plugin you provide via
plugins.<pluginName>.plugin, but your own entries anduseImportIntegrityare. The option types don't know about that and assume the built-in replacements are applied. - The autofix settings you set yourself, like
autofixDisabledGloballyForanddisableAutofix, apply to whichever implementation runs under the rule name.
| Rule | Replaced by | On by default | How it differs |
|---|---|---|---|
unicorn/no-array-reverse |
un/no-array-reverse |
Yes | Doesn't ask to copy new arrays that nothing else uses, like the result of .filter(), and reports such copies instead. The unneededCopies option controls that, 'require' works like the original rule |
unicorn/no-array-sort |
un/no-array-sort |
Yes | Same as above |
unicorn/no-array-splice |
un/no-array-splice |
Yes | Reports assigning the result of .toSpliced() back to the variable holding the only reference to its array, instead of reporting .splice(). The unneededCopies: 'require' option makes it work like the original rule |
import/no-cycle |
import-integrity/no-cycle |
No, see useImportIntegrity |
Faster, but doesn't support the options of the original rule, which are ignored |
import/no-named-as-default |
import-integrity/no-named-as-default |
No | Same as above |
import/no-unresolved |
import-integrity/no-unresolved-imports |
No | Same as above |
The un/* rules stay available under their own names too, off by default.
The documentation link of a replaced rule leads here.
ESLint still has no way to disable autofix for a single rule.
This config fills that gap: you can turn a rule's autofix off globally, or only for some files.
In the second case the rule is renamed to disable-autofix/<rule name>, which is the price of doing it per file.
You can disable autofix for any fixable rule globally using the autofixDisabledGloballyFor root option:
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
autofixDisabledGloballyFor: {
rules: {
'ts/array-type': true,
},
},
});Some rules already have their autofix disabled globally by default. The full list is in the JSDoc of this option.
You can also disable the autofixes of every rule of a plugin at once, and then bring some of them back:
autofixDisabledGloballyFor: {
plugins: {
ts: true,
},
rules: {
'ts/array-type': false,
},
},To disable the autofix only for certain files, use the object notation of the rule entry:
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
configs: {
unicorn: {
overrides: {
'unicorn/better-regex': {
severity: 2,
disableAutofix: true,
},
},
},
},
});Under the hood this creates a plugin with the disable-autofix prefix and copies the rule into it.
The copy is named disable-autofix/<rule name> and replaces the <rule name> entry in the resulting config.
Rules requiring type information are enabled by default, and typed linting is not free, so decide for yourself whether to keep them.
Such rules come not only from typescript-eslint but from many other plugins too, and they are all controlled by one root option, typeInfoRules.
Set it to disabled to opt out of typed linting, or use its ignores/allowDefaultProject for TypeScript files that are not part of any tsconfig.json and would otherwise make the project service throw.
Things that are easy to miss:
- turning these rules off does not make linting faster on its own, because as long as the
tsconfig is enabled, the project service is still set up, and that is what takes the time (ts: {parserOptions: {projectService: false}}turns it off); - the
tsconfig'stypeAwaresub-config only covers its own type-aware rules; the rules from the other plugins followtypeInfoRules; - the ESLint config file itself (
eslint.config.ts) and the configs of other tools are often not part of anytsconfig.json, so add them to one, or list them intypeInfoRules.allowDefaultProject; - the project service only reads files named
tsconfig.jsonand the projects they reference, so atsconfig.test.jsoncovering thetestdirectory has to be referenced from atsconfig.json, or be renamed totest/tsconfig.json.
The node config applies to all files, so all your code is treated as Node.js code.
In frontend code, or any other code that does not run in Node.js, this produces false positives, so narrow the config down with files/ignores, or turn it off:
node: {files: ['server/**', 'scripts/**']},Several rules of the node config report based on the range of Node.js versions your code has to support: no-deprecated-api, no-unsupported-features/* and prefer-node-protocol.
If that range is not set anywhere, the plugin falls back to >=16.0.0, so everything added to Node.js after v16 is reported as unsupported.
The recommended way to specify it is the engines.node field of your package.json:
{
"engines": {
"node": "^22.12.0 || >=24"
}
}Other rules read this field too, for example node-dependencies/compat-engines.
It is also the only place we look at when deciding whether to turn off rules that need a certain Node.js version: unicorn/prefer-import-meta-properties (>=20.11) and, if you turn it on, unicorn/prefer-dispose (>=24).
For those we read the package.json closest to the current working directory, not the one closest to each linted file, as the plugin does.
If adding that field is not an option, set the version through the plugins.node.settings root option, which the version-gated rules above do not read:
plugins: {
node: {
settings: {version: '^22.12.0 || >=24'},
},
},The plugin itself looks for the version in this order: the rule's own version option β settings.n β settings.node β engines.node β devEngines.runtime (the entry with name: "node") β >=16.0.0.
import/no-extraneous-dependencies, configured by the extraneousDependenciesCheck option, only reads the package.json closest to the linted file.
In a monorepo this means the dev tooling installed at the root is reported as undeclared inside workspace packages.
The packageDir sub-option lists the directories to read package.json from instead.
Relative paths are resolved against the current working directory, so prefer absolute ones:
import path from 'node:path';
import {eslintConfig} from 'eslint-config-un';
export default eslintConfig({
configs: {
import: {
extraneousDependenciesCheck: {
packageDir: [
import.meta.dirname,
...['api', 'ui'].map((name) => path.join(import.meta.dirname, 'packages', name)),
],
},
},
},
});The dependencies of all the listed package.json files are merged into a single list, so one package importing another's dependency won't be reported.
To avoid that, set the rule per package with extraConfigs instead, each entry scoped by files and listing only the root and that package in packageDir.
We detect the version of the frontend framework you use (Angular, Vue, Svelte and so on) and enable the rules that fit that version. You can always set the version yourself through the config's own option. See the JSDoc of each config for the details.
Generate the types of your framework before linting, like nuxt prepare, astro sync or svelte-kit sync do.
Without them, type-aware rules see much of your code as any.
TypeScript rules are enabled in .vue files when the vue config's enforceTypescriptInScriptSection sub-config is on, which happens automatically when the ts config is enabled.
If some of your .vue files are written in TypeScript and others in JavaScript, use that sub-config's files and ignores to say which are which.
It is not currently possible to pick rules based on the lang attribute of the <script> block itself.
Our un/vue-no-trailing-element-whitespace and un/vue-no-leading-text-whitespace rules check the whitespace at the edges of template elements.
They are off by default, as Prettier and oxfmt add such whitespace unless htmlWhitespaceSensitivity is strict.
Turn them on in overrides.
We support Angular versions 13 to 22, all at once.
Install @angular-eslint/eslint-plugin and @angular-eslint/eslint-plugin-template of the same major version as your Angular.
A higher version will most likely work too, which lets you run rules from newer @angular-eslint/eslint-plugin* releases on an older Angular codebase.
We lint React code with rules from several plugins.
Two of them, @eslint-react/eslint-plugin and eslint-plugin-react, implement a number of the same rules, and the react config's pluginX option decides which implementation wins.
prefer, the default, takes the @eslint-react one; avoid takes the eslint-plugin-react one; only and never drop one of the two plugins entirely.
The JSDoc of that option lists every rule the two plugins both implement.
The htmlScripts config lints each <script> tag of .htm(l) files as a virtual file named after the HTML file: index.html/0_script-0.js for a classic script (one without type="module"), or index.html/1_script-1.mjs for a module one.
GLOB_HTML_SCRIPTS from the globs entrypoint matches all of them, which is handy in extraConfigs.
Every config that lints .js files lints them too, except node (they run in browsers), format (it formats them only as a part of the HTML file) and checkFile.
To parse them with another parser, set it in parserOptions.parser, because replacing parser itself breaks the sharing of global variables between classic scripts, which the html-scripts/scope-sharing rule reports.
To skip scripts, for example ones with template syntax, put <!-- eslint-disable-next-script --> before one, or <!-- eslint-disable --> and <!-- eslint-enable --> around several.
When the markdown/mdx config is enabled (the default), the rules from the other configs are also applied to the code blocks (```lang ... ```) inside Markdown files.
This works because @eslint/markdown and `eslint-mdx` create a virtual file for every code block, with the extension taken from the language after the ``` fence.
Not every rule makes sense there: some are too strict for code that is never executed, and some report problems you cannot fix in a snippet at all, like a missing import.
The rules that throw without type information are disabled there as well, because code blocks never have it.
That is why a number of rules are disabled in code blocks by default; the full list shows up as autocompletion for the markdownCodeBlocksRules.doNotDisable option.
Use the markdownCodeBlocksRules option to decide which rules are disabled and which are not.
Linting of code blocks lives in a sub-config of the markdown/mdx configs, codeBlocks.
Set it to false to stop linting code blocks entirely, narrow its files/ignores to pick which Markdown/MDX files have their blocks linted, or use its overrides/overridesAny to change the rules for code blocks only.
A code block is not linted as a part of the Markdown file.
The processor cuts it out and gives it to ESLint as a separate virtual file, named <Markdown file>/<number>_<name>, where the name defaults to <number>.<extension> (README.md/0_0.js, docs.mdx/1_0.js).
The extension comes from the language of the block (javascript becomes js, and so on), and blocks without a language, as well as skipped ones, are not counted.
This is why an eslint-disable comment placed in the Markdown text does not reach the code inside a block.
What works instead:
-
An HTML comment right before the block (in MDX,
{/* eslint-disable eqeqeq */}, because HTML comments are not valid there). It is not rendered, and the processor moves it inside the virtual file:<!-- eslint-disable eqeqeq --> ```js if (a == b) {} ```Only comments starting with
eslintorglobalare picked up, and they apply to the next block only. Anything between such a comment and the block cancels it, except blank lines and other comments of the same kind.eslint-disable-next-linepoints at the first line of the block, because the comment is inserted above the code. -
An ordinary comment inside the block: works as in any other file, but your readers see it too.
-
<!-- eslint-skip -->right before the block ({/* eslint-skip */}in MDX): the whole next block is not linted at all. -
The config file, if the rule should be off in many blocks:
markdownCodeBlocksRules.additionalDisabledRulesfor every block of every file,overridesof thecodeBlockssub-config for every block of the files that config is applied to, or anextraConfigsentry withfilesmatching the virtual paths, like['**/*.md/**/*.ts']or['docs/**/*.md/**'].
Block numbers change as soon as you add or remove a block, so avoid matching them.
Name the block instead: both @eslint/markdown and eslint-mdx read the name from the opening fence.
```ts filename="example.ts"
const example = 1;
```
Such a block becomes README.md/3_example.ts, so ['**/*.md/**/*_example.ts'] matches it.
Reports you may see:
- Parsing error in a block whose language needs its own parser, like Vue, Svelte or GraphQL.
Blocks are ordinary files for ESLint, so such a language needs a parser set up for its extension, and the
filespatterns do not have to mention Markdown:**/*.vuecoversREADME.md/0_0.vueas well. Such blocks are only linted if a parser is set up for their extension, by an enabled Config or theparsingroot option (parsing: {graphql: true}), so this error means that the parser fails on the block itself; leave it out of linting with theignoresroot option (ignores: ['**/*.md/**/*.graphql']). - Unused eslint-disable directive on the comment before a block.
In Markdown files, the directive is unused in the block, for example because the rule is already disabled in code blocks by default.
The
codeBlockssub-config turns off these reports for the Markdown text itself. In MDX files, the comment is also reported for the MDX text, where it is almost always unused, and the autofix removes it even if the block needs it. Turn this off withlinterOptionsReportUnusedDisableDirectives: {ignores: ['**/*.mdx']}. eslint-comments/disable-enable-pairin MDX files, because they are parsed as code. Add{/* eslint-enable eqeqeq */}after the block.
Two plugins work with Tailwind:
| Package name | Default plugin prefix | Supported Tailwind versions (declared in peerDependencies) |
|---|---|---|
eslint-plugin-better-tailwindcss |
better-tailwindcss |
^3.3.0 || ^4.1.17 |
eslint-plugin-tailwindcss |
tailwindcss |
^4.0.0 |
We recommend the first one: it covers both Tailwind v3 and v4, has more rules, and at the time of writing it is maintained more actively.
Its prefix is long, so if it bothers you, rename it to tailwindcss or tailwind with the plugins.<pluginName>.prefix option.
Even when the perfectionist config is enabled, all of its rules and Sub-configs (there is one Sub-config per rule) are off by default.
To turn them all on, either set every Sub-config to true, or use this shorthand in the perfectionist config:
perfectionist: {
forceSeverity: 'error',
},The noPrettierIncompatibleRules config (enabled by default when prettier or oxfmt is installed) disables rules that are unnecessary or might conflict with Prettier.
Since oxfmt follows Prettier's output, the same rules conflict with it too.
It replaces eslint-config-prettier, which we used before.
The rule list is kept in this package, checked against what Prettier does today, and respects plugin prefix renames.
Rules are grouped by the language Prettier formats. Groups for the languages Prettier can only format through an extra plugin are applied only if one of these packages is installed:
| Group | Applied when |
|---|---|
svelte |
prettier-plugin-svelte is installed |
astro |
prettier-plugin-astro is installed |
toml |
prettier-plugin-toml or oxfmt is installed |
All other groups (js, vue, json, yaml, markdown, html) are always applied.
The languages option forces any group on or off.
oxfmt formats Svelte files only when its svelte option is on, and its config cannot be read to detect that.
If you use it, set languages.svelte to true, as well as the svelte.isPrettierPluginSvelteUsed option (the svelte config warns about it).
noPrettierIncompatibleRules: {
languages: {toml: true, markdown: false},
overrides: {
'stylistic/indent': 'error', // keep this rule on despite Prettier
curly: 'off', // turn off one of the Prettier-related rules we leave enabled
},
overridesAny: {'some-plugin/some-rule': 'off'},
},Type: Record<string, boolean | string | object | [object, ...object[]]>
Enables, disables and configures the individual Configs. See Rules configuration.
Type: object[]
Your own flat configs, with a richer rules option than ESLint's.
See Providing user-defined flat configs.
Type: (string | string[])[]
A list of global files patterns.
When it is not empty, a dedicated flat config entry is created with only these files (no rules and no other keys except name), which tells ESLint that the matched files are meant to be linted.
Use it to avoid the File ignored because no matching configuration was supplied error for files whose extension none of the enabled configs target.
Type: Record<string, boolean | object | object[]>
The single place where every non-JS language is taught how to be parsed.
Every key produces one flat config entry per language dialect the enabled Configs asked for, so markdown may emit both a gfm and a commonmark entry.
The array form merges into those same entries, unless one of its elements specifies files; then each element gets an entry of its own.
Each key accepts:
false: never parse anything as this language. The Configs whose rules target it stop matching any file;true: set the language up even when no enabled Config targets it, using the language's own defaultfiles;- an entry object, or an array of them.
For the object and array forms:
filesdefaults to the union of thefilesof every enabled Config whose rules are written for this language. For a Config that asks for the language but does not lint only its files, the language's own defaults are used instead:parsing.tsrxstays on.tsrxand.ripple, even though thetsrxConfig also lints.jsand.ts;ignoresare added to theignoresof every Config that lints files of this language;dialectcollapses every dialect the enabled Configs asked for into the one you name;languageOptionsis merged with what the Configs contributed for this option,parserincluded: passing your own replaces the parser the dialect would have picked, and that parser is then neither loaded nor assigned. Both win over the defaults of the language itself, such as the Tailwind CSS syntax used for.cssfiles whentailwindcssis installed.
Type: string[] | {files: string[]; override?: boolean}
A list of globally ignored files.
It is merged with our own ignore patterns (also exported as DEFAULT_GLOBAL_IGNORES), unless you use the object notation and set override to true.
Type: Record<string, MaybeFn<MaybePromise<EslintPlugin | TSESLint.FlatConfig.Plugin>>>
Additional ESLint plugins of your own.
Their prefixes, and where possible their rule names, show up in the rules types of the configs.
Like the built-in plugins, they are loaded only if they are used.
Their prefixes must not clash with the built-in ones (like ts or unicorn), nor with the prefixes you set through plugins.<pluginName>.prefix.
Type:
interface RootOptions {
linterOptionsNoInlineConfig?: ValueOrEslintConfigWithValue<boolean>;
linterOptionsReportUnusedDisableDirectives?: ValueOrEslintConfigWithValue<EslintSeverity>;
linterOptionsReportUnusedInlineConfigs?: ValueOrEslintConfigWithValue<EslintSeverity>;
}
type ValueOrEslintConfigWithValue<Value> =
| Value
| MaybeArray<{
ignores?: string[] | undefined;
files?: string[] | undefined;
value?: Value | undefined;
}>;Sets linterOptions.{noInlineConfig,reportUnusedDisableDirectives,reportUnusedInlineConfigs} globally or for certain files only.
An entry with ignores and no value reads as "turn this option off for these paths", so {ignores: ['**/*.mdx']} is enough to silence the option in MDX files.
reportUnusedDisableDirectives does not apply to the text of Markdown files whose code blocks are linted.
For the reason, see Disabling a rule in a code block.
reportUnusedDisableDirectives is also inherited by the rules doing the same job where ESLint does not see the directives itself: vue/comment-directive and svelte/comment-directive.
They can only take a single severity, so only the entries applying to every file are taken into account; off makes them stop reporting unused directives without turning the rules themselves off, as they are what makes the directives work in the first place.
The vue and svelte configs each have a reportUnusedDisableDirectives option taking the same severities, which wins over the inherited one.
Type: 'all-disabled' | 'misc-enabled'
Enables or disables many configs at once:
all-disabled: treat every top-level config as disabled unless you enable it explicitly;misc-enabled: enable the configs markedmisc-enabledin the tables above, all of which are otherwise off by default.
Type: 'app' | 'lib'
The kind of project you are linting: an application (app, the default) or a library (lib).
It affects a handful of rules, listed in the JSDoc of this option.
Type: Exclude<EslintSeverity, 0 | 'off'>
Sets the severity of every rule eslint-config-un configures, including the rules it turns off.
Rules you set yourself through overrides, overridesAny or extraConfigs keep the severity you gave them.
The same option is available per config.
Type: boolean
"Zero warnings tolerance" mode. Disabled by default. When enabled:
- the
warningseverity (1/'warn') is removed from the types of every option that takes a severity:forceSeverity(both root and per-config), thevueandsvelteconfigs'reportUnusedDisableDirectives,overrides/overridesAny,extraConfigsrules and thelinterOptions*options. Using it there is a type error; - every
warningseverity eslint-config-un would otherwise set by default is rewritten toerrorat runtime, including the implicitlinterOptions.reportUnusedDisableDirectivesdefault (which ESLint sets to'warn').
Type: Partial<Record<Exclude<PluginPrefix, ''>, {prefix?: string; plugin?: EslintPlugin | TSESLint.FlatConfig.Plugin; replacements?: boolean | object; settings?: object}>>
Per-plugin options, keyed by the "canonical" plugin prefix.
prefix changes the prefix the plugin is registered under, see Plugin prefixes.
plugin replaces the plugin implementation.
This is useful when you lint the repository of one of the built-in plugins with this config and want to use its development version.
replacements replaces the implementations of single rules, see Replacing rule implementations.
settings are the plugin's shared settings.
They are available only for the plugins that accept settings, and are typed per plugin.
They are applied only when at least one Config using that plugin is enabled, and each Config decides which settings property they end up under (the eslint-plugin-clsx settings, for instance, go to settings.clsxOptions), so check the option's JSDoc.
Some Configs also merge their own values in: react, for example, adds the detected React version.
For example: {plugins: {'eslint-react': {prefix: 'react-x'}, regexp: {settings: {allowedCharacterRanges: 'all'}}}}.
Type: boolean | {alwaysLoad: LoadablePluginPrefix[]}
Controls whether ESLint plugins are loaded only when they are actually used (true by default).
The object notation lets you name the plugins that must always be loaded. That is useful when you enable some of a plugin's rules only through configuration comments.
Type: boolean | {plugins?: Partial<Record<PluginPrefix, boolean>>; rules?: Partial<Record<FixableRuleNames, boolean>>}
See Globally disabling rule autofix.
Type: object (see properties below)
eslint-config-un disables a number of rules in all embedded code blocks (also called "fenced code blocks") inside Markdown and MDX files. This option lets you change which rules those are.
Type: Partial<Record<Exclude<UnExtraPluginsRules<ExtraPlugins> | UnAllRuleNames, CodeBlocksDisabledRules>, boolean>>
More rules to disable in embedded code blocks.
Type: Partial<Record<CodeBlocksDisabledRules, boolean>>
Rules that should stay enabled in embedded code blocks even though we disable them by default.
Type: boolean | {replaceRules?: Partial<Record<ImportPluginReplaceableRules, boolean>>}
Replaces the implementation of a few eslint-plugin-import-x rules with the faster ones from import-integrity-lint.
Disabled by default.
The rule names stay the same, the JSDoc lists which rules can be replaced, and the options of the replaced rules are silently ignored, because the new implementations do not support them.
This option only turns on the built-in replacements of these rules.
plugins.import.replacements wins over it.
The plugin's settings are set through plugins.import-integrity.settings.
Type: 'standalone' | 'splitOnly' | 'asIs' | 'disabled' | { mode?, ignores?: string[] } & ({ allowDefaultProject?: string[] } | { parserOptions? })
Controls how the rules that we know require type information are handled.
By default, every such rule that throws without type information is automatically moved into a separate ESLint config limited to the files that have it: TypeScript files, plus the Astro, Svelte and Vue files the ts config sets up type information for.
The rules that only work partially without type information stay where they are, so they still run on the other files, like plain JavaScript ones.
The mode (the string value, or the mode property) chooses the strategy:
standalone: the split happens, and the parser, includingprojectService, is configured in the generated config. That config only covers TypeScript files, and also gets copies of the rules that only work partially, so that they get type information there. This is the default when thetsconfig is disabled buttypescriptis installed.splitOnly: the split happens, but no parser is configured, because the project service is expected to come from theparsingroot option, which thetsconfig sets up. This is the default when that config is enabled, which is the most common case, or whentypescriptis not installed, since the parser cannot load without it.asIs: no split happens, and the rules stay in their original configs. Making type information available to them is up to you.disabled: no split happens, and every rule that throws without type information is turned off everywhere. Rules that only work partially without type information stay enabled.
Note
The following configs are never split, so for them every mode except disabled behaves like asIs:
ts/type-aware/*,vitest/tsandjest/ts, because they set up type-aware linting themselves;unicorn/css, because CSS files never have type information.
The object notation additionally accepts:
-
ignores: glob patterns excluded from type-aware linting, added to theignoresof every generated config and of the never-split configs above. Useful for TypeScript files that are not part of anytsconfig.json. -
allowDefaultProjectorparserOptions(you cannot pass both): the default parser options for the type-aware linting we set up, which means thestandalonesplit configs and, as a default, thetstype-aware config.allowDefaultProjectis a shortcut forparserOptions.projectService.allowDefaultProject. Thetsconfig has options with the same names, and those win for thetstype-aware config (allowDefaultProject>parserOptions> global).[!NOTE] These two only take effect where a type-aware parser is actually set up: the
standalonesplit configs (so only when the resolvedmodeisstandalone), and the parser of thetstype-aware config whenever that config is enabled, no matter themode. InasIsanddisabledmodes they therefore matter only if thetstype-aware config is enabled, and indisabledthat pairing contradicts itself, since it both turns off the throwing rules and sets up type information for them.
See the JSDoc of this option for more details.
Type: 'widely' | 'newly' | number
The level of Baseline availability every use-baseline rule allows the features to have: widely (the default), newly or a year in which the features became newly available at the latest.
It is passed as the available option to css/use-baseline, html/use-baseline, html-angular/use-baseline, html-react/use-baseline and html-svelte/use-baseline.
Type: Partial<Record<(typeof PACKAGES_TO_GET_INFO_FOR)[number], string>>
eslint-config-un checks whether certain packages are installed, and which version they are, to decide which configs, sub-configs and rules are enabled by default.
The full list of those packages is the PACKAGES_TO_GET_INFO_FOR constant in the source code, and it includes vue, typescript and prettier, among others.
A package declared under a different name, for example with an npm alias like "vue3": "npm:vue@^3.5.0", is found automatically, unless the project also declares it under its canonical name.
Use this option to say which name to look for instead, for example vue3 when the project has both vue and vue3.
Keys are the canonical package names, values are the names the packages are installed under.
Note
This option is not applicable to ESLint plugins: they are loaded by their canonical names.
Use plugins.<pluginName>.plugin to provide a plugin installed under an alias.
Type: boolean | ReadGitignoreOptions
By default, the files git ignores are added to the global ignores list.
The rules are read for the current working directory from every source git reads them from: .gitignore files in it, its subdirectories and its parents up to the repository root, .git/info/exclude, submodules and nested repositories.
Set this option to false to turn that off.
You can also pass an object, which is handed to gitignore-reader-x, the package that does the actual work.
Type: 'ci' | 'editor' | 'default' | ((detected: 'ci' | 'editor' | 'default') => 'ci' | 'editor' | 'default' | null | undefined)
Says where ESLint is being run: in CI, inside an editor, or in neither of those (default).
By default, the environment is detected by the ci-info and is-in-editor packages.
The function form receives the environment resolved so far (the value of the environment variable below if it is valid, the detected one otherwise) and can return a nullish value to keep it.
The environment can also be set through the ESLINT_CONFIG_UN_ENVIRONMENT environment variable, but the value passed to this option wins.
Warning
Use with care and keep the differences between runs as small as you can.
Type: boolean
Turns on "offline mode", which is handy for switching off, temporarily or not, the rules that make network requests, such as markdown-links/no-dead-urls.
It can also be enabled by setting the ESLINT_CONFIG_UN_OFFLINE_MODE environment variable to a non-empty string, but the value passed to this option wins.
Warning
Use with care and keep the differences between runs as small as you can.
Type: boolean
Enables flat config caching.
It is on by default when the resolved environment is editor.
It can also be enabled by setting the ESLINT_CONFIG_UN_CACHE_CONFIGS environment variable to a non-empty string, but the value passed to this option wins.
There are two layers of caching:
- In memory: the cache is kept in a global variable. When that variable survives between runs of the editor's ESLint process, as it does at least in VS Code, it is used instead of the file system cache. This layer is very fast.
- In the file system: the cache is written to
node_modules/.cache/eslint-config-un/config.json. Here caching can fail if the config contains values that cannot be serialized, such as functions.
Either way, the cache is considered fresh for one hour, unless one of these changes:
- the current git revision (
git rev-parse HEAD), or the ignore patterns coming from your.gitignorefiles; - the contents of
package.jsonor of the lockfile, or the package manager itself; - the contents of the ESLint config file;
- the Node.js version;
- the resolved
environmentorofflineMode; - the Nuxt auto-imports data, if your project has any.
All environment variables that affect eslint-config-un start with ESLINT_CONFIG_UN_.
Boolean ones are read through the Boolean constructor, so any non-empty value counts as true, '0' included.
See the cacheConfigs option.
Do not print any warnings to the console.
See the environment option.
Unlike the boolean environment variables, this one only accepts the exact values that option accepts; any other non-empty value is ignored, with a warning.
See the offlineMode option.
The function that builds the config. See Usage.
Returns the rule replacements of a plugin as they are, typed. See Replacing rule implementations.
The default export of the globals package, re-exported.
That package is a direct dependency of eslint-config-un, so you don't have to install it yourself.
A boolean constant telling whether the current process is likely running in CI.
The answer comes from the ci-info package.
Use it to turn rules or features on and off in CI.
Warning
Use with care and keep the differences between runs as small as you can.
A function telling whether the current process is likely running inside an editor.
The answer comes from the is-in-editor package.
Use it to turn rules or features on and off in an editor, usually to make linting faster there.
Warning
Use with care and keep the differences between runs as small as you can.
The default list of global ignores patterns set by eslint-config-un.
See also the ignores option.
The options type for the rules of all built-in plugins, generated by the eslint-typegen package.
Generators for a few rule options that are tedious to write by hand:
forbidImportingFromUtilityLibrariesforno-restricted-imports;forbid$slotsInsideVueTemplatesforvue/no-restricted-syntax.
See the JSDoc of each of them for the details.
Three helpers re-exported from the eslint-no-restricted package, each building an ESLint plugin with a separate rule for every restriction you pass.
Unlike with the no-restricted-* rules, every restriction can then be configured on its own.
Pass the plugin to the extraPlugins option to use it.
See the package documentation for more.
Various globs you may find useful when writing the files or ignores options.
Pass them in the extraConfigs option.
See Providing user-defined flat configs for where they are placed.
Their rules option is richer than ESLint's, as it accepts everything overrides does.
You can also await the eslintConfig() call and then put your own flat configs wherever you like.
The flat config composer from the eslint-flat-config-utils package is a good tool for that.
Some plugins are direct dependencies of this package, but most are optional peer dependencies that you install yourself. eslint-config-un refuses to run when a config needs a plugin that is not installed. Run ESLint with this config once to get the list of the packages you need to add.
There is too much of it to write down, so have a look at the source code instead.
Every config lives in the src/configs directory.
A package counts as installed if it's declared, under any name, in one of these package.json (or deno.json) files and can be resolved from there: the one closest to the current working directory, the ones above it and, in a monorepo root, the ones of the workspace packages.
A few packages also count if a declared package depends on them, like @tanstack/query-core, which comes with @tanstack/react-query (you can see the full list in the source, look for PACKAGES_INSTALLED_THROUGH).
Important
Nuxt and Astro starters don't declare typescript, so the ts config stays disabled and .ts files fail with Parsing error: Unexpected token :.
Add typescript to devDependencies to fix that.
Run ESLint with the DEBUG=eslint-config-un environment variable set to turn on debug output.
The messages are printed by the obug package, an alternative to debug with a compatible API, so see its documentation for what else you can pass there.
You can also inspect the final config with @eslint/config-inspector.
Make sure your Node.js and ESLint versions meet the minimum requirements. Don't migrate to ESLint 10 and to eslint-config-un at the same time: do the ESLint upgrade first.
We recommend doing every step and sub-step below in a separate commit, on a separate git branch. Split a step into several commits where that helps. Before each commit, run your tests, your formatter and any other linters and tools you have, to make sure nothing is broken.
- Dependencies:
- Remove every ESLint-related dev dependency: plugins, parsers,
eslintitself, anything else. This makes sure eslint-config-un resolves the plugin versions it expects, and saves you from other problems that are hard to debug. - Install
eslint-config-unfollowing the installation instructions.
- Remove every ESLint-related dev dependency: plugins, parsers,
- If your config file is a
.jsone, we strongly recommend moving to.ts, or at least adding the@ts-checkdirective to the JavaScript file. For a TypeScript config file, installjitiso that ESLint can read it. - Port your existing config to the closest eslint-config-un equivalent, guided by the JSDoc of the configs and their options.
- Run ESLint for the first time, without
--fix. It may print a list of packages to install. Check whether you actually need those plugins: install the ones you need, and disable the configs that ask for packages you don't want. - Rules in existing ESLint configuration comments may now have a different plugin prefix, most often
tsinstead of@typescript-eslint. Either rename them in the comments, or change the prefixes back with theplugins.<pluginName>.prefixoption. Look forDefinition for rule '<rule name>' was not founderrors.
- Run ESLint for the first time, without
- Do the following two steps in any order:
-
Enable the stylistic rules only, and fix them automatically if you want to, by running ESLint with
--fix --fix-type problem,suggestion,layout. The second flag leaves out thedirectivefix type, which is what stops ESLint from deletingeslint-disablecomments it considers unused:// ... configs: { // ... noStylisticRules: { enableRules: { rules: true, disableAllOtherRules: true, }, }, // ... }, // ...
Note: not every stylistic rule is fixable, and not every autofix is safe to apply blindly, which is why we already disable the autofix of a number of rules by default.
Review the applied fixes carefully, and don't forget the reports that need a manual fix. It may help to do this in two passes: the automatic fixes first, the manual ones after.
-
Set
configs.noStylisticRulestotrueto turn the purely stylistic rules off, and run ESLint with the new config. Don't use--fixhere, because it makes it harder to see what changed, and some autofixes are not safe to apply blindly. Go through the whole report and:- decide which rules to disable, enable or reconfigure;
- decide which
eslint-disablecomments are no longer needed and can go; - if some files are not part of any tsconfig but should still be covered by type-aware rules, list them in
ts.allowDefaultProject. The other way around, list the files that should be left out of type-aware linting ints.configTypeAware.ignores, or setts.configTypeAwaretofalseto turn type-aware linting off entirely; - add
<!-- eslint-skip -->before the fenced code blocks in Markdown files that fail to parse; - deal with anything else that comes up.
-
- Remove the
noStylisticRulesconfig and run ESLint once more, the way you normally would, to confirm everything works as intended.
The config is built every time ESLint starts, and some of the things it is built from are outside of your config file:
- The
environment(CI, an editor or neither): you can switch rules on and off depending on it, and we use it for a few defaults of our own. - The
offlineModeoption: the rules that make network requests are turned off. - The installed packages: a config needs its packages installed, and the detected framework version decides which of its rules are on. An install without dev dependencies changes the result, since a declared package that isn't installed doesn't count.
- The
cacheConfigsoption, on by default in editors: an earlier config is reused for up to an hour, and not every input is part of the cache key.
eslint-disable comments suffer from this the most.
A comment for a rule that is off in the current run is reported as Unused eslint-disable directive, and --fix deletes it.
Many editors run --fix on save, so the report the comment was written for comes back in the next run where the rule is on.
If the plugin is not loaded at all (see loadPluginsOnDemand), you get an error instead: Definition for rule ... was not found.
Keep these differences as small as you can.
Where you do want them, turn the report off in the runs with fewer rules, and add --fix-type problem,suggestion,layout to your --fix commands so they don't delete such comments (editors rarely let you choose the fix types):
import {eslintConfig, isInEditor} from 'eslint-config-un';
export default eslintConfig({
linterOptionsReportUnusedDisableDirectives: isInEditor() ? 0 : 2,
});I'm getting The inferred type of 'default' cannot be named without a reference to './node_modules/eslint-config-un/dist/eslint.mjs'. This is likely not portable. A type annotation is necessary kind of error when exporting the value returned by eslintConfig() in ESLint config file
It means TypeScript compiles that file with the declaration: true flag, but cannot reach a file it needs to infer the type of the returned value.
Here are the possible fixes.
Your ESLint config file may be included in the TypeScript project by mistake.
It may also be included in a composite project, which implies declaration: true.
In that case, exclude the config file from the composite project if you can, and use one of the other fixes if you can't.
Example:
import {defineConfig} from 'eslint/config';
import {eslintConfig} from 'eslint-config-un';
export default defineConfig(await eslintConfig(/* ... */));The heading describes the whole fix. See the TypeScript docs for the details.
ESLint looks up the config file from the directory of each linted file, so a nested eslint.config.* file, like the one of an example project or a fixture, is used for its directory instead of yours.
Ignore such directories in your config, and lint them in a separate run with their own config file if needed, or remove the nested config files.
If you don't want to wait for us to update a dependency, or need a different version of one for any other reason, your package manager's overrides will do the job for every dependency except these three, whose code is inlined into the published package:
| Package name | Reason |
|---|---|
eslint-plugin-file-progress |
Patched by us so that it doesn't leave the terminal cursor hidden or erase the end of ESLint's output |
eslint-plugin-arrow-return-style-x |
Its @typescript-eslint/utils dependency is overridden to a version that works with ESLint 10 |
@eslint-community/eslint-plugin-eslint-comments |
Crashes under Yarn Plug'n'Play otherwise |
eslint-config-un wraps 100+ ESLint plugins and updates them continuously.
To keep major bumps meaningful and rare, we follow standard SemVer with the clarifications below.
Breaking changes (major bump):
- Incompatible changes to the options object accepted by
eslintConfig(): removing or renaming an option, narrowing its type, changing its default value, or adding a required option - Removing or renaming a named export or an entry point (
.,./snippets,./globs) - Changing the default prefix of any built-in plugin (for example,
ymltoyaml) - Raising the minimum ESLint or Node.js version
- A config that was enabled by default becoming disabled by default
- A plugin moving from a direct dependency to an optional peer dependency
- Removing or renaming a rule of the built-in
eslint-plugin-un,eslint-plugin-un-formatoreslint-plugin-un-html-scripts, or changing its default options or schema in an incompatible way
Not breaking:
- Changes in lint output, meaning more or fewer errors and warnings, because this package continuously updates 100+ plugins, many of them optional peer dependencies whose installed version you control
- Third-party plugin updates absorbed in the same release: added rules, removed rules, schema changes and so on
- Changes to the shape of the generated ESLint flat config, such as entry names or the order of rules and configs, which are internal details
- Additive API changes: a widened type, a new optional option, a new named export, a new
eslint-plugin-unrule - Changes to the exported
RuleOptionstype, which is best-effort and informational rather than a stable contract
There is no fixed release cadence for major versions: one goes out when enough breaking changes have accumulated. Non-breaking improvements ship continuously as minor and patch releases of the current stable major.
Andrew Kazakov π» π π‘ π€ π π π§ π§ |
||||||
|
|
||||||
