eslint-plugin-th-rules 1.4.2 → 1.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [1.5.1](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.5.0...v1.5.1) (2024-02-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fixed ([9730e96](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/9730e96ff296ccd4afbc278fefd176f2684b89cb))
7
+
8
+ # [1.5.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.4.2...v1.5.0) (2024-02-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Add ESLint configurations for JSDoc and React ([45b6297](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/45b62978da758e4ebbf62780e74595393c38800b))
14
+
15
+
16
+ ### Features
17
+
18
+ * 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))
19
+
1
20
  ## [1.4.2](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.4.1...v1.4.2) (2024-02-26)
2
21
 
3
22
 
package/README.md CHANGED
@@ -13,6 +13,7 @@ This repository contains custom ESLint rules to enhance code quality and consist
13
13
 
14
14
  ## Configurations
15
15
 
16
+ ### All
16
17
  To add all of the rules into your project, add the following configuration into your ESLint configuration file:
17
18
 
18
19
  ```json
@@ -21,6 +22,34 @@ To add all of the rules into your project, add the following configuration into
21
22
  }
22
23
  ```
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
+
24
53
  ## Rules
25
54
 
26
55
  ### 1. No-Destruction Rule
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.2",
3
+ "version": "1.5.1",
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,13 @@
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",
27
+ "eslint-plugin-react-native": "^4.1.0",
21
28
  "requireindex": "^1.2.0"
22
29
  },
23
30
  "devDependencies": {
@@ -28,11 +35,13 @@
28
35
  "@semantic-release/github": "^9.2.1",
29
36
  "@semantic-release/npm": "^11.0.0",
30
37
  "@semantic-release/release-notes-generator": "^12.0.0",
38
+ "@types/xo": "^0",
31
39
  "bun-types": "latest",
32
40
  "eslint": "^8.19.0",
33
41
  "eslint-doc-generator": "^1.0.0",
34
42
  "eslint-plugin-eslint-plugin": "^5.0.0",
35
43
  "eslint-plugin-node": "^11.1.0",
44
+ "eslint-plugin-unicorn": "^51.0.1",
36
45
  "mocha": "^10.0.0",
37
46
  "npm-run-all": "^4.1.5",
38
47
  "xo": "^0.57.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
+ };
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
File without changes