eslint-plugin-th-rules 1.4.1 → 1.5.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,22 @@
1
+ # [1.5.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.4.2...v1.5.0) (2024-02-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add ESLint configurations for JSDoc and React ([45b6297](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/45b62978da758e4ebbf62780e74595393c38800b))
7
+
8
+
9
+ ### Features
10
+
11
+ * adding basic, recommended and all, also planning to add a recommended-react and recommended-react-native variants in the future ([85e54dd](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/85e54ddabe928aafadb83c4118ff5da390654260))
12
+
13
+ ## [1.4.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.4.1...v1.4.2) (2024-02-26)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * fixed name of no-destructuring rule ([30ab24a](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/30ab24aec8b84cda665c7fc43920f2625a2f8d83))
19
+
1
20
  ## [1.4.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.4.0...v1.4.1) (2024-02-26)
2
21
 
3
22
 
@@ -39,100 +58,100 @@
39
58
 
40
59
  * :sparkles: Created a recommended configuration ([4c81e02](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/4c81e027ef00ab06a4c69ef32857093fcb06fb3b))
41
60
 
42
- ## [1.1.4](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.1.3...v1.1.4) (2024-02-23)
61
+ ## [1.1.4](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.1.3...v1.1.4) (2024-02-23)
43
62
 
44
63
 
45
64
  ### Bug Fixes
46
65
 
47
- * Update lib/index.js to import all rules in lib/rules ([d4f3183](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/d4f3183de27b530a7f62fc1670055915641d7533))
66
+ * Update lib/index.js to import all rules in lib/rules ([d4f3183](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/d4f3183de27b530a7f62fc1670055915641d7533))
48
67
 
49
- ## [1.1.3](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.1.2...v1.1.3) (2024-02-23)
68
+ ## [1.1.3](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.1.2...v1.1.3) (2024-02-23)
50
69
 
51
70
 
52
71
  ### Bug Fixes
53
72
 
54
- * Remove "type" field from package.json ([aadbbb0](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/aadbbb090a256e20e8437b5d9c7bf57cbfd0daf5))
73
+ * Remove "type" field from package.json ([aadbbb0](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/aadbbb090a256e20e8437b5d9c7bf57cbfd0daf5))
55
74
 
56
- ## [1.1.2](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.1.1...v1.1.2) (2024-02-23)
75
+ ## [1.1.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.1.1...v1.1.2) (2024-02-23)
57
76
 
58
77
 
59
78
  ### Bug Fixes
60
79
 
61
- * changed back to CommonJS ([07174fc](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/07174fce92e3a0b660fe76b4baa862fd0d33ee72))
80
+ * changed back to CommonJS ([07174fc](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/07174fce92e3a0b660fe76b4baa862fd0d33ee72))
62
81
 
63
- ## [1.1.1](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.1.0...v1.1.1) (2024-02-23)
82
+ ## [1.1.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.1.0...v1.1.1) (2024-02-23)
64
83
 
65
84
 
66
85
  ### Bug Fixes
67
86
 
68
- * changed index.js to ES ([d55351e](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/d55351ed380ceeb2c15d89f4b9db7e85c5250937))
87
+ * changed index.js to ES ([d55351e](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/d55351ed380ceeb2c15d89f4b9db7e85c5250937))
69
88
 
70
- # [1.1.0](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.7...v1.1.0) (2024-02-23)
89
+ # [1.1.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.7...v1.1.0) (2024-02-23)
71
90
 
72
91
 
73
92
  ### Bug Fixes
74
93
 
75
- * Remove redundant Docker configuration ([2b1be8f](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/2b1be8f41a1036c8237f689d2addf29beedaedea))
76
- * Remove Dockerfile and update eslint rule ([63d6d03](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/63d6d033a3614be9a0e132e25ff5eb94b7448505))
94
+ * Remove redundant Docker configuration ([2b1be8f](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/2b1be8f41a1036c8237f689d2addf29beedaedea))
95
+ * Remove Dockerfile and update eslint rule ([63d6d03](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/63d6d033a3614be9a0e132e25ff5eb94b7448505))
77
96
 
78
97
 
79
98
  ### Features
80
99
 
81
- * Added a rule to convert unnamed default exports to named default exports based on the file name ([cfda4c1](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/cfda4c16bbba11b281a45deca8ca8742ecab23e9))
100
+ * Added a rule to convert unnamed default exports to named default exports based on the file name ([cfda4c1](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/cfda4c16bbba11b281a45deca8ca8742ecab23e9))
82
101
 
