eslint-plugin-th-rules 1.20.3 → 1.20.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.20.4](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.3...v1.20.4) (2026-01-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixed xo error ([056e708](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/056e7083ac33a4727b8664ac28b6838d5070de3f))
7
+
1
8
  ## [1.20.3](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.2...v1.20.3) (2026-01-06)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-th-rules",
3
- "version": "1.20.3",
3
+ "version": "1.20.4",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
package/src/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import-x/order */
1
2
  /* eslint-disable import-x/no-extraneous-dependencies */
2
3
  /* eslint-disable n/no-path-concat */
3
4
  /* eslint-disable unicorn/prefer-module */
@@ -11,6 +12,13 @@ const reactPlugin = require('eslint-plugin-react');
11
12
  const reactHooks = require('eslint-plugin-react-hooks');
12
13
  const tseslint = require('typescript-eslint');
13
14
 
15
+ // Plugins referenced by rule names in this config
16
+ const unicornPlugin = require('eslint-plugin-unicorn');
17
+ const importPlugin = require('eslint-plugin-import');
18
+ const nPlugin = require('eslint-plugin-n');
19
+ const sonarjsPlugin = require('eslint-plugin-sonarjs');
20
+ const securityPlugin = require('eslint-plugin-security');
21
+
14
22
  const plugin = {
15
23
  rules: requireIndex(`${__dirname}/rules`),
16
24
  configs: {},
@@ -27,10 +35,23 @@ const compat = new FlatCompat({
27
35
 
28
36
  const baseRecommended = {
29
37
  plugins: {
38
+ // Local rules
30
39
  'th-rules': plugin,
40
+
41
+ // Third-party plugins used by rule names below
42
+ unicorn: unicornPlugin,
43
+ import: importPlugin,
44
+ n: nPlugin,
45
+ sonarjs: sonarjsPlugin,
46
+ security: securityPlugin,
47
+
48
+ // Included so consumers can use react/react-hooks rules as well
49
+ react: reactPlugin,
50
+ 'react-hooks': reactHooks,
31
51
  },
32
52
  languageOptions: {
33
53
  ecmaVersion: 2024,
54
+ sourceType: 'module',
34
55
  globals: {
35
56
  ...globals.node,
36
57
  ...globals.es2024,
@@ -70,15 +91,18 @@ const baseRecommended = {
70
91
 
71
92
  /** @type {import('eslint').Linter.FlatConfig[]} */
72
93
  plugin.configs.recommended = flatConfigs(
73
- // These are legacy configs -> convert them
94
+ // Legacy configs -> convert them
74
95
  compat.extends('plugin:sonarjs/recommended-legacy', 'plugin:security/recommended-legacy'),
75
96
  baseRecommended,
76
97
  );
77
98
 
78
99
  plugin.configs['recommended-typescript'] = flatConfigs(
79
100
  plugin.configs.recommended,
101
+
102
+ // Typescript-eslint exports flat configs (arrays of flat config objects)
80
103
  tseslint.configs.strictTypeChecked,
81
104
  tseslint.configs.stylisticTypeChecked,
105
+
82
106
  {
83
107
  languageOptions: {
84
108
  parserOptions: {
@@ -103,11 +127,10 @@ plugin.configs['recommended-typescript'] = flatConfigs(
103
127
  plugin.configs['recommended-react'] = flatConfigs(
104
128
  plugin.configs.recommended,
105
129
 
106
- // React: flat config supported
107
- reactPlugin.configs?.flat?.recommended ?? reactPlugin.configs?.recommended,
108
-
109
- // React-hooks: if you suspect this is legacy in your version, swap to compat.extends('plugin:react-hooks/recommended')
110
- reactHooks.configs?.['recommended-latest'] ?? reactHooks.configs?.recommended,
130
+ // IMPORTANT: Always use compat here so we never accidentally inject eslintrc-style
131
+ // { plugins: ["react"] } into flat config (which causes the exact error you hit).
132
+ compat.extends('plugin:react/recommended'),
133
+ compat.extends('plugin:react-hooks/recommended'),
111
134
 
112
135
  {
113
136
  rules: {