eslint-config-un 1.0.0-beta.0 → 1.0.0-beta.2

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.
Files changed (248) hide show
  1. package/README.md +229 -87
  2. package/dist/config-un/cache.mjs +133 -0
  3. package/dist/config-un/config-utils.mjs +76 -0
  4. package/dist/config-un/config.mjs +467 -0
  5. package/dist/config-un/fast-import.d.mts +14 -0
  6. package/dist/config-un/fast-import.mjs +35 -0
  7. package/dist/config-un/is-module-loaded.mjs +21 -0
  8. package/dist/config-un/resolve-config-async-data.mjs +198 -0
  9. package/dist/config-un/shared.d.mts +250 -0
  10. package/dist/config-un/shared.mjs +23 -0
  11. package/dist/configs/angular.d.mts +151 -0
  12. package/dist/{angular.mjs → configs/angular.mjs} +7 -5
  13. package/dist/configs/antfu.d.mts +8 -0
  14. package/dist/configs/antfu.mjs +20 -0
  15. package/dist/configs/astro.d.mts +20 -0
  16. package/dist/{astro.mjs → configs/astro.mjs} +6 -4
  17. package/dist/configs/ava.d.mts +26 -0
  18. package/dist/{ava.mjs → configs/ava.mjs} +4 -4
  19. package/dist/configs/better-tailwind.d.mts +67 -0
  20. package/dist/{better-tailwind.mjs → configs/better-tailwind.mjs} +3 -3
  21. package/dist/configs/boundaries.d.mts +18 -0
  22. package/dist/configs/boundaries.mjs +18 -0
  23. package/dist/configs/case-police.d.mts +8 -0
  24. package/dist/{case-police.mjs → configs/case-police.mjs} +3 -3
  25. package/dist/configs/check-file.d.mts +31 -0
  26. package/dist/configs/check-file.mjs +22 -0
  27. package/dist/configs/command.d.mts +8 -0
  28. package/dist/configs/command.mjs +17 -0
  29. package/dist/configs/compat.d.mts +24 -0
  30. package/dist/{compat.mjs → configs/compat.mjs} +3 -3
  31. package/dist/configs/cspell.d.mts +13 -0
  32. package/dist/{cspell.mjs → configs/cspell.mjs} +3 -3
  33. package/dist/configs/css-in-js.d.mts +49 -0
  34. package/dist/{css-in-js.mjs → configs/css-in-js.mjs} +3 -3
  35. package/dist/configs/css.d.mts +40 -0
  36. package/dist/{css.mjs → configs/css.mjs} +5 -4
  37. package/dist/configs/cypress.d.mts +9 -0
  38. package/dist/{cypress.mjs → configs/cypress.mjs} +4 -4
  39. package/dist/configs/de-morgan.d.mts +8 -0
  40. package/dist/{de-morgan.mjs → configs/de-morgan.mjs} +3 -3
  41. package/dist/configs/depend.d.mts +13 -0
  42. package/dist/{depend.mjs → configs/depend.mjs} +3 -3
  43. package/dist/configs/docusaurus.d.mts +8 -0
  44. package/dist/configs/docusaurus.mjs +20 -0
  45. package/dist/configs/ember.d.mts +25 -0
  46. package/dist/{ember.mjs → configs/ember.mjs} +4 -4
  47. package/dist/configs/erasable-syntax-only.d.mts +19 -0
  48. package/dist/{erasable-syntax-only.mjs → configs/erasable-syntax-only.mjs} +3 -3
  49. package/dist/configs/es.d.mts +59 -0
  50. package/dist/{es2.mjs → configs/es.mjs} +5 -4
  51. package/dist/configs/eslint-comments.d.mts +8 -0
  52. package/dist/{eslint-comments.mjs → configs/eslint-comments.mjs} +3 -3
  53. package/dist/configs/eslint-plugin.d.mts +34 -0
  54. package/dist/{eslint-plugin.mjs → configs/eslint-plugin.mjs} +4 -4
  55. package/dist/configs/expect-type.d.mts +13 -0
  56. package/dist/configs/expect-type.mjs +21 -0
  57. package/dist/configs/extra/cli.d.mts +14 -0
  58. package/dist/{cli.mjs → configs/extra/cli.mjs} +3 -3
  59. package/dist/configs/extra/cloudfront-functions.d.mts +14 -0
  60. package/dist/{cloudfront-functions.mjs → configs/extra/cloudfront-functions.mjs} +4 -4
  61. package/dist/configs/extra/no-stylistic-rules.d.mts +782 -0
  62. package/dist/configs/extra/no-stylistic-rules.mjs +758 -0
  63. package/dist/configs/fast-import.d.mts +27 -0
  64. package/dist/{fast-import.mjs → configs/fast-import.mjs} +3 -3
  65. package/dist/configs/file-progress.d.mts +29 -0
  66. package/dist/{file-progress.mjs → configs/file-progress.mjs} +4 -3
  67. package/dist/configs/formatjs.d.mts +67 -0
  68. package/dist/{formatjs.mjs → configs/formatjs.mjs} +3 -3
  69. package/dist/configs/graphql.d.mts +46 -0
  70. package/dist/{graphql.mjs → configs/graphql.mjs} +6 -4
  71. package/dist/configs/header.d.mts +33 -0
  72. package/dist/{header.mjs → configs/header.mjs} +3 -3
  73. package/dist/configs/headers.d.mts +38 -0
  74. package/dist/{headers.mjs → configs/headers.mjs} +3 -3
  75. package/dist/configs/html.d.mts +43 -0
  76. package/dist/{html.mjs → configs/html.mjs} +4 -4
  77. package/dist/configs/import-zod.d.mts +8 -0
  78. package/dist/{import-zod.mjs → configs/import-zod.mjs} +3 -3
  79. package/dist/configs/import.d.mts +62 -0
  80. package/dist/{import.mjs → configs/import.mjs} +6 -7
  81. package/dist/configs/index.d.mts +1116 -0
  82. package/dist/configs/index.mjs +3 -0
  83. package/dist/configs/jest-dom.d.mts +8 -0
  84. package/dist/configs/jest-dom.mjs +22 -0
  85. package/dist/configs/jest.d.mts +125 -0
  86. package/dist/{jest.mjs → configs/jest.mjs} +6 -5
  87. package/dist/configs/js-inline.d.mts +81 -0
  88. package/dist/{js-inline.mjs → configs/js-inline.mjs} +5 -4
  89. package/dist/configs/js.d.mts +14 -0
  90. package/dist/{js.mjs → configs/js.mjs} +3 -3
  91. package/dist/configs/jsdoc.d.mts +160 -0
  92. package/dist/{jsdoc.mjs → configs/jsdoc.mjs} +3 -3
  93. package/dist/configs/json-schema-validator.d.mts +26 -0
  94. package/dist/{json-schema-validator.mjs → configs/json-schema-validator.mjs} +4 -4
  95. package/dist/configs/jsonc.d.mts +30 -0
  96. package/dist/{jsonc.mjs → configs/jsonc.mjs} +4 -4
  97. package/dist/configs/jsx-a11y.d.mts +206 -0
  98. package/dist/{jsx-a11y.mjs → configs/jsx-a11y.mjs} +3 -3
  99. package/dist/configs/lit.d.mts +51 -0
  100. package/dist/{lit.mjs → configs/lit.mjs} +3 -3
  101. package/dist/configs/markdown-links.d.mts +24 -0
  102. package/dist/{markdown-links.mjs → configs/markdown-links.mjs} +3 -3
  103. package/dist/configs/markdown-preferences.d.mts +138 -0
  104. package/dist/configs/markdown-preferences.mjs +66 -0
  105. package/dist/configs/markdown.d.mts +96 -0
  106. package/dist/{markdown.mjs → configs/markdown.mjs} +23 -10
  107. package/dist/configs/math.d.mts +14 -0
  108. package/dist/{math.mjs → configs/math.mjs} +3 -3
  109. package/dist/configs/mdx.d.mts +25 -0
  110. package/dist/{mdx.mjs → configs/mdx.mjs} +6 -5
  111. package/dist/configs/mocha.d.mts +35 -0
  112. package/dist/{mocha.mjs → configs/mocha.mjs} +4 -4
  113. package/dist/configs/module-interop.d.mts +8 -0
  114. package/dist/configs/module-interop.mjs +17 -0
  115. package/dist/configs/nest-js.d.mts +8 -0
  116. package/dist/configs/nest-js.mjs +20 -0
  117. package/dist/configs/nextjs.d.mts +22 -0
  118. package/dist/{nextjs.mjs → configs/nextjs.mjs} +3 -3
  119. package/dist/configs/no-only-tests.d.mts +8 -0
  120. package/dist/{no-only-tests.mjs → configs/no-only-tests.mjs} +4 -4
  121. package/dist/configs/no-secrets.d.mts +24 -0
  122. package/dist/configs/no-secrets.mjs +33 -0
  123. package/dist/configs/no-unsanitized.d.mts +8 -0
  124. package/dist/{no-unsanitized.mjs → configs/no-unsanitized.mjs} +3 -3
  125. package/dist/configs/node-dependencies.d.mts +19 -0
  126. package/dist/{node-dependencies.mjs → configs/node-dependencies.mjs} +3 -3
  127. package/dist/configs/node.d.mts +157 -0
  128. package/dist/{node.mjs → configs/node.mjs} +3 -3
  129. package/dist/configs/nx.d.mts +13 -0
  130. package/dist/{nx.mjs → configs/nx.mjs} +3 -3
  131. package/dist/configs/package-json.d.mts +80 -0
  132. package/dist/{package-json.mjs → configs/package-json.mjs} +3 -3
  133. package/dist/configs/perfectionist.d.mts +101 -0
  134. package/dist/{perfectionist.mjs → configs/perfectionist.mjs} +3 -3
  135. package/dist/configs/playwright.d.mts +44 -0
  136. package/dist/{playwright.mjs → configs/playwright.mjs} +4 -4
  137. package/dist/configs/pnpm.d.mts +56 -0
  138. package/dist/{pnpm.mjs → configs/pnpm.mjs} +10 -7
  139. package/dist/configs/prefer-arrow-functions.d.mts +8 -0
  140. package/dist/{prefer-arrow-functions.mjs → configs/prefer-arrow-functions.mjs} +3 -3
  141. package/dist/configs/promise.d.mts +8 -0
  142. package/dist/{promise.mjs → configs/promise.mjs} +3 -3
  143. package/dist/configs/qunit.d.mts +9 -0
  144. package/dist/{qunit.mjs → configs/qunit.mjs} +4 -4
  145. package/dist/configs/qwik.d.mts +10 -0
  146. package/dist/{qwik.mjs → configs/qwik.mjs} +3 -3
  147. package/dist/configs/react.d.mts +330 -0
  148. package/dist/{react.mjs → configs/react.mjs} +4 -4
  149. package/dist/configs/regexp.d.mts +8 -0
  150. package/dist/{regexp.mjs → configs/regexp.mjs} +3 -3
  151. package/dist/configs/rxjs.d.mts +34 -0
  152. package/dist/{rxjs.mjs → configs/rxjs.mjs} +3 -3
  153. package/dist/configs/security.d.mts +8 -0
  154. package/dist/{security.mjs → configs/security.mjs} +3 -3
  155. package/dist/configs/shared.d.mts +42 -0
  156. package/dist/{shared.mjs → configs/shared.mjs} +8 -3
  157. package/dist/configs/solid.d.mts +8 -0
  158. package/dist/{solid.mjs → configs/solid.mjs} +3 -3
  159. package/dist/configs/sonar.d.mts +24 -0
  160. package/dist/{sonar.mjs → configs/sonar.mjs} +3 -3
  161. package/dist/configs/storybook.d.mts +8 -0
  162. package/dist/{storybook.mjs → configs/storybook.mjs} +3 -3
  163. package/dist/configs/stylistic.d.mts +17 -0
  164. package/dist/{stylistic.mjs → configs/stylistic.mjs} +5 -4
  165. package/dist/configs/svelte.d.mts +81 -0
  166. package/dist/{svelte.mjs → configs/svelte.mjs} +7 -5
  167. package/dist/configs/tailwind.d.mts +29 -0
  168. package/dist/{tailwind.mjs → configs/tailwind.mjs} +3 -3
  169. package/dist/configs/tanstack-query.d.mts +8 -0
  170. package/dist/{tanstack-query.mjs → configs/tanstack-query.mjs} +3 -3
  171. package/dist/configs/testing-library.d.mts +76 -0
  172. package/dist/{testing-library.mjs → configs/testing-library.mjs} +4 -4
  173. package/dist/configs/toml.d.mts +34 -0
  174. package/dist/{toml.mjs → configs/toml.mjs} +6 -6
  175. package/dist/configs/tree-shaking.d.mts +13 -0
  176. package/dist/configs/tree-shaking.mjs +21 -0
  177. package/dist/configs/ts.d.mts +136 -0
  178. package/dist/{ts.mjs → configs/ts.mjs} +6 -5
  179. package/dist/configs/turbo.d.mts +14 -0
  180. package/dist/{turbo.mjs → configs/turbo.mjs} +3 -3
  181. package/dist/configs/un.d.mts +8 -0
  182. package/dist/configs/un.mjs +17 -0
  183. package/dist/configs/unicorn.d.mts +21 -0
  184. package/dist/{unicorn.mjs → configs/unicorn.mjs} +3 -3
  185. package/dist/configs/unnecessary-abstractions.d.mts +8 -0
  186. package/dist/{unnecessary-abstractions.mjs → configs/unnecessary-abstractions.mjs} +3 -3
  187. package/dist/configs/unocss.d.mts +8 -0
  188. package/dist/{unocss.mjs → configs/unocss.mjs} +3 -3
  189. package/dist/configs/unused-imports.d.mts +17 -0
  190. package/dist/{unused-imports.mjs → configs/unused-imports.mjs} +3 -3
  191. package/dist/configs/vitest.d.mts +65 -0
  192. package/dist/configs/vitest.mjs +61 -0
  193. package/dist/configs/vue.d.mts +225 -0
  194. package/dist/{vue.mjs → configs/vue.mjs} +7 -6
  195. package/dist/configs/web-components.d.mts +21 -0
  196. package/dist/{web-components.mjs → configs/web-components.mjs} +3 -3
  197. package/dist/configs/yaml.d.mts +36 -0
  198. package/dist/{yaml.mjs → configs/yaml.mjs} +6 -6
  199. package/dist/configs/you-dont-need-lodash-underscore.d.mts +15 -0
  200. package/dist/{you-dont-need-lodash-underscore.mjs → configs/you-dont-need-lodash-underscore.mjs} +3 -3
  201. package/dist/configs/zod.d.mts +46 -0
  202. package/dist/configs/zod.mjs +32 -0
  203. package/dist/constants.d.mts +12 -0
  204. package/dist/constants.mjs +8 -75
  205. package/dist/{no-stylistic-rules.mjs → eslint-rules.gen.mjs} +182 -833
  206. package/dist/eslint-types-fixable-only.gen.d.mts +4 -0
  207. package/dist/eslint-types-per-plugin.gen.d.mts +33537 -0
  208. package/dist/eslint-types.gen.d.mts +33076 -0
  209. package/dist/eslint.d.mts +35 -74262
  210. package/dist/eslint.mjs +67 -44
  211. package/dist/index.d.mts +5 -1
  212. package/dist/index.mjs +5 -889
  213. package/dist/loaders/index.d.mts +3 -0
  214. package/dist/loaders/index.mjs +5 -0
  215. package/dist/loaders/packages.d.mts +54 -0
  216. package/dist/loaders/packages.mjs +34 -0
  217. package/dist/loaders/parsers.d.mts +28 -0
  218. package/dist/loaders/parsers.mjs +19 -0
  219. package/dist/loaders/plugins.d.mts +3720 -0
  220. package/dist/{loaders.mjs → loaders/plugins.mjs} +15 -80
  221. package/dist/loaders/shared.d.mts +15 -0
  222. package/dist/loaders/shared.mjs +34 -0
  223. package/dist/node_modules/import-meta-resolve/index.mjs +34 -0
  224. package/dist/node_modules/import-meta-resolve/lib/errors.mjs +342 -0
  225. package/dist/node_modules/import-meta-resolve/lib/get-format.mjs +109 -0
  226. package/dist/node_modules/import-meta-resolve/lib/package-json-reader.mjs +102 -0
  227. package/dist/node_modules/import-meta-resolve/lib/resolve.mjs +681 -0
  228. package/dist/node_modules/import-meta-resolve/lib/utils.mjs +32 -0
  229. package/dist/node_modules/is-in-editor/dist/index.mjs +192 -0
  230. package/dist/package.mjs +82 -0
  231. package/dist/plugin-un/index.mjs +17 -0
  232. package/dist/plugin-un/rules/no-multiple-consecutive-spaces.mjs +50 -0
  233. package/dist/plugin-un/rules/no-typeof-like-comparisons.mjs +72 -0
  234. package/dist/plugin-un/rules/prefer-early-return.mjs +58 -0
  235. package/dist/snippets.d.mts +7 -3
  236. package/dist/snippets.mjs +4 -3
  237. package/dist/types.d.mts +9 -0
  238. package/dist/utils.d.mts +27 -0
  239. package/dist/utils.mjs +13 -1471
  240. package/package.json +123 -70
  241. package/dist/check-file.mjs +0 -21
  242. package/dist/configs.mjs +0 -1
  243. package/dist/es.mjs +0 -6
  244. package/dist/markdown-preferences.mjs +0 -57
  245. package/dist/plugin-un.mjs +0 -181
  246. package/dist/un.mjs +0 -20
  247. package/dist/vitest.mjs +0 -53
  248. package/dist/zod.mjs +0 -23
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 (50+ in total):
7
+ - **Every major plugin** is included (100+ in total):
8
8
  [![JavaScript](./assets/devicon-javascript.svg) 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,14 +42,19 @@ 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. We aim to update the dependencies within 1 month after their release. You can always override plugins' implementation with [`pluginOverrides` option](#pluginoverrides) or using your package manager's overrides functionality.
45
+ Commonly used plugins are direct dependencies of this package, you don't need to install them separately.
46
+ We aim to update the dependencies within 1 month after their release.
47
+ You can always override plugins' implementation with [`pluginOverrides` option](#pluginoverrides) or using your package manager's overrides functionality.
46
48
 
47
- 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. You need to run ESLint with our config once to find out which plugins should be installed manually.
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
+ You need to run ESLint with our config once to find out which plugins should be installed manually.
48
51
 
49
52
  <details>
50
53
  <summary>Installation with Yarn Classic (v1)</summary>
51
54
 
52
- 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. It fails with "Tarball is not in network and can not be located in cache" error. Installing directly from the tarball does work:
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
+ It fails with "Tarball is not in network and can not be located in cache" error.
57
+ Installing directly from the tarball does work:
53
58
 
54
59
  ```sh
55
60
  yarn add -D https://registry.npmjs.org/eslint-config-un/-/eslint-config-un-<VERSION>.tgz eslint@latest
@@ -67,6 +72,8 @@ Note that if you're using custom registry, the URL should be changed accordingly
67
72
  | `@angular-eslint/eslint-plugin-template` | `@angular-eslint/template` |
68
73
  | `@angular-eslint/eslint-plugin` | `@angular-eslint` |
69
74
  | `@cspell/eslint-plugin` | `@cspell` |
75
+ | `@darraghor/eslint-plugin-nestjs-typed` | `nestjs` |
76
+ | `@docusaurus/eslint-plugin` | `docusaurus` |
70
77
  | `@eslint-react/eslint-plugin` | `@eslint-react` |
71
78
  | `@intlify/eslint-plugin-vue-i18n` | `@intlify/vue-i18n` |
72
79
  | `@next/eslint-plugin-next` | `@next/next` |
@@ -74,13 +81,16 @@ Note that if you're using custom registry, the URL should be changed accordingly
74
81
  | `eslint-plugin-astro` | `astro` |
75
82
  | `eslint-plugin-ava` | `ava` |
76
83
  | `eslint-plugin-better-tailwindcss` | `better-tailwindcss` |
84
+ | `eslint-plugin-boundaries` | `boundaries` |
77
85
  | `eslint-plugin-case-police` | `case-police` |
78
86
  | `eslint-plugin-check-file` | `check-file` |
87
+ | `eslint-plugin-command` | `command` |
79
88
  | `eslint-plugin-de-morgan` | `de-morgan` |
80
89
  | `eslint-plugin-ember` | `ember` |
81
90
  | `eslint-plugin-erasable-syntax-only` | `erasable-syntax-only` |
82
91
  | `eslint-plugin-es-x` | `es` |
83
92
  | `eslint-plugin-eslint-plugin` | `eslint-plugin` |
93
+ | `eslint-plugin-expect-type` | `expect-type` |
84
94
  | `eslint-plugin-fast-import` | `fast-import` |
85
95
  | `@graphql-eslint/eslint-plugin` | `graphql` |
86
96
  | `eslint-plugin-header` | `header` |
@@ -128,18 +138,39 @@ export default eslintConfig({
128
138
  > [!NOTE]
129
139
  > We highly recommend using TypeScript config file, which is supported since ESLint v9.18.0, or [`@ts-check` directive](https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check) at the start of the file otherwise.
130
140
 
131
- ## List of configs
141
+ <!-- eslint-disable-next-line markdown-preferences/heading-casing -->
142
+ ## Configs and Sub-configs
132
143
 
133
- eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs. They are similar to ESLint flat config objects, but with some useful extensions. Every Config is *usually* tied to a one or more ESLint plugins produces one or more ESLint flat config items.
144
+ eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs.
145
+ They are similar to ESLint flat config objects, but with some useful extensions.
146
+ Every Config is *usually* tied to a one or more ESLint plugins produces one or more ESLint flat config items.
134
147
 
135
- You can enable any Config by setting it to `true` or an object with the Config's options. Passing `false` disables the Config. Passing an empty array to `files` disables the Config, but not its' Sub-configs.
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.
150
+ Passing an empty array to `files` disables the Config, but not its' Sub-configs.
136
151
 
137
- <details>
138
- <summary>Config interface & docs</summary>
152
+ Sub-config is a Config located within Config's options.
153
+ If the parent config is disabled by passing `false`, all its' Sub-configs are disabled too.
154
+
155
+ 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`.
156
+
157
+ ### Config (`UnConfig`) interface
139
158
 
140
159
  The Config has the following interface (exact types are simplified for docs):
141
160
 
142
161
  ```ts
162
+ type Severity = 0 | 1 | 2 | 'off' | 'warn' | 'error';
163
+
164
+ type RuleOptions = { /* ... pre-generated all rules' options */ };
165
+
166
+ type UnRuleEntry<RuleName extends string> = Severity | [Severity, RuleOptions[RuleName]] | {
167
+ severity: Severity;
168
+ options?: RuleOptions[RuleName];
169
+ disableAutofix?: boolean;
170
+ files?: string[];
171
+ ignores?: string[];
172
+ }
173
+
143
174
  type UnConfig =
144
175
  | boolean
145
176
  | {
@@ -148,41 +179,74 @@ type UnConfig =
148
179
 
149
180
  [RuleName in ('overrides' | 'overridesAny')]?: {
150
181
  [RuleName in string]:
151
- | Severity
152
- | [Severity, RuleOptions[RuleName]]
182
+ | UnRuleEntry<RuleName>
153
183
  | ((
154
184
  // These are severity and options *maybe* set by eslint-config-un
155
- ourSeverity: Severity,
156
- ourOptions?: RuleOptions[RuleName],
157
- ) => Severity | [Severity, RuleOptions[RuleName]]);
185
+ unRuleSeverity: Severity,
186
+ unRuleOptions?: RuleOptions[RuleName],
187
+ ) => UnRuleEntry<RuleName>);
158
188
  };
159
189
 
160
190
  forceSeverity?: '2' | 'error' | '1' | 'warn';
161
-
162
191
  [`config${string}`]: UnConfig; // These are Sub-configs
163
-
164
192
  [customOptions: string]: unknown; // Custom options, individual for each Config
165
193
  };
166
-
167
- type Severity = 0 | 1 | 2 | 'off' | 'warn' | 'error';
168
194
  ```
169
195
 
170
- </details>
196
+ #### `files` and `ignores`
197
+
198
+ They have exactly the same meaning as the corresponding ESLint flat config item properties, with the only difference being an empty array `[]` handling:
199
+
200
+ - If you specify an empty array for `files`, the Config **will be disabled**, but of its' Sub-configs remain unaffected.
201
+ - If you specify an empty array for `ignores`, the default ignore list won't be used.
202
+
203
+ #### `overrides` and `overridesAny`
204
+
205
+ These are similar to ESLint's `rules`, but with a very important advantage: you can provide a function that will be called with the rule severity and options set by eslint-config-un, which allows you to **granularly override the options** or change the severity of each rule.
171
206
 
172
- <br>
207
+ - The difference between `overrides` and `overridesAny` is that `overridesAny` will allow *any* rule to be overridden (from TypeScript's stand point; technically you can pass any rule to `overrides` too), while `overrides` will only allow those rules which are tied to the config.
208
+ - `overridesAny` will be applied **after** `overrides`.
173
209
 
174
- - Sub-configs are the same as Configs, but configured within Config options. All Sub-configs use `configXXX` naming convention.
175
- - 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`.
176
- - `files` and `ignores` have exactly the same meaning as the corresponding ESLint flat config item properties, with the only difference being an empty array `[]` handling:
177
- - If you specify an empty array for `files`, the Config **will be disabled**, but of its' Sub-configs remain unaffected.
178
- - If you specify an empty array for `ignores`, the default ignore list won't be used.
179
- - `overrides`/`overridesAny` is similar to ESLint's `rules`, but with a very important advantage: you can provide a function that will be called with the rule severity and options set by eslint-config-un, which allows you to **granularly override the options** or change the severity of each rule.
180
- - The difference between `overrides` and `overridesAny` is that `overridesAny` will allow *any* rule to be overridden (from TypeScript's stand point; technically you can pass any rule to `overrides` too), while `overrides` will only allow those rules which are tied to the config.
181
- - `overridesAny` will be applied **after** `overrides`.
182
- - `forceSeverity` allows to bulk override the severity of all the rules not overridden via `overrides` or `overridesAny`.
183
- - Custom options are individual for each Config and are documented in JSDoc format.
210
+ #### Sub-configs
184
211
 
185
- Sub-config is a Config located within Config's options. If the parent config is disabled by passing `false`, all its' Sub-configs are disabled too. In the following table, Sub-configs have `/` in their names.
212
+ Sub-configs are the same as Configs, but configured within Config options.
213
+ All Sub-configs use `configXXX` naming convention.
214
+
215
+ #### `forceSeverity`
216
+
217
+ Allows to bulk override the severity of all the rules not overridden via `overrides` or `overridesAny`.
218
+
219
+ #### Custom options
220
+
221
+ Custom options are individual for each Config and are documented in JSDoc format.
222
+
223
+ ### Rule entry (`UnRuleEntry`) interface
224
+
225
+ #### `severity` and `options`
226
+
227
+ Normal ESLint severity and rule options.
228
+
229
+ #### `disableAutofix`
230
+
231
+ Apply a copy of the rule with `disable-autofix/` prefix and all autofixes disabled.
232
+
233
+ #### `files` and `ignores`
234
+
235
+ Allows to limit to which files only the current rule will be applied.
236
+ Only works if:
237
+
238
+ - At least one of `files` or `ignores` is provided and non-empty;
239
+ - `files` or the current Config is not an empty array.
240
+
241
+ If these conditions are met, a separate Config will be created with:
242
+
243
+ - `name` being the current Config's name with `/@rule/<rule name with prefix>` postfix;
244
+ - `files` [intersected with the parent's `files`](https://eslint.org/docs/latest/use/configure/configuration-files#specifying-files-with-an-and-operation);
245
+ - `ignores` merged with the parent's `ignores`.
246
+
247
+ ## List of configs
248
+
249
+ In the following table, Sub-configs have `/` in their names.
186
250
 
187
251
  ### Most popular and well known
188
252
 
@@ -233,6 +297,7 @@ Sub-config is a Config located within Config's options. If the parent config is
233
297
  | ![Lit](./assets/logos-lit-icon.svg) `lit/a11y` | ✅ | [eslint-plugin-lit-a11y](https://npmjs.com/eslint-plugin-lit-a11y) (`lit-a11y`) | Since v1.0.0 |
234
298
  | ![TailwindCSS] `betterTailwind` | ✅ (`tailwindcss` is installed) | [eslint-plugin-better-tailwindcss](https://npmjs.com/eslint-plugin-better-tailwindcss) (`better-tailwindcss`) | Since v1.0.0<br>Supports v4 and v3 |
235
299
  | ![TailwindCSS] `tailwind` | ❌ | [eslint-plugin-tailwindcss](https://npmjs.com/eslint-plugin-tailwindcss) (`tailwindcss`) | Only supports v3 |
300
+ | ![NestJS](./assets/devicon-nestjs.svg) `nestJs` | ✅ (`@nestjs/core` is installed) | [@darraghor/eslint-plugin-nestjs-typed](https://npmjs.com/@darraghor/eslint-plugin-nestjs-typed) (`nestjs`) | Since v1.0.0 |
236
301
 
237
302
  ### Runtimes & related
238
303
 
@@ -254,6 +319,7 @@ Sub-config is a Config located within Config's options. If the parent config is
254
319
  | ----------------------------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
255
320
  | ![Markdown] `markdown` | ✅ | [@eslint/markdown](https://npmjs.com/@eslint/markdown) (`markdown`) | Since v0.7.0<br>Configured to also lint fenced code blocks inside .md files |
256
321
  | ![Markdown] `markdown/formatFencedCodeBlocks` | ✅ (`prettier` is installed) | [eslint-plugin-prettier](https://npmjs.com/eslint-plugin-prettier) (`prettier`) | Since v1.0.0<br>Format fenced code blocks inside Markdown files using Prettier |
322
+ | ![Markdown] `markdown/sentencesPerLine` | ❌ | [eslint-plugin-sentences-per-line](https://npmjs.com/eslint-plugin-sentences-per-line) (`sentences-per-line`) | Since v1.0.0 |
257
323
  | ![Markdown] `markdownPreferences` | ✅ | [eslint-plugin-markdown-preferences](https://npmjs.com/eslint-plugin-markdown-preferences) (`markdownPreferences`) | Since v1.0.0 |
258
324
  | ![Markdown] `markdownLinks` | ✅ | [eslint-plugin-markdown-links](https://npmjs.com/eslint-plugin-markdown-links) (`markdownLinks`) | Since v1.0.0 |
259
325
  | ![MDX](./assets/vscode-icons-file-type-mdx.svg) `mdx` | ✅ | [eslint-plugin-mdx](https://npmjs.com/eslint-plugin-mdx) (`mdx`) | Since v1.0.0<br>Configured to also lint fenced code blocks inside .mdx files |
@@ -286,6 +352,8 @@ Sub-config is a Config located within Config's options. If the parent config is
286
352
  | `erasableSyntaxOnly` | ❌ | [eslint-plugin-erasable-syntax-only](https://npmjs.com/eslint-plugin-erasable-syntax-only) (`erasable-syntax-only`) | Since v1.0.0 |
287
353
  | `noUnnecessaryAbstractions` | ✅ | [eslint-plugin-unnecessary-abstractions](https://npmjs.com/eslint-plugin-unnecessary-abstractions) (`unnecessary-abstractions`) | Since v1.0.0 |
288
354
  | `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 |
355
+ | `moduleInterop` | ✅ | [eslint-plugin-module-interop](https://npmjs.com/eslint-plugin-module-interop) (`module-interop`) | Since v1.0.0 |
356
+ | `treeShaking` | ❌ | [eslint-plugin-tree-shaking](https://npmjs.com/eslint-plugin-tree-shaking) (`tree-shaking`) | Since v1.0.0 |
289
357
 
290
358
  ### Libraries
291
359
 
@@ -297,6 +365,7 @@ Sub-config is a Config located within Config's options. If the parent config is
297
365
  | `jest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
298
366
  | `vitest` | ✅ (`vitest` is installed) | [@vitest/eslint-plugin](https://npmjs.com/@vitest/eslint-plugin) (`vitest`) | Since v0.3.0 |
299
367
  | `vitest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
368
+ | `jestDom` | ✅ (`@testing-library/jest-dom` is installed) | [eslint-plugin-jest-dom](https://npmjs.com/eslint-plugin-jest-dom) (`jest-dom`) | Since v1.0.0 |
300
369
  | `ava` | ✅ (`ava` is installed) | [eslint-plugin-ava](https://npmjs.com/eslint-plugin-ava) (`ava`) | Since v1.0.0 |
301
370
  | `ava/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests] (`no-only-tests`) | Since v1.0.0 |
302
371
  | `qunit` | ✅ (`qunit` is installed) | [eslint-plugin-qunit](https://npmjs.com/eslint-plugin-qunit) (`qunit`) | Since v1.0.0 |
@@ -325,6 +394,7 @@ Sub-config is a Config located within Config's options. If the parent config is
325
394
  | ![UnoCSS](./assets/logos-unocss.svg) `unocss` | ✅ (`unocss` is installed) | [@unocss/eslint-plugin](https://npmjs.com/@unocss/eslint-plugin) (`unocss`) | Since v1.0.0 |
326
395
  | ![Zod](./assets/logos-zod.svg) `zod` | ✅ (`zod@>=4` is installed) | [eslint-plugin-zod-x](https://npmjs.com/eslint-plugin-zod-x) (`zod`) | Since v1.0.0 |
327
396
  | ![FormatJS](./assets/logos-formatjs.svg) `formatJs` | ✅ (`@formatjs/icu-messageformat-parser` is installed) | [eslint-plugin-formatjs](https://npmjs.com/eslint-plugin-formatjs) (`formatjs`) | Since v1.0.0 |
397
+ | ![Docusaurus](./assets/vscode-icons-file-type-docusaurus.svg) `docusaurus` | ✅ (`@docusaurus/core` is installed) | [@docusaurus/eslint-plugin](https://npmjs.com/@docusaurus/eslint-plugin) (`docusaurus`) | Since v1.0.0 |
328
398
 
329
399
  ### Miscellaneous
330
400
 
@@ -341,6 +411,12 @@ Sub-config is a Config located within Config's options. If the parent config is
341
411
  | `header` | ❌ | [eslint-plugin-header](https://npmjs.com/eslint-plugin-header) (`header`) | Since v1.0.0 |
342
412
  | `headers` | ❌ | [eslint-plugin-headers](https://npmjs.com/eslint-plugin-headers) (`headers`) | Since v1.0.0 |
343
413
  | `checkFile` | ❌ | [eslint-plugin-check-file](https://npmjs.com/eslint-plugin-check-file) (`check-file`) | Since v1.0.0 |
414
+ | `boundaries` | ❌ | [eslint-plugin-boundaries](https://npmjs.com/eslint-plugin-boundaries) (`boundaries`) | Since v1.0.0 |
415
+ | `noSecrets` | ✅ | [eslint-plugin-no-secrets](https://npmjs.com/eslint-plugin-no-secrets) (`no-secrets`) | Since v1.0.0 |
416
+ | `noSecrets/json` | ✅ | ^ | Applied only to `.json` files by default |
417
+ | `expectType` | ❌ | [eslint-plugin-expect-type](https://npmjs.com/eslint-plugin-expect-type) (`expect-type`) | Since v1.0.0 |
418
+ | `command` | ❌ | [eslint-plugin-command](https://npmjs.com/eslint-plugin-command) (`command`) | Since v1.0.0 |
419
+ | `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. |
344
420
 
345
421
  ## How to use
346
422
 
@@ -383,7 +459,8 @@ export default eslintConfig({
383
459
 
384
460
  #### Providing user defined flag configs
385
461
 
386
- You can provide your own configs by using `extraConfigs` option. 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.
462
+ You can provide your own configs by using `extraConfigs` option.
463
+ 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.
387
464
 
388
465
  Example:
389
466
 
@@ -411,20 +488,25 @@ export default eslintConfig({
411
488
 
412
489
  ### Plugin prefixes (`pluginRenames` option)
413
490
 
414
- ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`. Then the rule name are formed by combining the prefix with the rule name, for example `unicorn/no-useless-undefined`.
491
+ ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`.
492
+ Then the rule name are formed by combining the prefix with the rule name, for example `unicorn/no-useless-undefined`.
415
493
 
416
- eslint-config-un provides the ability to change any registered plugin prefix. Additionally, some plugins are registered with a different prefix than their documentation suggests. 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.
494
+ eslint-config-un provides the ability to change any registered plugin prefix.
495
+ Additionally, some plugins are registered with a different prefix than their documentation suggests.
496
+ 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.
417
497
 
418
498
  #### Default renames
419
499
 
420
- | Plugin | Suggested prefix | Our prefix | Reason |
421
- | ------------------------------------------------------------------------ | -------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------- |
422
- | [`typescript-eslint`](https://npmjs.com/typescript-eslint) | `@typescript-eslint` | `ts` | More concise and convenient to use |
423
- | [`eslint-plugin-import-x`] | `import-x` | `import` | This plugin is a fork and is meant to replace the original plugin with `import` prefix |
424
- | [`eslint-plugin-n`](https://npmjs.com/eslint-plugin-n) | `n` | `node` | Same ^ |
425
- | [`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 |
426
- | [`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 |
427
- | [`eslint-plugin-zod-x`](https://npmjs.com/eslint-plugin-zod-x) | `zod-x` | `zod` | Better replacement for an existing `eslint-plugin-zod` plugin |
500
+ | Plugin | Suggested prefix | Our prefix | Reason |
501
+ | -------------------------------------------------------------------------------------------------- | ------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
502
+ | [`typescript-eslint`](https://npmjs.com/typescript-eslint) | `@typescript-eslint` | `ts` | More concise and convenient to use |
503
+ | [`eslint-plugin-import-x`] | `import-x` | `import` | This plugin is a fork and is meant to replace the original plugin with `import` prefix |
504
+ | [`eslint-plugin-n`](https://npmjs.com/eslint-plugin-n) | `n` | `node` | Same ^ |
505
+ | [`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 |
506
+ | [`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 |
507
+ | [`eslint-plugin-zod-x`](https://npmjs.com/eslint-plugin-zod-x) | `zod-x` | `zod` | Better replacement for an existing `eslint-plugin-zod` plugin |
508
+ | [`@docusaurus/eslint-plugin`](https://npmjs.com/@docusaurus/eslint-plugin) | `@docusaurus` | `docusaurus` | `@` feels unnecessary |
509
+ | [`@darraghor/eslint-plugin-nestjs-typed`](https://npmjs.com/@darraghor/eslint-plugin-nestjs-typed) | `@darraghor/nestjs-typed` | `nestjs` | More concise and convenient to use |
428
510
 
429
511
  > [!NOTE]
430
512
  > 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.
@@ -434,7 +516,8 @@ eslint-config-un provides the ability to change any registered plugin prefix. Ad
434
516
 
435
517
  ### Disabling rule autofix
436
518
 
437
- 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. 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.
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.
520
+ 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.
438
521
 
439
522
  #### Globally disabling rule autofix
440
523
 
@@ -490,35 +573,47 @@ export default eslintConfig({
490
573
  });
491
574
  ```
492
575
 
493
- This will technically create a plugin with `disable-autofix` prefix and copy this rule into it. The final rule is going to be given a name `disable-autofix/<rule-name>` which would replace `<rule-name>` entry in the resulting config.
576
+ This will technically create a plugin with `disable-autofix` prefix and copy this rule into it.
577
+ The final rule is going to be given a name `disable-autofix/<rule-name>` which would replace `<rule-name>` entry in the resulting config.
494
578
 
495
579
  ## Configs notes
496
580
 
497
581
  ### TypeScript
498
582
 
499
- 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. It's just a little heads up; you should make your own decision whether to keep them enabled. Use `configTypeAware` to control to which files such rules will be applied to, if any.
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.
584
+ It's just a little heads up; you should make your own decision whether to keep them enabled.
585
+ Use `configTypeAware` to control to which files such rules will be applied to, if any.
500
586
 
501
587
  ### Frontend frameworks
502
588
 
503
- We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version. You can always manually specify the version using an appropriate option. Consult JSDoc of each config for more details.
589
+ We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version.
590
+ You can always manually specify the version using an appropriate option.
591
+ Consult JSDoc of each config for more details.
504
592
 
505
593
  #### Vue
506
594
 
507
- 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. If you have `.vue` files authored in both TypeScript and JavaScript, use `enforceTypescriptInScriptSection.{files,ignores}` to manually specify TS & JS Vue components respectively. It is not currently possible to apply different ESLint rules depending on the value of `lang` attribute of `<script>` SFC section.
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.
597
+ It is not currently possible to apply different ESLint rules depending on the value of `lang` attribute of `<script>` SFC section.
508
598
 
509
599
  #### Angular
510
600
 
511
- We support Angular versions from 13 to 20, all at once. 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. With the latter, you can use the rules added in newer versions of `@angular-eslint/eslint-plugin*` on older Angular codebases.
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.
603
+ With the latter, you can use the rules added in newer versions of `@angular-eslint/eslint-plugin*` on older Angular codebases.
512
604
 
513
605
  #### React
514
606
 
515
- We use rules from several plugins to lint your React code. 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.
607
+ We use rules from several plugins to lint your React code.
608
+ 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.
516
609
 
517
610
  ### Markdown
518
611
 
519
- 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. 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 ```.
612
+ 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
+ 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 ```.
520
614
 
521
- 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). You can find the full list of disabled rules in `src/configs/markdown.ts` file.
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).
616
+ You can find the full list of disabled rules in `src/configs/markdown.ts` file.
522
617
 
523
618
  ### Tailwind CSS
524
619
 
@@ -542,11 +637,14 @@ See [Rules configuration](#rules-configuration-configs-and-extraconfigs-option).
542
637
 
543
638
  ### `ignores`
544
639
 
545
- Specifies a list of globally ignored files. 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`.
640
+ Specifies a list of globally ignored files.
641
+ 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`.
546
642
 
547
643
  ### `extraPlugins`
548
644
 
549
- Allows to provide additional ESLint plugins. Their prefixes and possibly rule names will appear in configs' `rules` property type. They, like all the built-in plugins, by default will be loaded only if used.
645
+ Allows to provide additional ESLint plugins.
646
+ Their prefixes and possibly rule names will appear in configs' `rules` property type.
647
+ They, like all the built-in plugins, by default will be loaded only if used.
550
648
 
551
649
  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).
552
650
 
@@ -556,18 +654,21 @@ Sets [`linterOptions.{noInlineConfig,reportUnusedDisableDirectives,reportUnusedI
556
654
 
557
655
  ### `defaultConfigsStatus`
558
656
 
559
- Quickly enable multiple configs at once. Possible options:
657
+ Quickly enable multiple configs at once.
658
+ Possible options:
560
659
 
561
660
  - `all-disabled`: consider all top level configs disabled unless explicitly enabled.
562
661
  - `misc-enabled`: consider some configs disabled by default (see the list in JSDoc).
563
662
 
564
663
  ### `mode`
565
664
 
566
- Type of your project, either application (`app`, default) or library (`lib`). Will affect certain rules, actual list of which is written in JSDoc of this option.
665
+ Type of your project, either application (`app`, default) or library (`lib`).
666
+ Will affect certain rules, actual list of which is written in JSDoc of this option.
567
667
 
568
668
  ### `forceSeverity`
569
669
 
570
- Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)). This can also be configured per-config.
670
+ Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)).
671
+ This can also be configured per-config.
571
672
 
572
673
  ### `pluginRenames`
573
674
 
@@ -575,13 +676,15 @@ See [Plugin prefixes](#plugin-prefixes-pluginrenames-option).
575
676
 
576
677
  ### `pluginOverrides`
577
678
 
578
- Override implementation of some of the plugins. 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.
679
+ Override implementation of some of the plugins.
680
+ 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.
579
681
 
580
682
  ### `loadPluginsOnDemand`
581
683
 
582
684
  This option allows to decide whether whether ESLint plugins will be loaded if they are actually used (`true` by default).
583
685
 
584
- Using object notation, you can also specify concrete plugins that will be loaded. 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).
686
+ Using object notation, you can also specify concrete plugins that will be loaded.
687
+ 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).
585
688
 
586
689
  ### `autofixDisabledGloballyFor`
587
690
 
@@ -589,7 +692,9 @@ See [Globally disabling rule autofix](#globally-disabling-rule-autofix).
589
692
 
590
693
  ### `gitignore`
591
694
 
592
- 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. Set this option to `false` to disable this behavior. You may also provide an object which configures [eslint-config-flat-gitignore](https://npmjs.com/eslint-config-flat-gitignore), which actually provides this functionality.
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.
697
+ You may also provide an object which configures [eslint-config-flat-gitignore](https://npmjs.com/eslint-config-flat-gitignore), which actually provides this functionality.
593
698
 
594
699
  ### `offlineMode`
595
700
 
@@ -599,12 +704,16 @@ It can also be enabled by setting `ESLINT_CONFIG_UN_OFFLINE_MODE` environment va
599
704
 
600
705
  ### `cacheConfigs`
601
706
 
602
- Enables flat config caching. This option is enabled by default when running in editor (detected by [`is-in-editor`](https://npmjs.com/is-in-editor)). 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.
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)).
709
+ 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.
603
710
 
604
711
  There are 2 layers of caching:
605
712
 
606
- - 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. This is an **extremely fast** caching option.
607
- - In file system: the cache will be stored in `node_modules/.cache/eslint-config-un/config.json`. Note that in this case caching might fail if the config contains unserializable data, such as functions.
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.
714
+ 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`.
716
+ Note that in this case caching might fail if the config contains unserializable data, such as functions.
608
717
 
609
718
  The cache, regardless of the storage, is considered fresh for 1 hour, unless one of the following is changed:
610
719
 
@@ -615,7 +724,8 @@ The cache, regardless of the storage, is considered fresh for 1 hour, unless one
615
724
 
616
725
  ### `disablePrettierIncompatibleRules`
617
726
 
618
- 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. Defaults to `true` if `prettier` package is installed.
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.
728
+ Defaults to `true` if `prettier` package is installed.
619
729
 
620
730
  ### `useFastImport`
621
731
 
@@ -631,22 +741,27 @@ Re-exported default export from [`globals` package](https://npmjs.com/globals),
631
741
 
632
742
  #### `isInCi`
633
743
 
634
- The constant showing if the current process is *likely* running in CI. Info provided by [`ci-info` package](https://npmjs.com/ci-info).
744
+ The constant showing if the current process is *likely* running in CI.
745
+ Info provided by [`ci-info` package](https://npmjs.com/ci-info).
635
746
 
636
- Use case: disable or enable certain rules or features in CI. Use with caution!
747
+ Use case: disable or enable certain rules or features in CI.
748
+ Use with caution!
637
749
 
638
750
  #### `isInEditor`
639
751
 
640
- The constant showing if the current process is *likely* running within editor. Info provided by [`is-in-editor` package](https://npmjs.com/is-in-editor).
752
+ The constant showing if the current process is *likely* running within editor.
753
+ Info provided by [`is-in-editor` package](https://npmjs.com/is-in-editor).
641
754
 
642
755
  Use case: disable or enable certain rules or features in editor, likely to improve performance.
643
756
 
644
757
  > [!WARNING]
645
- > Use this option sparingly as disabling certain rules only in editor might cause false positive reports on unused directives, which are subject to removal with autofix. We recommend also setting [`linterOptions.reportUnusedDisableDirectives`](https://eslint.org/docs/latest/use/configure/configuration-files#:~:text=reportUnusedDisableDirectives) to `!isInEditor()` for files affected by this option.
758
+ > Use this option sparingly as disabling certain rules only in editor might cause false positive reports on unused directives, which are subject to removal with autofix.
759
+ > We recommend also setting [`linterOptions.reportUnusedDisableDirectives`](https://eslint.org/docs/latest/use/configure/configuration-files#:~:text=reportUnusedDisableDirectives) to `!isInEditor()` for files affected by this option.
646
760
 
647
761
  #### `DEFAULT_GLOBAL_IGNORES`
648
762
 
649
- Default list of global `ignores` values set by eslint-config-un. See also [`ignores` option](#ignores)
763
+ Default list of global `ignores` values set by eslint-config-un.
764
+ See also [`ignores` option](#ignores)
650
765
 
651
766
  #### `RuleOptions`
652
767
 
@@ -665,23 +780,28 @@ Please refer to JSDoc of exported symbols for proper documentation.
665
780
 
666
781
  #### `createNoRestricted*Rule`
667
782
 
668
- Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules. Please refer to [the package documentation](https://github.com/bradzacher/eslint-no-restricted#readme) for more info.
783
+ Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
784
+ Please refer to [the package documentation](https://github.com/bradzacher/eslint-no-restricted#readme) for more info.
669
785
 
670
786
  ## FAQ
671
787
 
672
788
  ### How do I add my own flat configs?
673
789
 
674
- Use `extraConfigs` option. 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. These configs have a richer `rules` option, which allows you to apply more settings like `overrides` option does.
790
+ Use `extraConfigs` option.
791
+ 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
+ These configs have a richer `rules` option, which allows you to apply more settings like `overrides` option does.
675
793
 
676
794
  Alternatively, you can `await` the `eslintConfig()` function and then add your own flat configs to whatever place you like (we recommend use [flat config composer from `eslint-flat-config-utils` package](https://npmjs.com/eslint-flat-config-utils)) for this purpose.
677
795
 
678
796
  ### Do I have to install any of the used plugins?
679
797
 
680
- 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. Please run ESLint with our config once to get the list of dependencies to be installed manually.
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.
799
+ Please run ESLint with our config once to get the list of dependencies to be installed manually.
681
800
 
682
801
  ### How do I know how eslint-config-un configures rules?
683
802
 
684
- It's too much to document, so please have a look at the source code of our config. All the configs are placed inside `src/configs` directory.
803
+ It's too much to document, so please have a look at the source code of our config.
804
+ All the configs are placed inside `src/configs` directory.
685
805
 
686
806
  ### How does exactly eslint-config-un knows if some package is installed?
687
807
 
@@ -689,7 +809,8 @@ We use [`import-meta-resolve`](https://npmjs.com/import-meta-resolve) package to
689
809
 
690
810
  ### How can I know which configs will be enabled, for which rules autofix will be disabled, etc.?
691
811
 
692
- You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command. 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.
812
+ You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
813
+ 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.
693
814
 
694
815
  Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslint/config-inspector) to inspect the final config.
695
816
 
@@ -697,36 +818,56 @@ Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslin
697
818
 
698
819
  ### Prerequisites
699
820
 
700
- Node.JS and ESLint satisfy [minimum required versions](#installation). Please don't attempt to migrate to ESLint 9 and eslint-config-un at the same time.
821
+ Node.JS and ESLint satisfy [minimum required versions](#installation).
822
+ Please don't attempt to migrate to ESLint 9 and eslint-config-un at the same time.
701
823
 
702
824
  ### Migration guide
703
825
 
704
- We recommend that every step and sub-step below is done in a separate commit and on a separate git branch. Before committing, please do also run tests, formatter, other linters and tools to ensure that nothing became broken, if you have any.
826
+ We recommend that every step and sub-step below is done in a separate commit and on a separate git branch.
827
+ If necessary, any step should be additionally split into multiple commits.
828
+ Before committing, please do also run tests, formatter, other linters and tools to ensure that nothing became broken, if you have any.
705
829
 
706
- 1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself. This ensures correct versions of plugins will be resolved by eslint-config-un and saves you from other weird and hard to debug problems.
707
- 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. Please don't forget install [`jiti`](https://npmjs.com/jiti) for ESLint to able be to read your TypeScript config file.
830
+ 1. Dependencies:
831
+ 1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself.
832
+ 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
+ 2. Install `eslint-config-un` following [the installation instructions](#installation).
834
+ 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
+ Please don't forget install [`jiti`](https://npmjs.com/jiti) for ESLint to able be to read your TypeScript config file.
708
836
  3. Following your intuition or/and configs' options JSDoc documentation, migrate the existing config to the closest eslint-config-un equivalent.
709
- 1. Run ESLint for the first time (without `--fix`!). The list of dependencies to be installed might be shown to you. 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.
837
+ 1. Run ESLint for the first time (without `--fix`!).
838
+ The list of dependencies to be installed might be shown to you.
839
+ 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.
710
840
  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).
841
+ Look for `Definition for rule '<rule name>' was not found` comments
711
842
  4. Perform the following two steps in any order:
712
843
  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):
713
844
 
714
845
  ```ts
715
- noStylisticRules: {
716
- enableRules: {
717
- rules: true,
718
- disableAllOtherRules: true,
846
+ // ...
847
+ configs: {
848
+ // ...
849
+ noStylisticRules: {
850
+ enableRules: {
851
+ rules: true,
852
+ disableAllOtherRules: true,
853
+ },
719
854
  },
720
- }
855
+ // ...
856
+ },
857
+ // ...
721
858
  ```
722
859
 
723
860
  **Note:** not every stylistic rule is auto-fixable and not all auto-fixes are safe to apply automatically (although we already maintain a list of rules for which we've disabled autofixes by default for these reasons).
724
861
 
725
862
  Please carefully review automatically applied fixes and do not forget about problems requiring manual intervention.
726
- 2. Set `configs.noStylisticRules` to `true` to disable purely stylistic rules and run ESLint for the first time with the new config. 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). Thoroughly go through the report and:
863
+ 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).
866
+ Thoroughly go through the report and:
727
867
  - Decide which rules need to be disabled, enabled or changed the options of;
728
868
  - Decide which `eslint-ignore` comments are no longer relevant and should be removed;
729
- - 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. 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);
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.
870
+ 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);
730
871
  - Add `<!-- eslint-skip -->` comments before fenced code blocks in Markdown files for which code parsing is failing;
731
872
  - Fix/resolve any other issues and difficulties.
732
873
  5. Remove `noStylisticRules` config and probably re-run ESLint as you would do normally to make sure everything is working as intended.
@@ -735,10 +876,11 @@ We recommend that every step and sub-step below is done in a separate commit and
735
876
 
736
877
  ### Why are there reports from `node` plugin in my frontend code?
737
878
 
738
- All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code). Please specify `files`, `ignores` or disable `node` config altogether to avoid false positives.
879
+ All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code).
880
+ Please specify `files`, `ignores` or disable `node` config altogether to avoid false positives.
739
881
 
740
882
  <!-- eslint-disable-next-line markdown-preferences/heading-casing -->
741
- ### TypeError: Key `languageOptions`: Key `globals`: Global `AudioWorkletGlobalScope ` has leading or trailing whitespace.
883
+ ### TypeError: Key `languageOptions`: Key `globals`: Global `AudioWorkletGlobalScope ` has leading or trailing whitespace
742
884
 
743
885
  Install `globals` package as a dev dependency.
744
886