Skip to content

Commit b28210d

Browse files
droberts-ctrlodaurnimator
authored andcommitted
Fix build for modern JS+github
- update to latest dependencies - update github workflow with currently supported versions - update ESLint config (moves to new format)
1 parent bd945f0 commit b28210d

8 files changed

Lines changed: 2325 additions & 3159 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
node-version: [12.x, 14.x, 16.x, 17.x]
16+
node-version: [20.x, 22.x, 24.x, 25.x]
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v6
2020
- name: Use Node.js ${{ matrix.node-version }}
21-
uses: actions/setup-node@v2
21+
uses: actions/setup-node@v6
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424
cache: 'yarn'

eslint.config.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import globals from "globals";
2+
import { defineConfig } from "eslint/config";
3+
4+
export default defineConfig([
5+
{ files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: { ...globals.browser, ...globals.node, ...globals.worker } } },
6+
{ files: ["test/**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.jest } },
7+
{
8+
"rules": {
9+
"indent": [
10+
"error",
11+
4,
12+
{
13+
"SwitchCase": 1
14+
}
15+
],
16+
"linebreak-style": [
17+
"error",
18+
"unix"
19+
],
20+
"no-console": 0,
21+
"no-empty": [
22+
2,
23+
{
24+
"allowEmptyCatch": true
25+
}
26+
],
27+
"no-unused-vars": [
28+
2,
29+
{
30+
"args": "none",
31+
"caughtErrors": "none"
32+
}
33+
],
34+
"semi": [
35+
"error",
36+
"always"
37+
]
38+
}
39+
}
40+
]);

package.json

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -30,62 +30,13 @@
3030
},
3131
"homepage": "https://github.com/fengari-lua/fengari#readme",
3232
"devDependencies": {
33-
"eslint": "^5.15.1",
34-
"jest": "^24.5.0"
33+
"eslint": "^9.39.2",
34+
"jest": "^30.2.0"
3535
},
3636
"dependencies": {
37-
"readline-sync": "^1.4.9",
38-
"sprintf-js": "^1.1.2",
39-
"tmp": "^0.0.33"
37+
"readline-sync": "^1.4.10",
38+
"sprintf-js": "^1.1.3",
39+
"tmp": "^0.2.5"
4040
},
41-
"sideEffects": false,
42-
"eslintConfig": {
43-
"env": {
44-
"browser": true,
45-
"es6": true,
46-
"node": true,
47-
"worker": true
48-
},
49-
"extends": "eslint:recommended",
50-
"rules": {
51-
"indent": [
52-
"error",
53-
4,
54-
{
55-
"SwitchCase": 1
56-
}
57-
],
58-
"linebreak-style": [
59-
"error",
60-
"unix"
61-
],
62-
"no-console": 0,
63-
"no-empty": [
64-
2,
65-
{
66-
"allowEmptyCatch": true
67-
}
68-
],
69-
"no-unused-vars": [
70-
2,
71-
{
72-
"args": "none"
73-
}
74-
],
75-
"semi": [
76-
"error",
77-
"always"
78-
]
79-
},
80-
"overrides": [
81-
{
82-
"files": [
83-
"test/**/*.test.js"
84-
],
85-
"env": {
86-
"jest": true
87-
}
88-
}
89-
]
90-
}
41+
"sideEffects": false
9142
}

src/lauxlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ if (typeof process === "undefined") {
968968
lf.buff[lf.n++] = com.c; /* 'c' is the first character of the stream */
969969
let status = lua_load(L, getF, lf, lua_tostring(L, -1), mode);
970970
let readstatus = lf.err;
971-
if (filename) try { fs.closeSync(lf.f); } catch(e) {} /* close file (even in case of errors) */
971+
if (filename) try { fs.closeSync(lf.f); } catch (e) {} /* close file (even in case of errors) */
972972
if (readstatus) {
973973
lua_settop(L, fnameindex); /* ignore results from 'lua_load' */
974974
return errfile(L, "read", fnameindex, readstatus);

src/lbaselib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ if (typeof process === "undefined") {
9797
try {
9898
/* If the string is valid utf8, then we can use to_jsstring */
9999
s = to_jsstring(s);
100-
} catch(e) {
100+
} catch (e) {
101101
/* otherwise push copy of raw array */
102102
let copy = new Uint8Array(s.length);
103103
copy.set(s);

src/ldo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ const luaD_rawrunprotected = function(L, f, ud) {
424424
}
425425

426426
lj.status = LUA_ERRRUN;
427-
} catch(e2) {
427+
} catch (e2) {
428428
if (lj.status === LUA_OK) {
429429
/* also failed */
430430
lj.status = -1;

test/defs.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,36 @@ describe('to_jsstring', () => {
5959
describe('to_jsstring fails on invalid unicode', () => {
6060
test("non-utf8 char", () => {
6161
expect(() => defs.to_jsstring(defs.luastring_of(165)))
62-
.toThrowError(RangeError);
62+
.toThrow(RangeError);
6363
});
6464

6565
test("invalid continuation byte", () => {
6666
expect(() => defs.to_jsstring(defs.luastring_of(208, 60)))
67-
.toThrowError(RangeError);
67+
.toThrow(RangeError);
6868
});
6969

7070
test("invalid continuation byte", () => {
7171
expect(() => defs.to_jsstring(defs.luastring_of(225, 60, 145)))
72-
.toThrowError(RangeError);
72+
.toThrow(RangeError);
7373
});
7474

7575
test("invalid continuation byte", () => {
7676
expect(() => defs.to_jsstring(defs.luastring_of(225, 145, 60)))
77-
.toThrowError(RangeError);
77+
.toThrow(RangeError);
7878
});
7979

8080
test("invalid continuation byte", () => {
8181
expect(() => defs.to_jsstring(defs.luastring_of(242, 60, 145, 145)))
82-
.toThrowError(RangeError);
82+
.toThrow(RangeError);
8383
});
8484

8585
test("invalid continuation byte", () => {
8686
expect(() => defs.to_jsstring(defs.luastring_of(242, 145, 60, 145)))
87-
.toThrowError(RangeError);
87+
.toThrow(RangeError);
8888
});
8989

9090
test("invalid continuation byte", () => {
9191
expect(() => defs.to_jsstring(defs.luastring_of(242, 145, 145, 60)))
92-
.toThrowError(RangeError);
92+
.toThrow(RangeError);
9393
});
9494
});

0 commit comments

Comments
 (0)