eslint-plugin-hex-under 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -1,6 +1,6 @@
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.
3
+ Sometimes it's really hard for humans to read hexadecimal numbers and know the exact decimal value.
4
4
 
5
5
  ## hex-under
6
6
 
@@ -35,7 +35,6 @@ let func = () => 2748;
35
35
  function add(a, b) {
36
36
  return a + b + 256;
37
37
  }
38
-
39
38
  ```
40
39
 
41
40
  ## Integration
package/hex-under.js CHANGED
@@ -32,17 +32,18 @@ module.exports = {
32
32
  (token) => token.type === "Numeric" && token.value.startsWith("0x"),
33
33
  ) || [];
34
34
  for (const token of tokens) {
35
- if (token.value > limit) {
35
+ const value = parseInt(token.value);
36
+ if (value > limit) {
36
37
  context.report({
37
38
  node: token,
38
39
  messageId: "valueOverGeneral",
39
40
  data: {
40
41
  limit: limit,
41
42
  over255Raw: token.value,
42
- overValue: parseInt(token.value),
43
+ overValue: value,
43
44
  },
44
45
  fix(fixer) {
45
- return fixer.replaceText(token, parseInt(token.value));
46
+ return fixer.replaceText(token, value);
46
47
  },
47
48
  });
48
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-hex-under",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "main": "eslint-plugin-hex-under.js",
5
5
  "scripts": {
6
6
  "lint": "prettier . --check && eslint .",