eslint-plugin-hex-under 1.2.5 → 1.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/README.md +11 -0
- package/package.json +1 -1
- package/src/rules/binary-under.js +4 -1
- package/src/rules/hex-under.js +4 -1
- package/src/rules/octal-under.js +4 -1
package/README.md
CHANGED
|
@@ -63,6 +63,17 @@ const binary = 256;
|
|
|
63
63
|
const octal = 256;
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
If you want to disable all rules, you can paste a special block comment at the very first line of the file.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
/* ignore-all-hex-under */
|
|
70
|
+
|
|
71
|
+
// this all will be ignored
|
|
72
|
+
const foo = 0xffff;
|
|
73
|
+
|
|
74
|
+
const bar = 0b10100010101;
|
|
75
|
+
```
|
|
76
|
+
|
|
66
77
|
## Integration
|
|
67
78
|
|
|
68
79
|
```sh
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ const BINARY_REGEX_BIGINT = /^0[bB][01_]+n$/;
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
meta: {
|
|
6
|
-
version: '0.
|
|
6
|
+
version: '0.3.1',
|
|
7
7
|
type: 'suggestion',
|
|
8
8
|
docs: {
|
|
9
9
|
description: 'Ensures binary numbers do not exceed a limit.',
|
|
@@ -47,6 +47,9 @@ export default {
|
|
|
47
47
|
const raw = node.raw;
|
|
48
48
|
|
|
49
49
|
const sourceCode = context.sourceCode;
|
|
50
|
+
if (sourceCode.lines[0] === '/* ignore-all-hex-under */') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
50
53
|
const line = node.loc.end.line;
|
|
51
54
|
const ignore =
|
|
52
55
|
sourceCode.lines[line - 2]?.startsWith('// ignore-binary-under') ||
|
package/src/rules/hex-under.js
CHANGED
|
@@ -4,7 +4,7 @@ const HEX_REGEX_BIGINT = /^0[xX][0-9a-fA-F_]+n$/;
|
|
|
4
4
|
export default {
|
|
5
5
|
meta: {
|
|
6
6
|
type: 'suggestion',
|
|
7
|
-
version: '0.
|
|
7
|
+
version: '0.7.1',
|
|
8
8
|
defaultOptions: [
|
|
9
9
|
{
|
|
10
10
|
limit: 255,
|
|
@@ -48,6 +48,9 @@ export default {
|
|
|
48
48
|
const raw = node.raw;
|
|
49
49
|
|
|
50
50
|
const sourceCode = context.sourceCode;
|
|
51
|
+
if (sourceCode.lines[0] === '/* ignore-all-hex-under */') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
51
54
|
const line = node.loc.end.line;
|
|
52
55
|
const ignore =
|
|
53
56
|
sourceCode.lines[line - 2]?.startsWith('// ignore-hex-under') ||
|
package/src/rules/octal-under.js
CHANGED
|
@@ -3,7 +3,7 @@ const OCTAL_REGEX_BIGINT = /^0[oO]?[0-7_]+n$/;
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
meta: {
|
|
6
|
-
version: '0.
|
|
6
|
+
version: '0.3.1',
|
|
7
7
|
type: 'suggestion',
|
|
8
8
|
docs: {
|
|
9
9
|
description: 'Ensures octal numbers do not exceed a limit.',
|
|
@@ -47,6 +47,9 @@ export default {
|
|
|
47
47
|
const raw = node.raw;
|
|
48
48
|
|
|
49
49
|
const sourceCode = context.sourceCode;
|
|
50
|
+
if (sourceCode.lines[0] === '/* ignore-all-hex-under */') {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
50
53
|
const line = node.loc.end.line;
|
|
51
54
|
const ignore =
|
|
52
55
|
sourceCode.lines[line - 2]?.startsWith('// ignore-octal-under') ||
|