@forsakringskassan/eslint-config 12.2.0 → 12.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/flat.d.mts +6 -0
- package/flat.mjs +157 -26
- package/package.json +4 -4
package/flat.d.mts
ADDED
package/flat.mjs
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { fileURLToPath } from "node:url";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
4
2
|
import js from "@eslint/js";
|
|
5
|
-
import
|
|
3
|
+
import prettierConfig from "eslint-config-prettier";
|
|
4
|
+
import importPlugin from "eslint-plugin-import";
|
|
5
|
+
import eslintCommentsPlugin from "eslint-plugin-eslint-comments";
|
|
6
|
+
import prettierPlugin from "eslint-plugin-prettier";
|
|
7
|
+
import sonarjsPlugin from "eslint-plugin-sonarjs";
|
|
8
|
+
import globals from "globals";
|
|
6
9
|
|
|
7
10
|
export { default as globals } from "globals";
|
|
8
11
|
|
|
@@ -18,36 +21,164 @@ function defineConfig(config) {
|
|
|
18
21
|
return config;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
-
const __dirname = path.dirname(__filename);
|
|
23
|
-
|
|
24
|
-
const compat = new FlatCompat({
|
|
25
|
-
baseDirectory: __dirname,
|
|
26
|
-
resolvePluginsRelativeTo: __dirname,
|
|
27
|
-
recommendedConfig: js.configs.recommended,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const migrated = compat.config(legacyConfig);
|
|
31
|
-
|
|
32
|
-
for (const ruleset of migrated) {
|
|
33
|
-
if (!ruleset.languageOptions) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
delete ruleset.languageOptions.ecmaVersion;
|
|
37
|
-
delete ruleset.languageOptions.sourceType;
|
|
38
|
-
if (Object.keys(ruleset.languageOptions).length === 0) {
|
|
39
|
-
delete ruleset.languageOptions;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
24
|
export default [
|
|
44
|
-
|
|
25
|
+
defineConfig({
|
|
26
|
+
...js.configs.recommended,
|
|
27
|
+
}),
|
|
28
|
+
|
|
29
|
+
defineConfig({
|
|
30
|
+
plugins: {
|
|
31
|
+
prettier: prettierPlugin,
|
|
32
|
+
import: importPlugin,
|
|
33
|
+
"eslint-comments": eslintCommentsPlugin,
|
|
34
|
+
sonarjs: sonarjsPlugin,
|
|
35
|
+
},
|
|
36
|
+
settings: {
|
|
37
|
+
"import/resolver": {
|
|
38
|
+
[fileURLToPath(
|
|
39
|
+
import.meta.resolve("eslint-import-resolver-node"),
|
|
40
|
+
)]: true,
|
|
41
|
+
[fileURLToPath(
|
|
42
|
+
import.meta.resolve("eslint-import-resolver-typescript"),
|
|
43
|
+
)]: true,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
...prettierConfig.rules,
|
|
48
|
+
...prettierPlugin.configs.recommended.rules,
|
|
49
|
+
...importPlugin.configs.errors.rules,
|
|
50
|
+
...eslintCommentsPlugin.configs.recommended.rules,
|
|
51
|
+
...sonarjsPlugin.configs.recommended.rules,
|
|
52
|
+
},
|
|
53
|
+
}),
|
|
54
|
+
|
|
55
|
+
defineConfig({
|
|
56
|
+
name: "@forsakringskassan/eslint-config/rules",
|
|
57
|
+
rules: {
|
|
58
|
+
camelcase: "error",
|
|
59
|
+
complexity: ["error", 20],
|
|
60
|
+
"consistent-return": "error",
|
|
61
|
+
curly: "error",
|
|
62
|
+
eqeqeq: "error",
|
|
63
|
+
"max-depth": ["error", 3],
|
|
64
|
+
"max-params": ["error", { max: 5 }],
|
|
65
|
+
"no-eval": "error",
|
|
66
|
+
"no-implied-eval": "error",
|
|
67
|
+
"no-loop-func": "error",
|
|
68
|
+
"no-new": "error",
|
|
69
|
+
"no-new-func": "error",
|
|
70
|
+
"no-unreachable": "error",
|
|
71
|
+
"no-unused-vars": "error",
|
|
72
|
+
"no-var": "error",
|
|
73
|
+
"no-warning-comments": "error",
|
|
74
|
+
"prefer-const": "error",
|
|
75
|
+
"prefer-rest-params": "error",
|
|
76
|
+
"prefer-spread": "error",
|
|
77
|
+
"prefer-template": "error",
|
|
78
|
+
radix: "error",
|
|
79
|
+
yoda: "error",
|
|
80
|
+
|
|
81
|
+
"eslint-comments/disable-enable-pair": [
|
|
82
|
+
"error",
|
|
83
|
+
{ allowWholeFile: true },
|
|
84
|
+
],
|
|
85
|
+
"eslint-comments/require-description": [
|
|
86
|
+
"error",
|
|
87
|
+
{
|
|
88
|
+
ignore: [
|
|
89
|
+
"eslint-enable",
|
|
90
|
+
"eslint-env",
|
|
91
|
+
"exported",
|
|
92
|
+
"global",
|
|
93
|
+
"globals",
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
"eslint-comments/no-unused-disable": "error",
|
|
98
|
+
|
|
99
|
+
/* Use eslint native complexity rule instead */
|
|
100
|
+
"sonarjs/cognitive-complexity": "off",
|
|
101
|
+
|
|
102
|
+
/* Prefer to use multiple returns even for booleans (looks better and
|
|
103
|
+
* can yield performance increase), see example of this in
|
|
104
|
+
* "example.js". */
|
|
105
|
+
"sonarjs/prefer-single-boolean-return": "off",
|
|
106
|
+
|
|
107
|
+
/* This rule is deemed to provide more trouble than actual value.
|
|
108
|
+
* Especially because of the prevalence of translations, i.e., text
|
|
109
|
+
* keys. */
|
|
110
|
+
"sonarjs/no-duplicate-string": "off",
|
|
111
|
+
|
|
112
|
+
/* Lower some errors to warnings, these are allowed on local builds (to
|
|
113
|
+
* not prevent builds during development where code is unfinished and
|
|
114
|
+
* might contain debugging code) but is disallowed when building from
|
|
115
|
+
* Jenkins (via `--max-warnings 0`) */
|
|
116
|
+
"no-console": "warn",
|
|
117
|
+
"no-debugger": "warn",
|
|
118
|
+
"prettier/prettier": "warn",
|
|
119
|
+
|
|
120
|
+
"import/default": "off",
|
|
121
|
+
"import/extensions": [
|
|
122
|
+
"error",
|
|
123
|
+
"never",
|
|
124
|
+
{
|
|
125
|
+
css: "always",
|
|
126
|
+
json: "always",
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
"import/newline-after-import": "error",
|
|
130
|
+
"import/no-absolute-path": "error",
|
|
131
|
+
"import/no-deprecated": "error",
|
|
132
|
+
"import/no-duplicates": "error",
|
|
133
|
+
"import/no-dynamic-require": "error",
|
|
134
|
+
"import/no-extraneous-dependencies": "error",
|
|
135
|
+
"import/no-mutable-exports": "error",
|
|
136
|
+
"import/no-named-as-default": "error",
|
|
137
|
+
"import/no-named-as-default-member": "error",
|
|
138
|
+
"import/no-named-default": "error",
|
|
139
|
+
"import/no-unresolved": [
|
|
140
|
+
"error",
|
|
141
|
+
{
|
|
142
|
+
/* neither of the resolvers will handle @ alias */
|
|
143
|
+
ignore: ["^@"],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
"import/no-useless-path-segments": "error",
|
|
147
|
+
"import/order": [
|
|
148
|
+
"error",
|
|
149
|
+
{
|
|
150
|
+
pathGroups: [
|
|
151
|
+
{
|
|
152
|
+
pattern: "@/**",
|
|
153
|
+
group: "parent",
|
|
154
|
+
position: "before",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
}),
|
|
161
|
+
|
|
162
|
+
defineConfig({
|
|
163
|
+
name: "@forsakringskassan/eslint-config/globals",
|
|
164
|
+
languageOptions: {
|
|
165
|
+
globals: {
|
|
166
|
+
...globals.es6,
|
|
167
|
+
...globals.node,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
45
171
|
|
|
46
172
|
defineConfig({
|
|
47
173
|
name: "@forsakringskassan/eslint-config/ecma-version",
|
|
48
174
|
languageOptions: {
|
|
49
175
|
ecmaVersion: 2024,
|
|
50
176
|
sourceType: "module",
|
|
177
|
+
parserOptions: {
|
|
178
|
+
ecmaFeatures: {
|
|
179
|
+
globalReturn: true,
|
|
180
|
+
},
|
|
181
|
+
},
|
|
51
182
|
},
|
|
52
183
|
}),
|
|
53
184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forsakringskassan/eslint-config",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.2",
|
|
4
4
|
"description": "Försäkringskassans eslint shareable config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint"
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"patch",
|
|
23
23
|
"eslint.js",
|
|
24
24
|
"flat.mjs",
|
|
25
|
+
"flat.d.mts",
|
|
25
26
|
"index.cjs"
|
|
26
27
|
],
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@eslint/
|
|
29
|
-
"@eslint/js": "9.34.0",
|
|
29
|
+
"@eslint/js": "9.35.0",
|
|
30
30
|
"@rushstack/eslint-patch": "1.12.0",
|
|
31
31
|
"eslint": "8.57.1",
|
|
32
32
|
"eslint-config-prettier": "10.1.8",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">= 20.19"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ada50dccddcd01d906f764576493c5a1ebbe4253"
|
|
48
48
|
}
|