eslint-config-un 1.0.0-beta.4 → 1.0.0-beta.6
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 +207 -140
- 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 +8 -13
- package/dist/config-un/shared.d.mts +12 -10
- package/dist/config-un/shared.mjs +1 -1
- package/dist/configs/astro.d.mts +2 -3
- 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/e18e.d.mts +53 -0
- package/dist/configs/e18e.mjs +66 -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/eslint-plugin.mjs +1 -1
- package/dist/configs/expect-type.mjs +2 -2
- package/dist/configs/extra/no-stylistic-rules.d.mts +36 -2
- package/dist/configs/extra/no-stylistic-rules.mjs +32 -2
- 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 +102 -4
- 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.d.mts +25 -9
- package/dist/configs/jsdoc.mjs +2 -2
- package/dist/configs/jsx-a11y.mjs +17 -16
- package/dist/configs/lockfile.d.mts +45 -0
- package/dist/configs/lockfile.mjs +28 -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 +1 -1
- package/dist/configs/react.mjs +5 -5
- 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 +3 -3
- 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/ts.d.mts +4 -4
- package/dist/configs/ts.mjs +22 -35
- 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 +93 -18
- package/dist/eslint-types-fixable-only.gen.d.mts +1 -1
- package/dist/eslint-types-per-plugin.gen.d.mts +1770 -789
- package/dist/eslint-types.gen.d.mts +1547 -599
- package/dist/eslint.d.mts +3 -3
- 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 +1 -0
- package/dist/loaders/parsers.d.mts +2 -0
- package/dist/loaders/parsers.mjs +1 -0
- package/dist/loaders/plugins.d.mts +107 -3
- package/dist/loaders/plugins.mjs +10 -2
- package/dist/loaders/shared.d.mts +2 -0
- package/dist/package.mjs +31 -22
- package/dist/plugin-un/rules/no-typeof-like-comparisons.mjs +1 -1
- package/dist/snippets.d.mts +2 -5
- package/dist/snippets.mjs +2 -3
- package/dist/types.d.mts +1 -0
- package/package.json +139 -76
package/README.md
CHANGED
|
@@ -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
|
|
|
@@ -161,15 +185,20 @@ The Config has the following interface (exact types are simplified for docs):
|
|
|
161
185
|
```ts
|
|
162
186
|
type Severity = 0 | 1 | 2 | 'off' | 'warn' | 'error';
|
|
163
187
|
|
|
164
|
-
type RuleOptions = {
|
|
188
|
+
type RuleOptions = {
|
|
189
|
+
/* ... pre-generated all rules' options */
|
|
190
|
+
};
|
|
165
191
|
|
|
166
|
-
type UnRuleEntry<RuleName extends string> =
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
192
|
+
type UnRuleEntry<RuleName extends string> =
|
|
193
|
+
| Severity
|
|
194
|
+
| [Severity, RuleOptions[RuleName]]
|
|
195
|
+
| {
|
|
196
|
+
severity: Severity;
|
|
197
|
+
options?: RuleOptions[RuleName];
|
|
198
|
+
disableAutofix?: boolean;
|
|
199
|
+
files?: string[];
|
|
200
|
+
ignores?: string[];
|
|
201
|
+
};
|
|
173
202
|
|
|
174
203
|
type UnConfig =
|
|
175
204
|
| boolean
|
|
@@ -248,23 +277,28 @@ If these conditions are met, a separate Config will be created with:
|
|
|
248
277
|
|
|
249
278
|
In the following table, Sub-configs have `/` in their names.
|
|
250
279
|
|
|
280
|
+
> [!WARNING]
|
|
281
|
+
> You will notice that oftentimes the configs are automatically enabled if certain dependency(-ies) are installed.
|
|
282
|
+
> This check is done by [`import-meta-resolve` package](https://npmjs.com/import-meta-resolve) and might produce false positives.
|
|
283
|
+
> Please [read more about this here](#how-does-exactly-eslint-config-un-knows-if-some-package-is-installed).
|
|
284
|
+
|
|
251
285
|
### Most popular and well known
|
|
252
286
|
|
|
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) | -
|
|
287
|
+
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`) | Description/Notes |
|
|
288
|
+
| --------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
289
|
+
|  `js` | ✅ | [Vanilla ESLint rules](https://eslint.org/docs/latest/rules) | - |
|
|
290
|
+
| ![TypeScript] `ts` | ✅ | [typescript-eslint](https://npmjs.com/typescript-eslint) (`ts`) | Only rules **not** requiring type information. |
|
|
291
|
+
| ![TypeScript] `ts/typeAware` | ✅ | ^ | Only rules requiring type information. |
|
|
292
|
+
| ![TypeScript] `ts/noTypeAssertion` | ✅ | [eslint-plugin-no-type-assertion](https://npmjs.com/eslint-plugin-no-type-assertion) (`no-type-assertion`) | - |
|
|
293
|
+
| ![TypeScript] `ts/sortTsconfigKeys` | ❌ | - | Sort type-level and `compilerOptions` keys in tsconfig files. |
|
|
294
|
+
| 🦄 `unicorn` | ✅ | [eslint-plugin-unicorn](https://npmjs.com/eslint-plugin-unicorn) (`unicorn`) | - |
|
|
295
|
+
| ⭐ `regexp` | ✅ | [eslint-plugin-regexp](https://npmjs.com/eslint-plugin-regexp) (`regexp`) | - |
|
|
296
|
+
| `promise` | ✅ | [eslint-plugin-promise](https://npmjs.com/eslint-plugin-promise) (`promise`) | - |
|
|
297
|
+
| `import` | ✅ | [eslint-plugin-import-x] (`import`) | - |
|
|
298
|
+
| `sonarjs` | ✅ | [eslint-plugin-sonarjs](https://npmjs.com/eslint-plugin-sonarjs) (`sonarjs`) | - |
|
|
299
|
+
| `eslintComments` | ✅ | [@eslint-community/eslint-plugin-eslint-comments](https://npmjs.com/@eslint-community/eslint-plugin-eslint-comments) (`eslint-comments`) | Since v0.1.3 |
|
|
300
|
+
| `jsdoc` | ✅ | [eslint-plugin-jsdoc](https://npmjs.com/eslint-plugin-jsdoc) (`jsdoc`) | Since v0.3.1 |
|
|
301
|
+
| `jsdoc/typescript` | ✅ (`ts` config is enabled) | - | Config for disabling or disabling certain rules for TypeScript files |
|
|
268
302
|
|
|
269
303
|
### Web frameworks & related
|
|
270
304
|
|
|
@@ -338,63 +372,71 @@ In the following table, Sub-configs have `/` in their names.
|
|
|
338
372
|
|
|
339
373
|
### Js/ts - miscellaneous
|
|
340
374
|
|
|
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`
|
|
375
|
+
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`) | Description/Notes |
|
|
376
|
+
| ----------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
377
|
+
| `security` | ❌ | [eslint-plugin-security](https://npmjs.com/eslint-plugin-security) (`security`) | - |
|
|
378
|
+
| `unusedImports` | ❌ | [eslint-plugin-unused-imports](https://npmjs.com/eslint-plugin-unused-imports) (`unused-imports`) | Since v0.7.0 |
|
|
379
|
+
| `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` |
|
|
380
|
+
| `preferArrowFunctions` | ❌ | [eslint-plugin-prefer-arrow-functions](https://npmjs.com/eslint-plugin-prefer-arrow-functions) (`prefer-arrow-functions`) | Since v0.1.0 |
|
|
381
|
+
| `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 |
|
|
382
|
+
| `deMorgan` | ❌ | [eslint-plugin-de-morgan](https://npmjs.com/eslint-plugin-de-morgan) (`de-morgan`) | Since v0.5.0 |
|
|
383
|
+
| `es` | ❌ | [eslint-plugin-es-x](https://npmjs.com/eslint-plugin-es-x) (`es-x`) | Since v0.10.0 |
|
|
384
|
+
| `jsInline` | ✅ | [eslint-plugin-html](https://npmjs.com/eslint-plugin-html) (`html`) | Since v0.10.0<br>For linting inlined JS in HTML files |
|
|
385
|
+
| `math` | ✅ | [eslint-plugin-math](https://npmjs.com/eslint-plugin-math) (`math`) | Since v1.0.0 |
|
|
386
|
+
| `erasableSyntaxOnly` | ❌ | [eslint-plugin-erasable-syntax-only](https://npmjs.com/eslint-plugin-erasable-syntax-only) (`erasable-syntax-only`) | Since v1.0.0 |
|
|
387
|
+
| `noUnnecessaryAbstractions` | ✅ | [eslint-plugin-unnecessary-abstractions](https://npmjs.com/eslint-plugin-unnecessary-abstractions) (`unnecessary-abstractions`) | Since v1.0.0 |
|
|
388
|
+
| `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 |
|
|
389
|
+
| `moduleInterop` | ✅ | [eslint-plugin-module-interop](https://npmjs.com/eslint-plugin-module-interop) (`module-interop`) | Since v1.0.0 |
|
|
390
|
+
| `treeShaking` | ❌ | [eslint-plugin-tree-shaking](https://npmjs.com/eslint-plugin-tree-shaking) (`tree-shaking`) | Since v1.0.0 |
|
|
391
|
+
| `e18e` | ❌ | [@e18e/eslint-plugin](https://npmjs.com/@e18e/eslint-plugin) | Since v1.0.0 |
|
|
392
|
+
| `e18e/modernization` | ✅ | ^ | |
|
|
393
|
+
| `e18e/moduleReplacements` | ✅ | ^ | |
|
|
394
|
+
| `e18e/performanceImprovements` | ✅ | ^ | |
|
|
395
|
+
| `e18e/performanceImprovements/typescript` | ✅ (`ts` config is enabled) | ^ | |
|
|
396
|
+
| `barrelFiles` | ❌ | [eslint-plugin-barrel-files](https://npmjs.com/eslint-plugin-barrel-files) (`barrel-files`) | Since v1.0.0 |
|
|
357
397
|
|
|
358
398
|
### Libraries
|
|
359
399
|
|
|
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 |
|
|
403
|
+
| `jest/extended` | ✅ (`jest-extended` is installed) | [eslint-plugin-jest-extended](https://npmjs.com/eslint-plugin-jest-extended) (`jest-extended`) | - |
|
|
404
|
+
| `jest/typescript` | ✅ (`ts` config is enabled) | [eslint-plugin-jest](https://npmjs.com/eslint-plugin-jest) (`jest`) | Only TypeScript-specific rules from `eslint-plugin-jest` |
|
|
405
|
+
| `jest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
406
|
+
| `vitest` | ✅ (`vitest` is installed) | [@vitest/eslint-plugin](https://npmjs.com/@vitest/eslint-plugin) (`vitest`) | Since v0.3.0 |
|
|
407
|
+
| `vitest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
408
|
+
| `jestDom` | ✅ (`@testing-library/jest-dom` is installed) | [eslint-plugin-jest-dom](https://npmjs.com/eslint-plugin-jest-dom) (`jest-dom`) | Since v1.0.0 |
|
|
409
|
+
| `ava` | ✅ (`ava` is installed) | [eslint-plugin-ava](https://npmjs.com/eslint-plugin-ava) (`ava`) | Since v1.0.0 |
|
|
410
|
+
| `ava/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
411
|
+
| `qunit` | ✅ (`qunit` is installed) | [eslint-plugin-qunit](https://npmjs.com/eslint-plugin-qunit) (`qunit`) | Since v1.0.0 |
|
|
412
|
+
| `qunit/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
413
|
+
| ![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 |
|
|
414
|
+
| ![Testing Library] `testingLibrary/angular` | ✅ (`angular` config is enabled) | ^ | Since v1.0.0 |
|
|
415
|
+
| ![Testing Library] `testingLibrary/marko` | ✅ (`marko` is installed) | ^ | Since v1.0.0 |
|
|
416
|
+
| ![Testing Library] `testingLibrary/react` | ✅ (`react` config is enabled) | ^ | Since v1.0.0 |
|
|
417
|
+
| ![Testing Library] `testingLibrary/svelte` | ✅ (`svelte` config is enabled) | ^ | Since v1.0.0 |
|
|
418
|
+
| ![Testing Library] `testingLibrary/vue` | ✅ (`vue` config is enabled) | ^ | Since v1.0.0 |
|
|
419
|
+
| ![Testing Library] `testingLibrary/*/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
420
|
+
| `noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
421
|
+
|  `tanstackQuery` | ✅ (`@tanstack/query-core` is installed) | [@tanstack/eslint-plugin-query](https://npmjs.com/@tanstack/eslint-plugin-query) (`@tanstack/query`) | Since v1.0.0 |
|
|
422
|
+
|  `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 |
|
|
423
|
+
|  `storybook` | ✅ (`storybook` is installed) | [eslint-plugin-storybook](https://npmjs.com/eslint-plugin-storybook) (`storybook`) | Since v1.0.0 |
|
|
424
|
+
|  `cypress` | ✅ (`cypress` is installed) | [eslint-plugin-cypress](https://npmjs.com/eslint-plugin-cypress) (`cypress`) | Since v1.0.0 |
|
|
425
|
+
|  `cypress/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
426
|
+
|  `mocha` | ✅ (`mocha` is installed) | [eslint-plugin-mocha](https://npmjs.com/eslint-plugin-mocha) (`mocha`) | Since v1.0.0 |
|
|
427
|
+
|  `mocha/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
428
|
+
|  `turbo` | ✅ (`turbo` is installed) | [eslint-plugin-turbo](https://npmjs.com/eslint-plugin-turbo) (`turbo`) | Since v1.0.0 |
|
|
429
|
+
|  `playwright` | ✅ (`playwright` is installed) | [eslint-plugin-playwright](https://npmjs.com/eslint-plugin-playwright) (`playwright`) | Since v1.0.0 |
|
|
430
|
+
|  `playwright/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
|
|
431
|
+
|  `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 |
|
|
432
|
+
|  `rxjs` | ✅ (`rxjs` is installed) | [@smarttools/eslint-plugin-rxjs](https://npmjs.com/@smarttools/eslint-plugin-rxjs) (`rxjs`) | Since v1.0.0 |
|
|
433
|
+
|  `nx` | ✅ (`nx` is installed) | [@nx/eslint-plugin](https://npmjs.com/@nx/eslint-plugin) (`nx`) | Since v1.0.0 |
|
|
434
|
+
|  `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 |
|
|
435
|
+
|  `unocss` | ✅ (`unocss` is installed) | [@unocss/eslint-plugin](https://npmjs.com/@unocss/eslint-plugin) (`unocss`) | Since v1.0.0 |
|
|
436
|
+
|  `zod` | ✅ (`zod@>=4` is installed) | [eslint-plugin-zod-x](https://npmjs.com/eslint-plugin-zod-x) (`zod`) | Since v1.0.0 |
|
|
437
|
+
|  `formatJs` | ✅ (`@formatjs/icu-messageformat-parser` is installed) | [eslint-plugin-formatjs](https://npmjs.com/eslint-plugin-formatjs) (`formatjs`) | Since v1.0.0 |
|
|
438
|
+
|  `docusaurus` | ✅ (`@docusaurus/core` is installed) | [@docusaurus/eslint-plugin](https://npmjs.com/@docusaurus/eslint-plugin) (`docusaurus`) | Since v1.0.0 |
|
|
439
|
+
| `clsx` | ✅ (`clsx` is installed) | [eslint-plugin-clsx](https://npmjs.com/eslint-plugin-clsx) (`clsx`) | Since v1.0.0 |
|
|
398
440
|
|
|
399
441
|
### Miscellaneous
|
|
400
442
|
|
|
@@ -417,6 +459,10 @@ In the following table, Sub-configs have `/` in their names.
|
|
|
417
459
|
| `expectType` | ❌ | [eslint-plugin-expect-type](https://npmjs.com/eslint-plugin-expect-type) (`expect-type`) | Since v1.0.0 |
|
|
418
460
|
| `command` | ❌ | [eslint-plugin-command](https://npmjs.com/eslint-plugin-command) (`command`) | Since v1.0.0 |
|
|
419
461
|
| `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. |
|
|
462
|
+
| `sql` | ❌ | [eslint-plugin-sql](https://npmjs.com/eslint-plugin-sql) (`sql`) | Since v1.0.0 |
|
|
463
|
+
| `format` | ❌ | [eslint-plugin-format](https://npmjs.com/eslint-plugin-format) (`format`) | Since v1.0.0<br>📚 Supports multiple configs |
|
|
464
|
+
| `lockfile` | ❌ | [eslint-plugin-lockfile](https://npmjs.com/eslint-plugin-lockfile) (`lockfile`) | Since v1.0.0 |
|
|
465
|
+
|  `githubActions` | ✅ (`.github/workflows` directory exists) | [eslint-plugin-github-action](https://npmjs.com/eslint-plugin-github-action) (`github-actions`) | Since v1.0.0 |
|
|
420
466
|
|
|
421
467
|
## How to use
|
|
422
468
|
|
|
@@ -497,16 +543,19 @@ If you would like to rename them back or rename some other plugins, you can use
|
|
|
497
543
|
|
|
498
544
|
#### Default renames
|
|
499
545
|
|
|
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)
|
|
546
|
+
| Plugin | Suggested prefix | Our prefix | Reason |
|
|
547
|
+
| ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
548
|
+
| [`typescript-eslint`](https://npmjs.com/typescript-eslint) | `@typescript-eslint` | `ts` | More concise and convenient to use |
|
|
549
|
+
| [`eslint-plugin-import-x`] | `import-x` | `import` | This plugin is a fork and is meant to replace the original plugin with `import` prefix |
|
|
550
|
+
| [`eslint-plugin-n`](https://npmjs.com/eslint-plugin-n) | `n` | `node` | Same ^ |
|
|
551
|
+
| [`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 |
|
|
552
|
+
| [`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 |
|
|
553
|
+
| [`eslint-plugin-zod-x`](https://npmjs.com/eslint-plugin-zod-x) | `zod-x` | `zod` | Better replacement for an existing `eslint-plugin-zod` plugin |
|
|
554
|
+
| [`@docusaurus/eslint-plugin`](https://npmjs.com/@docusaurus/eslint-plugin) | `@docusaurus` | `docusaurus` | `@` feels unnecessary |
|
|
555
|
+
| [`@darraghor/eslint-plugin-nestjs-typed`](https://npmjs.com/@darraghor/eslint-plugin-nestjs-typed) | `@darraghor/nestjs-typed` | `nestjs` | More concise and convenient to use |
|
|
556
|
+
| [`@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 |
|
|
557
|
+
| [`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) |
|
|
558
|
+
| [`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
559
|
|
|
511
560
|
> [!NOTE]
|
|
512
561
|
> 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.
|
|
@@ -783,6 +832,10 @@ Please refer to JSDoc of exported symbols for proper documentation.
|
|
|
783
832
|
Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
|
|
784
833
|
Please refer to [the package documentation](https://github.com/bradzacher/eslint-no-restricted#readme) for more info.
|
|
785
834
|
|
|
835
|
+
### `globs` entrypoint
|
|
836
|
+
|
|
837
|
+
Exports various globs that can be useful for specifying `files` or `ignores` ESLint config options.
|
|
838
|
+
|
|
786
839
|
## FAQ
|
|
787
840
|
|
|
788
841
|
### How do I add my own flat configs?
|
|
@@ -807,6 +860,18 @@ All the configs are placed inside `src/configs` directory.
|
|
|
807
860
|
|
|
808
861
|
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
862
|
|
|
863
|
+
> [!WARNING]
|
|
864
|
+
> This tool replicates the Node.JS resolution algorithm, so there might be false positives
|
|
865
|
+
> on package detection if your dependencies are installed in such a way that non-direct dependencies
|
|
866
|
+
> can be resolved.
|
|
867
|
+
>
|
|
868
|
+
> If this is the case, at least 2 additional packages will be considered detected as installed
|
|
869
|
+
> regardless of whether they are actually installed in the root of your project, because they are
|
|
870
|
+
> sub-dependencies of eslint-config-un's direct dependencies:
|
|
871
|
+
>
|
|
872
|
+
> - `typescript` (enables `ts` config and friends);
|
|
873
|
+
> - `prettier` (causes Prettier-incompatible rules to be disabled).
|
|
874
|
+
|
|
810
875
|
### How can I know which configs will be enabled, for which rules autofix will be disabled, etc.?
|
|
811
876
|
|
|
812
877
|
You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
|
|
@@ -842,6 +907,8 @@ Before committing, please do also run tests, formatter, other linters and tools
|
|
|
842
907
|
4. Perform the following two steps in any order:
|
|
843
908
|
1. Enable stylistic rules only and fix them automatically (if you wish to do so) by running ESLint with `--fix --fix-type problem,suggestion,layout` (the latter flag ensures auto removal of "unused" `eslint-disable` comments will not happen):
|
|
844
909
|
|
|
910
|
+
<!-- eslint-skip -->
|
|
911
|
+
|
|
845
912
|
```ts
|
|
846
913
|
// ...
|
|
847
914
|
configs: {
|
package/dist/config-un/cache.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createTraverser, groupBy, isObject, isPlainObject, omit, readAndParseJson, readFileSafe } from "../utils.mjs";
|
|
2
|
+
import * as findUp from "empathic/find";
|
|
2
3
|
import fs from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import crypto from "node:crypto";
|
|
5
|
-
import * as findUp from "empathic/find";
|
|
6
6
|
import * as packageUtils from "empathic/package";
|
|
7
7
|
import { LOCKS } from "package-manager-detector/constants";
|
|
8
8
|
import { exec } from "tinyexec";
|
|
@@ -69,7 +69,7 @@ const saveCacheToFs = async (context, cacheData) => {
|
|
|
69
69
|
key: cacheKey,
|
|
70
70
|
...cacheData,
|
|
71
71
|
usedParsers: Object.fromEntries(cacheData.usedParsers.entries()),
|
|
72
|
-
usedPackages: Object.fromEntries(
|
|
72
|
+
usedPackages: Object.fromEntries(Array.from(cacheData.usedPackages.entries(), ([packageId, entries]) => [packageId, entries.map((info) => ({
|
|
73
73
|
...omit(info, ["valueTransformFn", "path"]),
|
|
74
74
|
property: [info.path, info.property].filter(Boolean).join("."),
|
|
75
75
|
...info.valueTransformFn && { valueTransformFn: [info.valueTransformFn.fn.toString(), info.valueTransformFn.scope] }
|
|
@@ -3,13 +3,14 @@ import semver from "semver";
|
|
|
3
3
|
|
|
4
4
|
//#region src/config-un/config-utils.ts
|
|
5
5
|
const CONFIGS_MISC_GROUP_DISABLED_BY_DEFAULT = new Set([
|
|
6
|
-
"
|
|
7
|
-
"yaml",
|
|
8
|
-
"toml",
|
|
6
|
+
"e18e",
|
|
9
7
|
"json",
|
|
10
8
|
"jsonSchemaValidator",
|
|
9
|
+
"lockfile",
|
|
11
10
|
"nodeDependencies",
|
|
12
|
-
"
|
|
11
|
+
"security",
|
|
12
|
+
"toml",
|
|
13
|
+
"yaml"
|
|
13
14
|
]);
|
|
14
15
|
const CONFIGS_TO_NOT_REPORT_IF_UNNECESSARILY_ENABLED_OR_DISABLED = new Set(["fileProgress"]);
|
|
15
16
|
function getIsConfigEnabled(configName, defaultConditionOrPackageInstalled = true, { preCondition, requireAllListedPackagesToBeInstalled } = {}) {
|