eslint-plugin-th-rules 1.5.5 → 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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ## [1.5.5](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v1.5.4...v1.5.5) (2024-06-14)
2
9
 
3
10
 
package/README.md CHANGED
@@ -52,7 +52,7 @@ To add all of the rules into your project, add the following configuration into
52
52
 
53
53
  ## Rules
54
54
 
55
- ### 1. No-Destruction Rule
55
+ ### 1. No-destructuring Rule
56
56
 
57
57
  **Rule ID:** `th-rules/no-destructuring`
58
58
 
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.5.5",
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 base = {
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: `Destruction at a nesting level above ${MAX_TAB_COUNT} is not allowed, instead saw ${tabCount} levels of nesting`,
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: `Destruction of more than ${MAX_VARIABLES} variables is not allowed`,
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: `Destruction on a line exceeding ${MAX_LINE_LENGTH} characters is not allowed`,
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-destruction', rule, {
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: 'Destruction of more than 2 variables is not allowed'}],
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: 'Destruction of more than 3 variables is not allowed'}, {message: 'Destruction on a line exceeding 80 characters is not allowed'}],
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: 'Destruction at a nesting level above 3 is not allowed, instead saw 7 levels of nesting'}],
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