eslint-config-un 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -185
- package/dist/config-un/cache.mjs +2 -2
- package/dist/config-un/config-utils.mjs +5 -4
- package/dist/config-un/config.mjs +35 -9
- package/dist/config-un/resolve-config-async-data.mjs +4 -4
- package/dist/config-un/shared.d.mts +12 -10
- package/dist/config-un/shared.mjs +2 -1
- package/dist/configs/barrel-files.d.mts +8 -0
- package/dist/configs/barrel-files.mjs +17 -0
- package/dist/configs/clsx.d.mts +23 -0
- package/dist/configs/clsx.mjs +18 -0
- package/dist/configs/css.mjs +1 -1
- package/dist/configs/e18e.d.mts +53 -0
- package/dist/configs/e18e.mjs +65 -0
- package/dist/configs/erasable-syntax-only.mjs +2 -2
- package/dist/configs/eslint-comments.d.mts +1 -1
- package/dist/configs/eslint-comments.mjs +2 -2
- package/dist/configs/expect-type.mjs +2 -2
- package/dist/configs/extra/no-stylistic-rules.d.mts +60 -4
- package/dist/configs/extra/no-stylistic-rules.mjs +55 -3
- package/dist/configs/format.d.mts +31 -0
- package/dist/configs/format.mjs +27 -0
- package/dist/configs/github-actions.d.mts +25 -0
- package/dist/configs/github-actions.mjs +30 -0
- package/dist/configs/html.mjs +4 -4
- package/dist/configs/index.d.mts +100 -2
- package/dist/configs/jest.d.mts +3 -2
- package/dist/configs/jest.mjs +11 -5
- package/dist/configs/js-inline.mjs +3 -3
- package/dist/configs/js.mjs +2 -2
- package/dist/configs/jsdoc.mjs +2 -2
- package/dist/configs/jsx-a11y.mjs +2 -2
- package/dist/configs/lockfile.d.mts +45 -0
- package/dist/configs/lockfile.mjs +28 -0
- package/dist/configs/nest-js.mjs +1 -1
- package/dist/configs/no-secrets.d.mts +5 -2
- package/dist/configs/no-secrets.mjs +2 -0
- package/dist/configs/nx.mjs +2 -2
- package/dist/configs/package-json.d.mts +10 -0
- package/dist/configs/package-json.mjs +5 -4
- package/dist/configs/perfectionist.d.mts +9 -1
- package/dist/configs/perfectionist.mjs +6 -2
- package/dist/configs/react.mjs +4 -4
- package/dist/configs/shared.mjs +2 -2
- package/dist/configs/sql.d.mts +23 -0
- package/dist/configs/sql.mjs +18 -0
- package/dist/configs/stylistic.mjs +2 -2
- package/dist/configs/svelte.d.mts +12 -10
- package/dist/configs/svelte.mjs +8 -9
- package/dist/configs/tanstack-router.d.mts +8 -0
- package/dist/configs/tanstack-router.mjs +17 -0
- package/dist/configs/testing-library.mjs +1 -1
- package/dist/configs/ts.d.mts +1 -1
- package/dist/configs/ts.mjs +24 -36
- package/dist/configs/vitest.mjs +1 -1
- package/dist/configs/vue.d.mts +21 -20
- package/dist/configs/vue.mjs +12 -10
- package/dist/configs/yaml.d.mts +2 -2
- package/dist/configs/yaml.mjs +2 -2
- package/dist/configs/zod.mjs +2 -2
- package/dist/constants.d.mts +60 -2
- package/dist/constants.mjs +50 -20
- package/dist/eslint-rules.gen.mjs +101 -20
- package/dist/eslint-types-fixable-only.gen.d.mts +1 -1
- package/dist/eslint-types-per-plugin.gen.d.mts +1632 -669
- package/dist/eslint-types.gen.d.mts +1589 -659
- package/dist/eslint.d.mts +2 -2
- package/dist/eslint.mjs +8 -12
- package/dist/globs.d.mts +2 -0
- package/dist/globs.mjs +3 -0
- package/dist/index.d.mts +1 -1
- package/dist/loaders/packages.d.mts +5 -4
- package/dist/loaders/parsers.d.mts +2 -0
- package/dist/loaders/parsers.mjs +1 -0
- package/dist/loaders/plugins.d.mts +142 -33
- package/dist/loaders/plugins.mjs +10 -2
- package/dist/loaders/shared.d.mts +2 -0
- package/dist/package.mjs +27 -18
- package/dist/plugin-un/rules/no-typeof-like-comparisons.mjs +1 -1
- package/dist/types.d.mts +1 -0
- package/package.json +126 -63
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Grown out of the personal collection of rules, an ESLint config aspiring to cove
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Every major plugin** is included (100+ in total):
|
|
7
|
+
- **Every major plugin** is included (100+ in total):
|
|
8
8
|
[ Vanilla JS rules](https://eslint.org/docs/latest/rules),
|
|
9
9
|
[![TypeScript] typescript-eslint](https://typescript-eslint.io/rules),
|
|
10
10
|
[🦄unicorn](https://npmjs.com/eslint-plugin-unicorn),
|
|
@@ -42,17 +42,17 @@ pnpm i -D eslint-config-un eslint@latest
|
|
|
42
42
|
yarn add -D eslint-config-un eslint@latest # Yarn Berry only (v2+)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Commonly used plugins are direct dependencies of this package, you don't need to install them separately.
|
|
45
|
+
Commonly used plugins are direct dependencies of this package, you don't need to install them separately.
|
|
46
46
|
We aim to update the dependencies within 1 month after their release.
|
|
47
47
|
You can always override plugins' implementation with [`pluginOverrides` option](#pluginoverrides) or using your package manager's overrides functionality.
|
|
48
48
|
|
|
49
|
-
Certain plugins (usually framework/library specific ones) are optional peer dependencies, which means that you need to install them manually if they are end up being used.
|
|
49
|
+
Certain plugins (usually framework/library specific ones) are optional peer dependencies, which means that you need to install them manually if they are end up being used.
|
|
50
50
|
You need to run ESLint with our config once to find out which plugins should be installed manually.
|
|
51
51
|
|
|
52
52
|
<details>
|
|
53
53
|
<summary>Installation with Yarn Classic (v1)</summary>
|
|
54
54
|
|
|
55
|
-
Yarn Classic (v1) does not support installing packages by npm name that have dependencies referenced by `file:` protocol - which we're using in this package.
|
|
55
|
+
Yarn Classic (v1) does not support installing packages by npm name that have dependencies referenced by `file:` protocol - which we're using in this package.
|
|
56
56
|
It fails with "Tarball is not in network and can not be located in cache" error.
|
|
57
57
|
Installing directly from the tarball does work:
|
|
58
58
|
|
|
@@ -67,59 +67,83 @@ Note that if you're using custom registry, the URL should be changed accordingly
|
|
|
67
67
|
<details>
|
|
68
68
|
<summary>List of optional peer dependencies</summary>
|
|
69
69
|
|
|
70
|
-
| Package name
|
|
71
|
-
|
|
|
72
|
-
| `@angular-eslint/eslint-plugin
|
|
73
|
-
| `@angular-eslint/eslint-plugin`
|
|
74
|
-
| `@cspell/eslint-plugin`
|
|
75
|
-
| `@darraghor/eslint-plugin-nestjs-typed`
|
|
76
|
-
| `@docusaurus/eslint-plugin`
|
|
77
|
-
| `@
|
|
78
|
-
| `@
|
|
79
|
-
| `@
|
|
80
|
-
| `@
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
| `eslint-plugin-
|
|
90
|
-
| `eslint-plugin-
|
|
91
|
-
| `eslint-plugin-
|
|
92
|
-
| `eslint-plugin-
|
|
93
|
-
| `eslint-plugin-
|
|
94
|
-
| `eslint-plugin-
|
|
95
|
-
|
|
|
96
|
-
| `eslint-plugin-
|
|
97
|
-
| `eslint-plugin-
|
|
98
|
-
| `eslint-plugin-
|
|
99
|
-
| `eslint-plugin-
|
|
100
|
-
| `eslint-plugin-
|
|
101
|
-
|
|
|
102
|
-
| `eslint-plugin-
|
|
103
|
-
| `eslint-plugin-
|
|
104
|
-
| `eslint-plugin-
|
|
105
|
-
| `eslint-plugin-
|
|
106
|
-
| `eslint-plugin-
|
|
107
|
-
| `eslint-plugin-
|
|
108
|
-
| `eslint-plugin-
|
|
109
|
-
| `eslint-plugin-
|
|
110
|
-
| `eslint-plugin-
|
|
111
|
-
|
|
|
112
|
-
| `eslint-plugin-
|
|
113
|
-
| `eslint-plugin-
|
|
114
|
-
| `eslint-plugin-
|
|
115
|
-
| `eslint-plugin-
|
|
116
|
-
| `eslint-plugin-
|
|
117
|
-
| `eslint-plugin-
|
|
118
|
-
|
|
|
119
|
-
| `eslint-plugin-
|
|
120
|
-
| `eslint-plugin-
|
|
121
|
-
| `eslint-plugin-
|
|
122
|
-
| `eslint-plugin-
|
|
70
|
+
| Package name | Default plugin prefix |
|
|
71
|
+
| -------------------------------------------------- | ------------------------------------ |
|
|
72
|
+
| `@angular-eslint/eslint-plugin` | `@angular-eslint` |
|
|
73
|
+
| `@angular-eslint/eslint-plugin-template` | `@angular-eslint/template` |
|
|
74
|
+
| `@cspell/eslint-plugin` | `@cspell` |
|
|
75
|
+
| `@darraghor/eslint-plugin-nestjs-typed` | `nestjs` |
|
|
76
|
+
| `@docusaurus/eslint-plugin` | `docusaurus` |
|
|
77
|
+
| `@e18e/eslint-plugin` | `e18e` |
|
|
78
|
+
| `@eslint-react/eslint-plugin` | `@eslint-react` |
|
|
79
|
+
| `@graphql-eslint/eslint-plugin` | `graphql` |
|
|
80
|
+
| `@intlify/eslint-plugin-vue-i18n` | `@intlify/vue-i18n` |
|
|
81
|
+
| `@next/eslint-plugin-next` | `@next/next` |
|
|
82
|
+
| `@nuxt/eslint-plugin` | `nuxt` |
|
|
83
|
+
| `@nx/eslint-plugin` | `nx` |
|
|
84
|
+
| `@smarttools/eslint-plugin-rxjs` | `rxjs` |
|
|
85
|
+
| `@tanstack/eslint-plugin-query` | `@tanstack/query` |
|
|
86
|
+
| `@tanstack/eslint-plugin-router` | `@tanstack/router` |
|
|
87
|
+
| `@unocss/eslint-plugin` | `@unocss` |
|
|
88
|
+
| `@vitest/eslint-plugin` | `vitest` |
|
|
89
|
+
| `eslint-plugin-antfu` | `antfu` |
|
|
90
|
+
| `eslint-plugin-astro` | `astro` |
|
|
91
|
+
| `eslint-plugin-ava` | `ava` |
|
|
92
|
+
| `eslint-plugin-barrel-files` | `barrel-files` |
|
|
93
|
+
| `eslint-plugin-better-tailwindcss` | `better-tailwindcss` |
|
|
94
|
+
| `eslint-plugin-boundaries` | `boundaries` |
|
|
95
|
+
| `eslint-plugin-case-police` | `case-police` |
|
|
96
|
+
| `eslint-plugin-check-file` | `check-file` |
|
|
97
|
+
| `eslint-plugin-clsx` | `clsx` |
|
|
98
|
+
| `eslint-plugin-command` | `command` |
|
|
99
|
+
| `eslint-plugin-compat` | `compat` |
|
|
100
|
+
| `eslint-plugin-cypress` | `cypress` |
|
|
101
|
+
| `eslint-plugin-de-morgan` | `de-morgan` |
|
|
102
|
+
| `eslint-plugin-ember` | `ember` |
|
|
103
|
+
| `eslint-plugin-erasable-syntax-only` | `erasable-syntax-only` |
|
|
104
|
+
| `eslint-plugin-es-x` | `es` |
|
|
105
|
+
| `eslint-plugin-eslint-plugin` | `eslint-plugin` |
|
|
106
|
+
| `eslint-plugin-expect-type` | `expect-type` |
|
|
107
|
+
| `eslint-plugin-fast-import` | `fast-import` |
|
|
108
|
+
| `eslint-plugin-format` | `format` |
|
|
109
|
+
| `eslint-plugin-formatjs` | `formatjs` |
|
|
110
|
+
| `eslint-plugin-github-action` | `github-actions` |
|
|
111
|
+
| `eslint-plugin-header` | `header` |
|
|
112
|
+
| `eslint-plugin-headers` | `headers` |
|
|
113
|
+
| `eslint-plugin-import-zod` | `import-zod` |
|
|
114
|
+
| `eslint-plugin-jest` | `jest` |
|
|
115
|
+
| `eslint-plugin-jest-dom` | `jest-dom` |
|
|
116
|
+
| `eslint-plugin-jest-extended` | `jest-extended` |
|
|
117
|
+
| `eslint-plugin-lit` | `lit` |
|
|
118
|
+
| `eslint-plugin-lit-a11y` | `lit-a11y` |
|
|
119
|
+
| `eslint-plugin-lockfile` | `lockfile` |
|
|
120
|
+
| `eslint-plugin-mocha` | `mocha` |
|
|
121
|
+
| `eslint-plugin-perfectionist` | `perfectionist` |
|
|
122
|
+
| `eslint-plugin-pinia` | `pinia` |
|
|
123
|
+
| `eslint-plugin-playwright` | `playwright` |
|
|
124
|
+
| `eslint-plugin-prefer-arrow-functions` | `prefer-arrow-functions` |
|
|
125
|
+
| `eslint-plugin-qunit` | `qunit` |
|
|
126
|
+
| `eslint-plugin-qwik` | `qwik` |
|
|
127
|
+
| `eslint-plugin-react` | `react` |
|
|
128
|
+
| `eslint-plugin-react-debug` | `@eslint-react` |
|
|
129
|
+
| `eslint-plugin-react-hooks` | `react-hooks` |
|
|
130
|
+
| `eslint-plugin-react-refresh` | `react-refresh` |
|
|
131
|
+
| `eslint-plugin-react-you-might-not-need-an-effect` | `react-you-might-not-need-an-effect` |
|
|
132
|
+
| `eslint-plugin-sentences-per-line` | `sentences-per-line` |
|
|
133
|
+
| `eslint-plugin-solid` | `solid` |
|
|
134
|
+
| `eslint-plugin-sql` | `sql` |
|
|
135
|
+
| `eslint-plugin-storybook` | `storybook` |
|
|
136
|
+
| `eslint-plugin-svelte` | `svelte` |
|
|
137
|
+
| `eslint-plugin-tailwindcss` | `tailwindcss` |
|
|
138
|
+
| `eslint-plugin-testing-library` | `testing-library` |
|
|
139
|
+
| `eslint-plugin-tree-shaking` | `tree-shaking` |
|
|
140
|
+
| `eslint-plugin-turbo` | `turbo` |
|
|
141
|
+
| `eslint-plugin-vue` | `vue` |
|
|
142
|
+
| `eslint-plugin-vue-scoped-css` | `vue-scoped-css` |
|
|
143
|
+
| `eslint-plugin-vuejs-accessibility` | `vuejs-accessibility` |
|
|
144
|
+
| `eslint-plugin-wc` | `wc` |
|
|
145
|
+
| `eslint-plugin-you-dont-need-lodash-underscore` | `you-dont-need-lodash-underscore` |
|
|
146
|
+
| `eslint-plugin-zod-x` | `zod` |
|
|
123
147
|
|
|
124
148
|
</details>
|
|
125
149
|
|
|
@@ -141,15 +165,15 @@ export default eslintConfig({
|
|
|
141
165
|
<!-- eslint-disable-next-line markdown-preferences/heading-casing -->
|
|
142
166
|
## Configs and Sub-configs
|
|
143
167
|
|
|
144
|
-
eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs.
|
|
168
|
+
eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs.
|
|
145
169
|
They are similar to ESLint flat config objects, but with some useful extensions.
|
|
146
170
|
Every Config is *usually* tied to a one or more ESLint plugins produces one or more ESLint flat config items.
|
|
147
171
|
|
|
148
|
-
You can enable any Config by setting it to `true` or an object with the Config's options.
|
|
149
|
-
Passing `false` disables the Config.
|
|
172
|
+
You can enable any Config by setting it to `true` or an object with the Config's options.
|
|
173
|
+
Passing `false` disables the Config.
|
|
150
174
|
Passing an empty array to `files` disables the Config, but not its' Sub-configs.
|
|
151
175
|
|
|
152
|
-
Sub-config is a Config located within Config's options.
|
|
176
|
+
Sub-config is a Config located within Config's options.
|
|
153
177
|
If the parent config is disabled by passing `false`, all its' Sub-configs are disabled too.
|
|
154
178
|
|
|
155
179
|
After evaluating all the flat configs, eslint-config-un will **load only those plugins that were actually used**, unless `loadPluginsOnDemand` option is set to `false`.
|
|
@@ -209,7 +233,7 @@ These are similar to ESLint's `rules`, but with a very important advantage: you
|
|
|
209
233
|
|
|
210
234
|
#### Sub-configs
|
|
211
235
|
|
|
212
|
-
Sub-configs are the same as Configs, but configured within Config options.
|
|
236
|
+
Sub-configs are the same as Configs, but configured within Config options.
|
|
213
237
|
All Sub-configs use `configXXX` naming convention.
|
|
214
238
|
|
|
215
239
|
#### `forceSeverity`
|
|
@@ -248,23 +272,28 @@ If these conditions are met, a separate Config will be created with:
|
|
|
248
272
|
|
|
249
273
|
In the following table, Sub-configs have `/` in their names.
|
|
250
274
|
|
|
275
|
+
> [!WARNING]
|
|
276
|
+
> You will notice that oftentimes the configs are automatically enabled if certain dependency(-ies) are installed.
|
|
277
|
+
> This check is done by [`import-meta-resolve` package](https://npmjs.com/import-meta-resolve) and might produce false positives.
|
|
278
|
+
> Please [read more about this here](#how-does-exactly-eslint-config-un-knows-if-some-package-is-installed).
|
|
279
|
+
|
|
251
280
|
### Most popular and well known
|
|
252
281
|
|
|
253
|
-
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`)
|
|
254
|
-
| --------------------------------------------------- | ------------------------------------------- |
|
|
255
|
-
|  `js` | ✅ | [Vanilla ESLint rules](https://eslint.org/docs/latest/rules)
|
|
256
|
-
| ![TypeScript] `ts` | ✅ | [typescript-eslint](https://npmjs.com/typescript-eslint) (`ts`)
|
|
257
|
-
| ![TypeScript] `ts/typeAware` | ✅ | ^
|
|
258
|
-
| ![TypeScript] `ts/noTypeAssertion` | ✅ | [eslint-plugin-no-type-assertion](https://npmjs.com/eslint-plugin-no-type-assertion) (`no-type-assertion`)
|
|
259
|
-
| ![TypeScript] `ts/sortTsconfigKeys` | ❌ | -
|
|
260
|
-
| 🦄 `unicorn` | ✅ | [eslint-plugin-unicorn](https://npmjs.com/eslint-plugin-unicorn) (`unicorn`)
|
|
261
|
-
| ⭐ `regexp` | ✅ | [eslint-plugin-regexp](https://npmjs.com/eslint-plugin-regexp) (`regexp`)
|
|
262
|
-
| `promise` | ✅ | [eslint-plugin-promise](https://npmjs.com/eslint-plugin-promise) (`promise`)
|
|
263
|
-
| `import` | ✅ | [eslint-plugin-import-x] (`import`)
|
|
264
|
-
| `sonarjs` | ✅ | [eslint-plugin-sonarjs](https://npmjs.com/eslint-plugin-sonarjs) (`sonarjs`)
|
|
265
|
-
| `eslintComments` | ✅ | [@eslint-community/eslint-plugin-eslint-comments](https://npmjs.com/@eslint-community/eslint-plugin-eslint-comments) (
|
|
266
|
-
| `jsdoc` | ✅ | [eslint-plugin-jsdoc](https://npmjs.com/eslint-plugin-jsdoc) (`jsdoc`)
|
|
267
|
-
| `jsdoc/typescript` | ✅ (`ts` config is enabled) | -
|
|
282
|
+
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`) | Description/Notes |
|
|
283
|
+
| --------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
284
|
+
|  `js` | ✅ | [Vanilla ESLint rules](https://eslint.org/docs/latest/rules) | - |
|
|
285
|
+
| ![TypeScript] `ts` | ✅ | [typescript-eslint](https://npmjs.com/typescript-eslint) (`ts`) | Only rules **not** requiring type information. |
|
|
286
|
+
| ![TypeScript] `ts/typeAware` | ✅ | ^ | Only rules requiring type information. |
|
|
287
|
+
| ![TypeScript] `ts/noTypeAssertion` | ✅ | [eslint-plugin-no-type-assertion](https://npmjs.com/eslint-plugin-no-type-assertion) (`no-type-assertion`) | - |
|
|
288
|
+
| ![TypeScript] `ts/sortTsconfigKeys` | ❌ | - | Sort type-level and `compilerOptions` keys in tsconfig files. |
|
|
289
|
+
| 🦄 `unicorn` | ✅ | [eslint-plugin-unicorn](https://npmjs.com/eslint-plugin-unicorn) (`unicorn`) | - |
|
|
290
|
+
| ⭐ `regexp` | ✅ | [eslint-plugin-regexp](https://npmjs.com/eslint-plugin-regexp) (`regexp`) | - |
|
|
291
|
+
| `promise` | ✅ | [eslint-plugin-promise](https://npmjs.com/eslint-plugin-promise) (`promise`) | - |
|
|
292
|
+
| `import` | ✅ | [eslint-plugin-import-x] (`import`) | - |
|
|
293
|
+
| `sonarjs` | ✅ | [eslint-plugin-sonarjs](https://npmjs.com/eslint-plugin-sonarjs) (`sonarjs`) | - |
|
|
294
|
+
| `eslintComments` | ✅ | [@eslint-community/eslint-plugin-eslint-comments](https://npmjs.com/@eslint-community/eslint-plugin-eslint-comments) (`eslint-comments`) | Since v0.1.3 |
|
|
295
|
+
| `jsdoc` | ✅ | [eslint-plugin-jsdoc](https://npmjs.com/eslint-plugin-jsdoc) (`jsdoc`) | Since v0.3.1 |
|
|
296
|
+
| `jsdoc/typescript` | ✅ (`ts` config is enabled) | - | Config for disabling or disabling certain rules for TypeScript files |
|
|
268
297
|
|
|
269
298
|
### Web frameworks & related
|
|
270
299
|
|
|
@@ -338,63 +367,71 @@ In the following table, Sub-configs have `/` in their names.
|
|
|
338
367
|
|
|
339
368
|
### Js/ts - miscellaneous
|
|
340
369
|
|
|
341
|
-
| Un config name
|
|
342
|
-
|
|
|
343
|
-
| `security`
|
|
344
|
-
| `unusedImports`
|
|
345
|
-
| `unusedImports/noUnusedVars`
|
|
346
|
-
| `preferArrowFunctions`
|
|
347
|
-
| `perfectionist`
|
|
348
|
-
| `deMorgan`
|
|
349
|
-
| `es`
|
|
350
|
-
| `jsInline`
|
|
351
|
-
| `math`
|
|
352
|
-
| `erasableSyntaxOnly`
|
|
353
|
-
| `noUnnecessaryAbstractions`
|
|
354
|
-
| `fastImport`
|
|
355
|
-
| `moduleInterop`
|
|
356
|
-
| `treeShaking`
|
|
370
|
+
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`) | Description/Notes |
|
|
371
|
+
| ----------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
372
|
+
| `security` | ❌ | [eslint-plugin-security](https://npmjs.com/eslint-plugin-security) (`security`) | - |
|
|
373
|
+
| `unusedImports` | ❌ | [eslint-plugin-unused-imports](https://npmjs.com/eslint-plugin-unused-imports) (`unused-imports`) | Since v0.7.0 |
|
|
374
|
+
| `unusedImports/noUnusedVars` | ❌ | ^ | Disables [`no-unused-vars`](https://eslint.org/docs/latest/rules/no-unused-vars), [`ts/no-unused-vars`](https://typescript-eslint.io/rules/no-unused-vars) and [`sonarjs/no-unused-vars`](https://sonarsource.github.io/rspec/#/rspec/S1481/javascript) rules in favor of `unused-imports/no-unused-vars` |
|
|
375
|
+
| `preferArrowFunctions` | ❌ | [eslint-plugin-prefer-arrow-functions](https://npmjs.com/eslint-plugin-prefer-arrow-functions) (`prefer-arrow-functions`) | Since v0.1.0 |
|
|
376
|
+
| `perfectionist` | ❌ | [eslint-plugin-perfectionist](https://npmjs.com/eslint-plugin-perfectionist) (`perfectionist`) | Since v0.4.0<br>Supports sub-configs for each rule from the plugin since v1.0.0 |
|
|
377
|
+
| `deMorgan` | ❌ | [eslint-plugin-de-morgan](https://npmjs.com/eslint-plugin-de-morgan) (`de-morgan`) | Since v0.5.0 |
|
|
378
|
+
| `es` | ❌ | [eslint-plugin-es-x](https://npmjs.com/eslint-plugin-es-x) (`es-x`) | Since v0.10.0 |
|
|
379
|
+
| `jsInline` | ✅ | [eslint-plugin-html](https://npmjs.com/eslint-plugin-html) (`html`) | Since v0.10.0<br>For linting inlined JS in HTML files |
|
|
380
|
+
| `math` | ✅ | [eslint-plugin-math](https://npmjs.com/eslint-plugin-math) (`math`) | Since v1.0.0 |
|
|
381
|
+
| `erasableSyntaxOnly` | ❌ | [eslint-plugin-erasable-syntax-only](https://npmjs.com/eslint-plugin-erasable-syntax-only) (`erasable-syntax-only`) | Since v1.0.0 |
|
|
382
|
+
| `noUnnecessaryAbstractions` | ✅ | [eslint-plugin-unnecessary-abstractions](https://npmjs.com/eslint-plugin-unnecessary-abstractions) (`unnecessary-abstractions`) | Since v1.0.0 |
|
|
383
|
+
| `fastImport` | ❌ | [eslint-plugin-fast-import](https://npmjs.com/eslint-plugin-fast-import) (`fast-import`) | Since v1.0.0<br>Faster `eslint-plugin-import(-x)` alternative |
|
|
384
|
+
| `moduleInterop` | ✅ | [eslint-plugin-module-interop](https://npmjs.com/eslint-plugin-module-interop) (`module-interop`) | Since v1.0.0 |
|
|
385
|
+
| `treeShaking` | ❌ | [eslint-plugin-tree-shaking](https://npmjs.com/eslint-plugin-tree-shaking) (`tree-shaking`) | Since v1.0.0 |
|
|
386
|
+
| `e18e` | ❌ | [@e18e/eslint-plugin](https://npmjs.com/@e18e/eslint-plugin) | Since v1.0.0 |
|
|
387
|
+
| `e18e/modernization` | ✅ | ^ | |
|
|
388
|
+
| `e18e/moduleReplacements` | ✅ | ^ | |
|
|
389
|
+
| `e18e/performanceImprovements` | ✅ | ^ | |
|
|
390
|
+
| `e18e/performanceImprovements/typescript` | ✅ (`ts` config is enabled) | ^ | |
|
|
391
|
+
| `barrelFiles` | ❌ | [eslint-plugin-barrel-files](https://npmjs.com/eslint-plugin-barrel-files) (`barrel-files`) | Since v1.0.0 |
|
|
357
392
|
|
|
358
393
|
### Libraries
|
|
359
394
|
|
|
360
|
-
| Un config name | Enabled by default?<br>(optional condition)
|
|
361
|
-
| ----------------------------------------------------------------------------------- |
|
|
362
|
-
| `jest` | ✅ (`jest` is installed)
|
|
363
|
-
| `jest/extended` | ✅ (`jest-extended` is installed)
|
|
364
|
-
| `jest/typescript` | ✅ (`ts` config is enabled)
|
|
365
|
-
| `jest/noOnlyTests` | ❌
|
|
366
|
-
| `vitest` | ✅ (`vitest` is installed)
|
|
367
|
-
| `vitest/noOnlyTests` | ❌
|
|
368
|
-
| `jestDom` | ✅ (`@testing-library/jest-dom` is installed)
|
|
369
|
-
| `ava` | ✅ (`ava` is installed)
|
|
370
|
-
| `ava/noOnlyTests` | ❌
|
|
371
|
-
| `qunit` | ✅ (`qunit` is installed)
|
|
372
|
-
| `qunit/noOnlyTests` | ❌
|
|
373
|
-
| ![Testing Library] `testingLibrary` | ✅ (`@testing-library/dom` is installed)
|
|
374
|
-
| ![Testing Library] `testingLibrary/angular` | ✅ (`angular` config is enabled)
|
|
375
|
-
| ![Testing Library] `testingLibrary/marko` | ✅ (`marko` is installed)
|
|
376
|
-
| ![Testing Library] `testingLibrary/react` | ✅ (`react` config is enabled)
|
|
377
|
-
| ![Testing Library] `testingLibrary/svelte` | ✅ (`svelte` config is enabled)
|
|
378
|
-
| ![Testing Library] `testingLibrary/vue` | ✅ (`vue` config is enabled)
|
|
379
|
-
| ![Testing Library] `testingLibrary/*/noOnlyTests` | ✅
|
|
380
|
-
| `noOnlyTests` | ❌
|
|
381
|
-
| `tanstackQuery`
|
|
382
|
-
|  `cypress
|
|
385
|
-
|  `mocha
|
|
387
|
-
|  `playwright
|
|
390
|
-
|  (`jest`) | Since v0.3.0 |
|
|
398
|
+
| `jest/extended` | ✅ (`jest-extended` is installed) | [eslint-plugin-jest-extended](https://npmjs.com/eslint-plugin-jest-extended) (`jest-extended`) | - |
|
|
399
|
+
| `jest/typescript` | ✅ (`ts` config is enabled) | [eslint-plugin-jest](https://npmjs.com/eslint-plugin-jest) (`jest`) | Only TypeScript-specific rules from `eslint-plugin-jest` |
|
|
400
|
+
| `jest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
401
|
+
| `vitest` | ✅ (`vitest` is installed) | [@vitest/eslint-plugin](https://npmjs.com/@vitest/eslint-plugin) (`vitest`) | Since v0.3.0 |
|
|
402
|
+
| `vitest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
403
|
+
| `jestDom` | ✅ (`@testing-library/jest-dom` is installed) | [eslint-plugin-jest-dom](https://npmjs.com/eslint-plugin-jest-dom) (`jest-dom`) | Since v1.0.0 |
|
|
404
|
+
| `ava` | ✅ (`ava` is installed) | [eslint-plugin-ava](https://npmjs.com/eslint-plugin-ava) (`ava`) | Since v1.0.0 |
|
|
405
|
+
| `ava/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
406
|
+
| `qunit` | ✅ (`qunit` is installed) | [eslint-plugin-qunit](https://npmjs.com/eslint-plugin-qunit) (`qunit`) | Since v1.0.0 |
|
|
407
|
+
| `qunit/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
408
|
+
| ![Testing Library] `testingLibrary` | ✅ (`@testing-library/dom` is installed) | [eslint-plugin-testing-library](https://npmjs.com/eslint-plugin-testing-library) (`testing-library`) | Since v1.0.0 |
|
|
409
|
+
| ![Testing Library] `testingLibrary/angular` | ✅ (`angular` config is enabled) | ^ | Since v1.0.0 |
|
|
410
|
+
| ![Testing Library] `testingLibrary/marko` | ✅ (`marko` is installed) | ^ | Since v1.0.0 |
|
|
411
|
+
| ![Testing Library] `testingLibrary/react` | ✅ (`react` config is enabled) | ^ | Since v1.0.0 |
|
|
412
|
+
| ![Testing Library] `testingLibrary/svelte` | ✅ (`svelte` config is enabled) | ^ | Since v1.0.0 |
|
|
413
|
+
| ![Testing Library] `testingLibrary/vue` | ✅ (`vue` config is enabled) | ^ | Since v1.0.0 |
|
|
414
|
+
| ![Testing Library] `testingLibrary/*/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
415
|
+
| `noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
416
|
+
|  `tanstackQuery` | ✅ (`@tanstack/query-core` is installed) | [@tanstack/eslint-plugin-query](https://npmjs.com/@tanstack/eslint-plugin-query) (`@tanstack/query`) | Since v1.0.0 |
|
|
417
|
+
|  `tanstackRouter` | ✅ (`@tanstack/react-router` or `@tanstack/solid-router` is installed) | [@tanstack/eslint-plugin-router](https://npmjs.com/@tanstack/eslint-plugin-router) (`@tanstack/router`) | Since v1.0.0 |
|
|
418
|
+
|  `storybook` | ✅ (`storybook` is installed) | [eslint-plugin-storybook](https://npmjs.com/eslint-plugin-storybook) (`storybook`) | Since v1.0.0 |
|
|
419
|
+
|  `cypress` | ✅ (`cypress` is installed) | [eslint-plugin-cypress](https://npmjs.com/eslint-plugin-cypress) (`cypress`) | Since v1.0.0 |
|
|
420
|
+
|  `cypress/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
421
|
+
|  `mocha` | ✅ (`mocha` is installed) | [eslint-plugin-mocha](https://npmjs.com/eslint-plugin-mocha) (`mocha`) | Since v1.0.0 |
|
|
422
|
+
|  `mocha/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
423
|
+
|  `turbo` | ✅ (`turbo` is installed) | [eslint-plugin-turbo](https://npmjs.com/eslint-plugin-turbo) (`turbo`) | Since v1.0.0 |
|
|
424
|
+
|  `playwright` | ✅ (`playwright` is installed) | [eslint-plugin-playwright](https://npmjs.com/eslint-plugin-playwright) (`playwright`) | Since v1.0.0 |
|
|
425
|
+
|  `playwright/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
426
|
+
|  `youDontNeedLodashUnderscore` | ✅ (`lodash`, `lodash-es` or `lodash.*` is installed) | [eslint-plugin-you-dont-need-lodash-underscore](https://npmjs.com/eslint-plugin-you-dont-need-lodash-underscore) (`you-dont-need-lodash-underscore`) | Since v1.0.0 |
|
|
427
|
+
|  `rxjs` | ✅ (`rxjs` is installed) | [@smarttools/eslint-plugin-rxjs](https://npmjs.com/@smarttools/eslint-plugin-rxjs) (`rxjs`) | Since v1.0.0 |
|
|
428
|
+
|  `nx` | ✅ (`nx` is installed) | [@nx/eslint-plugin](https://npmjs.com/@nx/eslint-plugin) (`nx`) | Since v1.0.0 |
|
|
429
|
+
|  `importZod` | ❌ | [eslint-plugin-import-zod](https://npmjs.com/eslint-plugin-import-zod) (`import-zod`) | Enforces namespace imports for `zod`. You should probably use `zod` config instead.<br>Since v1.0.0 |
|
|
430
|
+
|  `unocss` | ✅ (`unocss` is installed) | [@unocss/eslint-plugin](https://npmjs.com/@unocss/eslint-plugin) (`unocss`) | Since v1.0.0 |
|
|
431
|
+
|  `zod` | ✅ (`zod@>=4` is installed) | [eslint-plugin-zod-x](https://npmjs.com/eslint-plugin-zod-x) (`zod`) | Since v1.0.0 |
|
|
432
|
+
|  `formatJs` | ✅ (`@formatjs/icu-messageformat-parser` is installed) | [eslint-plugin-formatjs](https://npmjs.com/eslint-plugin-formatjs) (`formatjs`) | Since v1.0.0 |
|
|
433
|
+
|  `docusaurus` | ✅ (`@docusaurus/core` is installed) | [@docusaurus/eslint-plugin](https://npmjs.com/@docusaurus/eslint-plugin) (`docusaurus`) | Since v1.0.0 |
|
|
434
|
+
| `clsx` | ✅ (`clsx` is installed) | [eslint-plugin-clsx](https://npmjs.com/eslint-plugin-clsx) (`clsx`) | Since v1.0.0 |
|
|
398
435
|
|
|
399
436
|
### Miscellaneous
|
|
400
437
|
|
|
@@ -417,6 +454,10 @@ In the following table, Sub-configs have `/` in their names.
|
|
|
417
454
|
| `expectType` | ❌ | [eslint-plugin-expect-type](https://npmjs.com/eslint-plugin-expect-type) (`expect-type`) | Since v1.0.0 |
|
|
418
455
|
| `command` | ❌ | [eslint-plugin-command](https://npmjs.com/eslint-plugin-command) (`command`) | Since v1.0.0 |
|
|
419
456
|
| `antfu` | ❌ | [eslint-plugin-antfu](https://npmjs.com/eslint-plugin-antfu) (`antfu`) | Since v1.0.0<br>[Anthony Fu](https://antfu.me)'s personal collection of rules. |
|
|
457
|
+
| `sql` | ❌ | [eslint-plugin-sql](https://npmjs.com/eslint-plugin-sql) (`sql`) | Since v1.0.0 |
|
|
458
|
+
| `format` | ❌ | [eslint-plugin-format](https://npmjs.com/eslint-plugin-format) (`format`) | Since v1.0.0<br>📚 Supports multiple configs |
|
|
459
|
+
| `lockfile` | ❌ | [eslint-plugin-lockfile](https://npmjs.com/eslint-plugin-lockfile) (`lockfile`) | Since v1.0.0 |
|
|
460
|
+
|  `githubActions` | ✅ (`.github/workflows` directory exists) | [eslint-plugin-github-action](https://npmjs.com/eslint-plugin-github-action) (`github-actions`) | Since v1.0.0 |
|
|
420
461
|
|
|
421
462
|
## How to use
|
|
422
463
|
|
|
@@ -459,7 +500,7 @@ export default eslintConfig({
|
|
|
459
500
|
|
|
460
501
|
#### Providing user defined flag configs
|
|
461
502
|
|
|
462
|
-
You can provide your own configs by using `extraConfigs` option.
|
|
503
|
+
You can provide your own configs by using `extraConfigs` option.
|
|
463
504
|
The provided configs will be placed after all the eslint-config-un's configs, and before the config which disables Prettier incompatible rules for all files.
|
|
464
505
|
|
|
465
506
|
Example:
|
|
@@ -488,25 +529,28 @@ export default eslintConfig({
|
|
|
488
529
|
|
|
489
530
|
### Plugin prefixes (`pluginRenames` option)
|
|
490
531
|
|
|
491
|
-
ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`.
|
|
532
|
+
ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`.
|
|
492
533
|
Then the rule name are formed by combining the prefix with the rule name, for example `unicorn/no-useless-undefined`.
|
|
493
534
|
|
|
494
|
-
eslint-config-un provides the ability to change any registered plugin prefix.
|
|
535
|
+
eslint-config-un provides the ability to change any registered plugin prefix.
|
|
495
536
|
Additionally, some plugins are registered with a different prefix than their documentation suggests.
|
|
496
537
|
If you would like to rename them back or rename some other plugins, you can use `pluginRenames` option, which is a map from the "canonical" prefixes to the user defined ones.
|
|
497
538
|
|
|
498
539
|
#### Default renames
|
|
499
540
|
|
|
500
|
-
| Plugin
|
|
501
|
-
|
|
|
502
|
-
| [`typescript-eslint`](https://npmjs.com/typescript-eslint)
|
|
503
|
-
| [`eslint-plugin-import-x`]
|
|
504
|
-
| [`eslint-plugin-n`](https://npmjs.com/eslint-plugin-n)
|
|
505
|
-
| [`eslint-plugin-css`](https://npmjs.com/eslint-plugin-css)
|
|
506
|
-
| [`eslint-plugin-jsx-a11y-x`](https://npmjs.com/eslint-plugin-jsx-a11y-x)
|
|
507
|
-
| [`eslint-plugin-zod-x`](https://npmjs.com/eslint-plugin-zod-x)
|
|
508
|
-
| [`@docusaurus/eslint-plugin`](https://npmjs.com/@docusaurus/eslint-plugin)
|
|
509
|
-
| [`@darraghor/eslint-plugin-nestjs-typed`](https://npmjs.com/@darraghor/eslint-plugin-nestjs-typed)
|
|
541
|
+
| Plugin | Suggested prefix | Our prefix | Reason |
|
|
542
|
+
| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
543
|
+
| [`typescript-eslint`](https://npmjs.com/typescript-eslint) | `@typescript-eslint` | `ts` | More concise and convenient to use |
|
|
544
|
+
| [`eslint-plugin-import-x`] | `import-x` | `import` | This plugin is a fork and is meant to replace the original plugin with `import` prefix |
|
|
545
|
+
| [`eslint-plugin-n`](https://npmjs.com/eslint-plugin-n) | `n` | `node` | Same ^ |
|
|
546
|
+
| [`eslint-plugin-css`](https://npmjs.com/eslint-plugin-css) | `css` | `css-in-js` | Conflicts with [`@eslint/css`](https://npmjs.com/@eslint/css) and our name better captures the essence of the plugin |
|
|
547
|
+
| [`eslint-plugin-jsx-a11y-x`](https://npmjs.com/eslint-plugin-jsx-a11y-x) | `jsx-a11y-x` | `jsx-a11y` | This plugin is a fork and is meant to replace the original plugin with `jsx-a11y` prefix |
|
|
548
|
+
| [`eslint-plugin-zod-x`](https://npmjs.com/eslint-plugin-zod-x) | `zod-x` | `zod` | Better replacement for an existing `eslint-plugin-zod` plugin |
|
|
549
|
+
| [`@docusaurus/eslint-plugin`](https://npmjs.com/@docusaurus/eslint-plugin) | `@docusaurus` | `docusaurus` | `@` feels unnecessary |
|
|
550
|
+
| [`@darraghor/eslint-plugin-nestjs-typed`](https://npmjs.com/@darraghor/eslint-plugin-nestjs-typed) | `@darraghor/nestjs-typed` | `nestjs` | More concise and convenient to use |
|
|
551
|
+
| [`@eslint-community/eslint-plugin-eslint-comments`](https://npmjs.com/@eslint-community/eslint-plugin-eslint-comments) | `@eslint-community/eslint-comments` | `eslint-comments` | More concise and convenient to use |
|
|
552
|
+
| [`eslint-plugin-github-action`](https://npmjs.com/eslint-plugin-github-action) | `github-action` | `github-actions` | Consistent with the platform name (also `-github-actions` plugin seems to not be maintained) |
|
|
553
|
+
| [`eslint-plugin-yml`](https://npmjs.com/eslint-plugin-yml) | `yml` | `yaml` | Consistent with the official language name (also `-yaml` plugin is much less popular) |
|
|
510
554
|
|
|
511
555
|
> [!NOTE]
|
|
512
556
|
> If you rename a plugin, you still have to use the original prefix within `overrides`, `overridesAny` and `extraConfigs`. eslint-config-un will rename the rules accordingly for you.
|
|
@@ -516,7 +560,7 @@ If you would like to rename them back or rename some other plugins, you can use
|
|
|
516
560
|
|
|
517
561
|
### Disabling rule autofix
|
|
518
562
|
|
|
519
|
-
ESLint [doesn't (yet?) have the ability to disable autofix](https://github.com/eslint/rfcs/pull/125) for a rule by the user on per-rule basis.
|
|
563
|
+
ESLint [doesn't (yet?) have the ability to disable autofix](https://github.com/eslint/rfcs/pull/125) for a rule by the user on per-rule basis.
|
|
520
564
|
Our config attempts to provide this missing functionality by giving the ability to disable autofix for a rule as a whole ("globally") or per-file and per-rule basis, but in the latter case with a caveat that the rule will have `disable-autofix/` prefix in its name.
|
|
521
565
|
|
|
522
566
|
#### Globally disabling rule autofix
|
|
@@ -573,38 +617,38 @@ export default eslintConfig({
|
|
|
573
617
|
});
|
|
574
618
|
```
|
|
575
619
|
|
|
576
|
-
This will technically create a plugin with `disable-autofix` prefix and copy this rule into it.
|
|
620
|
+
This will technically create a plugin with `disable-autofix` prefix and copy this rule into it.
|
|
577
621
|
The final rule is going to be given a name `disable-autofix/<rule-name>` which would replace `<rule-name>` entry in the resulting config.
|
|
578
622
|
|
|
579
623
|
## Configs notes
|
|
580
624
|
|
|
581
625
|
### TypeScript
|
|
582
626
|
|
|
583
|
-
Rules [requiring type information](https://typescript-eslint.io/rules/?=typeInformation), which are [known to be performance-demanding](https://typescript-eslint.io/getting-started/typed-linting/#performance), are *enabled* by default, and will be applied to the same files as `ts` config is applied to.
|
|
627
|
+
Rules [requiring type information](https://typescript-eslint.io/rules/?=typeInformation), which are [known to be performance-demanding](https://typescript-eslint.io/getting-started/typed-linting/#performance), are *enabled* by default, and will be applied to the same files as `ts` config is applied to.
|
|
584
628
|
It's just a little heads up; you should make your own decision whether to keep them enabled.
|
|
585
629
|
Use `configTypeAware` to control to which files such rules will be applied to, if any.
|
|
586
630
|
|
|
587
631
|
### Frontend frameworks
|
|
588
632
|
|
|
589
|
-
We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version.
|
|
633
|
+
We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version.
|
|
590
634
|
You can always manually specify the version using an appropriate option.
|
|
591
635
|
Consult JSDoc of each config for more details.
|
|
592
636
|
|
|
593
637
|
#### Vue
|
|
594
638
|
|
|
595
|
-
By default, TypeScript rules will be enabled in `.vue` files if `enforceTypescriptInScriptSection` is set to `true` in vue's config options which in turn is *automatically* set to `true` if `ts` config is enabled.
|
|
596
|
-
If you have `.vue` files authored in both TypeScript and JavaScript, use `enforceTypescriptInScriptSection.{files,ignores}` to manually specify TS & JS Vue components respectively.
|
|
639
|
+
By default, TypeScript rules will be enabled in `.vue` files if `enforceTypescriptInScriptSection` is set to `true` in vue's config options which in turn is *automatically* set to `true` if `ts` config is enabled.
|
|
640
|
+
If you have `.vue` files authored in both TypeScript and JavaScript, use `enforceTypescriptInScriptSection.{files,ignores}` to manually specify TS & JS Vue components respectively.
|
|
597
641
|
It is not currently possible to apply different ESLint rules depending on the value of `lang` attribute of `<script>` SFC section.
|
|
598
642
|
|
|
599
643
|
#### Angular
|
|
600
644
|
|
|
601
|
-
We support Angular versions from 13 to 20, all at once.
|
|
602
|
-
You are expected to install `@angular-eslint/eslint-plugin` and `@angular-eslint/eslint-plugin-template` packages of the same major version as your Angular version, but installing a greater version would also likely work.
|
|
645
|
+
We support Angular versions from 13 to 20, all at once.
|
|
646
|
+
You are expected to install `@angular-eslint/eslint-plugin` and `@angular-eslint/eslint-plugin-template` packages of the same major version as your Angular version, but installing a greater version would also likely work.
|
|
603
647
|
With the latter, you can use the rules added in newer versions of `@angular-eslint/eslint-plugin*` on older Angular codebases.
|
|
604
648
|
|
|
605
649
|
#### React
|
|
606
650
|
|
|
607
|
-
We use rules from several plugins to lint your React code.
|
|
651
|
+
We use rules from several plugins to lint your React code.
|
|
608
652
|
You will be able to choose whether you would like to use only `@eslint-react/eslint-plugin` or `eslint-plugin-react`, or both, which is the default.
|
|
609
653
|
|
|
610
654
|
### Markdown
|
|
@@ -612,7 +656,7 @@ You will be able to choose whether you would like to use only `@eslint-react/esl
|
|
|
612
656
|
If `markdown` config is enabled (which is the default), the same rules provided by other configs will be applied to code blocks (\```lang ... \```) inside Markdown files.
|
|
613
657
|
This works because under the hood the plugin [`@eslint/markdown`](https://npmjs.com/@eslint/markdown) that provides that functionality will create virtual files for each code block with the same extension as specified after ```.
|
|
614
658
|
|
|
615
|
-
But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports).
|
|
659
|
+
But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports).
|
|
616
660
|
You can find the full list of disabled rules in `src/configs/markdown.ts` file.
|
|
617
661
|
|
|
618
662
|
### Tailwind CSS
|
|
@@ -637,13 +681,13 @@ See [Rules configuration](#rules-configuration-configs-and-extraconfigs-option).
|
|
|
637
681
|
|
|
638
682
|
### `ignores`
|
|
639
683
|
|
|
640
|
-
Specifies a list of globally ignored files.
|
|
684
|
+
Specifies a list of globally ignored files.
|
|
641
685
|
By default will be merged with our ignore patterns (also exported as [`DEFAULT_GLOBAL_IGNORES`](#default_global_ignores)), unless the object notation is used and the `override` property is set to `true`.
|
|
642
686
|
|
|
643
687
|
### `extraPlugins`
|
|
644
688
|
|
|
645
|
-
Allows to provide additional ESLint plugins.
|
|
646
|
-
Their prefixes and possibly rule names will appear in configs' `rules` property type.
|
|
689
|
+
Allows to provide additional ESLint plugins.
|
|
690
|
+
Their prefixes and possibly rule names will appear in configs' `rules` property type.
|
|
647
691
|
They, like all the built-in plugins, by default will be loaded only if used.
|
|
648
692
|
|
|
649
693
|
Note that their prefixes must not match the built-it/known ones (like `ts` or `unicorn`) or even prefixes you've set via [`pluginRenames`](#pluginrenames).
|
|
@@ -654,7 +698,7 @@ Sets [`linterOptions.{noInlineConfig,reportUnusedDisableDirectives,reportUnusedI
|
|
|
654
698
|
|
|
655
699
|
### `defaultConfigsStatus`
|
|
656
700
|
|
|
657
|
-
Quickly enable multiple configs at once.
|
|
701
|
+
Quickly enable multiple configs at once.
|
|
658
702
|
Possible options:
|
|
659
703
|
|
|
660
704
|
- `all-disabled`: consider all top level configs disabled unless explicitly enabled.
|
|
@@ -662,12 +706,12 @@ Possible options:
|
|
|
662
706
|
|
|
663
707
|
### `mode`
|
|
664
708
|
|
|
665
|
-
Type of your project, either application (`app`, default) or library (`lib`).
|
|
709
|
+
Type of your project, either application (`app`, default) or library (`lib`).
|
|
666
710
|
Will affect certain rules, actual list of which is written in JSDoc of this option.
|
|
667
711
|
|
|
668
712
|
### `forceSeverity`
|
|
669
713
|
|
|
670
|
-
Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)).
|
|
714
|
+
Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)).
|
|
671
715
|
This can also be configured per-config.
|
|
672
716
|
|
|
673
717
|
### `pluginRenames`
|
|
@@ -676,14 +720,14 @@ See [Plugin prefixes](#plugin-prefixes-pluginrenames-option).
|
|
|
676
720
|
|
|
677
721
|
### `pluginOverrides`
|
|
678
722
|
|
|
679
|
-
Override implementation of some of the plugins.
|
|
723
|
+
Override implementation of some of the plugins.
|
|
680
724
|
This can be useful when this config is used to lint a repository of one of the built-in plugins to provide development version of that plugin.
|
|
681
725
|
|
|
682
726
|
### `loadPluginsOnDemand`
|
|
683
727
|
|
|
684
728
|
This option allows to decide whether whether ESLint plugins will be loaded if they are actually used (`true` by default).
|
|
685
729
|
|
|
686
|
-
Using object notation, you can also specify concrete plugins that will be loaded.
|
|
730
|
+
Using object notation, you can also specify concrete plugins that will be loaded.
|
|
687
731
|
This can be useful if you enable certain plugin rules only be using [configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments).
|
|
688
732
|
|
|
689
733
|
### `autofixDisabledGloballyFor`
|
|
@@ -692,8 +736,8 @@ See [Globally disabling rule autofix](#globally-disabling-rule-autofix).
|
|
|
692
736
|
|
|
693
737
|
### `gitignore`
|
|
694
738
|
|
|
695
|
-
By default files from `.gitignore` (read from [the current working directory](https://nodejs.org/api/process.html#processcwd)) in the will be automatically added to the global [`ignores`](#ignores) list.
|
|
696
|
-
Set this option to `false` to disable this behavior.
|
|
739
|
+
By default files from `.gitignore` (read from [the current working directory](https://nodejs.org/api/process.html#processcwd)) in the will be automatically added to the global [`ignores`](#ignores) list.
|
|
740
|
+
Set this option to `false` to disable this behavior.
|
|
697
741
|
You may also provide an object which configures [eslint-config-flat-gitignore](https://npmjs.com/eslint-config-flat-gitignore), which actually provides this functionality.
|
|
698
742
|
|
|
699
743
|
### `offlineMode`
|
|
@@ -704,15 +748,15 @@ It can also be enabled by setting `ESLINT_CONFIG_UN_OFFLINE_MODE` environment va
|
|
|
704
748
|
|
|
705
749
|
### `cacheConfigs`
|
|
706
750
|
|
|
707
|
-
Enables flat config caching.
|
|
708
|
-
This option is enabled by default when running in editor (detected by [`is-in-editor`](https://npmjs.com/is-in-editor)).
|
|
751
|
+
Enables flat config caching.
|
|
752
|
+
This option is enabled by default when running in editor (detected by [`is-in-editor`](https://npmjs.com/is-in-editor)).
|
|
709
753
|
It can also be enabled by setting `ESLINT_CONFIG_UN_CACHE_CONFIGS` environment variable to non-empty string, but the explicitly passed value takes precedence.
|
|
710
754
|
|
|
711
755
|
There are 2 layers of caching:
|
|
712
756
|
|
|
713
|
-
- In memory: the cache will be stored in a global variable, and if it's preserved between ESLint extension process re-runs (it does at least in VSCode), it will be preferred over FS cache.
|
|
757
|
+
- In memory: the cache will be stored in a global variable, and if it's preserved between ESLint extension process re-runs (it does at least in VSCode), it will be preferred over FS cache.
|
|
714
758
|
This is an **extremely fast** caching option.
|
|
715
|
-
- In file system: the cache will be stored in `node_modules/.cache/eslint-config-un/config.json`.
|
|
759
|
+
- In file system: the cache will be stored in `node_modules/.cache/eslint-config-un/config.json`.
|
|
716
760
|
Note that in this case caching might fail if the config contains unserializable data, such as functions.
|
|
717
761
|
|
|
718
762
|
The cache, regardless of the storage, is considered fresh for 1 hour, unless one of the following is changed:
|
|
@@ -724,7 +768,7 @@ The cache, regardless of the storage, is considered fresh for 1 hour, unless one
|
|
|
724
768
|
|
|
725
769
|
### `disablePrettierIncompatibleRules`
|
|
726
770
|
|
|
727
|
-
Disables rules that are potentially conflicting with Prettier. [`eslint-config-prettier`](https://npmjs.com/eslint-config-prettier) is used under the hood, with a few exceptions.
|
|
771
|
+
Disables rules that are potentially conflicting with Prettier. [`eslint-config-prettier`](https://npmjs.com/eslint-config-prettier) is used under the hood, with a few exceptions.
|
|
728
772
|
Defaults to `true` if `prettier` package is installed.
|
|
729
773
|
|
|
730
774
|
### `useFastImport`
|
|
@@ -741,15 +785,15 @@ Re-exported default export from [`globals` package](https://npmjs.com/globals),
|
|
|
741
785
|
|
|
742
786
|
#### `isInCi`
|
|
743
787
|
|
|
744
|
-
The constant showing if the current process is *likely* running in CI.
|
|
788
|
+
The constant showing if the current process is *likely* running in CI.
|
|
745
789
|
Info provided by [`ci-info` package](https://npmjs.com/ci-info).
|
|
746
790
|
|
|
747
|
-
Use case: disable or enable certain rules or features in CI.
|
|
791
|
+
Use case: disable or enable certain rules or features in CI.
|
|
748
792
|
Use with caution!
|
|
749
793
|
|
|
750
794
|
#### `isInEditor`
|
|
751
795
|
|
|
752
|
-
The constant showing if the current process is *likely* running within editor.
|
|
796
|
+
The constant showing if the current process is *likely* running within editor.
|
|
753
797
|
Info provided by [`is-in-editor` package](https://npmjs.com/is-in-editor).
|
|
754
798
|
|
|
755
799
|
Use case: disable or enable certain rules or features in editor, likely to improve performance.
|
|
@@ -760,7 +804,7 @@ Use case: disable or enable certain rules or features in editor, likely to impro
|
|
|
760
804
|
|
|
761
805
|
#### `DEFAULT_GLOBAL_IGNORES`
|
|
762
806
|
|
|
763
|
-
Default list of global `ignores` values set by eslint-config-un.
|
|
807
|
+
Default list of global `ignores` values set by eslint-config-un.
|
|
764
808
|
See also [`ignores` option](#ignores)
|
|
765
809
|
|
|
766
810
|
#### `RuleOptions`
|
|
@@ -780,14 +824,18 @@ Please refer to JSDoc of exported symbols for proper documentation.
|
|
|
780
824
|
|
|
781
825
|
#### `createNoRestricted*Rule`
|
|
782
826
|
|
|
783
|
-
Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
|
|
827
|
+
Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
|
|
784
828
|
Please refer to [the package documentation](https://github.com/bradzacher/eslint-no-restricted#readme) for more info.
|
|
785
829
|
|
|
830
|
+
### `globs` entrypoint
|
|
831
|
+
|
|
832
|
+
Exports various globs that can be useful for specifying `files` or `ignores` ESLint config options.
|
|
833
|
+
|
|
786
834
|
## FAQ
|
|
787
835
|
|
|
788
836
|
### How do I add my own flat configs?
|
|
789
837
|
|
|
790
|
-
Use `extraConfigs` option.
|
|
838
|
+
Use `extraConfigs` option.
|
|
791
839
|
The configs provided there will be placed after all the eslint-config-un's configs, and before the config which disables Prettier incompatible rules for all files.
|
|
792
840
|
These configs have a richer `rules` option, which allows you to apply more settings like `overrides` option does.
|
|
793
841
|
|
|
@@ -795,21 +843,34 @@ Alternatively, you can `await` the `eslintConfig()` function and then add your o
|
|
|
795
843
|
|
|
796
844
|
### Do I have to install any of the used plugins?
|
|
797
845
|
|
|
798
|
-
Many plugins are direct dependencies on this package, but the rest (the majority) are optional peer dependencies which means you're responsible for making sure they're installed. eslint-config-un will refuse to work if a plugin is used but not installed.
|
|
846
|
+
Many plugins are direct dependencies on this package, but the rest (the majority) are optional peer dependencies which means you're responsible for making sure they're installed. eslint-config-un will refuse to work if a plugin is used but not installed.
|
|
799
847
|
Please run ESLint with our config once to get the list of dependencies to be installed manually.
|
|
800
848
|
|
|
801
849
|
### How do I know how eslint-config-un configures rules?
|
|
802
850
|
|
|
803
|
-
It's too much to document, so please have a look at the source code of our config.
|
|
851
|
+
It's too much to document, so please have a look at the source code of our config.
|
|
804
852
|
All the configs are placed inside `src/configs` directory.
|
|
805
853
|
|
|
806
854
|
### How does exactly eslint-config-un knows if some package is installed?
|
|
807
855
|
|
|
808
856
|
We use [`import-meta-resolve`](https://npmjs.com/import-meta-resolve) package to detect if the package is installed and resolve the path to its' `package.json`.
|
|
809
857
|
|
|
858
|
+
> [!WARNING]
|
|
859
|
+
> This tool replicates the Node.JS resolution algorithm, so there might be false positives
|
|
860
|
+
> on package detection if your dependencies are installed in such a way that non-direct dependencies
|
|
861
|
+
> can be resolved.
|
|
862
|
+
>
|
|
863
|
+
> If this is the case, at least 3 additional packages will be considered detected as installed
|
|
864
|
+
> regardless of whether they are actually installed in the root of your project, because they are
|
|
865
|
+
> sub-dependencies of eslint-config-un's direct dependencies:
|
|
866
|
+
>
|
|
867
|
+
> - `typescript` (enables `ts` config and friends);
|
|
868
|
+
> - `prettier` (causes Prettier-incompatible rules to be disabled);
|
|
869
|
+
> - `lodash` (enables `youDontNeedLodashUnderscore` config).
|
|
870
|
+
|
|
810
871
|
### How can I know which configs will be enabled, for which rules autofix will be disabled, etc.?
|
|
811
872
|
|
|
812
|
-
You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
|
|
873
|
+
You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
|
|
813
874
|
We use [`obug` package](https://npmjs.com/obug) ([`debug`](https://npmjs.com/debug) alternative with compatible API) to print debug messages, so please refer to its documentation for more info.
|
|
814
875
|
|
|
815
876
|
Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslint/config-inspector) to inspect the final config.
|
|
@@ -818,7 +879,7 @@ Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslin
|
|
|
818
879
|
|
|
819
880
|
### Prerequisites
|
|
820
881
|
|
|
821
|
-
Node.JS and ESLint satisfy [minimum required versions](#installation).
|
|
882
|
+
Node.JS and ESLint satisfy [minimum required versions](#installation).
|
|
822
883
|
Please don't attempt to migrate to ESLint 9 and eslint-config-un at the same time.
|
|
823
884
|
|
|
824
885
|
### Migration guide
|
|
@@ -828,13 +889,13 @@ If necessary, any step should be additionally split into multiple commits.
|
|
|
828
889
|
Before committing, please do also run tests, formatter, other linters and tools to ensure that nothing became broken, if you have any.
|
|
829
890
|
|
|
830
891
|
1. Dependencies:
|
|
831
|
-
1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself.
|
|
892
|
+
1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself.
|
|
832
893
|
This ensures correct versions of plugins will be resolved by eslint-config-un and saves you from other weird and hard to debug problems.
|
|
833
894
|
2. Install `eslint-config-un` following [the installation instructions](#installation).
|
|
834
895
|
2. If you're using `.js` config file, we highly recommend that you migrate to `.ts` one, or at least add `@ts-check` TypeScript directive to the former.
|
|
835
896
|
Please don't forget install [`jiti`](https://npmjs.com/jiti) for ESLint to able be to read your TypeScript config file.
|
|
836
897
|
3. Following your intuition or/and configs' options JSDoc documentation, migrate the existing config to the closest eslint-config-un equivalent.
|
|
837
|
-
1. Run ESLint for the first time (without `--fix`!).
|
|
898
|
+
1. Run ESLint for the first time (without `--fix`!).
|
|
838
899
|
The list of dependencies to be installed might be shown to you.
|
|
839
900
|
Please review whether those plugins are actually used/needed and act accordingly: install necessary plugins and disable configs which require packages you do not wish to install.
|
|
840
901
|
2. Rename rules on existing [`eslint` configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments) if they have different plugin prefixes (the most common case is that `typescript-eslint` plugin has `ts` prefix in eslint-config-un instead of `@typescript-eslint`) **OR** change prefixes using [`pluginRenames` option](#plugin-prefixes-pluginrenames-option).
|
|
@@ -861,12 +922,12 @@ Before committing, please do also run tests, formatter, other linters and tools
|
|
|
861
922
|
|
|
862
923
|
Please carefully review automatically applied fixes and do not forget about problems requiring manual intervention.
|
|
863
924
|
It might be worth to fix stylistic issues in two stages: auto and manually fixable problems.
|
|
864
|
-
2. Now set `configs.noStylisticRules` to `true` to disable purely stylistic rules and run ESLint for the first time with the new config.
|
|
865
|
-
Please don't use `--fix` option - this may complicate things as you will have less idea of what's changed (plus some autofixes may be unsafe to automatically apply).
|
|
925
|
+
2. Now set `configs.noStylisticRules` to `true` to disable purely stylistic rules and run ESLint for the first time with the new config.
|
|
926
|
+
Please don't use `--fix` option - this may complicate things as you will have less idea of what's changed (plus some autofixes may be unsafe to automatically apply).
|
|
866
927
|
Thoroughly go through the report and:
|
|
867
928
|
- Decide which rules need to be disabled, enabled or changed the options of;
|
|
868
929
|
- Decide which `eslint-ignore` comments are no longer relevant and should be removed;
|
|
869
|
-
- Possibly set `ts.allowDefaultProject` to include files which are not part of any TypeScript project (tsconfig file), but for which TypeScript type-aware rules (rules requiring type information) should still work.
|
|
930
|
+
- Possibly set `ts.allowDefaultProject` to include files which are not part of any TypeScript project (tsconfig file), but for which TypeScript type-aware rules (rules requiring type information) should still work.
|
|
870
931
|
Conversely, if for some files type-aware linting should be disabled, specify them in `ts.configTypeAware.ignores` option (or set `ts.configTypeAware` to `false` to disable type-aware linting altogether);
|
|
871
932
|
- Add `<!-- eslint-skip -->` comments before fenced code blocks in Markdown files for which code parsing is failing;
|
|
872
933
|
- Fix/resolve any other issues and difficulties.
|
|
@@ -876,7 +937,7 @@ Before committing, please do also run tests, formatter, other linters and tools
|
|
|
876
937
|
|
|
877
938
|
### Why are there reports from `node` plugin in my frontend code?
|
|
878
939
|
|
|
879
|
-
All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code).
|
|
940
|
+
All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code).
|
|
880
941
|
Please specify `files`, `ignores` or disable `node` config altogether to avoid false positives.
|
|
881
942
|
|
|
882
943
|
<!-- eslint-disable-next-line markdown-preferences/heading-casing -->
|