@forsakringskassan/eslint-config 10.2.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/eslint.js +13 -0
- package/index.js +122 -0
- package/package.json +43 -0
- package/patch/modern-module-resolution.js +1 -0
package/eslint.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
|
+
|
|
6
|
+
const pkgPath = path.dirname(require.resolve("eslint/package.json"));
|
|
7
|
+
const binary = path.join(pkgPath, "bin/eslint");
|
|
8
|
+
|
|
9
|
+
spawn("node", [binary, ...process.argv.slice(2)], {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
}).on("exit", (code) => {
|
|
12
|
+
process.exit(code);
|
|
13
|
+
});
|
package/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
"eslint:recommended",
|
|
4
|
+
"plugin:prettier/recommended",
|
|
5
|
+
"plugin:import/errors",
|
|
6
|
+
"plugin:eslint-comments/recommended",
|
|
7
|
+
"plugin:sonarjs/recommended",
|
|
8
|
+
],
|
|
9
|
+
|
|
10
|
+
env: {
|
|
11
|
+
es6: true,
|
|
12
|
+
node: true,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaVersion: 2022,
|
|
17
|
+
sourceType: "module",
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
settings: {
|
|
21
|
+
"import/resolver": {
|
|
22
|
+
[require.resolve("eslint-import-resolver-node")]: true,
|
|
23
|
+
[require.resolve("eslint-import-resolver-typescript")]: true,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
rules: {
|
|
28
|
+
camelcase: "error",
|
|
29
|
+
complexity: ["error", 20],
|
|
30
|
+
"consistent-return": "error",
|
|
31
|
+
curly: "error",
|
|
32
|
+
eqeqeq: "error",
|
|
33
|
+
"max-depth": ["error", 3],
|
|
34
|
+
"no-eval": "error",
|
|
35
|
+
"no-implied-eval": "error",
|
|
36
|
+
"no-loop-func": "error",
|
|
37
|
+
"no-new": "error",
|
|
38
|
+
"no-new-func": "error",
|
|
39
|
+
"no-unreachable": "error",
|
|
40
|
+
"no-unused-vars": "error",
|
|
41
|
+
"no-var": "error",
|
|
42
|
+
"no-warning-comments": "error",
|
|
43
|
+
"prefer-const": "error",
|
|
44
|
+
"prefer-rest-params": "error",
|
|
45
|
+
"prefer-spread": "error",
|
|
46
|
+
"prefer-template": "error",
|
|
47
|
+
radix: "error",
|
|
48
|
+
yoda: "error",
|
|
49
|
+
|
|
50
|
+
"eslint-comments/disable-enable-pair": [
|
|
51
|
+
"error",
|
|
52
|
+
{ allowWholeFile: true },
|
|
53
|
+
],
|
|
54
|
+
"eslint-comments/require-description": [
|
|
55
|
+
"error",
|
|
56
|
+
{
|
|
57
|
+
ignore: [
|
|
58
|
+
"eslint-enable",
|
|
59
|
+
"eslint-env",
|
|
60
|
+
"exported",
|
|
61
|
+
"global",
|
|
62
|
+
"globals",
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
"eslint-comments/no-unused-disable": "error",
|
|
67
|
+
|
|
68
|
+
/* Use eslint native complexity rule instead */
|
|
69
|
+
"sonarjs/cognitive-complexity": "off",
|
|
70
|
+
|
|
71
|
+
/* Prefer to use multiple returns even for booleans (looks better and
|
|
72
|
+
* can yield performance increase), see example of this in
|
|
73
|
+
* "example.js". */
|
|
74
|
+
"sonarjs/prefer-single-boolean-return": "off",
|
|
75
|
+
|
|
76
|
+
/* This rule is deemed to provide more trouble than actual value.
|
|
77
|
+
* Especially because of the prevalence of translations, i.e., text
|
|
78
|
+
* keys. */
|
|
79
|
+
"sonarjs/no-duplicate-string": "off",
|
|
80
|
+
|
|
81
|
+
/* Lower some errors to warnings, these are allowed on local builds (to
|
|
82
|
+
* not prevent builds during development where code is unfinished and
|
|
83
|
+
* might contain debugging code) but is disallowed when building from
|
|
84
|
+
* Jenkins (via `--max-warnings 0`) */
|
|
85
|
+
"no-console": "warn",
|
|
86
|
+
"no-debugger": "warn",
|
|
87
|
+
"prettier/prettier": "warn",
|
|
88
|
+
|
|
89
|
+
"import/default": "off",
|
|
90
|
+
"import/extensions": ["error", "never", { json: "always" }],
|
|
91
|
+
"import/newline-after-import": "error",
|
|
92
|
+
"import/no-absolute-path": "error",
|
|
93
|
+
"import/no-deprecated": "error",
|
|
94
|
+
"import/no-duplicates": "error",
|
|
95
|
+
"import/no-dynamic-require": "error",
|
|
96
|
+
"import/no-extraneous-dependencies": "error",
|
|
97
|
+
"import/no-mutable-exports": "error",
|
|
98
|
+
"import/no-named-as-default": "error",
|
|
99
|
+
"import/no-named-as-default-member": "error",
|
|
100
|
+
"import/no-named-default": "error",
|
|
101
|
+
"import/no-unresolved": [
|
|
102
|
+
"error",
|
|
103
|
+
{
|
|
104
|
+
/* neither of the resolvers will handle @ alias */
|
|
105
|
+
ignore: ["^@"],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
"import/no-useless-path-segments": "error",
|
|
109
|
+
"import/order": [
|
|
110
|
+
"error",
|
|
111
|
+
{
|
|
112
|
+
pathGroups: [
|
|
113
|
+
{
|
|
114
|
+
pattern: "@/**",
|
|
115
|
+
group: "parent",
|
|
116
|
+
position: "before",
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forsakringskassan/eslint-config",
|
|
3
|
+
"version": "10.2.0",
|
|
4
|
+
"description": "Försäkringskassans eslint shareable config",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/Forsakringskassan/eslint-config",
|
|
9
|
+
"bugs": "https://github.com/Forsakringskassan/eslint-config/issues",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/Forsakringskassan/eslint-config.git",
|
|
13
|
+
"directory": "packages/eslint-config"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Försäkringskassan",
|
|
17
|
+
"bin": {
|
|
18
|
+
"eslint": "eslint.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"patch",
|
|
22
|
+
"eslint.js",
|
|
23
|
+
"index.js"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@rushstack/eslint-patch": "1.7.2",
|
|
27
|
+
"eslint": "8.57.0",
|
|
28
|
+
"eslint-config-prettier": "9.1.0",
|
|
29
|
+
"eslint-import-resolver-node": "0.3.9",
|
|
30
|
+
"eslint-import-resolver-typescript": "3.6.1",
|
|
31
|
+
"eslint-plugin-eslint-comments": "3.2.0",
|
|
32
|
+
"eslint-plugin-import": "2.29.1",
|
|
33
|
+
"eslint-plugin-prettier": "4.2.1",
|
|
34
|
+
"eslint-plugin-sonarjs": "0.24.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"prettier": "^2 || ^3"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">= 16.10"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "0cd554a08710a08521bac5d79fcce26f2bdd5886"
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("@rushstack/eslint-patch/modern-module-resolution");
|