eslint-config-heck 9.6.0 → 10.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/biomeComplexity.json +48 -0
- package/biomeJsTs.json +1 -1
- package/eslint.config.js +1 -3
- package/package.json +3 -7
- package/readme.md +25 -84
- package/complexity.js +0 -26
- package/groupImports.js +0 -33
- package/node.js +0 -1308
- package/reactNative.js +0 -19
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
3
|
+
"root": false,
|
|
4
|
+
"linter": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"rules": {
|
|
7
|
+
"complexity": {
|
|
8
|
+
"noExcessiveCognitiveComplexity": "warn",
|
|
9
|
+
"noExcessiveLinesPerFunction": {
|
|
10
|
+
"level": "error",
|
|
11
|
+
"options": {
|
|
12
|
+
"maxLines": 20,
|
|
13
|
+
"skipBlankLines": true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"useMaxParams": {
|
|
17
|
+
"level": "error",
|
|
18
|
+
"options": {
|
|
19
|
+
"max": 3
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"overrides": [
|
|
26
|
+
{
|
|
27
|
+
"includes": [
|
|
28
|
+
"**/*.spec.ts",
|
|
29
|
+
"**/*.spec.tsx",
|
|
30
|
+
"**/*.test.ts",
|
|
31
|
+
"**/*.test.tsx",
|
|
32
|
+
"**/*.spec.js",
|
|
33
|
+
"**/*.spec.jsx",
|
|
34
|
+
"**/*.test.js",
|
|
35
|
+
"**/*.test.jsx"
|
|
36
|
+
],
|
|
37
|
+
"linter": {
|
|
38
|
+
"rules": {
|
|
39
|
+
"complexity": {
|
|
40
|
+
"noExcessiveCognitiveComplexity": "off",
|
|
41
|
+
"noExcessiveLinesPerFunction": "off",
|
|
42
|
+
"useMaxParams": "off"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
package/biomeJsTs.json
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"noBannedTypes": "error",
|
|
49
49
|
"noCommaOperator": "error",
|
|
50
50
|
"noEmptyTypeParameters": "error",
|
|
51
|
-
"noExcessiveCognitiveComplexity": "
|
|
51
|
+
"noExcessiveCognitiveComplexity": "off",
|
|
52
52
|
"noExcessiveLinesPerFunction": "off",
|
|
53
53
|
"noExcessiveNestedTestSuites": "error",
|
|
54
54
|
"noExtraBooleanCast": "error",
|
package/eslint.config.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from "eslint/config";
|
|
2
|
-
import complexity from "./complexity.js";
|
|
3
|
-
import groupImports from "./groupImports.js";
|
|
4
2
|
import nodeWithBiome from "./nodeWithBiome.js";
|
|
5
3
|
|
|
6
4
|
// biome-ignore lint/style/noDefaultExport: Required for ESLint configuration
|
|
7
5
|
export default defineConfig({
|
|
8
|
-
extends: [nodeWithBiome
|
|
6
|
+
extends: [nodeWithBiome],
|
|
9
7
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-heck",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Contains an ESLint configuration for ES2015+, TypeScript, and React.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -8,11 +8,7 @@
|
|
|
8
8
|
"./biomeJsTs": "./biomeJsTs.json",
|
|
9
9
|
"./biomeCss": "./biomeCss.json",
|
|
10
10
|
"./biomeJson": "./biomeJson.json",
|
|
11
|
-
"./
|
|
12
|
-
"./nodeWithBiome": "./nodeWithBiome.js",
|
|
13
|
-
"./complexity": "./complexity.js",
|
|
14
|
-
"./groupImports": "./groupImports.js",
|
|
15
|
-
"./reactNative": "./reactNative.js"
|
|
11
|
+
"./nodeWithBiome": "./nodeWithBiome.js"
|
|
16
12
|
},
|
|
17
13
|
"scripts": {
|
|
18
14
|
"update": "npx -y npm-check-updates -i --cooldown 2 --install never && npx -y npm-check-updates -i --cooldown 2 --target minor --install never && npx -y npm-check-updates -i --cooldown 2 --target patch --install never && npm update --force",
|
|
@@ -20,6 +16,7 @@
|
|
|
20
16
|
"semantic-release": "semantic-release"
|
|
21
17
|
},
|
|
22
18
|
"keywords": [
|
|
19
|
+
"Biome",
|
|
23
20
|
"ESLint",
|
|
24
21
|
"ES2015",
|
|
25
22
|
"TypeScript",
|
|
@@ -36,7 +33,6 @@
|
|
|
36
33
|
"eslint-plugin-jest": "29.15.2",
|
|
37
34
|
"eslint-plugin-react": "7.37.5",
|
|
38
35
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
39
|
-
"eslint-plugin-react-native": "5.0.0",
|
|
40
36
|
"eslint-plugin-testing-library": "7.16.2",
|
|
41
37
|
"eslint-plugin-unicorn": "64.0.0",
|
|
42
38
|
"typescript": "6.0.3"
|
package/readme.md
CHANGED
|
@@ -1,101 +1,30 @@
|
|
|
1
1
|
# eslint-config-heck
|
|
2
2
|
|
|
3
|
-
eslint-config-heck contains
|
|
3
|
+
eslint-config-heck contains ESLint and Biome configurations for ES2015+, TypeScript, and React.
|
|
4
|
+
|
|
5
|
+
**Both ESLint and Biome are required.** Biome handles formatting, import/export sorting, and a large set of linting rules. ESLint covers rules that Biome does not yet support. Using one without the other will leave significant gaps in your linting coverage.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
~~~sh
|
|
8
|
-
npm install --save-dev eslint@9 eslint-config-heck
|
|
9
|
-
~~~
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
To use one of the included configurations, create a `eslint.config.js` and import the configuration you want to use.
|
|
14
|
-
|
|
15
|
-
For a Node.js project use:
|
|
16
|
-
|
|
17
|
-
~~~js
|
|
18
|
-
{
|
|
19
|
-
import node from "eslint-config-heck/node";
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
...node,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
10
|
+
npm install --save-dev eslint@9 @biomejs/biome eslint-config-heck
|
|
25
11
|
~~~
|
|
26
12
|
|
|
27
|
-
##
|
|
13
|
+
## ESLint Setup
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Optionally you can enable some complexity rules by using the **complexity** configuration in addition to the **node** configuration:
|
|
15
|
+
Create an `eslint.config.js` and import the `nodeWithBiome` configuration. This configuration only enables rules that Biome does not yet support, so it is intended to be used alongside Biome.
|
|
32
16
|
|
|
33
17
|
~~~js
|
|
34
|
-
|
|
35
|
-
import node from "eslint-config-heck/node";
|
|
36
|
-
import complexity from "eslint-config-heck/complexity";
|
|
18
|
+
import nodeWithBiome from "eslint-config-heck/nodeWithBiome";
|
|
37
19
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
20
|
+
export default [
|
|
21
|
+
...nodeWithBiome,
|
|
22
|
+
];
|
|
43
23
|
~~~
|
|
44
24
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Optionally you can switch to another import sorting rule, which groups the imports by type and supports auto fixing. You can enable this rule by adding the **groupImports** configuration in addition to the **node** configuration:
|
|
48
|
-
|
|
49
|
-
~~~js
|
|
50
|
-
{
|
|
51
|
-
import node from "eslint-config-heck/node";
|
|
52
|
-
import groupImports from "eslint-config-heck/groupImports";
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
...node,
|
|
56
|
-
...groupImports,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
~~~
|
|
25
|
+
## Biome Setup
|
|
60
26
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
If you are using react-native, you can enable react-native specific rules:
|
|
64
|
-
|
|
65
|
-
~~~js
|
|
66
|
-
{
|
|
67
|
-
import node from "eslint-config-heck/node";
|
|
68
|
-
import reactNative from "eslint-config-heck/reactNative";
|
|
69
|
-
export default {
|
|
70
|
-
...node,
|
|
71
|
-
...reactNative,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
~~~
|
|
75
|
-
|
|
76
|
-
### Rules with usage of Biome
|
|
77
|
-
|
|
78
|
-
If you are using Biome you can use the "nodeWithBiome" configuration:
|
|
79
|
-
|
|
80
|
-
~~~js
|
|
81
|
-
{
|
|
82
|
-
import nodeWithBiome from "eslint-config-heck/nodeWithBiome";
|
|
83
|
-
|
|
84
|
-
export default {
|
|
85
|
-
...nodeWithBiome,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
~~~
|
|
89
|
-
|
|
90
|
-
If you are using Biome you can also extend your Biome config with the following Biome configurations:
|
|
91
|
-
|
|
92
|
-
- JavaScript/TypeScript: biomeJsTs
|
|
93
|
-
- React-Native: biomeReactNative
|
|
94
|
-
- CSS: biomeCss
|
|
95
|
-
- JSON: biomeJson
|
|
96
|
-
- Playwright: biomePlaywright
|
|
97
|
-
|
|
98
|
-
To enable all Biome rules, you can use the following configuration:
|
|
27
|
+
Create a `biome.jsonc` and extend the configurations you need:
|
|
99
28
|
|
|
100
29
|
~~~json
|
|
101
30
|
{
|
|
@@ -105,7 +34,19 @@ To enable all Biome rules, you can use the following configuration:
|
|
|
105
34
|
"eslint-config-heck/biomeReactNative",
|
|
106
35
|
"eslint-config-heck/biomeCss",
|
|
107
36
|
"eslint-config-heck/biomeJson",
|
|
108
|
-
"eslint-config-heck/biomePlaywright"
|
|
37
|
+
"eslint-config-heck/biomePlaywright",
|
|
38
|
+
"eslint-config-heck/biomeComplexity"
|
|
109
39
|
]
|
|
110
40
|
}
|
|
111
41
|
~~~
|
|
42
|
+
|
|
43
|
+
### Available Biome Configurations
|
|
44
|
+
|
|
45
|
+
| Configuration | Purpose |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `biomeJsTs` | JavaScript and TypeScript rules, formatting, and import/export sorting |
|
|
48
|
+
| `biomeReactNative` | React Native specific rules |
|
|
49
|
+
| `biomeCss` | CSS specific rules |
|
|
50
|
+
| `biomeJson` | JSON specific rules |
|
|
51
|
+
| `biomePlaywright` | Playwright test rules |
|
|
52
|
+
| `biomeComplexity` | Complexity rules |
|
package/complexity.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// biome-ignore lint/style/noDefaultExport: Required for ESLint configuration
|
|
2
|
-
export default [
|
|
3
|
-
{
|
|
4
|
-
rules: {
|
|
5
|
-
"max-depth": ["warn", 2],
|
|
6
|
-
"max-statements": ["warn", 20],
|
|
7
|
-
"max-params": ["warn", 3],
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
files: [
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.spec.tsx",
|
|
14
|
-
"**/*.test.ts",
|
|
15
|
-
"**/*.test.tsx",
|
|
16
|
-
"**/*.spec.js",
|
|
17
|
-
"**/*.spec.jsx",
|
|
18
|
-
"**/*.test.js",
|
|
19
|
-
"**/*.test.jsx",
|
|
20
|
-
],
|
|
21
|
-
rules: {
|
|
22
|
-
"max-statements": "off",
|
|
23
|
-
"max-params": "off",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
];
|
package/groupImports.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// biome-ignore lint/style/noDefaultExport: Required for ESLint configuration
|
|
2
|
-
export default [
|
|
3
|
-
{
|
|
4
|
-
rules: {
|
|
5
|
-
"sort-imports": [
|
|
6
|
-
"error",
|
|
7
|
-
{
|
|
8
|
-
ignoreCase: true,
|
|
9
|
-
ignoreDeclarationSort: true,
|
|
10
|
-
},
|
|
11
|
-
],
|
|
12
|
-
"importPlugin/order": [
|
|
13
|
-
"error",
|
|
14
|
-
{
|
|
15
|
-
groups: [
|
|
16
|
-
"unknown",
|
|
17
|
-
"builtin",
|
|
18
|
-
"external",
|
|
19
|
-
"internal",
|
|
20
|
-
"parent",
|
|
21
|
-
"sibling",
|
|
22
|
-
"index",
|
|
23
|
-
"object",
|
|
24
|
-
],
|
|
25
|
-
alphabetize: {
|
|
26
|
-
order: "asc",
|
|
27
|
-
caseInsensitive: true,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
];
|