-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Alphabetize error list #15083
Alphabetize error list #15083
Conversation
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.
Woo! Linting!
Shouldn't the linting be explicitly limited to lib/internal/errors.js to reduce the chance of it accidentally matching something else that starts with a capital 'E'? |
I haven't maintained that code - but are we sure the overhead of maintaining a plugin is worth it? It sounds like a lot more overhead than having non-alphabetized errors. |
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.
eslint FTW 🥇
lib/.eslintrc.yaml
Outdated
@@ -3,3 +3,4 @@ rules: | |||
require-buffer: error | |||
buffer-constructor: error | |||
no-let-in-for-declaration: error | |||
alphabetize-errors: error |
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.
Per @mscdex's comment It might be best to replace this with a:
/* esline-enable alphabetize-errors */
in lib/internal/errors.js
It's been a pain, especially conflict-wise. Also AFAIK this plugin could later be applied to validate that the codes in |
5765c33
to
8a1e6aa
Compare
Yep, this is something that I want to work on later on. |
lib/internal/errors.js
Outdated
@@ -1,3 +1,5 @@ | |||
/* esline-enable alphabetize-errors */ |
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.
This should be eslint-enable
, not esline
.
To make sure errors in lib/internal/errors.js (are defined via `E`) will stay in alphabetical order going forward.
8a1e6aa
to
aaec74c
Compare
Good catch, updated 👍 |
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.
Still LGTM
PR-URL: #15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
To make sure errors in lib/internal/errors.js (are defined via `E`) will stay in alphabetical order going forward. PR-URL: #15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Using a comment to enable a custom lint rule on a single file. Very clever. I salute you. 🎉 |
PR-URL: nodejs/node#15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
To make sure errors in lib/internal/errors.js (are defined via `E`) will stay in alphabetical order going forward. PR-URL: nodejs/node#15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
This will need to be backported to v8.x I attempted to use the lint rule to find out of order error codes, but unfortunately on the 8.x branch the lint rule wasn't doing anything, same with master. I opened an issue |
To make sure errors in lib/internal/errors.js (are defined via `E`) will stay in alphabetical order going forward. PR-URL: #15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
ping re backport |
If I'm not mistaken, this is dependent on multiple semver-majors and might be considered a 9.x-and-above only? Like, any existing error moved to the new error system is going to be semver-major... |
Actually, never mind, I have a backport-ish coming shortly. |
To make sure errors in lib/internal/errors.js (are defined via `E`) will stay in alphabetical order going forward. PR-URL: nodejs#15083 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorins Current v8.x-staging has the lint rule properly enabled and it is flagging two errors (that are duplicates) as being out of order. So this doesn't really need to be backported after all I don't think. But you'll probably want to find where that error was introduced and fix it so that there aren't a bunch of broken commits, yeah? |
First bad commit is 3b6c00a. ( |
I'll fix that with a backport of #15578 |
thanks all... I'll rebase it in before the first bad commit so we don't have broken stuff in the tree. Can you please include that information in the PR |
Thanks @refack and @MylesBorins. Sounds like there's nothing more for me to do here, but if I'm wrong, let me know. |
Includes a new ESLint rule to make sure the list doesn't become un-alphabetized again :)
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
errors, tools