83
- ## [1.0.7](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.6...v1.0.7) (2024-02-22)
102
+ ## [1.0.7](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.6...v1.0.7) (2024-02-22)
84
103
 
85
104
 
86
105
  ### Bug Fixes
87
106
 
88
- * test ([99d8a4f](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/99d8a4f325faaa425bc0ea0842567562441dcf2e))
107
+ * test ([99d8a4f](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/99d8a4f325faaa425bc0ea0842567562441dcf2e))
89
108
 
90
- ## [1.0.6](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.5...v1.0.6) (2024-02-22)
109
+ ## [1.0.6](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.5...v1.0.6) (2024-02-22)
91
110
 
92
111
 
93
112
  ### Bug Fixes
94
113
 
95
- * 7 ([f397bee](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/f397bee5676832b8b11e95dc52e0b8e83c5e5940))
114
+ * 7 ([f397bee](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/f397bee5676832b8b11e95dc52e0b8e83c5e5940))
96
115
 
97
- ## [1.0.5](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.4...v1.0.5) (2024-02-22)
116
+ ## [1.0.5](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.4...v1.0.5) (2024-02-22)
98
117
 
99
118
 
100
119
  ### Bug Fixes
101
120
 
102
- * 6 ([e4b80fd](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/e4b80fdea4d224b880c114e8ac5c433131f46e58))
121
+ * 6 ([e4b80fd](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/e4b80fdea4d224b880c114e8ac5c433131f46e58))
103
122
 
104
- ## [1.0.4](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.3...v1.0.4) (2024-02-22)
123
+ ## [1.0.4](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.3...v1.0.4) (2024-02-22)
105
124
 
106
125
 
107
126
  ### Bug Fixes
108
127
 
109
- * 3 ([de1546e](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/de1546eff2921718c6cfd6d6c4e8d6f82b178847))
110
- * 5 ([8d1b80d](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/8d1b80d22129d1a5baaa7330f76645ef6e9f2cc9))
128
+ * 3 ([de1546e](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/de1546eff2921718c6cfd6d6c4e8d6f82b178847))
129
+ * 5 ([8d1b80d](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/8d1b80d22129d1a5baaa7330f76645ef6e9f2cc9))
111
130
 
112
- ## [1.0.3](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.2...v1.0.3) (2024-02-22)
131
+ ## [1.0.3](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.2...v1.0.3) (2024-02-22)
113
132
 
114
133
 
115
134
  ### Bug Fixes
116
135
 
117
- * number 3 ([ac78e66](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/ac78e6685fcda4551a18f93afc0e05ecb232185c))
136
+ * number 3 ([ac78e66](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/ac78e6685fcda4551a18f93afc0e05ecb232185c))
118
137
 
119
- ## [1.0.2](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.1...v1.0.2) (2024-02-22)
138
+ ## [1.0.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.1...v1.0.2) (2024-02-22)
120
139
 
121
140
 
122
141
  ### Bug Fixes
123
142
 
124
- * Update package.json version to 1.0.6 ([1c5409c](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/1c5409ce77ccc5fc4e35a975ffa328f59766c1d7))
143
+ * Update package.json version to 1.0.6 ([1c5409c](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/1c5409ce77ccc5fc4e35a975ffa328f59766c1d7))
125
144
 
126
- ## [1.0.1](https://github.com/tomerh2001/eslint-plugin-no-destruction/compare/v1.0.0...v1.0.1) (2024-02-22)
145
+ ## [1.0.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.0.0...v1.0.1) (2024-02-22)
127
146
 
128
147
 
129
148
  ### Bug Fixes
130
149
 
131
- * semantic ([1e08f3d](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/1e08f3ddb5f1432307ce7a1e50863c9325ddbbfc))
150
+ * semantic ([1e08f3d](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/1e08f3ddb5f1432307ce7a1e50863c9325ddbbfc))
132
151
 
133
152
  # 1.0.0 (2024-02-22)
134
153
 
135
154
 
136
155
  ### Bug Fixes
137
156
 
