eslint-plugin-th-rules 2.2.0 → 2.4.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,6 +1,31 @@
1
+ # [2.4.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v2.3.0...v2.4.0) (2026-01-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * fixed git tags ([822f503](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/822f5033769f89fabbd6cf7177ccef74311ec2e5))
7
+
8
+ # [2.2.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v2.1.1...v2.2.0) (2026-01-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * enhance no-boolean-coercion rule with detailed messages and update tests ([c79ad92](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/c79ad921e2a6c4dabe0f0e74b80393b01525c3d7))
14
+ * enhance no-boolean-coercion rule with detailed messages and update tests ([686d620](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/686d6204bd46f757a4490656521b1094f3e3237e))
15
+
16
+
17
+ ### Features
18
+
19
+ * created new rule no-boolean-coercion ([f9b0803](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/f9b08039f6275e363da10e8e3ca49fb75ad2e48a))
20
+
1
21
  # [2.2.0](https://github.com/tomerh2001/eslint-plugin-th-rules/compare/v2.1.1...v2.2.0) (2026-01-14)
2
22
 
3
23
 
24
+ ### Bug Fixes
25
+
26
+ * enhance no-boolean-coercion rule with detailed messages and update tests ([686d620](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/686d6204bd46f757a4490656521b1094f3e3237e))
27
+
28
+
4
29
  ### Features
5
30
 
6
31
  * created new rule no-boolean-coercion ([f9b0803](https://github.com/tomerh2001/eslint-plugin-th-rules/commit/f9b08039f6275e363da10e8e3ca49fb75ad2e48a))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-th-rules",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "A List of custom ESLint rules created by Tomer Horowitz",
5
5
  "keywords": [
6
6
  "eslint",
@@ -2,13 +2,19 @@ const meta = {
2
2
  type: 'problem',
3
3
  docs: {
4
4
  description:
5
- 'Disallow Boolean(variable) or !!variable and enforce explicit _.isNil / _.isEmpty checks',
5
+ 'Disallow Boolean(value) or !!value. Enforce _.isNil(value) for scalar values and _.isEmpty(value) for strings, arrays, and objects.',
6
6
  category: 'Best Practices',
7
7
  recommended: true,
8
8
  url: 'https://github.com/tomerh2001/eslint-plugin-th-rules/blob/main/docs/rules/no-boolean-coercion.md',
9
9
  },
10
10
  hasSuggestions: true,
11
11
  schema: [],
12
+ messages: {
13
+ useIsEmpty:
14
+ 'Boolean coercion is not allowed. Use _.isEmpty(value) for strings, arrays, and objects.',
15
+ useIsNil:
16
+ 'Boolean coercion is not allowed. Use _.isNil(value) for scalar values.',
17
+ },
12
18
  };
13
19
 
14
20
  function create(context) {
@@ -75,8 +81,7 @@ function create(context) {
75
81
 
76
82
  context.report({
77
83
  node,
78
- message:
79
- 'Boolean coercion is not allowed. Use an explicit null/empty check instead.',
84
+ messageId: isCollection ? 'useIsEmpty' : 'useIsNil',
80
85
  suggest: [
81
86
  {
82
87
  desc: `Replace with ${replacement}`,
@@ -3,9 +3,6 @@ const rule = require('../src/rules/no-boolean-coercion');
3
3
 
4
4
  const ruleTester = new RuleTester({});
5
5
 
6
- const ERROR_MESSAGE
7
- = 'Boolean coercion is not allowed. Use an explicit null/empty check instead.';
8
-
9
6
  ruleTester.run('no-boolean-coercion', rule, {
10
7
  valid: [
11
8
  '_.isNil(value);',
@@ -22,7 +19,7 @@ ruleTester.run('no-boolean-coercion', rule, {
22
19
  code: 'Boolean(foo);',
23
20
  errors: [
24
21
  {
25
- message: ERROR_MESSAGE,
22
+ messageId: 'useIsNil',
26
23
  suggestions: [
27
24
  {
28
25
  desc: 'Replace with _.isNil(foo)',
@@ -37,7 +34,7 @@ ruleTester.run('no-boolean-coercion', rule, {
37
34
  code: 'const x = Boolean(bar);',
38
35
  errors: [
39
36
  {
40
- message: ERROR_MESSAGE,
37
+ messageId: 'useIsNil',
41
38
  suggestions: [
42
39
  {
43
40
  desc: 'Replace with _.isNil(bar)',
@@ -52,7 +49,7 @@ ruleTester.run('no-boolean-coercion', rule, {
52
49
  code: '!!value;',
53
50
  errors: [
54
51
  {
55
- message: ERROR_MESSAGE,
52
+ messageId: 'useIsNil',
56
53
  suggestions: [
57
54
  {
58
55
  desc: 'Replace with _.isNil(value)',
@@ -67,7 +64,7 @@ ruleTester.run('no-boolean-coercion', rule, {
67
64
  code: 'Boolean([]);',
68
65
  errors: [
69
66
  {
70
- message: ERROR_MESSAGE,
67
+ messageId: 'useIsEmpty',
71
68
  suggestions: [
72
69
  {
73
70
  desc: 'Replace with _.isEmpty([])',
@@ -77,6 +74,5 @@ ruleTester.run('no-boolean-coercion', rule, {
77
74
  },
78
75
  ],
79
76
  },
80
-
81
77
  ],
82
78
  });