eslint-plugin-hex-under 1.11.1 → 1.11.3

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.
Files changed (2) hide show
  1. package/README.md +23 -29
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,18 +23,18 @@ This can lead to:
23
23
 
24
24
  The plugin provides three independent rules:
25
25
 
26
- | Rule | Format | Default limit
27
- |---|---|---
28
- | hex-under/hex-under | Hexadecimal | 0xff (255)
29
- | hex-under/binary-under | Binary | 0b1111 (15)
30
- | hex-under/octal-under | Octal | 0o777 (511)
26
+ | Rule | Format | Default limit |
27
+ | ---------------------- | ----------- | ------------- |
28
+ | hex-under/hex-under | Hexadecimal | 0xff (255) |
29
+ | hex-under/binary-under | Binary | 0b1111 (15) |
30
+ | hex-under/octal-under | Octal | 0o777 (511) |
31
31
 
32
32
  The configured limit is inclusive.
33
33
 
34
34
  For example, with the default hexadecimal limit of 255:
35
35
 
36
36
  ```js
37
- const a = 0xff; // OK: 255
37
+ const a = 0xff; // OK: 255
38
38
  const b = 0x100; // Error: 256
39
39
  ```
40
40
 
@@ -60,18 +60,9 @@ export default [
60
60
  'hex-under': eslintPluginHexUnder,
61
61
  },
62
62
  rules: {
63
- 'hex-under/hex-under': [
64
- 'error',
65
- { limit: 255, checkBigInt: true },
66
- ],
67
- 'hex-under/octal-under': [
68
- 'error',
69
- { limit: 511, checkBigInt: true },
70
- ],
71
- 'hex-under/binary-under': [
72
- 'error',
73
- { limit: 15, checkBigInt: true },
74
- ],
63
+ 'hex-under/hex-under': ['error', { limit: 255, checkBigInt: true }],
64
+ 'hex-under/octal-under': ['error', { limit: 511, checkBigInt: true }],
65
+ 'hex-under/binary-under': ['error', { limit: 15, checkBigInt: true }],
75
66
  },
76
67
  },
77
68
  ];
@@ -103,8 +94,11 @@ function add(a, b) {
103
94
  const binary = 0b1111; // 15
104
95
 
105
96
  const octal = 0o377; // 255
97
+ ```
106
98
 
107
99
  Invalid with default limits
100
+
101
+ ```js
108
102
  const signal = 0x21b; // 539
109
103
 
110
104
  const func = () => 0xabc; // 2748
@@ -186,7 +180,7 @@ BigInt literals can optionally be checked using the checkBigInt option.
186
180
  By default:
187
181
 
188
182
  ```js
189
- checkBigInt: true
183
+ checkBigInt: true;
190
184
  ```
191
185
 
192
186
  For example:
@@ -200,7 +194,7 @@ With checkBigInt: true, this literal is checked against the configured limit.
200
194
  If you don't want BigInt literals to be checked, set:
201
195
 
202
196
  ```js
203
- checkBigInt: false
197
+ checkBigInt: false;
204
198
  ```
205
199
 
206
200
  For example:
@@ -225,20 +219,20 @@ const mask = 0xdead_beefn;
225
219
 
226
220
  ## Rules
227
221
 
228
- | Rule | Description
229
- |---|---
230
- | hex-under/hex-under | Limits hexadecimal numeric literals
231
- | hex-under/binary-under | Limits binary numeric literals
232
- | hex-under/octal-under | Limits octal numeric literals
222
+ | Rule | Description |
223
+ | ---------------------- | ----------------------------------- |
224
+ | hex-under/hex-under | Limits hexadecimal numeric literals |
225
+ | hex-under/binary-under | Limits binary numeric literals |
226
+ | hex-under/octal-under | Limits octal numeric literals |
233
227
 
234
228
  Each rule can be configured independently.
235
229
 
236
230
  ## Options
237
231
 
238
- | Option | Type | Default | Description
239
- |---|---|---|---
240
- | limit | number | Format-specific | Maximum allowed numeric value
241
- |checkBigInt | boolean | true | Whether BigInt literals should be checked
232
+ | Option | Type | Default | Description |
233
+ | ----------- | ------- | --------------- | ----------------------------------------- |
234
+ | limit | number | Format-specific | Maximum allowed numeric value |
235
+ | checkBigInt | boolean | true | Whether BigInt literals should be checked |
242
236
 
243
237
  The limit is inclusive. A literal equal to the limit is valid; a literal greater than the limit is reported.
244
238
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "0xflotus",
3
3
  "description": "This ESLint rule proves that hex numbers are less than a specified value.",
4
4
  "type": "module",
5
- "version": "1.11.1",
5
+ "version": "1.11.3",
6
6
  "devDependencies": {
7
7
  "@eslint/js": "10.0.1",
8
8
  "@eslint/json": "2.1.0",