@forsakringskassan/eslint-config 13.0.2 → 13.0.3

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.
Files changed (2) hide show
  1. package/index.mjs +56 -2
  2. package/package.json +2 -2
package/index.mjs CHANGED
@@ -11,6 +11,7 @@ export { default as globals } from "globals";
11
11
 
12
12
  /**
13
13
  * @typedef {import("eslint").Linter.Config} Config
14
+ * @typedef {import("eslint").Linter.RulesRecord} RulesRecord
14
15
  */
15
16
 
16
17
  /**
@@ -36,6 +37,17 @@ function merge(result, it) {
36
37
  };
37
38
  }
38
39
 
40
+ /**
41
+ * @param {RulesRecord} rules
42
+ * @param {(rule: string) => boolean} predicate
43
+ * @returns {RulesRecord}
44
+ */
45
+ function filterRules(rules, predicate) {
46
+ return Object.fromEntries(
47
+ Object.entries(rules).filter(([key]) => predicate(key)),
48
+ );
49
+ }
50
+
39
51
  export default [
40
52
  defineConfig({
41
53
  ...js.configs.recommended,
@@ -59,7 +71,27 @@ export default [
59
71
  },
60
72
  },
61
73
  rules: {
62
- ...prettierConfig.rules,
74
+ ...filterRules(prettierConfig.rules, (rule) => {
75
+ if (rule.startsWith("@stylistic/")) {
76
+ return false;
77
+ }
78
+ if (rule.startsWith("@babel/") || rule.startsWith("babel/")) {
79
+ return false;
80
+ }
81
+ if (rule.startsWith("flowtype/")) {
82
+ return false;
83
+ }
84
+ if (rule.startsWith("react/")) {
85
+ return false;
86
+ }
87
+ if (rule.startsWith("standard/")) {
88
+ return false;
89
+ }
90
+ if (rule.startsWith("unicorn/")) {
91
+ return false;
92
+ }
93
+ return true;
94
+ }),
63
95
  ...prettierPlugin.configs.recommended.rules,
64
96
  ...importPlugin.configs.errors.rules,
65
97
  ...eslintCommentsPlugin.configs.recommended.rules,
@@ -125,8 +157,10 @@ export default [
125
157
  "sonarjs/no-duplicate-string": "off",
126
158
 
127
159
  "sonarjs/argument-type": "off", // handled by typescript (and this rule is sometimes wrong)
160
+ "sonarjs/arguments-order": "off", // another slow rule, would be nice to have enabled thought
128
161
  "sonarjs/deprecation": "off", // covered by @typescript-eslint/no-deprecated (and this rule crashes on .svelte files)
129
162
  "sonarjs/function-return-type": "off", // overly broad and opinionated, let typescript deal with this
163
+ "sonarjs/no-commented-code": "off", // neat rule but is very very slow (over 50% of the total linting time)
130
164
  "sonarjs/no-control-regex": "off", // covered by no-control-regexp
131
165
  "sonarjs/no-empty-test-file": "off", // could be useful but it does not handle it.each or similar constructs thus yields more false positives than its worth */
132
166
  "sonarjs/no-selector-parameter": "off", // not always possible (e.g. watcher handler in vue)
@@ -141,6 +175,27 @@ export default [
141
175
  "sonarjs/unused-named-groups": "off", // named groups can help readability even if not used
142
176
  "sonarjs/use-type-alias": "off", // overly broad, lets leave this to the discretion of the author
143
177
 
178
+ /* disable sonarjs aws related rules as we dont use aws */
179
+ "sonarjs/aws-apigateway-public-api": "off",
180
+ "sonarjs/aws-ec2-rds-dms-public": "off",
181
+ "sonarjs/aws-ec2-unencrypted-ebs-volume": "off",
182
+ "sonarjs/aws-efs-unencrypted": "off",
183
+ "sonarjs/aws-iam-all-privileges": "off",
184
+ "sonarjs/aws-iam-all-resources-accessible": "off",
185
+ "sonarjs/aws-iam-privilege-escalation": "off",
186
+ "sonarjs/aws-iam-public-access": "off",
187
+ "sonarjs/aws-opensearchservice-domain": "off",
188
+ "sonarjs/aws-rds-unencrypted-databases": "off",
189
+ "sonarjs/aws-restricted-ip-admin-access": "off",
190
+ "sonarjs/aws-s3-bucket-granted-access": "off",
191
+ "sonarjs/aws-s3-bucket-insecure-http": "off",
192
+ "sonarjs/aws-s3-bucket-public-access": "off",
193
+ "sonarjs/aws-s3-bucket-server-encryption": "off",
194
+ "sonarjs/aws-s3-bucket-versioning": "off",
195
+ "sonarjs/aws-sagemaker-unencrypted-notebook": "off",
196
+ "sonarjs/aws-sns-unencrypted-topics": "off",
197
+ "sonarjs/aws-sqs-unencrypted-queue": "off",
198
+
144
199
  /* Lower some errors to warnings, these are allowed on local builds (to
145
200
  * not prevent builds during development where code is unfinished and
146
201
  * might contain debugging code) but is disallowed when building from
@@ -148,7 +203,6 @@ export default [
148
203
  "no-console": "warn",
149
204
  "no-debugger": "warn",
150
205
  "prettier/prettier": "warn",
151
- "sonarjs/no-commented-code": "warn",
152
206
 
153
207
  "import/default": "off",
154
208
  "import/extensions": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/eslint-config",
3
- "version": "13.0.2",
3
+ "version": "13.0.3",
4
4
  "description": "Försäkringskassans eslint shareable config",
5
5
  "keywords": [
6
6
  "eslint"
@@ -41,5 +41,5 @@
41
41
  "engines": {
42
42
  "node": ">= 22.0"
43
43
  },
44
- "gitHead": "99ad23a49dac0b99b44be7190639b0dfb5d27355"
44
+ "gitHead": "23765c7782b10249c9c2e7c42fe7448e0afddce6"
45
45
  }