@ethang/eslint-config 16.0.14 → 16.1.1

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 -12
  3. package/package.json +3 -1
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
@@ -494,7 +488,6 @@ export default tseslint.config(
494
488
  "unicorn/no-lonely-if": "error",
495
489
  "unicorn/no-magic-array-flat-depth": "error",
496
490
  "unicorn/no-negated-condition": "error",
497
- "unicorn/no-nested-ternary": "error",
498
491
  "unicorn/no-new-array": "error",
499
492
  "unicorn/no-new-buffer": "error",
500
493
  "unicorn/no-object-as-default-parameter": "error",
@@ -516,7 +509,6 @@ export default tseslint.config(
516
509
  "unicorn/no-useless-switch-case": "error",
517
510
  "unicorn/no-useless-undefined": "error",
518
511
  "unicorn/no-zero-fractions": "error",
519
- "unicorn/number-literal-case": "error",
520
512
  "unicorn/numeric-separators-style": "error",
521
513
  "unicorn/prefer-add-event-listener": "error",
522
514
  "unicorn/prefer-array-find": "error",
@@ -573,10 +565,42 @@ export default tseslint.config(
573
565
  "unicorn/require-post-message-target-origin": "error",
574
566
  "unicorn/string-content": "error",
575
567
  "unicorn/switch-case-braces": "error",
576
- "unicorn/template-indent": "error",
577
568
  "unicorn/text-encoding-identifier-case": "error",
578
569
  "unicorn/throw-new-error": "error",
579
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
+
580
604
  "simple-import-sort/exports": "error",
581
605
  "simple-import-sort/imports": "error",
582
606
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "16.0.14",
3
+ "version": "16.1.1",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -24,6 +24,7 @@
24
24
  "eslint-plugin-react": "^7.34.1",
25
25
  "eslint-plugin-react-hooks": "^4.6.2",
26
26
  "eslint-plugin-simple-import-sort": "^12.1.0",
27
+ "eslint-plugin-sonarjs": "^1.0.3",
27
28
  "eslint-plugin-unicorn": "^53.0.0",
28
29
  "prettier": "^3.2.5",
29
30
  "typescript": "^5.4.5",
@@ -41,6 +42,7 @@
41
42
  "eslint-plugin-react": "^7.34.1",
42
43
  "eslint-plugin-react-hooks": "^4.6.2",
43
44
  "eslint-plugin-simple-import-sort": "^12.1.0",
45
+ "eslint-plugin-sonarjs": "^1.0.3",
44
46
  "eslint-plugin-unicorn": "^53.0.0",
45
47
  "prettier": "^3.2.5",
46
48
  "typescript": "^5.4.5",