138
- * Add ESLint configuration and rules ([0197c62](https://github.com/tomerh2001/eslint-plugin-no-destruction/commit/0197c62d8d4be2f8fd5ae67ad4c3a83370d5d678))
157
+ * Add ESLint configuration and rules ([0197c62](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/0197c62d8d4be2f8fd5ae67ad4c3a83370d5d678))
package/README.md CHANGED
@@ -17,7 +17,7 @@ To add all of the rules into your project, add the following configuration into
17
17
 
18
18
  ```json
19
19
  {
20
- "extends": ["plugin:eslint-plugin-th-rules/all"]
20
+ "extends": ["plugin:th-rules/all"]
21
21
  }
22
22
  ```
23
23
 
@@ -25,7 +25,7 @@ To add all of the rules into your project, add the following configuration into
25
25
 
26
26
  ### 1. No-Destruction Rule
27
27
 
28
- **Rule ID:** `eslint-plugin-th-rules/no-destructuring`
28
+ **Rule ID:** `th-rules/no-destructuring`
29
29
 
30
30
  #### Description
31
31
 
@@ -44,14 +44,14 @@ This rule checks for:
44
44
  ```json
45
45
  {
46
46
  "rules": {
47
- "eslint-plugin-th-rules/no-destructuring": ["error", { "maximumDestructuredVariables": 2, "maximumLineLength": 100 }]
47
+ "th-rules/no-destructuring": ["error", { "maximumDestructuredVariables": 2, "maximumLineLength": 100 }]
48
48
  }
49
49
  }
50
50
  ```
51
51
 
52
52
  ### 2. Name-Export Rule
53
53
 
54
- **Rule ID:** `eslint-plugin-th-rules/no-default-export`
54
+ **Rule ID:** `th-rules/no-default-export`
55
55
 
56
56
  #### Description
57
57
 
@@ -65,7 +65,7 @@ This rule targets unnamed default exports and automatically generates a named ex
65
65
  ```json
66
66
  {
67
67
  "rules": {
68
- "eslint-plugin-th-rules/no-default-export": "error"
68
+ "no-default-export": "error"
69
69
  }
70
70
  }
71
71
  ```
@@ -74,11 +74,11 @@ This rule targets unnamed default exports and automatically generates a named ex
74
74
  ```json
75
75
  {
76
76
  "plugins": [
77
- "eslint-plugin-th-rules"
77
+ "th-rules"
78
78
  ],
79
79
  "rules": {
80
- "eslint-plugin-th-rules/no-destructuring": "error",
81
- "eslint-plugin-th-rules/no-default-export": "error"
80
+ "no-destructuring": "error",
81
+ "no-default-export": "error"
82
82
  }
83
83
  }
84
84
  ```
package/bun.lockb CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-th-rules",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
@@ -8,8 +8,8 @@
8
8
  "eslint-plugin"
9
9
  ],
10
10
  "author": "Tomer Horowitz",
11
- "main": "./lib/index.js",
12
- "exports": "./lib/index.js",
11
+ "main": "./src/index.js",
12
+ "exports": "./src/index.js",
13
13
  "scripts": {
14
14
  "lint": "npm-run-all \"lint:*\"",
15
15
  "lint:eslint-docs": "npm-run-all \"update:eslint-docs -- --check\"",
@@ -18,6 +18,12 @@
18
18
  "update:eslint-docs": "eslint-doc-generator"
19
19
  },
20
20
  "dependencies": {
21
+ "eslint-config-jsdoc": "^15.4.0",
22
+ "eslint-config-xo": "^0.44.0",
23
+ "eslint-config-xo-react": "^0.27.0",
24
+ "eslint-plugin-jsdoc": "^48.2.0",
25
+ "eslint-plugin-react": "^7.33.2",
26
+ "eslint-plugin-react-hooks": "^4.6.0",
21
27
  "requireindex": "^1.2.0"
22
28
  },
23
29
  "devDependencies": {
@@ -28,6 +34,7 @@
28
34
  "@semantic-release/github": "^9.2.1",
29
35
  "@semantic-release/npm": "^11.0.0",
30
36
  "@semantic-release/release-notes-generator": "^12.0.0",
37
+ "@types/xo": "^0",
31
38
  "bun-types": "latest",
32
39
  "eslint": "^8.19.0",
33
40
  "eslint-doc-generator": "^1.0.0",
package/src/index.js ADDED
@@ -0,0 +1,94 @@
1
+ /* eslint-disable n/no-path-concat */
2
+ /* eslint-disable unicorn/prefer-module */
3
+
4
+ /**
5
+ * @fileoverview A List of custom ESLint rules created by Tomer Horowitz
6
+ * @author Tomer Horowitz
7
+ */
8
+ 'use strict';
9
+ const requireIndex = require('requireindex');
10
+
11
+ /**
12
+ * Represents a basic configuration object.
13
+ *
14
+ * @type {Object}
15
+ * @property {string[]} plugins - The list of plugins.
16
+ * @property {string[]} extends - The list of extended configurations.
17
+ * @property {Object} rules - The rules configuration.
18
+ * @property {Object} envs - The environment configuration.
19
+ */
20
+ const basic = {
21
+ plugins: ['th-rules'],
22
+ extends: [],
23
+ rules: {
24
+ 'th-rules/no-destructuring': 'error',
25
+ 'th-rules/no-default-export': 'error',
26
+ },
27
+ envs: {},
28
+ };
29
+
30
+ /**
31
+ * Represents the recommended ESLint configuration.
32
+ * @type {Object}
33
+ */
34
+ const recommended = {
35
+ ...basic,
36
+ envs: {
37
+ node: true,
38
+ ES2024: true,
39
+ jest: true,
40
+ },
41
+ rules: {
42
+ ...basic.rules,
43
+ 'unicorn/filename-case': 'off',
44
+ 'unicorn/prefer-module': 'warn',
45
+ 'import/extensions': 'off',
46
+ camelcase: 'warn',
47
+ },
48
+ };
49
+
50
+ /**
51
+ * Represents an object containing all the configurations.
52
+ * @type {Object}
53
+ */
54
+ const all = {
55
+ ...recommended,
56
+ plugins: [...recommended.plugins, 'jsdoc'],
57
+ extends: [...recommended.extends, 'plugin:jsdoc/recommended-error'],
58
+ };
59
+
60
+ /**
61
+ * Represents an object containing all React-related configurations.
62
+ * @typedef {Object} allReact
63
+ * @property {Object} envs - The environment configurations.
64
+ * @property {boolean} envs.browser - Indicates if the browser environment is enabled.
65
+ * @property {Object} rules - The rule configurations.
66
+ * @property {string} rules['react/no-array-index-key'] - The configuration for the 'react/no-array-index-key' rule.
67
+ * @property {string[]} extends - The list of extended configurations.
68
+ */
69
+ const allReact = {
70
+ ...all,
71
+ envs: {...all.envs, node: false, browser: true},
72
+ rules: {...all.rules, 'react/no-array-index-key': 'off'},
73
+ extends: [...all.extends, 'xo-react'],
74
+ };
75
+
76
+ /**
77
+ * Object representing all React Native configurations.
78
+ * @type {Object}
79
+ */
80
+ const allReactNative = {
81
+ ...allReact,
82
+ extends: [...allReact.extends, 'plugin:react-native/all'],
83
+ };
84
+
85
+ module.exports = {
86
+ rules: requireIndex(`${__dirname}/rules`),
87
+ configs: {
88
+ basic,
89
+ recommended,
90
+ all,
91
+ 'all-react': allReact,
92
+ 'all-react-native': allReactNative,
93
+ },
94
+ };
@@ -1,7 +1,7 @@
1
1
  const MAX_TAB_COUNT = 3;
2
2
 
3
3
  /**
4
- * Represents the metadata for the "no-destruction" ESLint rule.
4
+ * Represents the metadata for the "no-destructuring" ESLint rule.
5
5
  *
6
6
  * @type {Object}
7
7
  * @property {string} type - The type of the rule.
@@ -1,5 +1,5 @@
1
1
  const {RuleTester} = require('eslint');
2
- const rule = require('../../../lib/rules/no-unamed-default-export.js');
2
+ const rule = require('../../../lib/rules/no-default-export.js');
3
3
 
4
4
  const ruleTester = new RuleTester({
5
5
  parserOptions: {
@@ -1,5 +1,5 @@
1
1
  const {RuleTester} = require('eslint');
2
- const rule = require('../../../lib/rules/no-destruction.js');
2
+ const rule = require('../../../lib/rules/no-destructuring.js');
3
3
 
4
4
  const ruleTester = new RuleTester({
5
5
  parserOptions: {
package/lib/index.js DELETED
@@ -1,32 +0,0 @@
1
- /* eslint-disable n/no-path-concat */
2
- /* eslint-disable unicorn/prefer-module */
3
-
4
- /**
5
- * @fileoverview A List of custom ESLint rules created by Tomer Horowitz
6
- * @author Tomer Horowitz
7
- */
8
- 'use strict';
9
-
10
- //------------------------------------------------------------------------------
11
- // Requirements
12
- //------------------------------------------------------------------------------
13
-
14
- const requireIndex = require('requireindex');
15
-
16
- //------------------------------------------------------------------------------
17
- // Plugin Definition
18
- //------------------------------------------------------------------------------
19
-
20
- // import all rules in lib/rules
21
- module.exports = {
22
- rules: requireIndex(`${__dirname}/rules`),
23
- configs: {
24
- all: {
25
- plugins: ['th-rules'],
26
- rules: {
27
- 'th-rules/no-destructuring': 'error',
28
- 'th-rules/no-default-export': 'error',
29
- },
30
- },
31
- },
32
- };
File without changes