-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: replace standard with eslint+prettier #1638
Conversation
function parseAuthOptions(opts) { | ||
let matches | ||
if (opts.auth) { | ||
matches = opts.auth.match(/^(.+):(.+)$/) |
Check failure
Code scanning / CodeQL
Polynomial regular expression used on uncontrolled data
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1638 +/- ##
==========================================
- Coverage 86.39% 86.16% -0.23%
==========================================
Files 19 19
Lines 1264 1272 +8
==========================================
+ Hits 1092 1096 +4
- Misses 172 176 +4
☔ View full report in Codecov by Sentry. |
@vishnureddy17 @BertKleewein as expected this has also fix some bugs in code like undefined vars that now are highlighted by eslint. Also everything has a cleaner syntax now using arrow functions |
Ready for review now @BertKleewein @vishnureddy17 🙏🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some suggestions, but feel free to merge without addressing them if you think they are out of scope for this PR.
@@ -1,27 +1,25 @@ | |||
'use strict' | |||
|
|||
const url = require('url') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we could do this everywhere we use a dependency built into node to make things clear. Not sure if this would affect brower compatibility.
const url = require('url') | |
const url = require('node:url') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just did a try, seems browserify doesn't support ndoe:
protocol yet :( we can keep this maybe for the rollup refactor if we ever find a way to make that work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference: browserify/browserify#2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no real benefit to using node:
; just stick with url
.
if (typeof alias !== 'undefined') { | ||
if (topic.length === 0) { | ||
if (alias > 0 && alias <= 0xffff) { | ||
const gotTopic = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I feel like the newline here is not really useful. Maybe increase the max line length setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line length increesed to 100 (default is 80)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted this as I found out prettier reccomendations: https://prettier.io/docs/en/options.html#print-width
Fixes #1637
Additional changes:
errors
was not defined inhandlers/auth
DEBUG
env based on if we are running tests with debug mode enabledthat
lint
andlint-fix
npm scripts and addedlint
to cishould not reconnect if pingresp is successful
test where client connection was not closed properlyauth packet
flaky test caused by a race condition (see comment)authPacket
client optionmanualConnect
option to allow user manually callingconnect
(previously called_setupStream
). This trick is used when user want to setup listeners or other thing before doing the connect. This is used inauth packet
test for example to prevent the race condition. Also Fixes Manual connect #1496I also tried to fix the mocha
after
method intest/client
andtest/unique_message_id_provider_client
. It actually callsserver.close()
without checking if there are open sockets (connections). I did a change to keep a reference of all sockets and close them before server.close and calldone
callback provided byafter
on server close. I also tried to change the code using afterEach and beforeEach so the server is created and closed before and after each test (as I think should be) but that doesn't work too.