@darksheep/eslint 4.4.19 → 5.0.0
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/CHANGELOG.md +70 -0
- package/package.json +22 -17
- package/src/configs/eslint-ignores.js +1 -0
- package/src/configs/eslint-style.js +1 -1
- package/src/custom/index.js +1 -1
- package/src/index.js +9 -12
- package/src/plugins/node.js +5 -4
- package/src/plugins/perfectionist.js +130 -0
- package/src/plugins/typescript.js +3 -1
- package/src/types.d.ts +32 -27
- package/src/utilities/editorconfig.js +2 -1
- package/src/utilities/eslint-files.js +1 -1
- package/src/utilities/filesystem.js +1 -1
- package/src/utilities/package.js +2 -1
- package/types/eslint.config.d.ts +1 -1
- package/types/src/configs/eslint-base.d.ts +1 -1
- package/types/src/configs/eslint-complexity.d.ts +1 -1
- package/types/src/configs/eslint-ignores.d.ts +1 -1
- package/types/src/configs/eslint-recommended.d.ts +1 -1
- package/types/src/configs/eslint-style.d.ts +1 -1
- package/types/src/custom/instance-of-array.d.ts +1 -1
- package/types/src/custom/loose-types.d.ts +1 -1
- package/types/src/custom/no-useless-expression.d.ts +1 -1
- package/types/src/custom/sequence-expression.d.ts +1 -1
- package/types/src/index.d.ts +1 -2
- package/types/src/plugins/eslint-comments.d.ts +1 -1
- package/types/src/plugins/jsdoc.d.ts +1 -1
- package/types/src/plugins/json.d.ts +1 -1
- package/types/src/plugins/node.d.ts +1 -1
- package/types/src/plugins/package-json.d.ts +1 -1
- package/types/src/plugins/perfectionist.d.ts +6 -0
- package/types/src/plugins/promise.d.ts +1 -1
- package/types/src/plugins/react.d.ts +1 -1
- package/types/src/plugins/regexp.d.ts +1 -1
- package/types/src/plugins/sca.d.ts +1 -1
- package/types/src/plugins/security.d.ts +1 -1
- package/types/src/plugins/sonarjs.d.ts +1 -1
- package/types/src/plugins/style.d.ts +1 -1
- package/types/src/plugins/typescript.d.ts +1 -1
- package/types/src/plugins/unicorn.d.ts +1 -1
- package/types/src/plugins/unused-imports.d.ts +1 -1
- package/types/src/utilities/editorconfig.d.ts +16 -1
- package/types/src/utilities/eslint-files.d.ts +2 -2
- package/types/src/utilities/make-compat.d.ts +1 -1
- package/types/src/utilities/package.d.ts +1 -1
- package/src/plugins/jest.js +0 -124
- package/src/plugins/jsx-a11y.js +0 -100
- package/types/src/plugins/jest.d.ts +0 -6
- package/types/src/plugins/jsx-a11y.d.ts +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [5.0.0](https://github.com/DarkSheepSoftware/eslint/compare/v4.4.20...v5.0.0) (2024-07-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* Add perfectionist plugin
|
|
9
|
+
|
|
10
|
+
### 🌟 Features
|
|
11
|
+
|
|
12
|
+
* Add perfectionist plugin ([bbe8aab](https://github.com/DarkSheepSoftware/eslint/commit/bbe8aab9115806ff56d4ccfff09b6e8bcc969406))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🐛 Fixes
|
|
16
|
+
|
|
17
|
+
* Patch perfectionist stypes ([38fec1b](https://github.com/DarkSheepSoftware/eslint/commit/38fec1b881d405b7bc8a9b381596a05aebed1bc8))
|
|
18
|
+
* Replace deprecated "ban-types" rule ([664b987](https://github.com/DarkSheepSoftware/eslint/commit/664b987841f014608cfbb752f98f5a24ca58b7fc))
|
|
19
|
+
* Run perfectionist on the repo ([0938cd3](https://github.com/DarkSheepSoftware/eslint/commit/0938cd31faa9c77644187008bd8f7d13dc9c796f))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### 📦 Dependencies
|
|
23
|
+
|
|
24
|
+
* **dev:** update dependency @types/eslint to v8.56.11 ([#515](https://github.com/DarkSheepSoftware/eslint/issues/515)) ([f39356a](https://github.com/DarkSheepSoftware/eslint/commit/f39356a1f70c01cccf4c7b569f75db3d43a8602c))
|
|
25
|
+
* **dev:** update dependency @types/eslint to v9 ([#517](https://github.com/DarkSheepSoftware/eslint/issues/517)) ([24502a8](https://github.com/DarkSheepSoftware/eslint/commit/24502a8a9bbfa4ea1dc0aff9c5de37acb89e1326))
|
|
26
|
+
* **dev:** update dependency @types/eslint__eslintrc to v2.1.2 ([#516](https://github.com/DarkSheepSoftware/eslint/issues/516)) ([80da38b](https://github.com/DarkSheepSoftware/eslint/commit/80da38b171085503fcc056ae6f5f121a5173f2c7))
|
|
27
|
+
* **dev:** update dependency @types/node to v20.14.11 ([#505](https://github.com/DarkSheepSoftware/eslint/issues/505)) ([c165262](https://github.com/DarkSheepSoftware/eslint/commit/c165262bcea1d48ba976f6fff87800f3347a5fdd))
|
|
28
|
+
* **dev:** update dependency type-fest to ~4.21.0 ([#502](https://github.com/DarkSheepSoftware/eslint/issues/502)) ([affd367](https://github.com/DarkSheepSoftware/eslint/commit/affd367f1bbc1b6ea671f26cdee21c66c4b368e8))
|
|
29
|
+
* **dev:** update dependency type-fest to ~4.23.0 ([#512](https://github.com/DarkSheepSoftware/eslint/issues/512)) ([fe6942e](https://github.com/DarkSheepSoftware/eslint/commit/fe6942e2709db20df1283e88f8b17b5807a46f6a))
|
|
30
|
+
* **dev:** update dependency typescript to v5.5.3 ([#500](https://github.com/DarkSheepSoftware/eslint/issues/500)) ([4df508e](https://github.com/DarkSheepSoftware/eslint/commit/4df508e8d4a3fa0af59004a100cb7f29e103114a))
|
|
31
|
+
* **dev:** update dependency typescript to v5.5.4 ([#518](https://github.com/DarkSheepSoftware/eslint/issues/518)) ([4a8eba5](https://github.com/DarkSheepSoftware/eslint/commit/4a8eba57d427b96582dd52942eae78ae7f91702e))
|
|
32
|
+
* **lock:** lock file maintenance ([#506](https://github.com/DarkSheepSoftware/eslint/issues/506)) ([e5792f3](https://github.com/DarkSheepSoftware/eslint/commit/e5792f33fc8c18e6e7d5d2fb24c156e2d52a6718))
|
|
33
|
+
* **pkg:** update dependency eslint-plugin-jsdoc to v48.5.2 ([#504](https://github.com/DarkSheepSoftware/eslint/issues/504)) ([4d926be](https://github.com/DarkSheepSoftware/eslint/commit/4d926be8b34424f5f3bf0df64028a8334345399b))
|
|
34
|
+
* **pkg:** update dependency eslint-plugin-jsdoc to v48.8.3 ([#508](https://github.com/DarkSheepSoftware/eslint/issues/508)) ([bf13633](https://github.com/DarkSheepSoftware/eslint/commit/bf13633ef1d6d45a975604848f2549431a4b6a21))
|
|
35
|
+
* **pkg:** update dependency eslint-plugin-package-json to v0.15.2 ([#509](https://github.com/DarkSheepSoftware/eslint/issues/509)) ([8b1ebe6](https://github.com/DarkSheepSoftware/eslint/commit/8b1ebe6b53d7c04cd0a9f544ad65520a20b9c054))
|
|
36
|
+
* **pkg:** update dependency eslint-plugin-promise to v6.6.0 ([#513](https://github.com/DarkSheepSoftware/eslint/issues/513)) ([89b51e2](https://github.com/DarkSheepSoftware/eslint/commit/89b51e250bb0a2759d9a2075ca0cac422c0c8054))
|
|
37
|
+
* **pkg:** update dependency eslint-plugin-react to v7.35.0 ([#511](https://github.com/DarkSheepSoftware/eslint/issues/511)) ([0149b92](https://github.com/DarkSheepSoftware/eslint/commit/0149b9213fb7179a1e89e431c07c91d083bc470a))
|
|
38
|
+
* **pkg:** update dependency eslint-plugin-unused-imports to v4.0.1 ([#514](https://github.com/DarkSheepSoftware/eslint/issues/514)) ([92b028c](https://github.com/DarkSheepSoftware/eslint/commit/92b028c3e2163be1939244293720ded1fa40161f))
|
|
39
|
+
* **pkg:** update eslint monorepo to v9.7.0 ([#510](https://github.com/DarkSheepSoftware/eslint/issues/510)) ([9f6c49d](https://github.com/DarkSheepSoftware/eslint/commit/9f6c49dd1813285a220f0463b3d535ef59a3d533))
|
|
40
|
+
* **pkg:** update typescript-eslint monorepo to v7.15.0 ([#501](https://github.com/DarkSheepSoftware/eslint/issues/501)) ([dc7dbce](https://github.com/DarkSheepSoftware/eslint/commit/dc7dbce5a22cdcb80fcc57dd64f8855026d09058))
|
|
41
|
+
* **pkg:** update typescript-eslint monorepo to v7.17.0 ([#507](https://github.com/DarkSheepSoftware/eslint/issues/507)) ([0cb3d8e](https://github.com/DarkSheepSoftware/eslint/commit/0cb3d8ea325cb6072435a9b032a3e5620042924a))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### 🔨 Refactoring
|
|
45
|
+
|
|
46
|
+
* Rename style and node configs ([815e77c](https://github.com/DarkSheepSoftware/eslint/commit/815e77c8c3b74ff39664777993c219ca30c33938))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### 🧹 Chores
|
|
50
|
+
|
|
51
|
+
* remove jest and a11y from lock ([8ce7add](https://github.com/DarkSheepSoftware/eslint/commit/8ce7add8d28c08d4486c8c34a70785f2d73e44cf))
|
|
52
|
+
* Remove jest rules ([76f0fab](https://github.com/DarkSheepSoftware/eslint/commit/76f0fab6128b8ff1d7d688321099b116b70c435d))
|
|
53
|
+
* Remove jsx-a11y rules ([8846a01](https://github.com/DarkSheepSoftware/eslint/commit/8846a0118b0bdd1113f7f9343a98a3236014520e))
|
|
54
|
+
* Resolve to [@ts-eslint](https://github.com/ts-eslint) to ^8 ([64d59fb](https://github.com/DarkSheepSoftware/eslint/commit/64d59fb5c16e7680123b912417813690b977b31e))
|
|
55
|
+
|
|
56
|
+
## [4.4.20](https://github.com/DarkSheepSoftware/eslint/compare/v4.4.19...v4.4.20) (2024-07-01)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### 📦 Dependencies
|
|
60
|
+
|
|
61
|
+
* **deps:** update yarn to v4.3.1 ([#491](https://github.com/DarkSheepSoftware/eslint/issues/491)) ([7392999](https://github.com/DarkSheepSoftware/eslint/commit/739299949f9208cfb612e9845e283f3836484ce4))
|
|
62
|
+
* **dev:** update dependency @types/node to v20.14.7 ([#490](https://github.com/DarkSheepSoftware/eslint/issues/490)) ([9c2c55e](https://github.com/DarkSheepSoftware/eslint/commit/9c2c55ece63dc2f3f3e982b2d169843e4a3f047c))
|
|
63
|
+
* **dev:** update dependency @types/node to v20.14.9 ([#492](https://github.com/DarkSheepSoftware/eslint/issues/492)) ([a0f553d](https://github.com/DarkSheepSoftware/eslint/commit/a0f553d870c625874f4c0670921aa0c88d34782d))
|
|
64
|
+
* **dev:** update dependency typescript to ~5.5.0 ([#488](https://github.com/DarkSheepSoftware/eslint/issues/488)) ([c6a1bfa](https://github.com/DarkSheepSoftware/eslint/commit/c6a1bfa76e0e96f817a6ff5effd821cb59d28d1f))
|
|
65
|
+
* **lock:** lock file maintenance ([#494](https://github.com/DarkSheepSoftware/eslint/issues/494)) ([4a5ceb6](https://github.com/DarkSheepSoftware/eslint/commit/4a5ceb6bfdcb3e1ae9e5f954fa74efc5d7929179))
|
|
66
|
+
* **pkg:** update dependency @eslint/js to v9.6.0 ([#497](https://github.com/DarkSheepSoftware/eslint/issues/497)) ([c49946c](https://github.com/DarkSheepSoftware/eslint/commit/c49946ccce2c85e8839223d81d8be8f51a7de7db))
|
|
67
|
+
* **pkg:** update dependency @stylistic/eslint-plugin to v2.3.0 ([#496](https://github.com/DarkSheepSoftware/eslint/issues/496)) ([5dd3839](https://github.com/DarkSheepSoftware/eslint/commit/5dd3839c512b062cc80043d4cd36c83cb3538298))
|
|
68
|
+
* **pkg:** update dependency eslint to v9 ([#499](https://github.com/DarkSheepSoftware/eslint/issues/499)) ([6bacdf0](https://github.com/DarkSheepSoftware/eslint/commit/6bacdf0a4528895d71797167273dafb10f88b6a1))
|
|
69
|
+
* **pkg:** update dependency eslint-plugin-jsdoc to v48.5.0 ([#493](https://github.com/DarkSheepSoftware/eslint/issues/493)) ([0ab6279](https://github.com/DarkSheepSoftware/eslint/commit/0ab6279371d5ba708113de72512fd0a5f27d1a10))
|
|
70
|
+
* **pkg:** update dependency eslint-plugin-promise to v6.4.0 ([#498](https://github.com/DarkSheepSoftware/eslint/issues/498)) ([c595f7b](https://github.com/DarkSheepSoftware/eslint/commit/c595f7be95980ade23b897fd5bc31bd89baee685))
|
|
71
|
+
* **pkg:** update typescript-eslint monorepo to v7.14.1 ([#495](https://github.com/DarkSheepSoftware/eslint/issues/495)) ([b75fa7a](https://github.com/DarkSheepSoftware/eslint/commit/b75fa7ac822967686900a80412b51bf7afff0460))
|
|
72
|
+
|
|
3
73
|
## [4.4.19](https://github.com/DarkSheepSoftware/eslint/compare/v4.4.18...v4.4.19) (2024-06-20)
|
|
4
74
|
|
|
5
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@darksheep/eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/DarkSheepSoftware/eslint"
|
|
@@ -21,46 +21,51 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"githooks": "git config core.hooksPath .githooks"
|
|
23
23
|
},
|
|
24
|
+
"resolutions": {
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0-0",
|
|
26
|
+
"@typescript-eslint/parser": "^8.0.0-0",
|
|
27
|
+
"@typescript-eslint/type-utils": "^8.0.0-0",
|
|
28
|
+
"@typescript-eslint/utils": "^8.0.0-0"
|
|
29
|
+
},
|
|
24
30
|
"dependencies": {
|
|
25
31
|
"@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
|
|
26
32
|
"@eslint/eslintrc": "3.1.0",
|
|
27
|
-
"@eslint/js": "9.
|
|
28
|
-
"@stylistic/eslint-plugin": "2.
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
30
|
-
"@typescript-eslint/parser": "7.
|
|
33
|
+
"@eslint/js": "9.7.0",
|
|
34
|
+
"@stylistic/eslint-plugin": "2.3.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
36
|
+
"@typescript-eslint/parser": "7.17.0",
|
|
31
37
|
"editorconfig": "2.0.0",
|
|
32
|
-
"eslint": "
|
|
33
|
-
"eslint-plugin-
|
|
34
|
-
"eslint-plugin-jsdoc": "48.2.12",
|
|
38
|
+
"eslint": "9.7.0",
|
|
39
|
+
"eslint-plugin-jsdoc": "48.8.3",
|
|
35
40
|
"eslint-plugin-jsonc": "2.16.0",
|
|
36
|
-
"eslint-plugin-jsx-a11y": "6.9.0",
|
|
37
41
|
"eslint-plugin-n": "17.9.0",
|
|
38
|
-
"eslint-plugin-package-json": "0.15.
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"eslint-plugin-
|
|
42
|
+
"eslint-plugin-package-json": "0.15.2",
|
|
43
|
+
"eslint-plugin-perfectionist": "3.0.0",
|
|
44
|
+
"eslint-plugin-promise": "6.6.0",
|
|
45
|
+
"eslint-plugin-react": "7.35.0",
|
|
41
46
|
"eslint-plugin-regexp": "2.6.0",
|
|
42
47
|
"eslint-plugin-security": "3.0.1",
|
|
43
48
|
"eslint-plugin-sonarjs": "1.0.3",
|
|
44
49
|
"eslint-plugin-unicorn": "54.0.0",
|
|
45
|
-
"eslint-plugin-unused-imports": "4.0.
|
|
50
|
+
"eslint-plugin-unused-imports": "4.0.1",
|
|
46
51
|
"jsonc-eslint-parser": "2.4.0"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
49
54
|
"@darksheep/eslint-formatter-github": "2.0.1",
|
|
50
|
-
"@types/eslint": "~
|
|
55
|
+
"@types/eslint": "~9.6.0",
|
|
51
56
|
"@types/eslint__eslintrc": "~2.1.1",
|
|
52
57
|
"@types/eslint__js": "~8.42.3",
|
|
53
58
|
"@types/estree": "~1.0.2",
|
|
54
59
|
"@types/node": "~20.14.0",
|
|
55
|
-
"type-fest": "~4.
|
|
56
|
-
"typescript": "~5.
|
|
60
|
+
"type-fest": "~4.23.0",
|
|
61
|
+
"typescript": "~5.5.0"
|
|
57
62
|
},
|
|
58
63
|
"peerDependenciesMeta": {
|
|
59
64
|
"typescript": {
|
|
60
65
|
"optional": true
|
|
61
66
|
}
|
|
62
67
|
},
|
|
63
|
-
"packageManager": "yarn@4.3.
|
|
68
|
+
"packageManager": "yarn@4.3.1",
|
|
64
69
|
"engines": {
|
|
65
70
|
"node": "^20 || ^21"
|
|
66
71
|
}
|
|
@@ -15,7 +15,7 @@ const rules = {
|
|
|
15
15
|
* @param {import('node:url').URL} root root url
|
|
16
16
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
17
17
|
*/
|
|
18
|
-
export async function
|
|
18
|
+
export async function createStyleConfig(root) {
|
|
19
19
|
return [
|
|
20
20
|
{ rules },
|
|
21
21
|
...await createEditorOverrides(root),
|
package/src/custom/index.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { pathToFileURL, URL } from 'node:url';
|
|
2
2
|
|
|
3
|
-
import { createEslintIgnoresConfig } from './configs/eslint-ignores.js';
|
|
4
3
|
import { createEslintBaseConfig } from './configs/eslint-base.js';
|
|
5
|
-
import { createEslintRecommendsConfig } from './configs/eslint-recommended.js';
|
|
6
4
|
import { createEslintComplexityConfig } from './configs/eslint-complexity.js';
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import { createEslintIgnoresConfig } from './configs/eslint-ignores.js';
|
|
6
|
+
import { createEslintRecommendsConfig } from './configs/eslint-recommended.js';
|
|
7
|
+
import { createStyleConfig } from './configs/eslint-style.js';
|
|
9
8
|
import { createEslintCommentsConfig } from './plugins/eslint-comments.js';
|
|
10
|
-
import { createEslintJestConfig } from './plugins/jest.js';
|
|
11
9
|
import { createEslintJSDocConfig } from './plugins/jsdoc.js';
|
|
12
|
-
import { createEslintPackageJsonConfig } from './plugins/package-json.js';
|
|
13
10
|
import { createEslintJsonConfig } from './plugins/json.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
11
|
+
import { createEslintNodeConfig } from './plugins/node.js';
|
|
12
|
+
import { createEslintPackageJsonConfig } from './plugins/package-json.js';
|
|
13
|
+
import { createEslintPerfectionistConfig } from './plugins/perfectionist.js';
|
|
16
14
|
import { createEslintPromiseConfig } from './plugins/promise.js';
|
|
17
15
|
import { createEslintReactConfig } from './plugins/react.js';
|
|
18
16
|
import { createEslintRegexpConfig } from './plugins/regexp.js';
|
|
@@ -29,22 +27,21 @@ const configBuilders = [
|
|
|
29
27
|
createEslintRecommendsConfig,
|
|
30
28
|
createEslintBaseConfig,
|
|
31
29
|
createEslintComplexityConfig,
|
|
32
|
-
|
|
30
|
+
createStyleConfig,
|
|
33
31
|
createEslintCommentsConfig,
|
|
34
|
-
|
|
32
|
+
createEslintNodeConfig,
|
|
33
|
+
createEslintPerfectionistConfig,
|
|
35
34
|
createEslintPackageJsonConfig,
|
|
36
35
|
createEslintJsonConfig,
|
|
37
36
|
createEslintPromiseConfig,
|
|
38
37
|
createEslintTypescriptConfig,
|
|
39
38
|
createEslintReactConfig,
|
|
40
|
-
createEslintJsxA11yConfig,
|
|
41
39
|
createEslintSecurityConfig,
|
|
42
40
|
createEslintUnicornConfig,
|
|
43
41
|
createEslintRegexpConfig,
|
|
44
42
|
createEslintSCAConfig,
|
|
45
43
|
createEslintSonarJSConfig,
|
|
46
44
|
createEslintStyleConfig,
|
|
47
|
-
createEslintJestConfig,
|
|
48
45
|
createEslintUnusedImportsConfig,
|
|
49
46
|
createEslintJSDocConfig,
|
|
50
47
|
];
|
package/src/plugins/node.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
1
|
import { dirname } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
3
|
|
|
4
4
|
import n from 'eslint-plugin-n';
|
|
5
|
+
|
|
5
6
|
import {
|
|
6
7
|
getCommonFiles,
|
|
7
|
-
getModuleFiles,
|
|
8
|
-
getTypescriptFiles,
|
|
9
8
|
getExampleFiles,
|
|
9
|
+
getModuleFiles,
|
|
10
10
|
getTestFiles,
|
|
11
|
+
getTypescriptFiles,
|
|
11
12
|
} from '../utilities/eslint-files.js';
|
|
12
13
|
|
|
13
14
|
const script = n.configs['flat/recommended-script'];
|
|
@@ -67,7 +68,7 @@ function toExt(globs) {
|
|
|
67
68
|
* @param {URL} root root url
|
|
68
69
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
69
70
|
*/
|
|
70
|
-
export async function
|
|
71
|
+
export async function createEslintNodeConfig(root) {
|
|
71
72
|
const commonFiles = await getCommonFiles(root);
|
|
72
73
|
const moduleFiles = await getModuleFiles(root);
|
|
73
74
|
const typescriptFiles = getTypescriptFiles();
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import perfectionist from 'eslint-plugin-perfectionist';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getCommonFiles,
|
|
5
|
+
getModuleFiles,
|
|
6
|
+
getTypescriptFiles,
|
|
7
|
+
} from '../utilities/eslint-files.js';
|
|
8
|
+
|
|
9
|
+
const groupClasses = [
|
|
10
|
+
'index-signature',
|
|
11
|
+
'static-property',
|
|
12
|
+
'private-property',
|
|
13
|
+
'property',
|
|
14
|
+
'constructor',
|
|
15
|
+
'static-method',
|
|
16
|
+
'private-method',
|
|
17
|
+
'static-private-method',
|
|
18
|
+
'method',
|
|
19
|
+
[ 'get-method', 'set-method' ],
|
|
20
|
+
'unknown',
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const groupImports = [
|
|
24
|
+
'type',
|
|
25
|
+
'builtin',
|
|
26
|
+
'external',
|
|
27
|
+
'internal-type',
|
|
28
|
+
'internal',
|
|
29
|
+
[ 'parent-type', 'sibling-type', 'index-type' ],
|
|
30
|
+
[ 'parent', 'sibling', 'index' ],
|
|
31
|
+
'object',
|
|
32
|
+
'unknown',
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
36
|
+
const commonRules = {
|
|
37
|
+
'perfectionist/sort-classes': [
|
|
38
|
+
'warn',
|
|
39
|
+
{
|
|
40
|
+
type: 'natural',
|
|
41
|
+
order: 'asc',
|
|
42
|
+
groups: groupClasses,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
'perfectionist/sort-array-includes': 0,
|
|
46
|
+
'perfectionist/sort-maps': 0,
|
|
47
|
+
'perfectionist/sort-objects': 0,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
51
|
+
const moduleRules = {
|
|
52
|
+
'perfectionist/sort-exports': [
|
|
53
|
+
'warn',
|
|
54
|
+
{
|
|
55
|
+
type: 'natural',
|
|
56
|
+
order: 'asc',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
'perfectionist/sort-imports': [
|
|
60
|
+
'warn',
|
|
61
|
+
{
|
|
62
|
+
type: 'natural',
|
|
63
|
+
order: 'asc',
|
|
64
|
+
newlinesBetween: 'always',
|
|
65
|
+
groups: groupImports,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
'perfectionist/sort-named-exports': [
|
|
69
|
+
'warn',
|
|
70
|
+
{
|
|
71
|
+
order: 'asc',
|
|
72
|
+
type: 'natural',
|
|
73
|
+
groupKind: 'types-first',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
'perfectionist/sort-named-imports': [
|
|
77
|
+
'warn',
|
|
78
|
+
{
|
|
79
|
+
order: 'asc',
|
|
80
|
+
type: 'natural',
|
|
81
|
+
groupKind: 'types-first',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @type {import('eslint').Linter.RulesRecord} */
|
|
87
|
+
const typescriptRules = {
|
|
88
|
+
'perfectionist/sort-interfaces': 1,
|
|
89
|
+
'perfectionist/sort-object-types': 1,
|
|
90
|
+
'perfectionist/sort-objects': 1,
|
|
91
|
+
'perfectionist/sort-union-types': 1,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get ESLint config for imports check
|
|
96
|
+
* @param {URL} root The root of the package being linted
|
|
97
|
+
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
98
|
+
*/
|
|
99
|
+
export async function createEslintPerfectionistConfig(root) {
|
|
100
|
+
const commonFiles = await getCommonFiles(root);
|
|
101
|
+
const moduleFiles = await getModuleFiles(root);
|
|
102
|
+
const typescriptFiles = getTypescriptFiles();
|
|
103
|
+
|
|
104
|
+
return [
|
|
105
|
+
{
|
|
106
|
+
files: commonFiles,
|
|
107
|
+
plugins: { perfectionist },
|
|
108
|
+
rules: {
|
|
109
|
+
...commonRules,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
files: moduleFiles,
|
|
114
|
+
plugins: { perfectionist },
|
|
115
|
+
rules: {
|
|
116
|
+
...commonRules,
|
|
117
|
+
...moduleRules,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
files: typescriptFiles,
|
|
122
|
+
plugins: { perfectionist },
|
|
123
|
+
rules: {
|
|
124
|
+
...commonRules,
|
|
125
|
+
...moduleRules,
|
|
126
|
+
...typescriptRules,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
}
|
|
@@ -67,7 +67,9 @@ export async function createEslintTypescriptConfig(root) {
|
|
|
67
67
|
|
|
68
68
|
// ts eslint recommended
|
|
69
69
|
'@typescript-eslint/ban-ts-comment': 'error',
|
|
70
|
-
'@typescript-eslint/
|
|
70
|
+
'@typescript-eslint/no-empty-object-type': 'error',
|
|
71
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
72
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
71
73
|
'@typescript-eslint/no-array-constructor': 'error',
|
|
72
74
|
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
73
75
|
'@typescript-eslint/no-explicit-any': 'error',
|
package/src/types.d.ts
CHANGED
|
@@ -10,40 +10,40 @@ declare module '@eslint-community/eslint-plugin-eslint-comments' {
|
|
|
10
10
|
declare module 'eslint-plugin-import' {
|
|
11
11
|
import type { ESLint, Linter } from 'eslint';
|
|
12
12
|
export default {} as {
|
|
13
|
-
rules: Required<ESLint.Plugin['rules']>;
|
|
14
13
|
configs: {
|
|
15
|
-
'
|
|
16
|
-
|
|
17
|
-
rules: Linter.RulesRecord;
|
|
18
|
-
parserOptions: Required<ESLint.ConfigData['parserOptions']>;
|
|
14
|
+
'electron': {
|
|
15
|
+
settings: Required<ESLint.ConfigData['settings']>;
|
|
19
16
|
};
|
|
20
17
|
'errors': {
|
|
21
18
|
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
22
19
|
rules: Linter.RulesRecord;
|
|
23
20
|
};
|
|
24
|
-
'warnings': {
|
|
25
|
-
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
26
|
-
rules: Linter.RulesRecord;
|
|
27
|
-
};
|
|
28
|
-
'stage-0': {
|
|
29
|
-
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
30
|
-
rules: Linter.RulesRecord;
|
|
31
|
-
};
|
|
32
21
|
'react': {
|
|
33
|
-
settings: Required<ESLint.ConfigData['settings']>;
|
|
34
22
|
parserOptions: Required<ESLint.ConfigData['parserOptions']>;
|
|
23
|
+
settings: Required<ESLint.ConfigData['settings']>;
|
|
35
24
|
};
|
|
36
25
|
'react-native': {
|
|
37
26
|
settings: Required<ESLint.ConfigData['settings']>;
|
|
38
27
|
};
|
|
39
|
-
'
|
|
40
|
-
|
|
28
|
+
'recommended': {
|
|
29
|
+
parserOptions: Required<ESLint.ConfigData['parserOptions']>;
|
|
30
|
+
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
31
|
+
rules: Linter.RulesRecord;
|
|
32
|
+
};
|
|
33
|
+
'stage-0': {
|
|
34
|
+
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
35
|
+
rules: Linter.RulesRecord;
|
|
41
36
|
};
|
|
42
37
|
'typescript': {
|
|
38
|
+
rules: Linter.RulesRecord;
|
|
43
39
|
settings: Required<ESLint.ConfigData['settings']>;
|
|
40
|
+
};
|
|
41
|
+
'warnings': {
|
|
42
|
+
plugins: Required<ESLint.ConfigData['plugins']>;
|
|
44
43
|
rules: Linter.RulesRecord;
|
|
45
44
|
};
|
|
46
45
|
};
|
|
46
|
+
rules: Required<ESLint.Plugin['rules']>;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -52,6 +52,11 @@ declare module 'eslint-plugin-jest' {
|
|
|
52
52
|
export default {} as WithRequired<ESLint.Plugin, 'environments'>;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
declare module 'eslint-plugin-perfectionist' {
|
|
56
|
+
import type { ESLint } from 'eslint';
|
|
57
|
+
export default {} as WithRequired<ESLint.Plugin, 'environments'>;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
declare module 'eslint-plugin-jsdoc' {
|
|
56
61
|
import type { ESLint } from 'eslint';
|
|
57
62
|
export default {} as WithRequired<ESLint.Plugin, 'environments'>;
|
|
@@ -70,10 +75,10 @@ declare module 'eslint-plugin-jsx-a11y' {
|
|
|
70
75
|
declare module 'eslint-plugin-promise' {
|
|
71
76
|
import type { ESLint } from 'eslint';
|
|
72
77
|
export default {} as {
|
|
73
|
-
rules: Required<ESLint.Plugin['rules']>;
|
|
74
78
|
configs: {
|
|
75
79
|
recommended: WithRequired<ESLint.ConfigData, 'plugins' | 'rules'>;
|
|
76
80
|
};
|
|
81
|
+
rules: Required<ESLint.Plugin['rules']>;
|
|
77
82
|
};
|
|
78
83
|
}
|
|
79
84
|
|
|
@@ -85,10 +90,10 @@ declare module 'eslint-plugin-react' {
|
|
|
85
90
|
declare module 'eslint-plugin-security' {
|
|
86
91
|
import type { ESLint } from 'eslint';
|
|
87
92
|
export default {} as {
|
|
88
|
-
rules: Required<ESLint.Plugin['rules']>;
|
|
89
93
|
configs: {
|
|
90
94
|
recommended: WithRequired<ESLint.ConfigData, 'plugins' | 'rules'>;
|
|
91
95
|
};
|
|
96
|
+
rules: Required<ESLint.Plugin['rules']>;
|
|
92
97
|
};
|
|
93
98
|
}
|
|
94
99
|
|
|
@@ -100,19 +105,19 @@ declare module 'eslint-plugin-unused-imports' {
|
|
|
100
105
|
declare module 'eslint-plugin-n' {
|
|
101
106
|
import type { ESLint, Linter } from 'eslint';
|
|
102
107
|
export default {} as {
|
|
108
|
+
configs: {
|
|
109
|
+
'flat/mixed-esm-and-cjs': Linter.FlatConfig;
|
|
110
|
+
'flat/recommended': Linter.FlatConfig;
|
|
111
|
+
'flat/recommended-module': Linter.FlatConfig;
|
|
112
|
+
'flat/recommended-script': Linter.FlatConfig;
|
|
113
|
+
'recommended': ESLint.ConfigData;
|
|
114
|
+
'recommended-module': ESLint.ConfigData;
|
|
115
|
+
'recommended-script': ESLint.ConfigData;
|
|
116
|
+
};
|
|
103
117
|
meta: {
|
|
104
118
|
name: string;
|
|
105
119
|
version: string;
|
|
106
120
|
};
|
|
107
121
|
rules: Required<ESLint.Plugin['rules']>;
|
|
108
|
-
configs: {
|
|
109
|
-
'recommended-module': ESLint.ConfigData;
|
|
110
|
-
'recommended-script': ESLint.ConfigData;
|
|
111
|
-
'recommended': ESLint.ConfigData;
|
|
112
|
-
'flat/recommended-module': Linter.FlatConfig;
|
|
113
|
-
'flat/recommended-script': Linter.FlatConfig;
|
|
114
|
-
'flat/recommended': Linter.FlatConfig;
|
|
115
|
-
'flat/mixed-esm-and-cjs': Linter.FlatConfig;
|
|
116
|
-
};
|
|
117
122
|
};
|
|
118
123
|
}
|
|
@@ -3,8 +3,9 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
|
|
5
5
|
import { parseBuffer } from 'editorconfig';
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
import { expandGlob } from './expand-glob.js';
|
|
8
|
+
import { findUp } from './filesystem.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @typedef {Object} RuleSet
|
package/src/utilities/package.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';
|
|
2
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
4
5
|
import { findUp } from './filesystem.js';
|
|
5
6
|
|
|
6
7
|
const errorCodesToSkip = new Set([
|
package/types/eslint.config.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default config;
|
|
2
|
-
declare const config: import("eslint").Linter.FlatConfig
|
|
2
|
+
declare const config: import("eslint").Linter.FlatConfig[];
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get the ESLint base config
|
|
3
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintBaseConfig(): Promise<import(
|
|
5
|
+
export function createEslintBaseConfig(): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get the ESLint config for complexity checks
|
|
3
3
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintComplexityConfig(): import(
|
|
5
|
+
export function createEslintComplexityConfig(): import("eslint").Linter.FlatConfig[];
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintIgnoresConfig(root: import(
|
|
6
|
+
export function createEslintIgnoresConfig(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get recommended ESLint config
|
|
3
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintRecommendsConfig(): Promise<import(
|
|
5
|
+
export function createEslintRecommendsConfig(): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function createStyleConfig(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
package/types/src/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
/**
|
|
3
2
|
* @param {string | URL} root root url
|
|
4
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
4
|
*/
|
|
6
|
-
export function createConfig(root: string | URL): Promise<import(
|
|
5
|
+
export function createConfig(root: string | URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
7
6
|
export * from "eslint";
|
|
8
7
|
import { URL } from 'node:url';
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {URL} root The root of the package being linted
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintJSDocConfig(root: URL): Promise<import(
|
|
6
|
+
export function createEslintJSDocConfig(root: URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get ESLint config for imports check
|
|
3
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintJsonConfig(): Promise<import(
|
|
5
|
+
export function createEslintJsonConfig(): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function createEslintNodeConfig(root: URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get ESLint config for the regexp plugin
|
|
3
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintPackageJsonConfig(): Promise<import(
|
|
5
|
+
export function createEslintPackageJsonConfig(): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get ESLint config for imports check
|
|
3
|
+
* @param {URL} root The root of the package being linted
|
|
4
|
+
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
|
+
*/
|
|
6
|
+
export function createEslintPerfectionistConfig(root: URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {URL} root The root of the package being linted
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintReactConfig(root: URL): Promise<import(
|
|
6
|
+
export function createEslintReactConfig(root: URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintRegexpConfig(root: import(
|
|
6
|
+
export function createEslintRegexpConfig(root: import("node:url").URL): import("eslint").Linter.FlatConfig[];
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {URL} root The root url of the package we are linting
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintSCAConfig(root: URL): Promise<import(
|
|
6
|
+
export function createEslintSCAConfig(root: URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Get ESLint config for the security plugin
|
|
3
3
|
* @returns {import('eslint').Linter.FlatConfig[]}
|
|
4
4
|
*/
|
|
5
|
-
export function createEslintSecurityConfig(): import(
|
|
5
|
+
export function createEslintSecurityConfig(): import("eslint").Linter.FlatConfig[];
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintTypescriptConfig(root: import(
|
|
6
|
+
export function createEslintTypescriptConfig(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintUnicornConfig(root: import(
|
|
6
|
+
export function createEslintUnicornConfig(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @param {import('node:url').URL} root root url
|
|
4
4
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
5
|
*/
|
|
6
|
-
export function createEslintUnusedImportsConfig(root: import(
|
|
6
|
+
export function createEslintUnusedImportsConfig(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
@@ -2,24 +2,39 @@
|
|
|
2
2
|
* @param {import('node:url').URL} root root url
|
|
3
3
|
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
4
4
|
*/
|
|
5
|
-
export function createEditorOverrides(root: import(
|
|
5
|
+
export function createEditorOverrides(root: import("node:url").URL): Promise<import("eslint").Linter.FlatConfig[]>;
|
|
6
6
|
export type RuleSet = {
|
|
7
|
+
/**
|
|
8
|
+
* end of line
|
|
9
|
+
*/
|
|
7
10
|
/**
|
|
8
11
|
* end of line
|
|
9
12
|
*/
|
|
10
13
|
EOL: string;
|
|
14
|
+
/**
|
|
15
|
+
* line feed
|
|
16
|
+
*/
|
|
11
17
|
/**
|
|
12
18
|
* line feed
|
|
13
19
|
*/
|
|
14
20
|
LF: string;
|
|
21
|
+
/**
|
|
22
|
+
* trailing spaces
|
|
23
|
+
*/
|
|
15
24
|
/**
|
|
16
25
|
* trailing spaces
|
|
17
26
|
*/
|
|
18
27
|
TRAIL: string;
|
|
28
|
+
/**
|
|
29
|
+
* indent size
|
|
30
|
+
*/
|
|
19
31
|
/**
|
|
20
32
|
* indent size
|
|
21
33
|
*/
|
|
22
34
|
INDENT: string;
|
|
35
|
+
/**
|
|
36
|
+
* indent binary ops size
|
|
37
|
+
*/
|
|
23
38
|
/**
|
|
24
39
|
* indent binary ops size
|
|
25
40
|
*/
|
|
@@ -8,13 +8,13 @@ export function getJsonFiles(): Promise<string[]>;
|
|
|
8
8
|
* @param {import('node:url').URL} root root url
|
|
9
9
|
* @returns {Promise<string[]>}
|
|
10
10
|
*/
|
|
11
|
-
export function getCommonFiles(root: import(
|
|
11
|
+
export function getCommonFiles(root: import("node:url").URL): Promise<string[]>;
|
|
12
12
|
/**
|
|
13
13
|
* Get a list of globs for module files
|
|
14
14
|
* @param {import('node:url').URL} root root url
|
|
15
15
|
* @returns {Promise<string[]>}
|
|
16
16
|
*/
|
|
17
|
-
export function getModuleFiles(root: import(
|
|
17
|
+
export function getModuleFiles(root: import("node:url").URL): Promise<string[]>;
|
|
18
18
|
/**
|
|
19
19
|
* Get a list of globs for typescript files
|
|
20
20
|
* @returns {string[]}
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* @param {import('node:url').URL} root root url
|
|
3
3
|
* @returns {import('@eslint/eslintrc').FlatCompat}
|
|
4
4
|
*/
|
|
5
|
-
export function makeCompat(root: import(
|
|
5
|
+
export function makeCompat(root: import("node:url").URL): import("@eslint/eslintrc").FlatCompat;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param {string} [packageName] The name of the npm package
|
|
5
5
|
* @returns {Promise<import('type-fest').PackageJson | null>}
|
|
6
6
|
*/
|
|
7
|
-
export function getPackageJson(root: import(
|
|
7
|
+
export function getPackageJson(root: import("node:url").URL, packageName?: string | undefined): Promise<import("type-fest").PackageJson | null>;
|
package/src/plugins/jest.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import jest from 'eslint-plugin-jest';
|
|
2
|
-
import { getPackageJson } from '../utilities/package.js';
|
|
3
|
-
import { expandGlob } from '../utilities/expand-glob.js';
|
|
4
|
-
|
|
5
|
-
const { globals } = jest.environments.globals;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Get ESLint config jest plugin
|
|
9
|
-
* @param {import('node:url').URL} root root url
|
|
10
|
-
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
11
|
-
*/
|
|
12
|
-
export async function createEslintJestConfig(root) {
|
|
13
|
-
const packageJson = await getPackageJson(root, 'jest');
|
|
14
|
-
|
|
15
|
-
// Jest not installed
|
|
16
|
-
if (packageJson == null) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return [
|
|
21
|
-
{
|
|
22
|
-
files: expandGlob('**/*.{test,spec}.{js,ts}'),
|
|
23
|
-
plugins: { jest },
|
|
24
|
-
languageOptions: { globals },
|
|
25
|
-
settings: {
|
|
26
|
-
jest: { version: packageJson?.version },
|
|
27
|
-
// node: { allowModules: [ '@jest/globals' ] },
|
|
28
|
-
},
|
|
29
|
-
rules: {
|
|
30
|
-
'max-lines': 'off',
|
|
31
|
-
'max-lines-per-function': 'off',
|
|
32
|
-
'max-nested-callbacks': 'off',
|
|
33
|
-
'class-methods-use-this': 'off',
|
|
34
|
-
|
|
35
|
-
'i6-custom-rules/moment/no-date': 'off',
|
|
36
|
-
'import/no-webpack-loader-syntax': 'off',
|
|
37
|
-
'import/first': 'off',
|
|
38
|
-
// 'node/no-extraneous-import': 'off',
|
|
39
|
-
'sonarjs/no-duplicate-string': 'off',
|
|
40
|
-
|
|
41
|
-
'jest/consistent-test-it': [
|
|
42
|
-
'error', {
|
|
43
|
-
fn: 'test',
|
|
44
|
-
withinDescribe: 'test',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
'jest/expect-expect': [
|
|
48
|
-
'error',
|
|
49
|
-
{ assertFunctionNames: [ 'expect' ] },
|
|
50
|
-
],
|
|
51
|
-
'jest/lowercase-name': 'off',
|
|
52
|
-
'jest/no-alias-methods': 'error',
|
|
53
|
-
|
|
54
|
-
'jest/no-commented-out-tests': 'error',
|
|
55
|
-
'jest/no-disabled-tests': 'warn',
|
|
56
|
-
'jest/no-focused-tests': 'warn',
|
|
57
|
-
|
|
58
|
-
'jest/no-duplicate-hooks': 'error',
|
|
59
|
-
'jest/no-export': 'error',
|
|
60
|
-
'jest/no-hooks': 'off',
|
|
61
|
-
'jest/no-identical-title': 'error',
|
|
62
|
-
'jest/no-jasmine-globals': 'error',
|
|
63
|
-
'jest/no-large-snapshots': 'off',
|
|
64
|
-
'jest/no-mocks-import': 'error',
|
|
65
|
-
'jest/prefer-snapshot-hint': 'off',
|
|
66
|
-
|
|
67
|
-
'jest/no-conditional-expect': 'error',
|
|
68
|
-
'jest/no-conditional-in-test': 'warn',
|
|
69
|
-
'jest/no-deprecated-functions': 'error',
|
|
70
|
-
'jest/no-restricted-jest-methods': 'off',
|
|
71
|
-
'jest/no-restricted-matchers': [
|
|
72
|
-
'error',
|
|
73
|
-
{
|
|
74
|
-
toBeTruthy: 'Avoid `toBeTruthy`',
|
|
75
|
-
toBeFalsy: 'Avoid `toBeFalsy`',
|
|
76
|
-
resolves: 'Use `expect(await promise)` instead.',
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
|
|
80
|
-
'jest/no-done-callback': 'error',
|
|
81
|
-
'jest/no-standalone-expect': 'error',
|
|
82
|
-
'jest/no-test-prefixes': 'error',
|
|
83
|
-
'jest/no-test-return-statement': 'error',
|
|
84
|
-
'jest/prefer-called-with': 'warn',
|
|
85
|
-
'jest/prefer-expect-assertions': [ 'warn', { onlyFunctionsWithAsyncKeyword: true } ],
|
|
86
|
-
'jest/prefer-comparison-matcher': 'warn',
|
|
87
|
-
'jest/prefer-equality-matcher': 'warn',
|
|
88
|
-
'jest/prefer-hooks-in-order': 'warn',
|
|
89
|
-
'jest/prefer-hooks-on-top': 'warn',
|
|
90
|
-
'jest/prefer-to-be': 'warn',
|
|
91
|
-
'jest/prefer-to-contain': 'warn',
|
|
92
|
-
'jest/prefer-to-have-length': 'warn',
|
|
93
|
-
'jest/prefer-todo': 'warn',
|
|
94
|
-
'jest/require-to-throw-message': 'error',
|
|
95
|
-
'jest/require-top-level-describe': 'error',
|
|
96
|
-
'jest/valid-describe-callback': 'error',
|
|
97
|
-
'jest/valid-expect': 'error',
|
|
98
|
-
'jest/valid-expect-in-promise': 'error',
|
|
99
|
-
'jest/valid-title': 'error',
|
|
100
|
-
|
|
101
|
-
'jest/prefer-spy-on': 'warn',
|
|
102
|
-
'jest/prefer-strict-equal': 'error',
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
files: [
|
|
107
|
-
'**/jest.{js,ts}',
|
|
108
|
-
'**/jest/**/*.{js,ts}',
|
|
109
|
-
'**/__mocks__/**/*.{js,ts}',
|
|
110
|
-
'**/test/**/*.{js,ts}',
|
|
111
|
-
'**/spec/**/*.{js,ts}',
|
|
112
|
-
'**/*.spec.ts',
|
|
113
|
-
'**/*.test.ts',
|
|
114
|
-
],
|
|
115
|
-
languageOptions: {
|
|
116
|
-
globals: {
|
|
117
|
-
__filename: true,
|
|
118
|
-
__dirname: true,
|
|
119
|
-
...globals,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
}
|
package/src/plugins/jsx-a11y.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import jsxa11y from 'eslint-plugin-jsx-a11y';
|
|
2
|
-
|
|
3
|
-
/** @type {import('eslint').Linter.RulesRecord} */
|
|
4
|
-
const rules = {
|
|
5
|
-
'jsx-a11y/alt-text': 'error',
|
|
6
|
-
'jsx-a11y/anchor-ambiguous-text': 'off',
|
|
7
|
-
// TODO: error
|
|
8
|
-
'jsx-a11y/anchor-has-content': 'error',
|
|
9
|
-
'jsx-a11y/anchor-is-valid': 'error',
|
|
10
|
-
'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
|
|
11
|
-
'jsx-a11y/aria-props': 'error',
|
|
12
|
-
'jsx-a11y/aria-proptypes': 'error',
|
|
13
|
-
'jsx-a11y/aria-role': 'error',
|
|
14
|
-
'jsx-a11y/aria-unsupported-elements': 'error',
|
|
15
|
-
'jsx-a11y/autocomplete-valid': 'error',
|
|
16
|
-
'jsx-a11y/click-events-have-key-events': 'error',
|
|
17
|
-
'jsx-a11y/control-has-associated-label': [ 'off', {
|
|
18
|
-
ignoreElements: [ 'audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video' ],
|
|
19
|
-
ignoreRoles: [ 'grid', 'listbox', 'menu', 'menubar', 'radiogroup', 'row', 'tablist', 'toolbar', 'tree', 'treegrid' ],
|
|
20
|
-
includeRoles: [ 'alert', 'dialog' ],
|
|
21
|
-
} ],
|
|
22
|
-
'jsx-a11y/heading-has-content': 'error',
|
|
23
|
-
'jsx-a11y/html-has-lang': 'error',
|
|
24
|
-
'jsx-a11y/iframe-has-title': 'error',
|
|
25
|
-
'jsx-a11y/img-redundant-alt': 'error',
|
|
26
|
-
'jsx-a11y/interactive-supports-focus': [ 'error', {
|
|
27
|
-
tabbable: [ 'button', 'checkbox', 'link', 'searchbox', 'spinbutton', 'switch', 'textbox' ],
|
|
28
|
-
} ],
|
|
29
|
-
'jsx-a11y/label-has-associated-control': 'error',
|
|
30
|
-
'jsx-a11y/label-has-for': 'off',
|
|
31
|
-
'jsx-a11y/media-has-caption': 'error',
|
|
32
|
-
'jsx-a11y/mouse-events-have-key-events': 'error',
|
|
33
|
-
'jsx-a11y/no-access-key': 'error',
|
|
34
|
-
'jsx-a11y/no-autofocus': 'error',
|
|
35
|
-
'jsx-a11y/no-distracting-elements': 'error',
|
|
36
|
-
'jsx-a11y/no-interactive-element-to-noninteractive-role': [ 'error', {
|
|
37
|
-
tr: [ 'none', 'presentation' ],
|
|
38
|
-
canvas: [ 'img' ],
|
|
39
|
-
} ],
|
|
40
|
-
'jsx-a11y/no-noninteractive-element-interactions': [ 'error', {
|
|
41
|
-
handlers: [ 'onClick', 'onError', 'onLoad', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp' ],
|
|
42
|
-
alert: [ 'onKeyUp', 'onKeyDown', 'onKeyPress' ],
|
|
43
|
-
body: [ 'onError', 'onLoad' ],
|
|
44
|
-
dialog: [ 'onKeyUp', 'onKeyDown', 'onKeyPress' ],
|
|
45
|
-
iframe: [ 'onError', 'onLoad' ],
|
|
46
|
-
img: [ 'onError', 'onLoad' ],
|
|
47
|
-
} ],
|
|
48
|
-
'jsx-a11y/no-noninteractive-element-to-interactive-role': [ 'error', {
|
|
49
|
-
ul: [ 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid' ],
|
|
50
|
-
ol: [ 'listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid' ],
|
|
51
|
-
li: [ 'menuitem', 'option', 'row', 'tab', 'treeitem' ],
|
|
52
|
-
table: [ 'grid' ],
|
|
53
|
-
td: [ 'gridcell' ],
|
|
54
|
-
fieldset: [ 'radiogroup', 'presentation' ],
|
|
55
|
-
} ],
|
|
56
|
-
'jsx-a11y/no-noninteractive-tabindex': [ 'error', {
|
|
57
|
-
tags: [],
|
|
58
|
-
roles: [ 'tabpanel' ],
|
|
59
|
-
allowExpressionValues: true,
|
|
60
|
-
} ],
|
|
61
|
-
'jsx-a11y/no-redundant-roles': 'error',
|
|
62
|
-
'jsx-a11y/no-static-element-interactions': [ 'error', {
|
|
63
|
-
allowExpressionValues: true,
|
|
64
|
-
handlers: [ 'onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp' ],
|
|
65
|
-
} ],
|
|
66
|
-
'jsx-a11y/role-has-required-aria-props': 'error',
|
|
67
|
-
'jsx-a11y/role-supports-aria-props': 'error',
|
|
68
|
-
'jsx-a11y/scope': 'error',
|
|
69
|
-
'jsx-a11y/tabindex-no-positive': 'error',
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Get ESLint config for imports check
|
|
74
|
-
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
75
|
-
*/
|
|
76
|
-
export async function createEslintJsxA11yConfig() {
|
|
77
|
-
return [
|
|
78
|
-
{
|
|
79
|
-
files: [ '**/*.jsx' ],
|
|
80
|
-
languageOptions: {
|
|
81
|
-
parserOptions: {
|
|
82
|
-
ecmaFeatures: { jsx: true },
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
plugins: { 'jsx-a11y': jsxa11y },
|
|
86
|
-
rules: rules,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
files: [ '**/*.tsx' ],
|
|
90
|
-
languageOptions: {
|
|
91
|
-
parserOptions: {
|
|
92
|
-
ecmaFeatures: { jsx: true },
|
|
93
|
-
jsxPragma: null, // for @typescript/eslint-parser
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
plugins: { 'jsx-a11y': jsxa11y },
|
|
97
|
-
rules: rules,
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get ESLint config jest plugin
|
|
3
|
-
* @param {import('node:url').URL} root root url
|
|
4
|
-
* @returns {Promise<import('eslint').Linter.FlatConfig[]>}
|
|
5
|
-
*/
|
|
6
|
-
export function createEslintJestConfig(root: import('node:url').URL): Promise<import('eslint').Linter.FlatConfig[]>;
|