Skip to content

Commit da76e20

Browse files
authored
v0.3.1
* test: added bigint test * 0.3.1
1 parent 7b49906 commit da76e20

File tree

4 files changed

+56
-4
lines changed

4 files changed

+56
-4
lines changed

.github/workflows/build-and-test.yml

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ jobs:
3737
node-version: ${{ matrix.node-version }}
3838
- run: npm install
3939
- run: npm test
40+
- run: npm run test:bigint

hex-under-bigint.test.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
const { RuleTester } = require("eslint");
2+
const hexUnderBigintRule = require("./hex-under-bigint");
3+
4+
const ruleTester = new RuleTester({
5+
languageOptions: {
6+
ecmaVersion: 2022,
7+
},
8+
});
9+
10+
ruleTester.run("hex-under-bigint", hexUnderBigintRule, {
11+
valid: [
12+
{
13+
options: [{ limit: 255 }],
14+
code: "const foo = 0xffn;",
15+
},
16+
{
17+
options: [{ limit: 15 }],
18+
code: "const foo = 0xfn;",
19+
},
20+
{
21+
options: [{ limit: 256 }],
22+
code: "const foo = 0x100n;",
23+
},
24+
{
25+
options: [{ limit: 255 }],
26+
code: "let foo = 0xffn;",
27+
},
28+
{
29+
options: [{ limit: 256 }],
30+
code: "var foo = 0xffn;",
31+
},
32+
{
33+
code: "function func() {\n return 0xffn;\n}",
34+
},
35+
{
36+
code: "functionA(0xefn);",
37+
},
38+
{
39+
code: "const func = () => 0xabn;",
40+
},
41+
],
42+
invalid: [
43+
{
44+
code: "const foo = 0x100n;",
45+
errors: 1,
46+
},
47+
],
48+
});
49+
50+
console.log("All tests passed!");

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"name": "eslint-plugin-hex-under",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"main": "eslint-plugin-hex-under.js",
55
"scripts": {
66
"lint": "prettier . --check && eslint .",
7-
"test": "node hex-under.test.js"
7+
"test": "node hex-under.test.js",
8+
"test:bigint": "node hex-under-bigint.test.js"
89
},
910
"repository": {
1011
"type": "git",

0 commit comments

Comments
 (0)