@ethang/eslint-config 19.7.4 → 19.8.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.
package/README.md CHANGED
@@ -5,20 +5,22 @@
5
5
  > [!CAUTION]
6
6
  > Do not use this with Prettier! Styling rules are included.
7
7
 
8
- - 886 errored rules.
8
+ - 890 errored rules.
9
9
  - 289 rules from [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md)
10
10
  - 144 rules from [@eslint/js](https://github.com/eslint/eslint/tree/main/packages/js)
11
11
  - 113 rules from [sindresorhus/eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
12
12
  - 103 rules from [@typescript/eslint](https://github.com/typescript-eslint/typescript-eslint)
13
- - 91 rules from [@stylistic/eslint-plugin](https://eslint.style/)
13
+ - 67 rules from [@stylistic/eslint-plugin](https://eslint.style/)
14
14
  - 42 rules from [eslint-plugin-lodash](https://github.com/wix-incubator/eslint-plugin-lodash)
15
15
  - 35 rules from [jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
16
+ - 25 rules from [@stylistic/eslint-plugin-ts](https://eslint.style/)
16
17
  - 20 rules from [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n)
17
18
  - 20 rules from [eslint-plugin-perfectionist](https://github.com/azat-io/eslint-plugin-perfectionist)
18
19
  - 7 rules from [eslint-plugin-tailwindcss](https://github.com/francoismassart/eslint-plugin-tailwindcss)
19
20
  - 7 rules from [@eslint/markdown](https://github.com/eslint/markdown)
20
21
  - 5 rules from [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
21
22
  - 4 rules from [eslint-plugin-barrel-files](https://github.com/thepassle/eslint-plugin-barrel-files)
23
+ - 3 rules from [exception-handling](https://github.com/Akronae/eslint-plugin-exception-handling)
22
24
  - 2 rules from [@eslint/json](https://github.com/eslint/json)
23
25
  - 1 rule from [eslint-plugin-depend](https://github.com/es-tooling/eslint-plugin-depend/tree/main)
24
26
  - 1 rule from [@cspell/eslint-plugin](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-eslint-plugin)
@@ -21,6 +21,7 @@ import { unicornRules } from "../setup/unicorn.ts";
21
21
  import { cspellRules } from "../setup/cspell.js";
22
22
  import { tanstackRouterRules } from "../setup/tanstack-router.js";
23
23
  import { exceptionHandlingRules } from "../setup/exception-handling.js";
24
+ import { stylisticTsRules } from "../setup/stylistic-ts.js";
24
25
 
25
26
  export const ruleList = [
26
27
  {
@@ -144,11 +145,21 @@ export const ruleList = [
144
145
  type: "core",
145
146
  url: "https://eslint.style/",
146
147
  },
148
+ {
149
+ importString: 'import stylisticTs from "@stylistic/eslint-plugin-ts";',
150
+ list: stylisticTsRules,
151
+ name: "@stylistic/eslint-plugin-ts",
152
+ order: 12,
153
+ pluginName: "stylisticTs",
154
+ pluginValue: "stylisticTs",
155
+ type: "core",
156
+ url: "https://eslint.style/",
157
+ },
147
158
  {
148
159
  importString: 'import perfectionist from "eslint-plugin-perfectionist";',
149
160
  list: perfectionistRules,
150
161
  name: "eslint-plugin-perfectionist",
151
- order: 12,
162
+ order: 13,
152
163
  pluginName: "perfectionist",
153
164
  pluginValue: "perfectionist",
154
165
  type: "core",
@@ -158,7 +169,7 @@ export const ruleList = [
158
169
  importString: 'import tanstackQuery from "@tanstack/eslint-plugin-query";',
159
170
  list: tanstackQueryRules,
160
171
  name: "@tanstack/eslint-plugin-query",
161
- order: 13,
172
+ order: 14,
162
173
  pluginName: "@tanstack/query",
163
174
  pluginValue: "tanstackQuery",
164
175
  type: "core",
@@ -169,7 +180,7 @@ export const ruleList = [
169
180
  'import tanstackRouter from "@tanstack/eslint-plugin-router";',
170
181
  list: tanstackRouterRules,
171
182
  name: "@tanstack/eslint-plugin-router",
172
- order: 14,
183
+ order: 15,
173
184
  pluginName: "@tanstack/router",
174
185
  pluginValue: "tanstackRouter",
175
186
  type: "core",
@@ -179,7 +190,7 @@ export const ruleList = [
179
190
  importString: 'import a11y from "eslint-plugin-jsx-a11y";',
180
191
  list: a11yRules,
181
192
  name: "jsx-a11y",
182
- order: 15,
193
+ order: 16,
183
194
  pluginName: "a11y",
184
195
  pluginValue: "a11y",
185
196
  type: "core",
@@ -189,7 +200,7 @@ export const ruleList = [
189
200
  importString: undefined,
190
201
  list: deprecatedRules,
191
202
  name: "@eslint/js",
192
- order: 16,
203
+ order: 17,
193
204
  pluginName: undefined,
194
205
  pluginValue: undefined,
195
206
  type: "core",
package/eslint.config.js CHANGED
@@ -13,6 +13,7 @@ import n from "eslint-plugin-n";
13
13
  import perfectionist from "eslint-plugin-perfectionist";
14
14
  import sonar from "eslint-plugin-sonarjs";
15
15
  import stylistic from "@stylistic/eslint-plugin";
16
+ import stylisticTs from "@stylistic/eslint-plugin-ts";
16
17
  import tailwind from "eslint-plugin-tailwindcss";
17
18
  import tanstackQuery from "@tanstack/eslint-plugin-query";
18
19
  import tanstackRouter from "@tanstack/eslint-plugin-router";
@@ -40,6 +41,7 @@ export default tseslint.config(
40
41
  "exception-handling": exceptionHandling,
41
42
  tailwind: tailwind,
42
43
  stylistic: stylistic,
44
+ stylisticTs: stylisticTs,
43
45
  perfectionist: perfectionist,
44
46
  "@tanstack/query": tanstackQuery,
45
47
  "@tanstack/router": tanstackRouter,
@@ -932,9 +934,9 @@ export default tseslint.config(
932
934
  "sonar/weak-ssl": "error",
933
935
  "sonar/x-powered-by": "error",
934
936
  "sonar/xml-parser-xxe": "error",
935
- "exception-handling/might-throw": "off",
936
- "exception-handling/no-unhandled": "off",
937
- "exception-handling/use-error-cause": "off",
937
+ "exception-handling/might-throw": "error",
938
+ "exception-handling/no-unhandled": "error",
939
+ "exception-handling/use-error-cause": "error",
938
940
  "tailwind/classnames-order": "error",
939
941
  "tailwind/enforces-negative-arbitrary-values": "error",
940
942
  "tailwind/enforces-shorthand": "error",
@@ -948,21 +950,21 @@ export default tseslint.config(
948
950
  "stylistic/array-element-newline": ["error", "consistent"],
949
951
  "stylistic/arrow-parens": "error",
950
952
  "stylistic/arrow-spacing": "error",
951
- "stylistic/block-spacing": "error",
952
- "stylistic/brace-style": "error",
953
- "stylistic/comma-dangle": ["error", "always-multiline"],
954
- "stylistic/comma-spacing": "error",
953
+ "stylistic/block-spacing": "off",
954
+ "stylistic/brace-style": "off",
955
+ "stylistic/comma-dangle": "off",
956
+ "stylistic/comma-spacing": "off",
955
957
  "stylistic/comma-style": "error",
956
958
  "stylistic/computed-property-spacing": "error",
957
959
  "stylistic/dot-location": ["error", "property"],
958
960
  "stylistic/eol-last": "error",
959
- "stylistic/func-call-spacing": "error",
961
+ "stylistic/func-call-spacing": "off",
960
962
  "stylistic/function-call-argument-newline": ["error", "consistent"],
961
- "stylistic/function-call-spacing": "error",
963
+ "stylistic/function-call-spacing": "off",
962
964
  "stylistic/function-paren-newline": ["error", "consistent"],
963
965
  "stylistic/generator-star-spacing": "error",
964
966
  "stylistic/implicit-arrow-linebreak": "error",
965
- "stylistic/indent": ["error", 2],
967
+ "stylistic/indent": "off",
966
968
  "stylistic/indent-binary-ops": "error",
967
969
  "stylistic/jsx-child-element-spacing": "error",
968
970
  "stylistic/jsx-closing-bracket-location": "error",
@@ -988,11 +990,11 @@ export default tseslint.config(
988
990
  { declaration: "parens-new-line" },
989
991
  ],
990
992
  "stylistic/key-spacing": "error",
991
- "stylistic/keyword-spacing": "error",
993
+ "stylistic/keyword-spacing": "off",
992
994
  "stylistic/line-comment-position": "off",
993
995
  "stylistic/linebreak-style": "error",
994
- "stylistic/lines-around-comment": "error",
995
- "stylistic/lines-between-class-members": "error",
996
+ "stylistic/lines-around-comment": "off",
997
+ "stylistic/lines-between-class-members": "off",
996
998
  "stylistic/max-len": [
997
999
  "error",
998
1000
  {
@@ -1005,18 +1007,14 @@ export default tseslint.config(
1005
1007
  },
1006
1008
  ],
1007
1009
  "stylistic/max-statements-per-line": "error",
1008
- "stylistic/member-delimiter-style": "error",
1010
+ "stylistic/member-delimiter-style": "off",
1009
1011
  "stylistic/multiline-comment-style": "off",
1010
1012
  "stylistic/multiline-ternary": "error",
1011
1013
  "stylistic/new-parens": "error",
1012
1014
  "stylistic/newline-per-chained-call": "error",
1013
1015
  "stylistic/no-confusing-arrow": "error",
1014
- "stylistic/no-extra-parens": [
1015
- "error",
1016
- "all",
1017
- { ignoreJSX: "multi-line" },
1018
- ],
1019
- "stylistic/no-extra-semi": "error",
1016
+ "stylistic/no-extra-parens": "off",
1017
+ "stylistic/no-extra-semi": "off",
1020
1018
  "stylistic/no-floating-decimal": "error",
1021
1019
  "stylistic/no-mixed-operators": "error",
1022
1020
  "stylistic/no-mixed-spaces-and-tabs": "error",
@@ -1026,40 +1024,81 @@ export default tseslint.config(
1026
1024
  "stylistic/no-trailing-spaces": "error",
1027
1025
  "stylistic/no-whitespace-before-property": "error",
1028
1026
  "stylistic/nonblock-statement-body-position": "error",
1029
- "stylistic/object-curly-newline": [
1030
- "error",
1031
- { multiline: true, consistent: true },
1032
- ],
1033
- "stylistic/object-curly-spacing": ["error", "always"],
1034
- "stylistic/object-property-newline": "error",
1027
+ "stylistic/object-curly-newline": "off",
1028
+ "stylistic/object-curly-spacing": "off",
1029
+ "stylistic/object-property-newline": "off",
1035
1030
  "stylistic/one-var-declaration-per-line": "error",
1036
1031
  "stylistic/operator-linebreak": "error",
1037
1032
  "stylistic/padded-blocks": ["error", "never"],
1038
- "stylistic/padding-line-between-statements": "error",
1039
- "stylistic/quote-props": ["error", "as-needed"],
1040
- "stylistic/quotes": "error",
1033
+ "stylistic/padding-line-between-statements": "off",
1034
+ "stylistic/quote-props": "off",
1035
+ "stylistic/quotes": "off",
1041
1036
  "stylistic/rest-spread-spacing": "error",
1042
- "stylistic/semi": "error",
1037
+ "stylistic/semi": "off",
1043
1038
  "stylistic/semi-spacing": "error",
1044
1039
  "stylistic/semi-style": "error",
1045
- "stylistic/space-before-blocks": "error",
1046
- "stylistic/space-before-function-paren": [
1047
- "error",
1048
- { anonymous: "always", named: "never", asyncArrow: "always" },
1049
- ],
1040
+ "stylistic/space-before-blocks": "off",
1041
+ "stylistic/space-before-function-paren": "off",
1050
1042
  "stylistic/space-in-parens": "error",
1051
- "stylistic/space-infix-ops": "error",
1043
+ "stylistic/space-infix-ops": "off",
1052
1044
  "stylistic/space-unary-ops": "error",
1053
1045
  "stylistic/spaced-comment": "error",
1054
1046
  "stylistic/switch-colon-spacing": "error",
1055
1047
  "stylistic/template-curly-spacing": "error",
1056
1048
  "stylistic/template-tag-spacing": "error",
1057
- "stylistic/type-annotation-spacing": "error",
1049
+ "stylistic/type-annotation-spacing": "off",
1058
1050
  "stylistic/type-generic-spacing": "error",
1059
1051
  "stylistic/type-named-tuple-spacing": "error",
1060
1052
  "stylistic/wrap-iife": "error",
1061
1053
  "stylistic/wrap-regex": "error",
1062
1054
  "stylistic/yield-star-spacing": "error",
1055
+ "stylistic/ts/block-spacing": "error",
1056
+ "stylistic/ts/brace-style": "error",
1057
+ "stylistic/ts/comma-dangle": [
1058
+ "error",
1059
+ {
1060
+ arrays: "always-multiline",
1061
+ objects: "always-multiline",
1062
+ imports: "always-multiline",
1063
+ exports: "always-multiline",
1064
+ functions: "always-multiline",
1065
+ enums: "never",
1066
+ generics: "never",
1067
+ tuples: "never",
1068
+ },
1069
+ ],
1070
+ "stylistic/ts/comma-spacing": "error",
1071
+ "stylistic/ts/func-call-spacing": "error",
1072
+ "stylistic/ts/function-call-spacing": "error",
1073
+ "stylistic/ts/indent": ["error", 2],
1074
+ "stylistic/ts/key-spacing": "error",
1075
+ "stylistic/ts/keyword-spacing": "error",
1076
+ "stylistic/ts/lines-around-comment": "error",
1077
+ "stylistic/ts/lines-between-class-members": "error",
1078
+ "stylistic/ts/member-delimiter-style": "error",
1079
+ "stylistic/ts/no-extra-parens": [
1080
+ "error",
1081
+ "all",
1082
+ { ignoreJSX: "multi-line" },
1083
+ ],
1084
+ "stylistic/ts/no-extra-semi": "error",
1085
+ "stylistic/ts/object-curly-newline": [
1086
+ "error",
1087
+ { multiline: true, consistent: true },
1088
+ ],
1089
+ "stylistic/ts/object-curly-spacing": ["error", "always"],
1090
+ "stylistic/ts/object-property-newline": "error",
1091
+ "stylistic/ts/padding-line-between-statements": "error",
1092
+ "stylistic/ts/quote-props": ["error", "as-needed"],
1093
+ "stylistic/ts/quotes": "error",
1094
+ "stylistic/ts/semi": "error",
1095
+ "stylistic/ts/space-before-blocks": "error",
1096
+ "stylistic/ts/space-before-function-paren": [
1097
+ "error",
1098
+ { anonymous: "always", named: "never", asyncArrow: "always" },
1099
+ ],
1100
+ "stylistic/ts/space-infix-ops": "error",
1101
+ "stylistic/ts/type-annotation-spacing": "error",
1063
1102
  "perfectionist/sort-array-includes": "error",
1064
1103
  "perfectionist/sort-astro-attributes": [
1065
1104
  "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethang/eslint-config",
3
- "version": "19.7.4",
3
+ "version": "19.8.0",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/eglove/eslint-config-ethang.git"
6
6
  },
@@ -20,6 +20,7 @@
20
20
  "@eslint/json": "^0.4.0",
21
21
  "@eslint/markdown": "^6.1.0",
22
22
  "@stylistic/eslint-plugin": "^2.8.0",
23
+ "@stylistic/eslint-plugin-ts": "^2.8.0",
23
24
  "@tanstack/eslint-plugin-query": "^5.57.1",
24
25
  "@tanstack/eslint-plugin-router": "^1.58.6",
25
26
  "@typescript-eslint/parser": "^8.6.0",
@@ -28,7 +29,7 @@
28
29
  "eslint-plugin-barrel-files": "^2.1.0",
29
30
  "eslint-plugin-compat": "^6.0.1",
30
31
  "eslint-plugin-depend": "^0.11.0",
31
- "eslint-plugin-exception-handling": "^1.4.2",
32
+ "eslint-plugin-exception-handling": "^1.4.3",
32
33
  "eslint-plugin-jsx-a11y": "^6.10.0",
33
34
  "eslint-plugin-lodash": "^8.0.0",
34
35
  "eslint-plugin-n": "^17.10.3",
@@ -60,6 +61,7 @@
60
61
  "@eslint/json": "^0.4.0",
61
62
  "@eslint/markdown": "^6.1.0",
62
63
  "@stylistic/eslint-plugin": "^2.8.0",
64
+ "@stylistic/eslint-plugin-ts": "^2.8.0",
63
65
  "@tanstack/eslint-plugin-query": "^5.57.1",
64
66
  "@tanstack/eslint-plugin-router": "^1.58.6",
65
67
  "@typescript-eslint/parser": "^8.6.0",
@@ -68,7 +70,7 @@
68
70
  "eslint-plugin-barrel-files": "^2.1.0",
69
71
  "eslint-plugin-compat": "^6.0.1",
70
72
  "eslint-plugin-depend": "^0.11.0",
71
- "eslint-plugin-exception-handling": "^1.4.2",
73
+ "eslint-plugin-exception-handling": "^1.4.3",
72
74
  "eslint-plugin-jsx-a11y": "^6.10.0",
73
75
  "eslint-plugin-lodash": "^8.0.0",
74
76
  "eslint-plugin-n": "^17.10.3",
@@ -9,5 +9,4 @@ export const exceptionHandlingRules = genRules(
9
9
  ruleNames,
10
10
  [],
11
11
  "exception-handling",
12
- "off", // TODO fix with https://github.com/Akronae/eslint-plugin-exception-handling/issues/5
13
12
  );
@@ -0,0 +1,51 @@
1
+ import stylisticTs from "@stylistic/eslint-plugin-ts";
2
+ import { genRules, getNonDeprecatedRules } from "./gen-rules.js";
3
+
4
+ const ruleNames = Object.keys(getNonDeprecatedRules(stylisticTs.rules));
5
+
6
+ const customRules = [
7
+ {
8
+ name: "comma-dangle",
9
+ rule: [
10
+ "error",
11
+ {
12
+ arrays: "always-multiline",
13
+ objects: "always-multiline",
14
+ imports: "always-multiline",
15
+ exports: "always-multiline",
16
+ functions: "always-multiline",
17
+ enums: "never",
18
+ generics: "never",
19
+ tuples: "never",
20
+ },
21
+ ],
22
+ },
23
+ { name: "indent", rule: ["error", 2] },
24
+ {
25
+ name: "no-extra-parens",
26
+ rule: ["error", "all", { ignoreJSX: "multi-line" }],
27
+ },
28
+ {
29
+ name: "object-curly-newline",
30
+ rule: ["error", { multiline: true, consistent: true }],
31
+ },
32
+ { name: "object-curly-spacing", rule: ["error", "always"] },
33
+ { name: "quote-props", rule: ["error", "as-needed"] },
34
+ {
35
+ name: "space-before-function-paren",
36
+ rule: [
37
+ "error",
38
+ {
39
+ anonymous: "always",
40
+ named: "never",
41
+ asyncArrow: "always",
42
+ },
43
+ ],
44
+ },
45
+ ];
46
+
47
+ export const stylisticTsRules = genRules(
48
+ ruleNames,
49
+ customRules,
50
+ "stylistic/ts",
51
+ );
@@ -5,13 +5,36 @@ import { genRules, getNonDeprecatedRules } from "./gen-rules.ts";
5
5
  // @ts-expect-error this exists
6
6
  const ruleNames = Object.keys(getNonDeprecatedRules(stylistic.rules));
7
7
  const customRules = [
8
+ { name: "block-spacing", rule: "off" }, // TS
9
+ { name: "brace-style", rule: "off" }, // TS
10
+ { name: "comma-dangle", rule: "off" }, // TS
11
+ { name: "comma-spacing", rule: "off" }, // TS
12
+ { name: "func-call-spacing", rule: "off" }, // TS
13
+ { name: "function-call-spacing", rule: "off" }, // TS
14
+ { name: "indent", rule: "off" }, // TS
15
+ { name: "keyword-spacing", rule: "off" }, // TS
16
+ { name: "lines-around-comment", rule: "off" }, // TS
17
+ { name: "lines-between-class-members", rule: "off" }, // TS
18
+ { name: "member-delimiter-style", rule: "off" }, // TS
19
+ { name: "no-extra-parens", rule: "off" }, // TS
20
+ { name: "no-extra-semi", rule: "off" }, // TS
21
+ { name: "object-curly-newline", rule: "off" }, // TS
22
+ { name: "object-curly-spacing", rule: "off" }, // TS
23
+ { name: "object-property-newline", rule: "off" }, // TS
24
+ { name: "padding-line-between-statements", rule: "off" }, // TS
25
+ { name: "quote-props", rule: "off" }, // TS
26
+ { name: "quotes", rule: "off" }, // TS
27
+ { name: "semi", rule: "off" }, // TS
28
+ { name: "space-before-blocks", rule: "off" }, // TS
29
+ { name: "space-before-function-paren", rule: "off" }, // TS
30
+ { name: "space-infix-ops", rule: "off" }, // TS
31
+ { name: "type-annotation-spacing", rule: "off" }, // TS
32
+
8
33
  { name: "array-bracket-newline", rule: ["error", "consistent"] },
9
34
  { name: "array-element-newline", rule: ["error", "consistent"] },
10
- { name: "comma-dangle", rule: ["error", "always-multiline"] },
11
35
  { name: "dot-location", rule: ["error", "property"] },
12
36
  { name: "function-call-argument-newline", rule: ["error", "consistent"] },
13
37
  { name: "function-paren-newline", rule: ["error", "consistent"] },
14
- { name: "indent", rule: ["error", 2] },
15
38
  { name: "line-comment-position", rule: "off" },
16
39
  {
17
40
  name: "max-len",
@@ -28,28 +51,7 @@ const customRules = [
28
51
  ],
29
52
  },
30
53
  { name: "multiline-comment-style", rule: "off" },
31
- {
32
- name: "no-extra-parens",
33
- rule: ["error", "all", { ignoreJSX: "multi-line" }],
34
- },
35
- {
36
- name: "object-curly-newline",
37
- rule: ["error", { multiline: true, consistent: true }],
38
- },
39
- { name: "object-curly-spacing", rule: ["error", "always"] },
40
54
  { name: "padded-blocks", rule: ["error", "never"] },
41
- { name: "quote-props", rule: ["error", "as-needed"] },
42
- {
43
- name: "space-before-function-paren",
44
- rule: [
45
- "error",
46
- {
47
- anonymous: "always",
48
- named: "never",
49
- asyncArrow: "always",
50
- },
51
- ],
52
- },
53
55
  { name: "jsx-indent-props", rule: ["error", 2] },
54
56
  { name: "jsx-newline", rule: ["error", { prevent: true }] },
55
57
  { name: "jsx-sort-props", rule: "off" },