@ethang/eslint-config 16.0.13 → 16.1.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.
Files changed (3) hide show
  1. package/README.md +23 -17
  2. package/eslint.config.js +36 -13
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # Opinionated, Strict, Brutal, Unforgiving
2
2
 
3
- * Nearly every EsLint rule error's as a default.
4
- * [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
5
- * 100's of opinionated rules for a consistent codebase.
6
- * [@typescript-eslint/strict-type-checked](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked.ts)
7
- * [@typescript-eslint/stylistic-type-checked](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked.ts)
8
- * Strictest config options from typescript-eslint
3
+ * More than 500 errored rules.
4
+ * Over 100 vanilla ESLint rules.
5
+ * Over 100 rules from [@typescript/eslint](https://github.com/typescript-eslint/typescript-eslint)
6
+ * Over 100 rules from [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
7
+ * Nearly 100 rules from [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react)
8
+ * Includes [eslint-plugin-react-hooks](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
9
+ * Includes [jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
10
+ * Includes [eslint-plugin-astro](https://www.npmjs.com/package/eslint-plugin-astro)
11
+ * Includes [eslint-plugin-sonarjs](https://github.com/SonarSource/eslint-plugin-sonarjs)
12
+ * Import sorting with [eslint-plugin-simple-import-sort](https://github.com/lydell/eslint-plugin-simple-import-sort)
9
13
  * Includes Prettier built in (do NOT use this with a separate Prettier config.)
10
14
  * And more...
11
15
 
@@ -20,19 +24,21 @@
20
24
  In **eslint.config.js**
21
25
 
22
26
  ```js
23
- import config from "@ethang/eslint-config/index.js";
24
-
25
- export default [
26
- ...config,
27
- {
28
- languageOptions: {
29
- parserOptions: {
30
- project: true,
31
- tsconfigRootDir: import.meta.dirname,
32
- },
27
+ import config from "@ethang/eslint-config/eslint.config.js";
28
+ import tseslint from "typescript-eslint";
29
+
30
+ export default tseslint.config(...config, {
31
+ ignores: ["dist/"], // Your ignores directories
32
+ languageOptions: {
33
+ parserOptions: {
34
+ project: true,
35
+ tsconfigRootDir: "./tsconfig.json",
33
36
  },
34
37
  },
35
- ];
38
+ rules: {
39
+ // your custom rules here
40
+ },
41
+ });
36
42
  ```
37
43
 
38
44
  **Scripts**:
package/eslint.config.js CHANGED
@@ -9,6 +9,7 @@ import reactHooks from "eslint-plugin-react-hooks";
9
9
  import importSort from "eslint-plugin-simple-import-sort";
10
10
  import unicorn from "eslint-plugin-unicorn";
11
11
  import tseslint from "typescript-eslint";
12
+ import sonar from "eslint-plugin-sonarjs";
12
13
 
13
14
  const languageOptions = {
14
15
  parser,
@@ -65,20 +66,12 @@ export default tseslint.config(
65
66
  "react/hook-use-state": "error",
66
67
  "react/iframe-missing-sandbox": "error",
67
68
  "react/jsx-boolean-value": "error",
68
- "react/jsx-child-element-spacing": "error",
69
- "react/jsx-closing-bracket-location": "error",
70
- "react/jsx-closing-tag-location": "error",
71
69
  "react/jsx-curly-brace-presence": "error",
72
- "react/jsx-curly-newline": "error",
73
- "react/jsx-curly-spacing": "error",
74
- "react/jsx-equals-spacing": "error",
75
70
  "react/jsx-filename-extension": "error",
76
71
  "react/jsx-fragments": "error",
77
72
  "react/jsx-handler-names": "error",
78
73
  "react/jsx-key": "error",
79
74
  "react/jsx-max-depth": "error",
80
- "react/jsx-max-props-per-line": "error",
81
- "react/jsx-newline": "error",
82
75
  "react/jsx-no-bind": "error",
83
76
  "react/jsx-no-comment-textnodes": "error",
84
77
  "react/jsx-no-constructed-context-values": "error",
@@ -150,6 +143,7 @@ export default tseslint.config(
150
143
  "@typescript-eslint": tseslint.plugin,
151
144
  a11y,
152
145
  n,
146
+ sonar,
153
147
  "simple-import-sort": importSort,
154
148
  unicorn,
155
149
  },
@@ -157,7 +151,6 @@ export default tseslint.config(
157
151
  "accessor-pairs": "error",
158
152
  "array-callback-return": "error",
159
153
  "block-scoped-var": "error",
160
- complexity: "error",
161
154
  "consistent-this": "error",
162
155
  "constructor-super": "error",
163
156
  eqeqeq: "error",
@@ -306,6 +299,7 @@ export default tseslint.config(
306
299
  yoda: ["error", "always"],
307
300
  // eslint overloads
308
301
 
302
+ complexity: "off", // Handled by Sonar
309
303
  "default-param-last": "off", // Handled by tseslint
310
304
  "dot-notation": "off", // Handled by tseslint
311
305
  "max-params": "off", // Handled by tseslint
@@ -442,7 +436,6 @@ export default tseslint.config(
442
436
  "@typescript-eslint/prefer-optional-chain": "error",
443
437
  "@typescript-eslint/prefer-promise-reject-errors": "error",
444
438
  "@typescript-eslint/prefer-readonly": "error",
445
- "@typescript-eslint/prefer-readonly-parameter-types": "warn",
446
439
  "@typescript-eslint/prefer-reduce-type-parameter": "error",
447
440
  "@typescript-eslint/prefer-regexp-exec": "error",
448
441
  "@typescript-eslint/prefer-return-this-type": "error",
@@ -495,7 +488,6 @@ export default tseslint.config(
495
488
  "unicorn/no-lonely-if": "error",
496
489
  "unicorn/no-magic-array-flat-depth": "error",
497
490
  "unicorn/no-negated-condition": "error",
498
- "unicorn/no-nested-ternary": "error",
499
491
  "unicorn/no-new-array": "error",
500
492
  "unicorn/no-new-buffer": "error",
501
493
  "unicorn/no-object-as-default-parameter": "error",
@@ -517,7 +509,6 @@ export default tseslint.config(
517
509
  "unicorn/no-useless-switch-case": "error",
518
510
  "unicorn/no-useless-undefined": "error",
519
511
  "unicorn/no-zero-fractions": "error",
520
- "unicorn/number-literal-case": "error",
521
512
  "unicorn/numeric-separators-style": "error",
522
513
  "unicorn/prefer-add-event-listener": "error",
523
514
  "unicorn/prefer-array-find": "error",
@@ -574,10 +565,42 @@ export default tseslint.config(
574
565
  "unicorn/require-post-message-target-origin": "error",
575
566
  "unicorn/string-content": "error",
576
567
  "unicorn/switch-case-braces": "error",
577
- "unicorn/template-indent": "error",
578
568
  "unicorn/text-encoding-identifier-case": "error",
579
569
  "unicorn/throw-new-error": "error",
580
570
 
571
+ "sonar/cognitive-complexity": "error",
572
+ "sonar/elseif-without-else": "error",
573
+ "sonar/max-switch-cases": "error",
574
+ "sonar/no-all-duplicated-branches": "error",
575
+ "sonar/no-collapsible-if": "error",
576
+ "sonar/no-collection-size-mischeck": "error",
577
+ "sonar/no-duplicate-string": "error",
578
+ "sonar/no-duplicated-branches": "error",
579
+ "sonar/no-element-overwrite": "error",
580
+ "sonar/no-empty-collection": "error",
581
+ "sonar/no-extra-arguments": "error",
582
+ "sonar/no-gratuitous-expressions": "error",
583
+ "sonar/no-identical-conditions": "error",
584
+ "sonar/no-identical-expressions": "error",
585
+ "sonar/no-identical-functions": "error",
586
+ "sonar/no-ignored-return": "error",
587
+ "sonar/no-inverted-boolean-check": "error",
588
+ "sonar/no-nested-switch": "error",
589
+ "sonar/no-nested-template-literals": "error",
590
+ "sonar/no-one-iteration-loop": "error",
591
+ "sonar/no-redundant-boolean": "error",
592
+ "sonar/no-redundant-jump": "error",
593
+ "sonar/no-same-line-conditional": "error",
594
+ "sonar/no-small-switch": "error",
595
+ "sonar/no-unused-collection": "error",
596
+ "sonar/no-use-of-empty-return-value": "error",
597
+ "sonar/no-useless-catch": "error",
598
+ "sonar/non-existent-operator": "error",
599
+ "sonar/prefer-immediate-return": "error",
600
+ "sonar/prefer-object-literal": "error",
601
+ "sonar/prefer-single-boolean-return": "error",
602
+ "sonar/prefer-while": "error",
603
+
581
604
  "simple-import-sort/exports": "error",
582
605
  "simple-import-sort/imports": "error",
583
606
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "16.0.13",
3
+ "version": "16.1.0",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -47,6 +47,7 @@
47
47
  "typescript-eslint": "^7.10.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@ethang/project-builder": "^1.1.37"
50
+ "@ethang/project-builder": "^1.1.37",
51
+ "eslint-plugin-sonarjs": "^1.0.3"
51
52
  }
52
53
  }