eslint-plugin-th-rules 1.19.3 → 1.20.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.
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "cSpell.words": [
3
3
  "sonarjs"
4
+ ],
5
+ "conventionalCommits.scopes": [
6
+ "eslint"
4
7
  ]
5
8
  }
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.20.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.20.0...v1.20.1) (2026-01-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixed xo errors ([633d5e0](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/633d5e08a22feddaecf925bc685798bc23ea795c))
7
+
8
+ # [1.20.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.19.3...v1.20.0) (2026-01-06)
9
+
10
+
11
+ ### Features
12
+
13
+ * **eslint:** :boom: migrated to ESLint flat configs ([0af8a5e](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/0af8a5e49026af3145924363949cdb2978886dbf))
14
+
1
15
  ## [1.19.3](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.19.2...v1.19.3) (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.19.3",
3
+ "version": "1.20.1",
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
@@ -2,60 +2,84 @@
2
2
  /* eslint-disable unicorn/prefer-module */
3
3
 
4
4
  'use strict';
5
+
5
6
  const requireIndex = require('requireindex');
7
+ const globals = require('globals');
8
+ const sonarjs = require('eslint-plugin-sonarjs');
9
+ const security = require('eslint-plugin-security');
10
+ const reactPlugin = require('eslint-plugin-react');
11
+ const reactHooks = require('eslint-plugin-react-hooks');
12
+ const tseslint = require('typescript-eslint');
6
13
 
7
- const configs = {
8
- recommended: {
9
- plugins: [
10
- 'th-rules',
11
- 'sonarjs',
12
- ],
13
- extends: [
14
- 'plugin:sonarjs/recommended-legacy',
15
- 'plugin:security/recommended-legacy',
16
- ],
17
- rules: {
18
- 'th-rules/no-destructuring': 'error',
19
- 'th-rules/no-default-export': 'error',
20
- 'th-rules/no-comments': 'error',
21
- 'th-rules/top-level-functions': 'error',
22
- 'th-rules/schemas-in-schemas-file': 'error',
23
- 'th-rules/types-in-dts': 'error',
24
- 'unicorn/prefer-module': 'warn',
25
- 'unicorn/filename-case': 'off',
26
- 'unicorn/no-array-callback-reference': 'off',
27
- 'import/extensions': 'off',
28
- 'unicorn/no-static-only-class': 'off',
29
- 'unicorn/no-await-expression-member': 'off',
30
- 'new-cap': 'off',
31
- 'no-await-in-loop': 'off',
32
- 'n/file-extension-in-import': 'off',
33
- 'import/no-cycle': 'off',
34
- camelcase: 'warn',
35
- 'sonarjs/mouse-events-a11y': 'off',
36
- 'sonarjs/no-unstable-nested-components': 'off',
37
- 'unicorn/prefer-global-this': 'off',
38
- 'unicorn/no-thenable': 'off',
39
- 'sonarjs/no-clear-text-protocols': 'off',
40
- },
41
- env: {
42
- node: true,
43
- es2024: true,
44
- jest: true,
14
+ const plugin = {
15
+ rules: requireIndex(`${__dirname}/rules`),
16
+ configs: {},
17
+ };
18
+
19
+ const baseRecommended = {
20
+ plugins: {
21
+ 'th-rules': plugin,
22
+ security,
23
+ react: reactPlugin,
24
+ 'react-hooks': reactHooks,
25
+ },
26
+ languageOptions: {
27
+ ecmaVersion: 2024,
28
+ globals: {
29
+ ...globals.node,
30
+ ...globals.es2024,
31
+ ...globals.jest,
45
32
  },
46
33
  },
34
+ settings: {
35
+ react: {version: 'detect'},
36
+ },
37
+ rules: {
38
+ 'th-rules/no-destructuring': 'error',
39
+ 'th-rules/no-default-export': 'error',
40
+ 'th-rules/no-comments': 'error',
41
+ 'th-rules/top-level-functions': 'error',
42
+ 'th-rules/schemas-in-schemas-file': 'error',
43
+ 'th-rules/types-in-dts': 'error',
44
+
45
+ 'unicorn/prefer-module': 'warn',
46
+ 'unicorn/filename-case': 'off',
47
+ 'unicorn/no-array-callback-reference': 'off',
48
+ 'import/extensions': 'off',
49
+ 'unicorn/no-static-only-class': 'off',
50
+ 'unicorn/no-await-expression-member': 'off',
51
+ 'new-cap': 'off',
52
+ 'no-await-in-loop': 'off',
53
+ 'n/file-extension-in-import': 'off',
54
+ 'import/no-cycle': 'off',
55
+ camelcase: 'warn',
56
+
57
+ 'sonarjs/mouse-events-a11y': 'off',
58
+ 'sonarjs/no-unstable-nested-components': 'off',
59
+ 'unicorn/prefer-global-this': 'off',
60
+ 'unicorn/no-thenable': 'off',
61
+ 'sonarjs/no-clear-text-protocols': 'off',
62
+ },
47
63
  };
48
64
 
49
- for (const configName of Object.keys(configs)) {
50
- configs[`${configName}-typescript`] = {
51
- ...configs[configName],
52
- extends: [
53
- 'plugin:@typescript-eslint/strict-type-checked',
54
- 'plugin:@typescript-eslint/stylistic-type-checked',
55
- ...configs[configName].extends,
56
- ],
65
+ /** @type {import('eslint').Linter.Config[]} */
66
+ plugin.configs.recommended = [
67
+ sonarjs.configs.recommended,
68
+ security.configs.recommended,
69
+ baseRecommended,
70
+ ];
71
+
72
+ plugin.configs['recommended-typescript'] = [
73
+ ...plugin.configs.recommended,
74
+ tseslint.configs.strictTypeChecked,
75
+ tseslint.configs.stylisticTypeChecked,
76
+ {
77
+ languageOptions: {
78
+ parserOptions: {
79
+ projectService: true,
80
+ },
81
+ },
57
82
  rules: {
58
- ...configs[configName].rules,
59
83
  '@typescript-eslint/naming-convention': 'warn',
60
84
  '@typescript-eslint/consistent-type-definitions': 'off',
61
85
  '@typescript-eslint/no-extraneous-class': 'off',
@@ -67,22 +91,18 @@ for (const configName of Object.keys(configs)) {
67
91
  '@typescript-eslint/no-unsafe-return': 'off',
68
92
  '@typescript-eslint/no-unsafe-argument': 'off',
69
93
  },
70
- };
71
- configs[`${configName}-react`] = {
72
- ...configs[configName],
73
- extends: [
74
- 'plugin:react/recommended',
75
- 'plugin:react-hooks/recommended',
76
- ...configs[configName].extends,
77
- ],
94
+ },
95
+ ];
96
+
97
+ plugin.configs['recommended-react'] = [
98
+ ...plugin.configs.recommended,
99
+ reactPlugin.configs.flat.recommended,
100
+ reactHooks.configs['recommended-latest'] ?? reactHooks.configs.recommended,
101
+ {
78
102
  rules: {
79
- ...configs[configName].rules,
80
103
  'n/prefer-global/process': 'off',
81
104
  },
82
- };
83
- }
105
+ },
106
+ ];
84
107
 
85
- module.exports = {
86
- rules: requireIndex(`${__dirname}/rules`),
87
- configs,
88
- };
108
+ module.exports = plugin;