eslint-config-un 1.0.0-alpha.3 → 1.0.0-alpha.31
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 +106 -32
- package/dist/angular-Pf0R5jax.js +102 -0
- package/dist/astro-CFD4uE3c.js +52 -0
- package/dist/ava-mAvMDLsV.js +23 -0
- package/dist/better-tailwind-Ck8EKLIg.js +22 -0
- package/dist/case-police-Cifvu0We.js +22 -0
- package/dist/cli-B-3GpC1h.js +26 -0
- package/dist/cloudfront-functions-D_TcXbNg.js +155 -0
- package/dist/compat-B7XqSOqY.js +17 -0
- package/dist/cspell-BzWwMxlh.js +23 -0
- package/dist/css-CAZnxYDK.js +37 -0
- package/dist/css-in-js-B1sXk8GN.js +22 -0
- package/dist/cypress-DYNbBbNU.js +23 -0
- package/dist/de-morgan-DSEiOLt5.js +19 -0
- package/dist/depend-DfnWJ8op.js +22 -0
- package/dist/ember-B6gnVNd2.js +40 -0
- package/dist/erasable-syntax-only-D4jphm1M.js +20 -0
- package/dist/es-C_VcP0p1.js +51 -0
- package/dist/es-ytGNh1bl.js +4 -0
- package/dist/eslint-comments-Bv7e-adi.js +21 -0
- package/dist/eslint-mdJDlbfT.js +869 -0
- package/dist/eslint-plugin-BTo2Orsp.js +25 -0
- package/dist/file-progress-QjTopsIA.js +17 -0
- package/dist/graphql--fE_wOSS.js +104 -0
- package/dist/header-CiKmYyEl.js +22 -0
- package/dist/headers-CHoqKGuE.js +17 -0
- package/dist/html-3g41fi8P.js +28 -0
- package/dist/import-CyKGt5kD.js +60 -0
- package/dist/import-zod-C6lGpDfE.js +16 -0
- package/dist/index.d.ts +37177 -36928
- package/dist/index.js +534 -568
- package/dist/jest-BFQ7WWmK.js +62 -0
- package/dist/js-CqYVXGF8.js +94 -0
- package/dist/js-inline-D6yxSsLP.js +59 -0
- package/dist/jsdoc-s_kbrMmA.js +36 -0
- package/dist/json-schema-validator-BH_wzptH.js +28 -0
- package/dist/jsonc-CXtKc6A0.js +56 -0
- package/dist/jsx-a11y-CwHPYepU.js +204 -0
- package/dist/lit-Df0_6Mxs.js +30 -0
- package/dist/markdown-DiIvbBK-.js +74 -0
- package/dist/math-DiQcO2rz.js +17 -0
- package/dist/mdx-BflljH1R.js +61 -0
- package/dist/mocha-CbeZiavJ.js +30 -0
- package/dist/nextjs-ng1gjGuz.js +20 -0
- package/dist/no-only-tests-CKvWFjoD.js +20 -0
- package/dist/no-stylistic-rules-Du84Up2N.js +4225 -0
- package/dist/no-unsanitized-p5VPViUx.js +16 -0
- package/dist/node-DLUNIMyH.js +24 -0
- package/dist/node-dependencies-BQ_kITp4.js +25 -0
- package/dist/nx-eiNfyuW4.js +26 -0
- package/dist/package-json-Bj38requ.js +4 -0
- package/dist/package-json-Cjo73QDx.js +51 -0
- package/dist/perfectionist-CpMj6j0_.js +67 -0
- package/dist/playwright-A5s1mg64.js +23 -0
- package/dist/plugin-un-kFXeMWAf.js +47 -0
- package/dist/pnpm-Rh2Jt2nQ.js +36 -0
- package/dist/prefer-arrow-functions-BrPjfZY6.js +19 -0
- package/dist/promise-CnKT1iJB.js +22 -0
- package/dist/qunit-qW8prkdn.js +23 -0
- package/dist/qwik-rBITGQ_d.js +23 -0
- package/dist/react-CC8vK6sO.js +238 -0
- package/dist/regexp-BfY-g1FY.js +19 -0
- package/dist/rxjs-V-VElvd2.js +22 -0
- package/dist/security-wmBA6lPx.js +19 -0
- package/dist/shared-DF15gELl.js +163 -0
- package/dist/solid-0w2rRjQg.js +24 -0
- package/dist/sonar-Cfs-L6Pl.js +28 -0
- package/dist/storybook-D-V4w5LC.js +20 -0
- package/dist/svelte-AdgUGkuB.js +72 -0
- package/dist/tailwind-Cj4gutij.js +40 -0
- package/dist/tanstack-query-B9Io-R9B.js +16 -0
- package/dist/testing-library-BuMOEXgs.js +49 -0
- package/dist/toml-BmXpwVBP.js +30 -0
- package/dist/ts-DY75vdMd.js +468 -0
- package/dist/turbo-BvIxEOkV.js +17 -0
- package/dist/un-CoXKvbNe.js +19 -0
- package/dist/unicorn-ClN_QELq.js +25 -0
- package/dist/unocss-CO5teYoS.js +16 -0
- package/dist/unused-imports-8NcopKvh.js +21 -0
- package/dist/vitest-BpMTkXaC.js +41 -0
- package/dist/vue-CzzoOPtN.js +184 -0
- package/dist/web-components-_rgyA1_q.js +17 -0
- package/dist/yaml-Dhq1Edkr.js +29 -0
- package/dist/you-dont-need-lodash-underscore-CxMTxIpD.js +100 -0
- package/node_modules/@pkgr/core/index.d.cts +3 -0
- package/node_modules/@pkgr/core/lib/constants.d.ts +8 -0
- package/node_modules/@pkgr/core/lib/constants.js +9 -0
- package/node_modules/@pkgr/core/lib/constants.js.map +1 -0
- package/node_modules/@pkgr/core/lib/helpers.d.ts +5 -0
- package/node_modules/@pkgr/core/lib/helpers.js +45 -0
- package/node_modules/@pkgr/core/lib/helpers.js.map +1 -0
- package/node_modules/@pkgr/core/lib/index.cjs +65 -0
- package/node_modules/@pkgr/core/lib/index.d.ts +2 -0
- package/node_modules/@pkgr/core/lib/index.js +3 -0
- package/node_modules/@pkgr/core/lib/index.js.map +1 -0
- package/node_modules/@pkgr/core/package.json +38 -0
- package/node_modules/eslint-plugin-no-type-assertion/LICENSE +21 -0
- package/node_modules/eslint-plugin-no-type-assertion/README.md +61 -0
- package/node_modules/eslint-plugin-no-type-assertion/lib/index.js +3 -0
- package/node_modules/eslint-plugin-no-type-assertion/lib/rules/no-type-assertion.js +55 -0
- package/node_modules/eslint-plugin-no-type-assertion/package.json +35 -0
- package/node_modules/eslint-plugin-prettier/LICENSE.md +24 -0
- package/node_modules/eslint-plugin-prettier/README.md +202 -0
- package/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.d.ts +5 -0
- package/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js +309 -0
- package/node_modules/eslint-plugin-prettier/package.json +60 -0
- package/node_modules/eslint-plugin-prettier/recommended.d.ts +12 -0
- package/node_modules/eslint-plugin-prettier/recommended.js +18 -0
- package/node_modules/eslint-plugin-prettier/worker.mjs +191 -0
- package/node_modules/fast-diff/LICENSE +201 -0
- package/node_modules/fast-diff/README.md +24 -0
- package/node_modules/fast-diff/diff.d.ts +21 -0
- package/node_modules/fast-diff/diff.js +1138 -0
- package/node_modules/fast-diff/package.json +30 -0
- package/node_modules/prettier-linter-helpers/.editorconfig +15 -0
- package/node_modules/prettier-linter-helpers/.eslintignore +2 -0
- package/node_modules/prettier-linter-helpers/.eslintrc.js +6 -0
- package/node_modules/prettier-linter-helpers/.github/CONTRIBUTING.md +41 -0
- package/node_modules/prettier-linter-helpers/.prettierignore +1 -0
- package/node_modules/prettier-linter-helpers/.prettierrc +6 -0
- package/node_modules/prettier-linter-helpers/.vscode/settings.json +12 -0
- package/node_modules/prettier-linter-helpers/LICENSE.md +24 -0
- package/node_modules/prettier-linter-helpers/README.md +14 -0
- package/node_modules/prettier-linter-helpers/index.js +145 -0
- package/node_modules/prettier-linter-helpers/package.json +38 -0
- package/node_modules/prettier-linter-helpers/test/index.test.js +29 -0
- package/node_modules/synckit/LICENSE +21 -0
- package/node_modules/synckit/README.md +256 -0
- package/node_modules/synckit/lib/common.d.ts +5 -0
- package/node_modules/synckit/lib/common.js +22 -0
- package/node_modules/synckit/lib/common.js.map +1 -0
- package/node_modules/synckit/lib/constants.d.ts +38 -0
- package/node_modules/synckit/lib/constants.js +54 -0
- package/node_modules/synckit/lib/constants.js.map +1 -0
- package/node_modules/synckit/lib/helpers.d.ts +27 -0
- package/node_modules/synckit/lib/helpers.js +413 -0
- package/node_modules/synckit/lib/helpers.js.map +1 -0
- package/node_modules/synckit/lib/index.cjs +590 -0
- package/node_modules/synckit/lib/index.d.cts +138 -0
- package/node_modules/synckit/lib/index.d.ts +7 -0
- package/node_modules/synckit/lib/index.js +73 -0
- package/node_modules/synckit/lib/index.js.map +1 -0
- package/node_modules/synckit/lib/types.d.ts +48 -0
- package/node_modules/synckit/lib/types.js +2 -0
- package/node_modules/synckit/lib/types.js.map +1 -0
- package/node_modules/synckit/package.json +45 -0
- package/package.json +349 -99
- package/deps/angular-eslint-eslint-plugin-18.4.3.tgz +0 -0
- package/deps/angular-eslint-eslint-plugin-template-17.5.3.tgz +0 -0
- package/dist/angular-PZI3A3TT.js +0 -310
- package/dist/astro-SPEGCL4X.js +0 -79
- package/dist/ava-OGL4ZYIU.js +0 -42
- package/dist/better-tailwind-B3H7LLD3.js +0 -61
- package/dist/case-police-VBM65QND.js +0 -29
- package/dist/chunk-A6BNKVXQ.js +0 -944
- package/dist/chunk-DCPED2ZM.js +0 -261
- package/dist/chunk-HVHXEX2N.js +0 -96
- package/dist/chunk-R6XLKF5J.js +0 -267
- package/dist/chunk-Y6GBHMX5.js +0 -137
- package/dist/cli-CLCDYQFQ.js +0 -37
- package/dist/cloudfront-functions-JNZHKWCE.js +0 -195
- package/dist/cspell-WUO3ZUYY.js +0 -30
- package/dist/css-PBPAF7WU.js +0 -57
- package/dist/css-in-js-F6V2FJMX.js +0 -45
- package/dist/cypress-GZXOIWLV.js +0 -35
- package/dist/de-morgan-FIQQMXXC.js +0 -20
- package/dist/depend-VY7OJIJK.js +0 -33
- package/dist/ember-QVWJPE67.js +0 -66
- package/dist/erasable-syntax-only-76OX5PVR.js +0 -29
- package/dist/es-3DTZALVI.js +0 -7
- package/dist/eslint-comments-PC2VOBAC.js +0 -37
- package/dist/eslint-plugin-BZ2G7E6F.js +0 -54
- package/dist/file-progress-2TB5JEAY.js +0 -29
- package/dist/graphql-J33QTJKH.js +0 -150
- package/dist/html-Q2JM45UB.js +0 -45
- package/dist/import-SAGZNT6U.js +0 -80
- package/dist/jest-HWHVJQUD.js +0 -132
- package/dist/js-F54BQ4AF.js +0 -87
- package/dist/js-inline-D4LC5F7K.js +0 -91
- package/dist/jsdoc-HH6UWCAO.js +0 -70
- package/dist/json-schema-validator-UFDHXJR6.js +0 -80
- package/dist/jsonc-TC5NGRVI.js +0 -55
- package/dist/jsx-a11y-KM73RAFZ.js +0 -7
- package/dist/markdown-L3THHMHN.js +0 -167
- package/dist/math-RYSG7JEV.js +0 -28
- package/dist/mdx-V2IURSRP.js +0 -127
- package/dist/nextjs-5DOQMIMR.js +0 -38
- package/dist/no-stylistic-rules-Q6NBOIKA.js +0 -7044
- package/dist/no-unsanitized-2KPEJSCX.js +0 -20
- package/dist/node-673CBR44.js +0 -60
- package/dist/node-dependencies-MRETNKW5.js +0 -40
- package/dist/package-json-2CA7EEQE.js +0 -9
- package/dist/perfectionist-2LFG57QU.js +0 -115
- package/dist/pnpm-XFEA4BGX.js +0 -63
- package/dist/prefer-arrow-functions-DY5UA7O6.js +0 -26
- package/dist/promise-3MWSL3R2.js +0 -22
- package/dist/qwik-QF7NLOE3.js +0 -37
- package/dist/react-QRLTTQM2.js +0 -521
- package/dist/regexp-NL27XPQR.js +0 -22
- package/dist/security-2NGVDTYK.js +0 -22
- package/dist/solid-IEWXKLHX.js +0 -43
- package/dist/sonar-FMNW6U2M.js +0 -35
- package/dist/storybook-Y7FBXLKH.js +0 -36
- package/dist/svelte-CAT2RYHH.js +0 -122
- package/dist/tailwind-6LMXE44Z.js +0 -50
- package/dist/tanstack-query-ALV2FXOI.js +0 -20
- package/dist/testing-library-WEUZZEJO.js +0 -108
- package/dist/toml-UCBYLOME.js +0 -53
- package/dist/ts-IH7HITVU.js +0 -703
- package/dist/turbo-MN5RGR4K.js +0 -25
- package/dist/unicorn-WFY6AAUO.js +0 -24
- package/dist/unused-imports-7I576FY2.js +0 -35
- package/dist/vitest-ZOAYUEWH.js +0 -81
- package/dist/vue-5UGWOT77.js +0 -368
- package/dist/yaml-BIZ6RRWD.js +0 -62
package/README.md
CHANGED
|
@@ -31,32 +31,77 @@ and many more;
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
33
|
Minimum supported versions:
|
|
34
|
-
- NodeJS: ^20.
|
|
34
|
+
- NodeJS: ^20.12 or >=21.7
|
|
35
35
|
- ESLint: ^9.15.0 (peer dependency)
|
|
36
36
|
|
|
37
37
|
```shell
|
|
38
38
|
npm i -D eslint-config-un eslint@latest
|
|
39
39
|
pnpm i -D eslint-config-un eslint@latest
|
|
40
|
-
yarn add -D eslint-config-un eslint@latest
|
|
40
|
+
yarn add -D eslint-config-un eslint@latest # Yarn Berry only (v2+)
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
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.
|
|
44
44
|
|
|
45
|
-
Certain plugins are optional peer dependencies, which means that you need to install them manually if they are end up being used.
|
|
45
|
+
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.
|
|
46
46
|
|
|
47
47
|
<details>
|
|
48
|
-
<summary>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
<summary>Installation with Yarn Classic (v1)</summary>
|
|
49
|
+
|
|
50
|
+
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 do work:
|
|
51
|
+
|
|
52
|
+
```shell
|
|
53
|
+
yarn add -D https://registry.npmjs.org/eslint-config-un/-/eslint-config-un-<VERSION>.tgz eslint@latest
|
|
54
|
+
```
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<details>
|
|
58
|
+
<summary>List of optional peer dependencies</summary>
|
|
59
|
+
|
|
60
|
+
| Default plugin prefix | Package name |
|
|
61
|
+
| -------------------------- | ---------------------------------------- |
|
|
62
|
+
| `@angular-eslint` | `@angular-eslint/eslint-plugin` |
|
|
63
|
+
| `@angular-eslint/template` | `@angular-eslint/eslint-plugin-template` |
|
|
64
|
+
| `@cspell` | `@cspell/eslint-plugin` |
|
|
65
|
+
| `@eslint-react` | `@eslint-react/eslint-plugin` |
|
|
66
|
+
| `@intlify/vue-i18n` | `@intlify/eslint-plugin-vue-i18n` |
|
|
67
|
+
| `@next/next` | `@next/eslint-plugin-next` |
|
|
68
|
+
| `@tanstack/query` | `@tanstack/eslint-plugin-query` |
|
|
69
|
+
| `astro` | `eslint-plugin-astro` |
|
|
70
|
+
| `ava` | `eslint-plugin-ava` |
|
|
71
|
+
| `better-tailwindcss` | `eslint-plugin-better-tailwindcss` |
|
|
72
|
+
| `case-police` | `eslint-plugin-case-police` |
|
|
73
|
+
| `de-morgan` | `eslint-plugin-de-morgan` |
|
|
74
|
+
| `ember` | `eslint-plugin-ember` |
|
|
75
|
+
| `erasable-syntax-only` | `eslint-plugin-erasable-syntax-only` |
|
|
76
|
+
| `es` | `eslint-plugin-es-x` |
|
|
77
|
+
| `eslint-plugin` | `eslint-plugin-eslint-plugin` |
|
|
78
|
+
| `graphql` | `@graphql-eslint/eslint-plugin` |
|
|
79
|
+
| `header` | `eslint-plugin-header` |
|
|
80
|
+
| `headers` | `eslint-plugin-headers` |
|
|
81
|
+
| `jest-extended` | `eslint-plugin-jest-extended` |
|
|
82
|
+
| `jest` | `eslint-plugin-jest` |
|
|
83
|
+
| `nx` | `@nx/eslint-plugin` |
|
|
84
|
+
| `perfectionist` | `eslint-plugin-perfectionist` |
|
|
85
|
+
| `pinia` | `eslint-plugin-pinia` |
|
|
86
|
+
| `playwright` | `eslint-plugin-playwright` |
|
|
87
|
+
| `prefer-arrow-functions` | `eslint-plugin-prefer-arrow-functions` |
|
|
88
|
+
| `qunit` | `eslint-plugin-qunit` |
|
|
89
|
+
| `qwik` | `eslint-plugin-qwik` |
|
|
90
|
+
| `react-compiler` | `eslint-plugin-react-compiler` |
|
|
91
|
+
| `react-hooks` | `eslint-plugin-react-hooks` |
|
|
92
|
+
| `react-refresh` | `eslint-plugin-react-refresh` |
|
|
93
|
+
| `react` | `eslint-plugin-react` |
|
|
94
|
+
| `rxjs` | `@smarttools/eslint-plugin-rxjs` |
|
|
95
|
+
| `solid` | `eslint-plugin-solid` |
|
|
96
|
+
| `storybook` | `eslint-plugin-storybook` |
|
|
97
|
+
| `svelte` | `eslint-plugin-svelte` |
|
|
98
|
+
| `tailwindcss` | `eslint-plugin-tailwindcss` |
|
|
99
|
+
| `testing-library` | `eslint-plugin-testing-library` |
|
|
100
|
+
| `turbo` | `eslint-plugin-turbo` |
|
|
101
|
+
| `vitest` | `@vitest/eslint-plugin` |
|
|
102
|
+
| `vue` | `eslint-plugin-vue` |
|
|
103
|
+
| `vue-scoped-css` | `eslint-plugin-vue-scoped-css` |
|
|
104
|
+
| `vuejs-accessibility` | `eslint-plugin-vuejs-accessibility` |
|
|
60
105
|
</details>
|
|
61
106
|
|
|
62
107
|
### Usage
|
|
@@ -118,7 +163,7 @@ type Severity = 0 | 1 | 2 | 'off' | 'warn' | 'error';
|
|
|
118
163
|
- Sub-configs are the same as Configs, but configured within Config options. All Sub-configs use `configXXX` naming convention.
|
|
119
164
|
- 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`.
|
|
120
165
|
- `files` is an array of file globs to which this Config will be applied. If you specify an empty array `[]`, the Config **will be disabled**, but not its Sub-configs.
|
|
121
|
-
- `ignores` is exactly the same as ESLint's `ignores`.
|
|
166
|
+
- `ignores` is exactly the same as ESLint's `ignores`. If you specify an empty array `[]`, the default ignore list won't be used.
|
|
122
167
|
- `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.
|
|
123
168
|
- The only 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.
|
|
124
169
|
- `overridesAny` will be applied **after** `overrides`.
|
|
@@ -162,6 +207,7 @@ Sub-config is a Config located within Config's options. If the parent config is
|
|
|
162
207
|
|  `react/dom` | ✅ (`react-dom` is installed) | [@eslint-react/eslint-plugin](https://npmjs.com/package/@eslint-react/eslint-plugin) (`@eslint-react`)<br>[eslint-plugin-react](https://npmjs.com/eslint-plugin-react) | Includes rules with `@eslint-react/dom` prefix from `@eslint-react/eslint-plugin` and DOM related rules from `eslint-plugin-react` |
|
|
163
208
|
|  `react/refresh` | ✅ | [eslint-plugin-react-refresh](https://npmjs.com/eslint-plugin-react-refresh) (`react-refresh`) | - |
|
|
164
209
|
|  `react/compiler` | ✅ (if React version is at least 19) | [eslint-plugin-react-compiler](https://npmjs.com/eslint-plugin-react-compiler) (`react-compiler`) | - |
|
|
210
|
+
|  `react/youMightNotNeedAnEffect` | ✅ | [eslint-plugin-react-you-might-not-need-an-effect](https://npmjs.com/eslint-plugin-react-you-might-not-need-an-effect) (`react-you-might-not-need-an-effect`) | Since v1.0.0 |
|
|
165
211
|
|  `react/allowDefaultExportsInJsxFiles` | ✅ | - | Config that allows default exports in all JSX files |
|
|
166
212
|
|  `nextJs` | ✅ (`next` is installed) | [@next/eslint-plugin-next](https://npmjs.com/package/@next/eslint-plugin-next) (`@next/next`) | Since v0.9.0 |
|
|
167
213
|
|  `solid` | ✅ (`solid-js` is installed) | [eslint-plugin-solid](https://npmjs.com/eslint-plugin-solid) (`solid`) | Since v0.10.0 |
|
|
@@ -170,6 +216,10 @@ Sub-config is a Config located within Config's options. If the parent config is
|
|
|
170
216
|
|  `astro/jsxA11y` | ✅ | ^ | Only A11Y rules from `eslint-plugin-astro` |
|
|
171
217
|
|  `svelte` | ✅ (`svelte` is installed) | [eslint-plugin-svelte](https://npmjs.com/eslint-plugin-svelte) (`svelte`) | Since v0.10.0 |
|
|
172
218
|
|  `ember` | ✅ (`ember-source` is installed) | [eslint-plugin-ember](https://npmjs.com/eslint-plugin-ember) (`ember`) | Since v1.0.0 |
|
|
219
|
+
|  `ember/testFiles` | ✅ | ^ | Since v1.0.0 |
|
|
220
|
+
|  `ember/testFiles/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
221
|
+
|  `lit` | ✅ (`lit` is installed) | [eslint-plugin-lit](https://npmjs.com/eslint-plugin-lit) (`lit`) | Since v1.0.0 |
|
|
222
|
+
|  `lit/a11y` | ✅ | [eslint-plugin-lit-a11y](https://npmjs.com/eslint-plugin-lit-a11y) (`lit-a11y`) | Since v1.0.0 |
|
|
173
223
|
|  `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 |
|
|
174
224
|
|  `tailwind` | ❌ | [eslint-plugin-tailwindcss](https://npmjs.com/eslint-plugin-tailwindcss) (`tailwindcss`) | Only supports v3 |
|
|
175
225
|
|
|
@@ -224,18 +274,40 @@ Sub-config is a Config located within Config's options. If the parent config is
|
|
|
224
274
|
|
|
225
275
|
### Libraries
|
|
226
276
|
|
|
227
|
-
| Un config name | Enabled by default?<br>(optional condition)
|
|
228
|
-
| -------------- |
|
|
229
|
-
| `jest`
|
|
230
|
-
| `jest/extended`
|
|
231
|
-
| `jest/typescript`
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
|
|
|
235
|
-
| `
|
|
236
|
-
|
|
|
237
|
-
|
|
|
238
|
-
|
|
|
277
|
+
| Un config name | Enabled by default?<br>(optional condition) | Primary plugin(s) (`default-prefix`) | Description/Notes |
|
|
278
|
+
| -------------- | -------------------------------------------------------------------- | ------------------------------------ | ----------------- |
|
|
279
|
+
| `jest` | ✅ (`jest` is installed) | [eslint-plugin-jest](https://npmjs.com/eslint-plugin-jest) (`jest`) | Since v0.3.0 |
|
|
280
|
+
| `jest/extended` | ✅ (`jest-extended` is installed) | [eslint-plugin-jest-extended](https://npmjs.com/eslint-plugin-jest-extended) (`jest-extended`) | - |
|
|
281
|
+
| `jest/typescript` | ✅ (`ts` config is enabled) | [eslint-plugin-jest](https://npmjs.com/eslint-plugin-jest) (`jest`) | Only TypeScript-specific rules from `eslint-plugin-jest` |
|
|
282
|
+
| `jest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
283
|
+
| `vitest` | ✅ (`vitest` is installed) | [@vitest/eslint-plugin](https://npmjs.com/package/@vitest/eslint-plugin) (`vitest`) | Since v0.3.0 |
|
|
284
|
+
| `vitest/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
285
|
+
| `ava` | ✅ (`ava` is installed) | [eslint-plugin-ava](https://npmjs.com/eslint-plugin-ava) (`ava`) | Since v1.0.0 |
|
|
286
|
+
| `ava/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
287
|
+
| `qunit` | ✅ (`qunit` is installed) | [eslint-plugin-qunit](https://npmjs.com/eslint-plugin-qunit) (`qunit`) | Since v1.0.0 |
|
|
288
|
+
| `qunit/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
289
|
+
|  `testingLibrary` | ✅ (`@testing-library/dom` is installed) | [eslint-plugin-testing-library](https://npmjs.com/eslint-plugin-testing-library) (`testing-library`) | Since v1.0.0 |
|
|
290
|
+
|  `testingLibrary/angular` | ✅ (`angular` config is enabled) | ^ | Since v1.0.0 |
|
|
291
|
+
|  `testingLibrary/marko` | ✅ (`marko` is installed) | ^ | Since v1.0.0 |
|
|
292
|
+
|  `testingLibrary/react` | ✅ (`react` config is enabled) | ^ | Since v1.0.0 |
|
|
293
|
+
|  `testingLibrary/svelte` | ✅ (`svelte` config is enabled) | ^ | Since v1.0.0 |
|
|
294
|
+
|  `testingLibrary/vue` | ✅ (`vue` config is enabled) | ^ | Since v1.0.0 |
|
|
295
|
+
|  `testingLibrary/*/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
296
|
+
| `noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
297
|
+
| `tanstackQuery` | ✅ (`@tanstack/query-core` is installed) | [@tanstack/eslint-plugin-query](https://npmjs.com/package/@tanstack/eslint-plugin-query) (`@tanstack/query`) | Since v1.0.0 |
|
|
298
|
+
|  `storybook` | ✅ (`storybook` is installed) | [eslint-plugin-storybook](https://npmjs.com/eslint-plugin-storybook) (`storybook`) | Since v1.0.0 |
|
|
299
|
+
|  `cypress` | ✅ (`cypress` is installed) | [eslint-plugin-cypress](https://npmjs.com/eslint-plugin-cypress) (`cypress`) | Since v1.0.0 |
|
|
300
|
+
|  `cypress/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
301
|
+
|  `mocha` | ✅ (`mocha` is installed) | [eslint-plugin-mocha](https://npmjs.com/eslint-plugin-mocha) (`mocha`) | Since v1.0.0 |
|
|
302
|
+
|  `mocha/noOnlyTests` | ✅ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
303
|
+
|  `turbo` | ✅ (`turbo` is installed) | [eslint-plugin-turbo](https://npmjs.com/eslint-plugin-turbo) (`turbo`) | Since v1.0.0 |
|
|
304
|
+
|  `playwright` | ✅ (`playwright` is installed) | [eslint-plugin-playwright](https://npmjs.com/eslint-plugin-playwright) (`playwright`) | Since v1.0.0 |
|
|
305
|
+
|  `playwright/noOnlyTests` | ❌ | [eslint-plugin-no-only-tests](https://npmjs.com/eslint-plugin-no-only-tests) (`no-only-tests`) | Since v1.0.0 |
|
|
306
|
+
|  `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 |
|
|
307
|
+
|  `rxjs` | ✅ (`rxjs` is installed) | [@smarttools/eslint-plugin-rxjs](https://npmjs.com/@smarttools/eslint-plugin-rxjs) (`rxjs`) | Since v1.0.0 |
|
|
308
|
+
|  `nx` | ✅ (`nx` is installed) | [@nx/eslint-plugin](https://npmjs.com/@nx/eslint-plugin) (`nx`) | Since v1.0.0 |
|
|
309
|
+
| `importZod` | ✅ (`zod` and `next` are installed) | [eslint-plugin-import-zod](https://npmjs.com/eslint-plugin-import-zod) (`import-zod`) | Enforces namespace imports for `zod`<br>Since v1.0.0 |
|
|
310
|
+
|  `unocss` | ✅ (`unocss` is installed) | [@unocss/eslint-plugin](https://npmjs.com/@unocss/eslint-plugin) (`unocss`) | Since v1.0.0 |
|
|
239
311
|
|
|
240
312
|
### Miscellaneous
|
|
241
313
|
|
|
@@ -247,6 +319,10 @@ Sub-config is a Config located within Config's options. If the parent config is
|
|
|
247
319
|
|  `cspell` | ❌ | [@cspell/eslint-plugin](https://npmjs.com/package/@cspell/eslint-plugin) (`@cspell`) | Since v1.0.0 |
|
|
248
320
|
|  `eslintPlugin` | ❌ | [eslint-plugin-eslint-plugin](https://npmjs.com/eslint-plugin-eslint-plugin) (`eslint-plugin`) | Since v1.0.0<br>For linting ESLint plugins |
|
|
249
321
|
| `fileProgress` | ❌ | [eslint-plugin-file-progress](https://npmjs.com/eslint-plugin-file-progress) (`file-progress`) | Since v1.0.0<br>An ESlint plugin to print file progress |
|
|
322
|
+
| `compat` | ❌ | [eslint-plugin-compat](https://npmjs.com/eslint-plugin-compat) (`compat`) | Since v1.0.0 |
|
|
323
|
+
| `webComponents` | ❌ | [eslint-plugin-wc](https://npmjs.com/eslint-plugin-wc) (`wc`) | Since v1.0.0 |
|
|
324
|
+
| `header` | ❌ | [eslint-plugin-header](https://npmjs.com/eslint-plugin-header) (`header`) | Since v1.0.0 |
|
|
325
|
+
| `headers` | ❌ | [eslint-plugin-headers](https://npmjs.com/eslint-plugin-headers) (`headers`) | Since v1.0.0 |
|
|
250
326
|
|
|
251
327
|
## How to use
|
|
252
328
|
|
|
@@ -382,9 +458,7 @@ By default, TypeScript rules will be enabled in `.vue` files if `enforceTypescri
|
|
|
382
458
|
|
|
383
459
|
#### Angular
|
|
384
460
|
|
|
385
|
-
We support Angular versions from 13 to
|
|
386
|
-
|
|
387
|
-
With this approach, we offer a unique ability to port the rules added in newer versions of `@angular-eslint/eslint-plugin*` and use them with older rules on older Angular codebases. Use `portRules` option to control which rules will be ported.
|
|
461
|
+
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.
|
|
388
462
|
|
|
389
463
|
#### React
|
|
390
464
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ERROR, GLOB_HTML, GLOB_JS_TS_X, OFF, WARNING, assignDefaults, cloneDeep, createConfigBuilder, fetchPackageInfo, interopDefault, pluginsLoaders } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/angular.ts
|
|
4
|
+
const SUPPORTED_ANGULAR_VERSIONS = [
|
|
5
|
+
13,
|
|
6
|
+
14,
|
|
7
|
+
15,
|
|
8
|
+
16,
|
|
9
|
+
17,
|
|
10
|
+
18,
|
|
11
|
+
19,
|
|
12
|
+
20
|
|
13
|
+
];
|
|
14
|
+
const LATEST_SUPPORTED_ANGULAR_VERSION = SUPPORTED_ANGULAR_VERSIONS.at(-1);
|
|
15
|
+
const angularUnConfig = async (context) => {
|
|
16
|
+
const optionsRaw = context.rootOptions.configs?.angular;
|
|
17
|
+
const optionsResolved = assignDefaults(optionsRaw, {
|
|
18
|
+
configTemplate: true,
|
|
19
|
+
processInlineTemplates: true,
|
|
20
|
+
componentClassSuffixes: ["Component"],
|
|
21
|
+
componentSelector: true,
|
|
22
|
+
componentStylesStyle: true,
|
|
23
|
+
directiveClassSuffixes: ["Directive"],
|
|
24
|
+
directiveSelector: true,
|
|
25
|
+
disallowedInputPrefixes: ["on"],
|
|
26
|
+
disallowAttributeDecorator: false,
|
|
27
|
+
disallowForwardRef: false
|
|
28
|
+
});
|
|
29
|
+
const angularVersion = optionsResolved.angularVersion ?? (() => {
|
|
30
|
+
const majorVersion = context.packagesInfo["@angular/core"]?.versions.major;
|
|
31
|
+
if (majorVersion != null && majorVersion >= SUPPORTED_ANGULAR_VERSIONS[0] && majorVersion <= LATEST_SUPPORTED_ANGULAR_VERSION) return majorVersion;
|
|
32
|
+
return optionsRaw === true ? LATEST_SUPPORTED_ANGULAR_VERSION : null;
|
|
33
|
+
})();
|
|
34
|
+
if (angularVersion == null) return null;
|
|
35
|
+
const { configTemplate, processInlineTemplates, componentClassSuffixes, componentSelector, componentStylesStyle, directiveClassSuffixes, directiveSelector, disallowedInputPrefixes, disallowAttributeDecorator, disallowForwardRef, pipePrefixes } = optionsResolved;
|
|
36
|
+
optionsResolved.preferStandaloneComponents ??= angularVersion >= 19;
|
|
37
|
+
const { preferStandaloneComponents } = optionsResolved;
|
|
38
|
+
const forbiddenMetadataProperties = {
|
|
39
|
+
inputs: true,
|
|
40
|
+
outputs: true,
|
|
41
|
+
queries: true,
|
|
42
|
+
...optionsResolved.forbiddenMetadataProperties
|
|
43
|
+
};
|
|
44
|
+
const configBuilderGeneral = createConfigBuilder(context, optionsResolved, "@angular-eslint");
|
|
45
|
+
const [angularEslintPlugin, angularEslintPluginPackageInfo, angularTemplateEslintPlugin, angularTemplateEslintPluginPackageInfo, angularTemplateParserPackageInfo, extractInlineHtmlProcessor] = await Promise.all([
|
|
46
|
+
pluginsLoaders["@angular-eslint"](context).then(({ module }) => module),
|
|
47
|
+
fetchPackageInfo("@angular-eslint/eslint-plugin"),
|
|
48
|
+
pluginsLoaders["@angular-eslint/template"](context).then(({ module }) => module),
|
|
49
|
+
fetchPackageInfo("@angular-eslint/eslint-plugin-template"),
|
|
50
|
+
fetchPackageInfo("@angular-eslint/template-parser"),
|
|
51
|
+
interopDefault(import("@angular-eslint/eslint-plugin-template")).then((m) => m.processors["extract-inline-html"]).then((processor) => {
|
|
52
|
+
const fixedProcessor = cloneDeep(processor);
|
|
53
|
+
fixedProcessor.meta ||= { name: "extract-inline-html" };
|
|
54
|
+
return fixedProcessor;
|
|
55
|
+
})
|
|
56
|
+
]);
|
|
57
|
+
[
|
|
58
|
+
[angularEslintPluginPackageInfo, "@angular-eslint/eslint-plugin"],
|
|
59
|
+
[angularTemplateEslintPluginPackageInfo, "@angular-eslint/eslint-plugin-template"],
|
|
60
|
+
[angularTemplateParserPackageInfo, "@angular-eslint/template-parser"]
|
|
61
|
+
].forEach(([packageInfo, packageName]) => {
|
|
62
|
+
if (packageInfo?.versions.major != null && packageInfo.versions.major !== angularVersion) context.logger.warn(`Your \`${packageName}\` major version (${packageInfo.versions.major}) might not be compatible with the configured (or detected) Angular major version (${angularVersion}).`);
|
|
63
|
+
});
|
|
64
|
+
const angularEslintPluginRules = Object.keys(angularEslintPlugin?.rules || {});
|
|
65
|
+
const getAngularEslintPluginRuleSeverity = (ruleName, severity) => [ruleName, angularEslintPlugin && !angularEslintPluginRules.includes(ruleName) ? OFF : severity];
|
|
66
|
+
configBuilderGeneral?.addConfig(["angular/general", {
|
|
67
|
+
includeDefaultFilesAndIgnores: true,
|
|
68
|
+
filesFallback: [GLOB_JS_TS_X]
|
|
69
|
+
}], { ...processInlineTemplates && { processor: extractInlineHtmlProcessor } }).addRule(...getAngularEslintPluginRuleSeverity("component-class-suffix", componentClassSuffixes.length === 0 ? OFF : ERROR), [{ ...componentClassSuffixes.length > 0 && { suffixes: componentClassSuffixes } }]).addRule(...getAngularEslintPluginRuleSeverity("component-max-inline-declarations", OFF)).addRule(...getAngularEslintPluginRuleSeverity("component-selector", componentSelector === false ? OFF : ERROR), [{
|
|
70
|
+
type: ["element"],
|
|
71
|
+
style: "kebab-case",
|
|
72
|
+
...typeof componentSelector === "object" && componentSelector
|
|
73
|
+
}]).addRule(...getAngularEslintPluginRuleSeverity("consistent-component-styles", componentStylesStyle === false ? OFF : ERROR), [typeof componentStylesStyle === "string" ? componentStylesStyle : "string"]).addRule(...getAngularEslintPluginRuleSeverity("contextual-decorator", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("contextual-lifecycle", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("directive-class-suffix", directiveClassSuffixes.length === 0 ? OFF : ERROR), [{ ...directiveClassSuffixes.length > 0 && { suffixes: directiveClassSuffixes } }]).addRule(...getAngularEslintPluginRuleSeverity("directive-selector", directiveSelector === false ? OFF : ERROR), [{
|
|
74
|
+
type: ["attribute"],
|
|
75
|
+
style: "camelCase",
|
|
76
|
+
...typeof directiveSelector === "object" && directiveSelector
|
|
77
|
+
}]).addRule(...getAngularEslintPluginRuleSeverity("no-async-lifecycle-method", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-attribute-decorator", disallowAttributeDecorator ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-conflicting-lifecycle", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-developer-preview", WARNING)).addRule(...getAngularEslintPluginRuleSeverity("no-duplicates-in-metadata-arrays", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-empty-lifecycle-method", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-experimental", WARNING)).addRule(...getAngularEslintPluginRuleSeverity("no-forward-ref", disallowForwardRef ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-host-metadata-property", forbiddenMetadataProperties.host ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-output-emitter-ref", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-input-prefix", ERROR), [{ prefixes: disallowedInputPrefixes }]).addRule(...getAngularEslintPluginRuleSeverity("no-input-rename", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-inputs-metadata-property", forbiddenMetadataProperties.inputs ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-lifecycle-call", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-native", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-on-prefix", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-rename", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-outputs-metadata-property", forbiddenMetadataProperties.outputs ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-pipe-impure", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-queries-metadata-property", forbiddenMetadataProperties.queries ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-uncalled-signals", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("pipe-prefix", ERROR), [{ prefixes: pipePrefixes }]).addRule(...getAngularEslintPluginRuleSeverity("prefer-inject", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("prefer-on-push-component-change-detection", OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-output-readonly", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("prefer-signals", OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-standalone", preferStandaloneComponents && angularVersion >= 17 ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-standalone-component", preferStandaloneComponents && angularVersion < 17 ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("relative-url-prefix", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("require-lifecycle-on-prototype", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("require-localize-metadata", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("runtime-localize", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-keys-in-type-decorator", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-lifecycle-methods", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-ngmodule-metadata-arrays", OFF)).addRule(...getAngularEslintPluginRuleSeverity("use-component-selector", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-component-view-encapsulation", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-injectable-provided-in", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-lifecycle-interface", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-pipe-transform-interface", ERROR)).addOverrides();
|
|
78
|
+
const angularTemplateEslintPluginRules = Object.keys(angularTemplateEslintPlugin?.rules || {});
|
|
79
|
+
const getAngularEslintTemplatePluginRuleSeverity = (ruleName, severity) => [ruleName, angularTemplateEslintPlugin && !angularTemplateEslintPluginRules.includes(ruleName) ? OFF : severity];
|
|
80
|
+
const configTemplateOptions = assignDefaults(configTemplate, {
|
|
81
|
+
a11yRules: true,
|
|
82
|
+
preferControlFlow: angularVersion >= 19,
|
|
83
|
+
preferNgSrc: false,
|
|
84
|
+
requireLoopIndexes: false
|
|
85
|
+
});
|
|
86
|
+
const { a11yRules, preferControlFlow, preferNgSrc, requireLoopIndexes } = configTemplateOptions;
|
|
87
|
+
const a11yRulesSeverity = a11yRules === true ? ERROR : a11yRules === "warn" ? WARNING : OFF;
|
|
88
|
+
const configBuilderTemplate = createConfigBuilder(context, configTemplate, "@angular-eslint/template");
|
|
89
|
+
configBuilderTemplate?.addConfig(["angular/template", {
|
|
90
|
+
includeDefaultFilesAndIgnores: true,
|
|
91
|
+
filesFallback: [GLOB_HTML],
|
|
92
|
+
parser: "@angular-eslint/template-parser",
|
|
93
|
+
doNotIgnoreHtml: true
|
|
94
|
+
}]).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-alt-text", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-elements-content", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-interactive-supports-focus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-label-for", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-label-has-associated-control", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-role-has-required-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-table-scope", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-valid-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("alt-text", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("attributes-order", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("banana-in-box", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("button-has-type", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("click-events-have-key-events", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("conditional-complexity", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("cyclomatic-complexity", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("elements-content", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("eqeqeq", ERROR), [{ allowNullOrUndefined: true }]).addRule(...getAngularEslintTemplatePluginRuleSeverity("i18n", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("interactive-supports-focus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("label-has-associated-control", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("mouse-events-have-key-events", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-any", WARNING)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-autofocus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-call-expression", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-distracting-elements", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-duplicate-attributes", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-inline-styles", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-interpolation-in-attributes", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-negated-async", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-nested-tags", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-positive-tabindex", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-at-empty", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-contextual-for-variables", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-control-flow", preferControlFlow ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-ngsrc", preferNgSrc ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-template-literal", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-self-closing-tags", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-static-string-properties", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("role-has-required-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("table-scope", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("use-track-by-function", requireLoopIndexes ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("valid-aria", a11yRulesSeverity)).addOverrides();
|
|
95
|
+
return {
|
|
96
|
+
configs: [configBuilderGeneral, configBuilderTemplate],
|
|
97
|
+
optionsResolved
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { angularUnConfig };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ERROR, GLOB_ASTRO, OFF, WARNING, assignDefaults, createConfigBuilder, interopDefault, pluginsLoaders } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/astro.ts
|
|
4
|
+
const DEFAULT_ASTRO_FILES = [GLOB_ASTRO];
|
|
5
|
+
const astroUnConfig = async (context) => {
|
|
6
|
+
const [eslintPluginAstro, { parser: typescriptEslintParser }] = await Promise.all([pluginsLoaders.astro(context).then(({ module }) => module), interopDefault(import("typescript-eslint"))]);
|
|
7
|
+
context.usedPlugins.add("astro");
|
|
8
|
+
if (!eslintPluginAstro) return null;
|
|
9
|
+
const optionsRaw = context.rootOptions.configs?.astro;
|
|
10
|
+
const optionsResolved = assignDefaults(optionsRaw, {
|
|
11
|
+
files: DEFAULT_ASTRO_FILES,
|
|
12
|
+
configJsxA11y: true
|
|
13
|
+
});
|
|
14
|
+
const { files: parentConfigFiles, ignores: parentConfigIgnores, configJsxA11y } = optionsResolved;
|
|
15
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "astro");
|
|
16
|
+
const isTypescriptEnabled = context.configsMeta.ts.enabled;
|
|
17
|
+
configBuilder?.addConfig(["astro/setup", {
|
|
18
|
+
filesFallback: [...DEFAULT_ASTRO_FILES, ...parentConfigFiles],
|
|
19
|
+
doNotIgnoreMarkdown: true,
|
|
20
|
+
parser: "astro-eslint-parser"
|
|
21
|
+
}], {
|
|
22
|
+
languageOptions: {
|
|
23
|
+
globals: eslintPluginAstro.environments.astro.globals,
|
|
24
|
+
parserOptions: { parser: isTypescriptEnabled ? typescriptEslintParser : void 0 },
|
|
25
|
+
sourceType: "module"
|
|
26
|
+
},
|
|
27
|
+
...isTypescriptEnabled && { processor: eslintPluginAstro.processors["client-side-ts"] }
|
|
28
|
+
});
|
|
29
|
+
configBuilder?.addConfig(["astro", {
|
|
30
|
+
doNotIgnoreMarkdown: true,
|
|
31
|
+
includeDefaultFilesAndIgnores: true,
|
|
32
|
+
filesFallback: DEFAULT_ASTRO_FILES
|
|
33
|
+
}]).addRule("missing-client-only-directive-value", ERROR).addRule("no-conflict-set-directives", ERROR).addRule("no-deprecated-astro-canonicalurl", ERROR).addRule("no-deprecated-astro-fetchcontent", ERROR).addRule("no-deprecated-astro-resolve", ERROR).addRule("no-deprecated-getentrybyslug", ERROR).addRule("no-exports-from-components", ERROR).addRule("no-unused-define-vars-in-style", ERROR).addRule("valid-compile", ERROR).addRule("no-set-html-directive", ERROR).addRule("no-set-text-directive", OFF).addRule("no-unused-css-selector", WARNING).addRule("prefer-class-list-directive", ERROR).addRule("prefer-object-class-list", ERROR).addRule("prefer-split-class-list", ERROR).addRule("sort-attributes", ERROR).addRule("semi", OFF).addOverrides();
|
|
34
|
+
return {
|
|
35
|
+
configs: [configBuilder, ...configJsxA11y === false ? [] : await (async () => {
|
|
36
|
+
const { jsxA11yUnConfig } = await import("./jsx-a11y-CwHPYepU.js");
|
|
37
|
+
const result = await jsxA11yUnConfig(context, {
|
|
38
|
+
prefix: "astro",
|
|
39
|
+
options: {
|
|
40
|
+
files: parentConfigFiles,
|
|
41
|
+
ignores: parentConfigIgnores,
|
|
42
|
+
...typeof configJsxA11y === "object" && configJsxA11y
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return result?.configs || [];
|
|
46
|
+
})()],
|
|
47
|
+
optionsResolved
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { astroUnConfig };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ERROR, GLOB_JS_TS_X_EXTENSION, OFF, WARNING, assignDefaults, createConfigBuilder } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
import { RULES_TO_DISABLE_IN_TEST_FILES, generateConfigNoOnlyTestsBuilder, generateDefaultTestFiles } from "./shared-DF15gELl.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/ava.ts
|
|
5
|
+
const avaUnConfig = (context) => {
|
|
6
|
+
const optionsRaw = context.rootOptions.configs?.ava;
|
|
7
|
+
const optionsResolved = assignDefaults(optionsRaw, { configNoOnlyTests: false });
|
|
8
|
+
const { configNoOnlyTests, enforceAssertionMessage, enforceMaxAssertions } = optionsResolved;
|
|
9
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "ava");
|
|
10
|
+
const configFilesFallback = generateDefaultTestFiles(GLOB_JS_TS_X_EXTENSION);
|
|
11
|
+
configBuilder?.addConfig(["ava", {
|
|
12
|
+
includeDefaultFilesAndIgnores: true,
|
|
13
|
+
filesFallback: configFilesFallback
|
|
14
|
+
}]).addRule("assertion-arguments", ERROR, enforceAssertionMessage == null ? [] : [{ message: enforceAssertionMessage ? "always" : "never" }]).addRule("hooks-order", ERROR).addRule("max-asserts", enforceMaxAssertions == null ? OFF : ERROR, enforceMaxAssertions == null ? [] : [enforceMaxAssertions]).addRule("no-async-fn-without-await", ERROR).addRule("no-duplicate-modifiers", ERROR).addRule("no-identical-title", ERROR).addRule("no-ignored-test-files", ERROR).addRule("no-import-test-files", ERROR).addRule("no-incorrect-deep-equal", ERROR).addRule("no-inline-assertions", ERROR).addRule("no-nested-tests", ERROR).addRule("no-only-test", ERROR).addRule("no-skip-assert", ERROR).addRule("no-skip-test", ERROR).addRule("no-todo-implementation", ERROR).addRule("no-todo-test", WARNING).addRule("no-unknown-modifiers", ERROR).addRule("prefer-async-await", ERROR).addRule("prefer-power-assert", OFF).addRule("prefer-t-regex", ERROR).addRule("test-title", ERROR).addRule("test-title-format", OFF).addRule("use-t", ERROR).addRule("use-t-throws-async-well", ERROR).addRule("use-t-well", ERROR).addRule("use-test", ERROR).addRule("use-true-false", ERROR).disableBulkRules(RULES_TO_DISABLE_IN_TEST_FILES).addOverrides();
|
|
15
|
+
const configBuilderNoOnlyTests = generateConfigNoOnlyTestsBuilder(context, "ava", configNoOnlyTests, optionsResolved, { filesFallback: configFilesFallback });
|
|
16
|
+
return {
|
|
17
|
+
configs: [configBuilder, configBuilderNoOnlyTests],
|
|
18
|
+
optionsResolved
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { avaUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, OFF, WARNING, assignDefaults, createConfigBuilder } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/better-tailwind.ts
|
|
4
|
+
const betterTailwindUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.betterTailwind;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, { classOrder: "official" });
|
|
7
|
+
const { settings: pluginSettings, breakUpClassesIntoMultipleLines, classOrder, restrictedClasses } = optionsResolved;
|
|
8
|
+
const tailwindPackageInfo = context.packagesInfo.tailwindcss;
|
|
9
|
+
const tailwindRealMajorVersion = tailwindPackageInfo?.versions.major;
|
|
10
|
+
const tailwindMajorVersion = tailwindRealMajorVersion === 3 ? 3 : 4;
|
|
11
|
+
if (tailwindRealMajorVersion === 4 && !pluginSettings?.entryPoint) context.logger.warn("[betterTailwind] You haven't specified `settings.entryPoint` option which is required for `eslint-plugin-better-tailwindcss` to work properly with Tailwind 4");
|
|
12
|
+
if (tailwindRealMajorVersion != null && (tailwindRealMajorVersion < 3 || tailwindRealMajorVersion > 4)) context.logger.warn("[betterTailwind] The detected Tailwind version is not supported by `eslint-plugin-better-tailwindcss`");
|
|
13
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "better-tailwindcss");
|
|
14
|
+
configBuilder?.addConfig(["better-tailwindcss", { includeDefaultFilesAndIgnores: true }], { ...pluginSettings && { settings: { "better-tailwindcss": pluginSettings } } }).addRule("enforce-consistent-variable-syntax", tailwindMajorVersion === 3 ? OFF : WARNING).addRule("enforce-consistent-line-wrapping", breakUpClassesIntoMultipleLines ? WARNING : OFF, breakUpClassesIntoMultipleLines ? [breakUpClassesIntoMultipleLines] : []).addRule("no-duplicate-classes", WARNING).addRule("no-unnecessary-whitespace", WARNING).addRule("enforce-consistent-class-order", typeof classOrder === "string" ? WARNING : OFF, typeof classOrder === "string" ? [{ order: classOrder }] : []).addRule("no-conflicting-classes", ERROR).addRule("no-restricted-classes", restrictedClasses?.length ? ERROR : OFF, restrictedClasses?.length ? [{ restrict: restrictedClasses }] : []).addRule("no-unregistered-classes", OFF).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { betterTailwindUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/case-police.ts
|
|
4
|
+
const casePoliceUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.casePolice;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "case-police");
|
|
8
|
+
configBuilder?.addConfig(["case-police", {
|
|
9
|
+
includeDefaultFilesAndIgnores: true,
|
|
10
|
+
doNotIgnoreCss: true,
|
|
11
|
+
doNotIgnoreHtml: true,
|
|
12
|
+
doNotIgnoreMarkdown: true,
|
|
13
|
+
doNotIgnoreMdx: true
|
|
14
|
+
}]).addRule("string-check", ERROR, [], { disableAutofix: true }).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { casePoliceUnConfig };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ERROR, GLOB_JS_TS_EXTENSION, assignDefaults, createConfigBuilder } from "./eslint-mdJDlbfT.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/extra/cli.ts
|
|
4
|
+
const DEFAULT_CLI_DIRS = [
|
|
5
|
+
"bin",
|
|
6
|
+
"scripts",
|
|
7
|
+
"cli"
|
|
8
|
+
];
|
|
9
|
+
const DEFAULT_CLI_FILES = ["cli"];
|
|
10
|
+
const cliUnConfig = (context) => {
|
|
11
|
+
const optionsRaw = context.rootOptions.configs?.cli;
|
|
12
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
13
|
+
const { onlyTopLevelDirs } = optionsResolved;
|
|
14
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, null);
|
|
15
|
+
configBuilder?.addConfig(["cli", {
|
|
16
|
+
includeDefaultFilesAndIgnores: true,
|
|
17
|
+
filesFallback: [...DEFAULT_CLI_DIRS.map((dir) => `${onlyTopLevelDirs ? "" : "**/"}${dir}/**/*.${GLOB_JS_TS_EXTENSION}`), ...DEFAULT_CLI_FILES.map((file) => `${onlyTopLevelDirs ? "" : "**/"}${file}.${GLOB_JS_TS_EXTENSION}`)]
|
|
18
|
+
}]).disableAnyRule("node", "hashbang").disableAnyRule("node", "no-process-exit").disableAnyRule("unicorn", "no-process-exit").disableAnyRule("", "no-await-in-loop").disableAnyRule("", "no-console").disableAnyRule("import", "no-extraneous-dependencies").addAnyRule("unicorn", "prefer-top-level-await", ERROR).disableAnyRule("node", "no-top-level-await").addOverrides();
|
|
19
|
+
return {
|
|
20
|
+
configs: [configBuilder],
|
|
21
|
+
optionsResolved
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { cliUnConfig };
|