eslint-plugin-th-rules 1.8.1 → 1.9.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.9.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.8.1...v1.9.0) (2024-06-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * created separate configs for typescript and non-typescript configs ([13f17df](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/13f17dfad0182c9437e38a51adb37c1b15153d71))
7
+
1
8
  ## [1.8.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.8.0...v1.8.1) (2024-06-15)
2
9
 
3
10
 
package/README.md CHANGED
@@ -11,45 +11,6 @@ This repository contains custom ESLint rules to enhance code quality and consist
11
11
 
12
12
  This repository contains custom ESLint rules to enhance code quality and consistency across projects, created by Tomer Horowitz.
13
13
 
14
- ## Configurations
15
-
16
- ### All
17
- To add all of the rules into your project, add the following configuration into your ESLint configuration file:
18
-
19
- ```json
20
- {
21
- "extends": ["plugin:th-rules/all"]
22
- }
23
- ```
24
-
25
- ### All React
26
- ```json
27
- {
28
- "extends": ["plugin:th-rules/all-react"]
29
- }
30
- ```
31
-
32
- ### All React Native
33
- ```json
34
- {
35
- "extends": ["plugin:th-rules/all-react-native"]
36
- }
37
- ```
38
-
39
- ### Recommended
40
- ```json
41
- {
42
- "extends": ["plugin:th-rules/recommended"]
43
- }
44
- ```
45
-
46
- ### Basic
47
- ```json
48
- {
49
- "extends": ["plugin:th-rules/basic"]
50
- }
51
- ```
52
-
53
14
  ## Rules
54
15
 
55
16
  ### 1. No-destructuring Rule
@@ -98,16 +59,3 @@ This rule targets unnamed default exports and automatically generates a named ex
98
59
  }
99
60
  }
100
61
  ```
101
-
102
- ## Installation
103
- ```json
104
- {
105
- "plugins": [
106
- "th-rules"
107
- ],
108
- "rules": {
109
- "no-destructuring": "error",
110
- "no-default-export": "error"
111
- }
112
- }
113
- ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-th-rules",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
package/src/index.js CHANGED
@@ -4,33 +4,22 @@
4
4
  'use strict';
5
5
  const requireIndex = require('requireindex');
6
6
 
7
- const recommended = {
7
+ const configs = {};
8
+ configs.recommended = {
8
9
  plugins: ['th-rules', 'sonarjs'],
9
10
  extends: [
10
- 'plugin:@typescript-eslint/strict-type-checked',
11
- 'plugin:@typescript-eslint/stylistic-type-checked',
12
11
  'plugin:sonarjs/recommended-legacy',
13
12
  ],
14
13
  rules: {
15
14
  'th-rules/no-destructuring': 'error',
16
15
  'th-rules/no-default-export': 'error',
17
16
  'unicorn/prefer-module': 'warn',
18
- '@typescript-eslint/naming-convention': 'warn',
19
17
  'unicorn/filename-case': 'off',
20
18
  'unicorn/no-array-callback-reference': 'off',
21
19
  'import/extensions': 'off',
22
- '@typescript-eslint/consistent-type-definitions': 'off',
23
20
  'unicorn/no-static-only-class': 'off',
24
- '@typescript-eslint/no-extraneous-class': 'off',
25
21
  'unicorn/no-await-expression-member': 'off',
26
- '@typescript-eslint/no-duplicate-type-constituents': 'off',
27
22
  'new-cap': 'off',
28
- '@typescript-eslint/no-non-null-assertion': 'off',
29
- '@typescript-eslint/require-await': 'off',
30
- '@typescript-eslint/no-unsafe-member-access': 'off',
31
- '@typescript-eslint/no-unsafe-call': 'off',
32
- '@typescript-eslint/no-unsafe-return': 'off',
33
- '@typescript-eslint/no-unsafe-argument': 'off',
34
23
  'no-await-in-loop': 'off',
35
24
  camelcase: 'warn',
36
25
  },
@@ -41,9 +30,31 @@ const recommended = {
41
30
  },
42
31
  };
43
32
 
33
+ for (const configName of Object.keys(configs)) {
34
+ configs[configName + '-typescript'] = {
35
+ ...configs[configName],
36
+ extends: [
37
+ 'plugin:@typescript-eslint/strict-type-checked',
38
+ 'plugin:@typescript-eslint/stylistic-type-checked',
39
+ ...configs[configName].extends,
40
+ ],
41
+ rules: {
42
+ ...configs[configName].rules,
43
+ '@typescript-eslint/naming-convention': 'warn',
44
+ '@typescript-eslint/consistent-type-definitions': 'off',
45
+ '@typescript-eslint/no-extraneous-class': 'off',
46
+ '@typescript-eslint/no-duplicate-type-constituents': 'off',
47
+ '@typescript-eslint/no-non-null-assertion': 'off',
48
+ '@typescript-eslint/require-await': 'off',
49
+ '@typescript-eslint/no-unsafe-member-access': 'off',
50
+ '@typescript-eslint/no-unsafe-call': 'off',
51
+ '@typescript-eslint/no-unsafe-return': 'off',
52
+ '@typescript-eslint/no-unsafe-argument': 'off',
53
+ },
54
+ };
55
+ }
56
+
44
57
  module.exports = {
45
58
  rules: requireIndex(`${__dirname}/rules`),
46
- configs: {
47
- recommended,
48
- },
59
+ configs,
49
60
  };