Skip to content

Commit 97b44e7

Browse files
committed
Merge remote-tracking branch 'origin/amqplib-modernisation-6-useParseIntRadix'
2 parents 5ca9f45 + a5dfa65 commit 97b44e7

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Enable noUnusedFunctionParameters lint rule and fix all violations
1010
- Enable noUnusedVariables lint rule and remove all unused variables from codebase
1111
- Replace all var declarations with let/const for modern JavaScript standards
12+
- Ensure parseInt calls use explicit radix parameter for clarity and reliability
1213

1314
## v0.10.9
1415
- Add support for IPv6 urls

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"noUnusedFunctionParameters": "error",
2424
"noUnusedVariables": "error",
2525
"noInnerDeclarations": "error",
26-
"useParseIntRadix": "off",
26+
"useParseIntRadix": "error",
2727
"noSwitchDeclarations": "off",
2828
"noInvalidUseBeforeDeclaration": "error",
2929
"noPrecisionLoss": "off"

lib/connect.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function openFrames(vhost, query, credentials, extraClientProperties) {
5050
query = query || {};
5151

5252
function intOrDefault(val, def) {
53-
return val === undefined ? def : parseInt(val);
53+
return val === undefined ? def : parseInt(val, 10);
5454
}
5555

5656
const clientProperties = Object.create(CLIENT_PROPERTIES);
@@ -133,7 +133,7 @@ function connect(url, socketOptions, openCallback) {
133133
protocol = parts.protocol;
134134
sockopts.host = host;
135135
sockopts.servername = sockopts.servername || host;
136-
sockopts.port = parseInt(parts.port) || (protocol === 'amqp:' ? 5672 : 5671);
136+
sockopts.port = parseInt(parts.port, 10) || (protocol === 'amqp:' ? 5672 : 5671);
137137
const vhost = parts.pathname ? parts.pathname.substr(1) : null;
138138
fields = openFrames(vhost, parts.query, sockopts.credentials || credentialsFromUrl(parts), extraClientProperties);
139139
}

test/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ function kCallback(k, ek) {
163163
// A noddy way to make tests depend on the node version.
164164
function versionGreaterThan(actual, spec) {
165165
function int(e) {
166-
return parseInt(e);
166+
return parseInt(e, 10);
167167
}
168168

169169
const version = actual.split('.').map(int);

0 commit comments

Comments
 (0)