eslint-plugin-th-rules 1.5.4 → 1.6.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 +14 -0
- package/README.md +1 -1
- package/bun.lockb +0 -0
- package/package.json +2 -1
- package/src/index.js +4 -3
- package/src/rules/no-destructuring.js +3 -3
- package/src/tests/no-destructuring.js +4 -4
- package/src/configs.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.5.5...v1.6.0) (2024-06-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Added eslint-plugin-sonarjs to recommended config ([13176f3](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/13176f3ededa543f3b5f05789a5deed6f0f5cdb1))
|
|
7
|
+
|
|
8
|
+
## [1.5.5](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.5.4...v1.5.5) (2024-06-14)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* fixed CI ([36f1e36](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/36f1e36c95debb7360455bf0d00cdbffd07be77b))
|
|
14
|
+
|
|
1
15
|
## [1.5.4](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.5.3...v1.5.4) (2024-06-14)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
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.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A List of custom ESLint rules created by Tomer Horowitz",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"eslint-doc-generator": "^1.7.1",
|
|
43
43
|
"eslint-plugin-eslint-plugin": "^6.1.0",
|
|
44
44
|
"eslint-plugin-node": "^11.1.0",
|
|
45
|
+
"eslint-plugin-sonarjs": "^1.0.3",
|
|
45
46
|
"eslint-plugin-unicorn": "^54.0.0",
|
|
46
47
|
"mocha": "^10.4.0",
|
|
47
48
|
"npm-run-all": "^4.1.5",
|
package/src/index.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
const requireIndex = require('requireindex');
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
plugins: ['th-rules'],
|
|
7
|
+
const recommended = {
|
|
8
|
+
plugins: ['th-rules', 'sonarjs'],
|
|
9
|
+
extends: ['plugin:sonarjs/recommended-legacy'],
|
|
9
10
|
rules: {
|
|
10
11
|
'th-rules/no-destructuring': 'error',
|
|
11
12
|
'th-rules/no-default-export': 'error',
|
|
@@ -32,6 +33,6 @@ const base = {
|
|
|
32
33
|
module.exports = {
|
|
33
34
|
rules: requireIndex(`${__dirname}/rules`),
|
|
34
35
|
configs: {
|
|
35
|
-
base,
|
|
36
|
+
base: recommended,
|
|
36
37
|
},
|
|
37
38
|
};
|
|
@@ -63,7 +63,7 @@ function create(context) {
|
|
|
63
63
|
if (tabCount > MAX_TAB_COUNT) {
|
|
64
64
|
context.report({
|
|
65
65
|
node,
|
|
66
|
-
message: `
|
|
66
|
+
message: `destructuring at a nesting level above ${MAX_TAB_COUNT} is not allowed, instead saw ${tabCount} levels of nesting`,
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -71,7 +71,7 @@ function create(context) {
|
|
|
71
71
|
if (node?.id?.properties?.length > MAX_VARIABLES) {
|
|
72
72
|
context.report({
|
|
73
73
|
node,
|
|
74
|
-
message: `
|
|
74
|
+
message: `destructuring of more than ${MAX_VARIABLES} variables is not allowed`,
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -79,7 +79,7 @@ function create(context) {
|
|
|
79
79
|
if (lineLength > MAX_LINE_LENGTH) {
|
|
80
80
|
context.report({
|
|
81
81
|
node,
|
|
82
|
-
message: `
|
|
82
|
+
message: `destructuring on a line exceeding ${MAX_LINE_LENGTH} characters is not allowed`,
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
},
|
|
@@ -8,7 +8,7 @@ const ruleTester = new RuleTester({
|
|
|
8
8
|
},
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
ruleTester.run('no-
|
|
11
|
+
ruleTester.run('no-destructuring', rule, {
|
|
12
12
|
valid: [
|
|
13
13
|
{
|
|
14
14
|
code: 'const { a, b } = obj;',
|
|
@@ -35,17 +35,17 @@ ruleTester.run('no-destruction', rule, {
|
|
|
35
35
|
{
|
|
36
36
|
code: 'const { a, b, c } = obj;',
|
|
37
37
|
options: [{maximumDestructuredVariables: 2, maximumLineLength: 80}],
|
|
38
|
-
errors: [{message: '
|
|
38
|
+
errors: [{message: 'destructuring of more than 2 variables is not allowed'}],
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
code: 'const { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z } = obj;',
|
|
42
42
|
options: [{maximumDestructuredVariables: 3, maximumLineLength: 80}],
|
|
43
|
-
errors: [{message: '
|
|
43
|
+
errors: [{message: 'destructuring of more than 3 variables is not allowed'}, {message: 'destructuring on a line exceeding 80 characters is not allowed'}],
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
code: 'function foo() {\n\t\t\t\t\t\t\tconst { a, b } = obj;\n}',
|
|
47
47
|
options: [{maximumDestructuredVariables: 3, maximumLineLength: 80}],
|
|
48
|
-
errors: [{message: '
|
|
48
|
+
errors: [{message: 'destructuring at a nesting level above 3 is not allowed, instead saw 7 levels of nesting'}],
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
});
|
package/src/configs.js
DELETED
|
File without changes
|