eslint-plugin-th-rules 1.20.2 → 1.20.3

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.3](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.2...v1.20.3) (2026-01-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update dependencies in yarn.lock ([2059b35](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/2059b3503efb1515843d822f3d386d58666b1864))
7
+
1
8
  ## [1.20.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.1...v1.20.2) (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.2",
3
+ "version": "1.20.3",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
package/src/index.js CHANGED
@@ -6,8 +6,7 @@
6
6
 
7
7
  const requireIndex = require('requireindex');
8
8
  const globals = require('globals');
9
- const sonarjs = require('eslint-plugin-sonarjs');
10
- const security = require('eslint-plugin-security');
9
+ const {FlatCompat} = require('@eslint/eslintrc');
11
10
  const reactPlugin = require('eslint-plugin-react');
12
11
  const reactHooks = require('eslint-plugin-react-hooks');
13
12
  const tseslint = require('typescript-eslint');
@@ -21,14 +20,14 @@ const plugin = {
21
20
  const asArray = value => (Array.isArray(value) ? value : [value]);
22
21
  const flatConfigs = (...items) => items.flatMap(element => asArray(element));
23
22
 
23
+ // Converts legacy "extends"/eslintrc configs into flat config objects
24
+ const compat = new FlatCompat({
25
+ baseDirectory: __dirname,
26
+ });
27
+
24
28
  const baseRecommended = {
25
29
  plugins: {
26
30
  'th-rules': plugin,
27
-
28
- // Only include plugin objects you reference directly in rules/settings.
29
- security,
30
- react: reactPlugin,
31
- 'react-hooks': reactHooks,
32
31
  },
33
32
  languageOptions: {
34
33
  ecmaVersion: 2024,
@@ -71,8 +70,8 @@ const baseRecommended = {
71
70
 
72
71
  /** @type {import('eslint').Linter.FlatConfig[]} */
73
72
  plugin.configs.recommended = flatConfigs(
74
- sonarjs.configs.recommended,
75
- security.configs.recommended,
73
+ // These are legacy configs -> convert them
74
+ compat.extends('plugin:sonarjs/recommended-legacy', 'plugin:security/recommended-legacy'),
76
75
  baseRecommended,
77
76
  );
78
77
 
@@ -83,7 +82,6 @@ plugin.configs['recommended-typescript'] = flatConfigs(
83
82
  {
84
83
  languageOptions: {
85
84
  parserOptions: {
86
- // Typescript-eslint typed linting
87
85
  projectService: true,
88
86
  },
89
87
  },
@@ -104,8 +102,13 @@ plugin.configs['recommended-typescript'] = flatConfigs(
104
102
 
105
103
  plugin.configs['recommended-react'] = flatConfigs(
106
104
  plugin.configs.recommended,
105
+
106
+ // React: flat config supported
107
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')
108
110
  reactHooks.configs?.['recommended-latest'] ?? reactHooks.configs?.recommended,
111
+
109
112
  {
110
113
  rules: {
111
114
  'n/prefer-global/process': 'off',