Skip to content
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

eslint: enable recommended ruleset #3263

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Jun 19, 2024

No description provided.

alxndrsn added 2 commits June 19, 2024 15:11
Also delete tests which have not been enabled since 2017.
@alxndrsn
Copy link
Contributor Author

@brianc is there anything I can do to help get this PR considered for review?

Copy link
Collaborator

@charmander charmander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d merge this if it were just the ESLint rule. Don’t want to combine two unrelated changes.

@alxndrsn
Copy link
Contributor Author

I’d merge this if it were just the ESLint rule. Don’t want to combine two unrelated changes.

Thanks for the feedback. I've reverted the unrelated changes.

@charmander
Copy link
Collaborator

Oh, I see there are no code changes associated with this. How about applying the entire ESLint recommended configuration, then?

@alxndrsn alxndrsn changed the title eslint: add rule: no-unreachable eslint: enable recommended ruleset Apr 6, 2025
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Apr 6, 2025

How about applying the entire ESLint recommended configuration, then?

I've done this, and updated the PR title to reflect the change.

Eslint's ECMAScript version is bumped to 2020 as this was required to support globalThis (already in use before this PR), and 2020 seems to be fully supported by node 16, which is the oldest version supported in this repo's CI tests:

node:
- '16'
- '18'
- '20'
- '22'
- '23'

It's picked up some obvious errors, and some stuff which is more debatable.

Copy link
Collaborator

@charmander charmander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! It’s nice to see this change catching some important issues.

@@ -11,7 +11,6 @@ if (module === require.main) {
pool.query('SELECT NOW()', (err, res) => console.log('completed first'))
pool.on('remove', () => {
console.log('removed')
done()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven’t really looked at this, but there’s probably more to do here than quietly deleting a line. Does none of this code run at all, then?

return count
}
}
} while (Date.now() - start > time)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here has been inverted.

return count
}
}
} while (Date.now() - start > time)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here has been inverted.


const { length: OIDLength, index: indexAfterOIDLength } = readASN1Length(data, index)
index = indexAfterOIDLength
lastIndex = index + OIDLength
let lastIndex = index + OIDLength
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! Good catch.

@@ -225,7 +225,7 @@ suite.test('sasl/scram', function () {
0x0d, // signature algorithm length
0x06, // ASN.1 OID
0x09, // OID length
0x2a, // OID: 1.2.840.113549.1.1.11 (RSASSA-PKCS1-v1_5 / SHA-256)
0x2a, // OID: 1.2.840.113549.1.1.11 (RSASSA-PKCS1-v1_5 / SHA-256)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(note for other readers: the difference is a zero-width space after “SHA-256”)

@charmander
Copy link
Collaborator

Eslint's ECMAScript version is bumped to 2020 as this was required to support globalThis (already in use before this PR), and 2020 seems to be fully supported by node 16, which is the oldest version supported in this repo's CI tests:

You can define navigator as a global instead. Despite the lack of CI, pg 8 still supports Node 8(!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants