Skip to content

Commit d86318b

Browse files
authored
chore: fixes code smells, added Node v24 test matrix (#211)
1 parent 7c136ad commit d86318b

File tree

11 files changed

+20
-20
lines changed

11 files changed

+20
-20
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:22-alpine
1+
FROM node:24-alpine
22

33
ARG USERNAME=node
44
ARG USER_UID=1000

.github/workflows/master.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919

20-
- name: Use Node.js 22.x
20+
- name: Use Node.js 24.x
2121
uses: actions/setup-node@v5
2222
with:
23-
node-version: 22.x
23+
node-version: 24.x
2424
- run: npm install
2525
- run: npm run lint
2626
- run: npm test
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
node-version: [16.x, 18.x, 20.x, 22.x]
41+
node-version: [16.x, 18.x, 20.x, 22.x, 24.x]
4242
os: [ ubuntu-latest, windows-latest ]
4343
runs-on: ${{ matrix.os }}
4444

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v5
1414
- uses: actions/setup-node@v5
1515
with:
16-
node-version: 22
16+
node-version: 24
1717
- run: npm install
1818
- run: npm test
1919
env:
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@v5
3232
- uses: actions/setup-node@v5
3333
with:
34-
node-version: 22
34+
node-version: 24
3535
registry-url: https://registry.npmjs.org/
3636
- run: npm install
3737
- run: npm publish --provenance --access public

.github/workflows/sonar.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ jobs:
3333
ref: ${{ steps.pr.outputs.head_sha }}
3434
fetch-depth: 0
3535

36-
- name: Use Node.js 22.x
36+
- name: Use Node.js 24.x
3737
uses: actions/setup-node@v5
3838
with:
39-
node-version: 22.x
39+
node-version: 24.x
4040
- run: npm install
4141
- run: npm run lint
4242
- run: npm test

.github/workflows/staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
node:
88
description: 'Node version'
99
required: true
10-
default: '22.x'
10+
default: '24.x'
1111
os:
1212
description: 'Operating System (ubuntu-20.04, ubuntu-latest, windows-latest)'
1313
required: true

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
],
3333
"devDependencies": {
3434
"@babel/eslint-parser": "^7.28.4",
35-
"@typescript-eslint/eslint-plugin": "^8.44.1",
36-
"@typescript-eslint/parser": "^8.44.1",
35+
"@typescript-eslint/eslint-plugin": "^8.45.0",
36+
"@typescript-eslint/parser": "^8.45.0",
3737
"c8": "^10.1.3",
3838
"chai": "^6.2.0",
3939
"env-cmd": "^11.0.0",
40-
"eslint": "^9.36.0",
41-
"mocha": "^11.7.2",
40+
"eslint": "^9.37.0",
41+
"mocha": "^11.7.4",
4242
"mocha-sonarqube-reporter": "^1.0.2",
4343
"sinon": "^21.0.0"
4444
},

src/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ export class Client {
7171
}
7272
};
7373

74-
Object.entries(optionsHandler).forEach(([key, handler]) => {
74+
for (const [key, handler] of Object.entries(optionsHandler)) {
7575
if (key in options) {
7676
handler(options[key]);
7777
}
78-
});
78+
}
7979

8080
this.#initTimedMatch(options);
8181
}

src/lib/remoteAuth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class Auth {
1717

1818
static setRetryOptions(silentMode) {
1919
this.#retryOptions = {
20-
retryTime: parseInt(silentMode.slice(0, -1)),
20+
retryTime: Number.parseInt(silentMode.slice(0, -1)),
2121
retryDurationIn: silentMode.slice(-1),
2222
};
2323
}

src/lib/snapshot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const checkSwitchersLocal = (snapshot, switcherKeys) => {
4848
found = false;
4949
const { config } = g;
5050

51-
if (config.find(c => c.key === switcher)) {
51+
if (config.some(c => c.key === switcher)) {
5252
found = true;
5353
break;
5454
}
@@ -229,7 +229,7 @@ function processPAYLOAD(operation, input, values) {
229229
const keys = payloadReader(inputJson);
230230
switch(operation) {
231231
case OperationsType.HAS_ONE:
232-
return keys.filter(key => values.includes(key)).length > 0;
232+
return keys.some(key => values.includes(key));
233233
case OperationsType.HAS_ALL:
234234
return values.every(element => keys.includes(element));
235235
}

src/lib/utils/ipcidr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default class IPCIDR {
44
}
55

66
ip4ToInt(ip) {
7-
return ip.split('.').reduce((int, oct) => (int << 8) + parseInt(oct, 10), 0) >>> 0;
7+
return ip.split('.').reduce((int, oct) => (int << 8) + Number.parseInt(oct, 10), 0) >>> 0;
88
}
99

1010
isIp4InCidr(ip) {

0 commit comments

Comments
 (0)