eslint-plugin-hex-under 0.2.1 → 0.2.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 +21 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # eslint-plugin-hex-under
2
2
 
3
+ Sometimes it's really hard for humans to read hexadecimal numbers and know the exact decimal value.
4
+
3
5
  ## hex-under
4
6
 
5
- This ESLint plugin proves, if you use hexadecimal numbers in your variable declaration code, that its value is less than or equal a specified value (default: 255). If you use a hexadecimal number greater than this specified value, it will be transformed to its decimal value.
7
+ This ESLint plugin proves, if you use hexadecimal numbers in your code, that its value is less than or equal a specified value (default: 255). If you use a hexadecimal number greater than this specified value, it will be transformed to its decimal value.
6
8
 
7
9
  ### Example
8
10
 
@@ -10,11 +12,29 @@ This ESLint plugin proves, if you use hexadecimal numbers in your variable decla
10
12
  // valid with { limit: 255 }
11
13
  const signal = 0xef;
12
14
 
15
+ let func = () => 0xab;
16
+
17
+ function add(a, b) {
18
+ return a + b + 0x1f;
19
+ }
20
+
13
21
  // invalid with { limit: 255 }
14
22
  const signal = 0x21b;
15
23
 
24
+ let func = () => 0xabc;
25
+
26
+ function add(a, b) {
27
+ return a + b + 0x100;
28
+ }
29
+
16
30
  // This can be transformed to:
17
31
  const signal = 539;
32
+
33
+ let func = () => 2748;
34
+
35
+ function add(a, b) {
36
+ return a + b + 256;
37
+ }
18
38
  ```
19
39
 
20
40
  ## Integration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-hex-under",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "main": "eslint-plugin-hex-under.js",
5
5
  "scripts": {
6
6
  "lint": "prettier . --check && eslint .",