@prowise/eslint-config-linting-rules 2.0.2 → 2.0.4

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/front-react.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import globals from "globals";
2
+ import base from "./base.js";
2
3
  import react from "./rules/plugin-react-rules.js";
4
+ import typescript from "./rules/plugin-typescript-rules.js";
3
5
  import vitest from "./rules/plugin-vitest-rules.js";
4
- import typescript from "./typescript.js";
5
6
 
6
7
  export default [
8
+ base,
7
9
  typescript,
8
10
  react,
9
11
  vitest,
package/front-solid.js CHANGED
@@ -1,9 +1,11 @@
1
1
  import globals from "globals";
2
+ import base from "./base.js";
2
3
  import solid from "./rules/plugin-solid-rules.js";
4
+ import typescript from "./rules/plugin-typescript-rules.js";
3
5
  import vitest from "./rules/plugin-vitest-rules.js";
4
- import typescript from "./typescript.js";
5
6
 
6
7
  export default [
8
+ base,
7
9
  typescript,
8
10
  solid,
9
11
  vitest,
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@prowise/eslint-config-linting-rules","version":"2.0.2","description":"Default Prowise linting rules for npm packages.","main":"index.js","type":"module","exports":{"./typescript":"./typescript.js","./backend":"./backend.js","./front-react":"./front-react.js","./front-solid":"./front-solid.js"},"scripts":{"lint":"eslint","inspect":"eslint --inspect-config"},"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/prowise/npm-linting-rules.git"},"author":"Prowise B.V.","license":"UNLICENSED","homepage":"https://bitbucket.org/prowise/npm-linting-rules#readme","dependencies":{"@stylistic/eslint-plugin":"^2.8.0","confusing-browser-globals":"^1.0.11","eslint":"^9.11.1","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-import-x":"^4.3.0","eslint-plugin-jest":"^28.8.3","eslint-plugin-jsdoc":"^50.2.4","eslint-plugin-jsx-a11y":"^6.10.0","eslint-plugin-n":"^17.10.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-react":"^7.36.1","eslint-plugin-solid":"^0.14.3","eslint-plugin-vitest":"^0.5.4","globals":"^15.9.0","typescript-eslint":"^8.7.0"},"devDependencies":{"@eslint/config-inspector":"^0.5.4"}}
1
+ {"name":"@prowise/eslint-config-linting-rules","version":"2.0.4","description":"Default Prowise linting rules for npm packages.","main":"index.js","type":"module","exports":{"./typescript":"./typescript.js","./backend":"./backend.js","./front-react":"./front-react.js","./front-solid":"./front-solid.js"},"scripts":{"lint":"eslint","inspect":"eslint --inspect-config"},"repository":{"type":"git","url":"git+ssh://git@bitbucket.org/prowise/npm-linting-rules.git"},"author":"Prowise B.V.","license":"UNLICENSED","homepage":"https://bitbucket.org/prowise/npm-linting-rules#readme","dependencies":{"@stylistic/eslint-plugin":"^2.8.0","confusing-browser-globals":"^1.0.11","eslint":"^9.11.1","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-import-x":"^4.3.0","eslint-plugin-jest":"^28.8.3","eslint-plugin-jsdoc":"^50.2.4","eslint-plugin-jsx-a11y":"^6.10.0","eslint-plugin-n":"^17.10.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-react":"^7.36.1","eslint-plugin-solid":"^0.14.3","eslint-plugin-vitest":"^0.5.4","globals":"^15.9.0","typescript-eslint":"^8.7.0"},"devDependencies":{"@eslint/config-inspector":"^0.5.4"}}
@@ -327,7 +327,7 @@ export default {
327
327
  * Disallow declaration of variables that are not used in the code ✅
328
328
  * https://eslint.org/docs/latest/rules/no-unused-vars.
329
329
  */
330
- "no-unused-vars": ["error", { vars: "all", args: "after-used", ignoreRestSiblings: true }],
330
+ "no-unused-vars": ["error", { vars: "all", args: "after-used", caughtErrors: "none", ignoreRestSiblings: true }],
331
331
 
332
332
  /**
333
333
  * Disallow use of variables before they are defined
@@ -384,7 +384,7 @@ export default {
384
384
  * Require camel case names
385
385
  * https://eslint.org/docs/latest/rules/camelcase.
386
386
  */
387
- camelcase: ["error", { properties: "never", ignoreDestructuring: false }],
387
+ "camelcase": ["error", { properties: "never", ignoreDestructuring: false }],
388
388
 
389
389
  /**
390
390
  * Enforce or disallow capitalization of the first letter of a comment 🔧
@@ -439,7 +439,7 @@ export default {
439
439
  * Specify the maximum cyclomatic complexity allowed in a program
440
440
  * https://eslint.org/docs/latest/rules/complexity.
441
441
  */
442
- complexity: ["off", 20],
442
+ "complexity": ["off", 20],
443
443
 
444
444
  /**
445
445
  * Require return statements to either always or never specify values
@@ -457,7 +457,7 @@ export default {
457
457
  * Specify curly brace conventions for all control statements 🔧
458
458
  * https://eslint.org/docs/latest/rules/curly.
459
459
  */
460
- curly: ["error", "multi-line", "consistent"],
460
+ "curly": ["error", "multi-line", "consistent"],
461
461
 
462
462
  /**
463
463
  * Require default case in switch statements
@@ -487,7 +487,7 @@ export default {
487
487
  * Require the use of === and !== 🔧
488
488
  * https://eslint.org/docs/latest/rules/eqeqeq.
489
489
  */
490
- eqeqeq: ["error", "always", { null: "ignore" }],
490
+ "eqeqeq": ["error", "always", { null: "ignore" }],
491
491
 
492
492
  /**
493
493
  * Requires function names to match the name of the variable or property to which they are assigned
@@ -1311,7 +1311,7 @@ export default {
1311
1311
  * Require use of the second argument for parseInt()
1312
1312
  * https://eslint.org/docs/latest/rules/radix.
1313
1313
  */
1314
- radix: ["error", "as-needed"],
1314
+ "radix": ["error", "as-needed"],
1315
1315
 
1316
1316
  /**
1317
1317
  * Require `await` in `async function` (note: this is a horrible rule that should never be used)
@@ -1361,7 +1361,7 @@ export default {
1361
1361
  * Require or disallow strict mode directives 🔧
1362
1362
  * https://eslint.org/docs/latest/rules/strict.
1363
1363
  */
1364
- strict: ["error", "never"],
1364
+ "strict": ["error", "never"],
1365
1365
 
1366
1366
  /**
1367
1367
  * Require a Symbol description
@@ -1385,6 +1385,6 @@ export default {
1385
1385
  * Require or disallow Yoda conditions 🔧
1386
1386
  * https://eslint.org/docs/latest/rules/yoda.
1387
1387
  */
1388
- yoda: "error",
1388
+ "yoda": "error",
1389
1389
  },
1390
1390
  };
@@ -27,10 +27,10 @@ export default {
27
27
  "jsx-a11y/alt-text": [
28
28
  "error",
29
29
  {
30
- elements: ["img", "object", "area", "input[type='image']"],
31
- img: [],
32
- object: [],
33
- area: [],
30
+ "elements": ["img", "object", "area", "input[type='image']"],
31
+ "img": [],
32
+ "object": [],
33
+ "area": [],
34
34
  "input[type='image']": [],
35
35
  },
36
36
  ],
@@ -1,4 +1,5 @@
1
1
  import nodePlugin from "eslint-plugin-n";
2
+ import globals from "globals";
2
3
 
3
4
  export default {
4
5
  /*
@@ -9,6 +10,12 @@ export default {
9
10
  * 💭 requires type information
10
11
  */
11
12
 
13
+ languageOptions: {
14
+ globals: {
15
+ ...globals.node,
16
+ },
17
+ },
18
+
12
19
  plugins: {
13
20
  node: nodePlugin,
14
21
  },
@@ -217,7 +217,7 @@ export default {
217
217
  code: 120,
218
218
  tabWidth: 4,
219
219
  ignoreUrls: true,
220
- ignoreComments: false,
220
+ ignoreComments: true,
221
221
  ignoreRegExpLiterals: true,
222
222
  ignoreStrings: true,
223
223
  ignoreTemplateLiterals: true,
@@ -424,7 +424,7 @@ export default {
424
424
  * Require quotes around object literal property names 🔧
425
425
  * https://eslint.org/docs/latest/rules/quote-props.
426
426
  */
427
- "style/quote-props": ["error", "as-needed", { keywords: false, unnecessary: true, numbers: false }],
427
+ "style/quote-props": ["error", "consistent-as-needed", { keywords: false, unnecessary: true, numbers: false }],
428
428
 
429
429
  /**
430
430
  * Enforce spacing between object rest-spread 🔧
@@ -1,6 +1,7 @@
1
1
  // eslint-disable-next-line import/no-unresolved
2
2
  import typescriptPlugin from "typescript-eslint";
3
3
  import baseRules from "./baseSettings.js";
4
+ import importRules from "./plugin-import-rules.js";
4
5
 
5
6
  export default {
6
7
  /*
@@ -11,6 +12,8 @@ export default {
11
12
  * 💭 requires type information
12
13
  */
13
14
 
15
+ files: ["**/*.ts", "**/*.tsx"],
16
+
14
17
  plugins: { "@typescript-eslint": typescriptPlugin.plugin },
15
18
  languageOptions: {
16
19
  parser: typescriptPlugin.parser,
@@ -49,7 +52,7 @@ export default {
49
52
  "ts-ignore": "allow-with-description",
50
53
  "ts-nocheck": "allow-with-description",
51
54
  "ts-check": "allow-with-description",
52
- minimumDescriptionLength: 3,
55
+ "minimumDescriptionLength": 3,
53
56
  },
54
57
  ],
55
58
 
@@ -174,7 +177,7 @@ export default {
174
177
  * Enforce naming conventions for everything across a codebase 💭
175
178
  * https://typescript-eslint.io/rules/naming-convention.
176
179
  */
177
- camelcase: "off", // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
180
+ "camelcase": "off", // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
178
181
  "@typescript-eslint/naming-convention": [
179
182
  "error",
180
183
  // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
@@ -254,7 +257,10 @@ export default {
254
257
  * Disallow accidentally using the "empty object" type ✅ 🔧 💡
255
258
  * https://typescript-eslint.io/rules/no-empty-object-type.
256
259
  */
257
- "@typescript-eslint/no-empty-object-type": "error",
260
+ "@typescript-eslint/no-empty-object-type": ["error", {
261
+ allowInterfaces: "always",
262
+ allowObjectTypes: "always",
263
+ }],
258
264
 
259
265
  /**
260
266
  * Disallow the any type ✅ 🔧 💡
@@ -709,32 +715,39 @@ export default {
709
715
  */
710
716
  "@typescript-eslint/unified-signatures": "error",
711
717
 
712
- // TODO: fix this rule!
713
- // Append "ts" and "tsx" to Airbnb "import/extensions" rule
714
- // "import/extensions": [
715
- // importRules.rules["import/extensions"][0],
716
- // importRules.rules["import/extensions"][1],
717
- // {
718
- // ...importRules.rules["import/extensions"][2],
719
- // ts: "never",
720
- // tsx: "never",
721
- // },
722
- // ],
723
-
724
- // TODO: fix this rule!
725
- // "import/no-extraneous-dependencies": [
726
- // importRules.rules["import/no-extraneous-dependencies"][0],
727
- // {
728
- // ...importRules.rules["import/no-extraneous-dependencies"][1],
729
- // devDependencies: importRules.rules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
730
- // (result, devDep) => {
731
- // const toAppend = [devDep];
732
- // const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
733
- // if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
734
- // return [...result, ...toAppend];
735
- // },
736
- // ),
737
- // },
738
- // ],
718
+ /**
719
+ * See https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/named.md# why it is turned off
720
+ */
721
+ "import/named": "off",
722
+
723
+ /**
724
+ * Turned off because extension *.ts can not be resolved to the required *.js extension in node!
725
+ */
726
+ "import/no-unresolved": "off",
727
+
728
+ "import/extensions": [
729
+ importRules.rules["import/extensions"][0],
730
+ importRules.rules["import/extensions"][1],
731
+ {
732
+ ...importRules.rules["import/extensions"][2],
733
+ ts: "never",
734
+ tsx: "never",
735
+ },
736
+ ],
737
+
738
+ "import/no-extraneous-dependencies": [
739
+ importRules.rules["import/no-extraneous-dependencies"][0],
740
+ {
741
+ ...importRules.rules["import/no-extraneous-dependencies"][1],
742
+ devDependencies: importRules.rules["import/no-extraneous-dependencies"][1].devDependencies.reduce(
743
+ (result, devDep) => {
744
+ const toAppend = [devDep];
745
+ const devDepWithTs = devDep.replace(/\bjs(x?)\b/g, "ts$1");
746
+ if (devDepWithTs !== devDep) toAppend.push(devDepWithTs);
747
+ return [...result, ...toAppend];
748
+ },
749
+ ),
750
+ },
751
+ ],
739
752
  },
740
753
  };