Skip to content

Commit 13f9a5e

Browse files
Update files as per review
Update ci workflow with currently supported NodeJS version Add variable to catch statements Add appropriate eslint-disable directives Fix ESLint config Add Node 20.x to CI script Remove ESLint comments Remove ESLint from package.json Fix shadowing of error parameter Updated versions in CI script
1 parent 3c37b20 commit 13f9a5e

9 files changed

Lines changed: 15 additions & 62 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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import globals from "globals";
22
import { defineConfig } from "eslint/config";
33

44
export default defineConfig([
5-
{ files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: { ...globals.browser, ...globals.node, ...globals.worker, ...globals.jest } } },
5+
{ files: ["**/*.{js,mjs,cjs}"], languageOptions: { globals: { ...globals.browser, ...globals.node, ...globals.worker } } },
6+
{ files: ["test/**/*.{js,mjs,cjs}"], languageOptions: { globals: globals.jest } },
67
{
78
"rules": {
89
"indent": [
@@ -26,7 +27,8 @@ export default defineConfig([
2627
"no-unused-vars": [
2728
2,
2829
{
29-
"args": "none"
30+
"args": "none",
31+
"caughtErrors": "none"
3032
}
3133
],
3234
"semi": [

package.json

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -38,54 +38,5 @@
3838
"sprintf-js": "^1.1.3",
3939
"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 {} /* 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: 2 additions & 2 deletions
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 {
100+
} catch (e) {
101101
/* otherwise push copy of raw array */
102102
let copy = new Uint8Array(s.length);
103103
copy.set(s);
@@ -269,7 +269,7 @@ const luaB_ipairs = function(L) {
269269
const b_str2int = function(s, base) {
270270
try {
271271
s = to_jsstring(s);
272-
} catch {
272+
} catch (e) {
273273
return null;
274274
}
275275
let r = /^[\t\v\f \n\r]*([+-]?)0*([0-9A-Za-z]+)[\t\v\f \n\r]*$/.exec(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 {
427+
} catch (e2) {
428428
if (lj.status === LUA_OK) {
429429
/* also failed */
430430
lj.status = -1;

src/loadlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ if (typeof process !== "undefined") { // Only with Node
202202
try {
203203
let fd = fs.openSync(filename, 'r');
204204
fs.closeSync(fd);
205-
} catch {
205+
} catch (e) {
206206
return false;
207207
}
208208
return true;

src/lobject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ const lua_strx2number = function(s) {
478478
const lua_str2number = function(s) {
479479
try {
480480
s = to_jsstring(s);
481-
} catch {
481+
} catch (e) {
482482
return null;
483483
}
484484
/* use a regex to validate number and also to get length

test/test-suite/ltests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ const checkpanic = function(L) {
691691
try { /* set jump buffer */
692692
runJS(L, L1, { script: code, offset: 0 }); /* run code unprotected */
693693
lua.lua_pushliteral(L, "no errors");
694-
} catch { /* error handling */
694+
} catch (e) { /* error handling */
695695
/* move error message to original state */
696696
lua.lua_pushstring(L, lua.lua_tostring(L1, -1));
697697
}

0 commit comments

Comments
 (0)