eslint-plugin-th-rules 1.20.0 → 1.20.2

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/CHANGELOG.md +14 -0
  2. package/package.json +6 -10
  3. package/src/index.js +19 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.20.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.1...v1.20.2) (2026-01-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refactor config handling to use flatConfigs for better structure ([22d64f2](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/22d64f20a5d5b64ae0676d6afcd87e2790f5ef4f))
7
+
8
+ ## [1.20.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.0...v1.20.1) (2026-01-06)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * fixed xo errors ([633d5e0](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/633d5e08a22feddaecf925bc685798bc23ea795c))
14
+
1
15
  # [1.20.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.19.3...v1.20.0) (2026-01-06)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-th-rules",
3
- "version": "1.20.0",
3
+ "version": "1.20.2",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
@@ -38,28 +38,24 @@
38
38
  "@semantic-release/git": "^10.0.1",
39
39
  "@semantic-release/github": "^12.0.2",
40
40
  "@semantic-release/npm": "^13.1.3",
41
- "@semantic-release/release-notes-generator": "^14.0.2",
41
+ "@semantic-release/release-notes-generator": "^14.1.0",
42
42
  "@types/eslint-plugin-security": "^3.0.0",
43
43
  "@types/eslint__js": "^9.14.0",
44
44
  "@types/requireindex": "^1.2.4",
45
45
  "@types/xo": "^0.39.9",
46
46
  "bun-types": "latest",
47
- "eslint": "^9.17.0",
47
+ "eslint": "^9.39.2",
48
48
  "eslint-doc-generator": "^3.0.2",
49
49
  "eslint-plugin-eslint-plugin": "^7.2.0",
50
50
  "eslint-plugin-node": "^11.1.0",
51
51
  "eslint-plugin-sonarjs": "^3.0.5",
52
- "eslint-plugin-th-rules": "1.18.0",
52
+ "eslint-plugin-th-rules": "1.19.3",
53
53
  "eslint-plugin-unicorn": "^62.0.0",
54
54
  "mocha": "^11.7.5",
55
55
  "npm-run-all": "^4.1.5",
56
56
  "typescript": "^5.9.3",
57
- "typescript-eslint": "^8.51.0",
58
- "xo": "^0.60.0"
59
- },
60
- "peerDependencies": {
61
- "eslint": ">=9.17.0",
62
- "typescript": "^5.7.2"
57
+ "typescript-eslint": "^8.52.0",
58
+ "xo": "^1.2.3"
63
59
  },
64
60
  "license": "ISC",
65
61
  "packageManager": "yarn@4.12.0"
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import-x/no-extraneous-dependencies */
1
2
  /* eslint-disable n/no-path-concat */
2
3
  /* eslint-disable unicorn/prefer-module */
3
4
 
@@ -16,9 +17,15 @@ const plugin = {
16
17
  configs: {},
17
18
  };
18
19
 
20
+ // Flattens configs so we never embed arrays inside arrays (avoids "Unexpected key '0'")
21
+ const asArray = value => (Array.isArray(value) ? value : [value]);
22
+ const flatConfigs = (...items) => items.flatMap(element => asArray(element));
23
+
19
24
  const baseRecommended = {
20
25
  plugins: {
21
26
  'th-rules': plugin,
27
+
28
+ // Only include plugin objects you reference directly in rules/settings.
22
29
  security,
23
30
  react: reactPlugin,
24
31
  'react-hooks': reactHooks,
@@ -62,19 +69,21 @@ const baseRecommended = {
62
69
  },
63
70
  };
64
71
 
65
- plugin.configs.recommended = [
72
+ /** @type {import('eslint').Linter.FlatConfig[]} */
73
+ plugin.configs.recommended = flatConfigs(
66
74
  sonarjs.configs.recommended,
67
75
  security.configs.recommended,
68
76
  baseRecommended,
69
- ];
77
+ );
70
78
 
71
- plugin.configs['recommended-typescript'] = [
72
- ...plugin.configs.recommended,
79
+ plugin.configs['recommended-typescript'] = flatConfigs(
80
+ plugin.configs.recommended,
73
81
  tseslint.configs.strictTypeChecked,
74
82
  tseslint.configs.stylisticTypeChecked,
75
83
  {
76
84
  languageOptions: {
77
85
  parserOptions: {
86
+ // Typescript-eslint typed linting
78
87
  projectService: true,
79
88
  },
80
89
  },
@@ -91,17 +100,17 @@ plugin.configs['recommended-typescript'] = [
91
100
  '@typescript-eslint/no-unsafe-argument': 'off',
92
101
  },
93
102
  },
94
- ];
103
+ );
95
104
 
96
- plugin.configs['recommended-react'] = [
97
- ...plugin.configs.recommended,
98
- reactPlugin.configs.flat.recommended,
99
- reactHooks.configs['recommended-latest'] ?? reactHooks.configs.recommended,
105
+ plugin.configs['recommended-react'] = flatConfigs(
106
+ plugin.configs.recommended,
107
+ reactPlugin.configs?.flat?.recommended ?? reactPlugin.configs?.recommended,
108
+ reactHooks.configs?.['recommended-latest'] ?? reactHooks.configs?.recommended,
100
109
  {
101
110
  rules: {
102
111
  'n/prefer-global/process': 'off',
103
112
  },
104
113
  },
105
- ];
114
+ );
106
115
 
107
116
  module.exports = plugin;