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

Alphabetize error list #15083

Closed
wants to merge 2 commits into from
Closed

Conversation

maclover7
Copy link
Contributor

Includes a new ESLint rule to make sure the list doesn't become un-alphabetized again :)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

errors, tools

@nodejs-github-bot nodejs-github-bot added errors Issues and PRs related to JavaScript errors originated in Node.js core. tools Issues and PRs related to the tools directory. labels Aug 30, 2017
Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

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

Woo! Linting!

@mscdex
Copy link
Contributor

mscdex commented Aug 30, 2017

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'?

@benjamingr
Copy link
Member

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.

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

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

eslint FTW 🥇

@@ -3,3 +3,4 @@ rules:
require-buffer: error
buffer-constructor: error
no-let-in-for-declaration: error
alphabetize-errors: error
Copy link
Contributor

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

@refack
Copy link
Contributor

refack commented Aug 30, 2017

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.

It's been a pain, especially conflict-wise. Also AFAIK this plugin could later be applied to validate that the codes in lib/internal/errors.js and in doc/api/errors.md are in sync.

@refack refack self-assigned this Aug 30, 2017
@maclover7 maclover7 force-pushed the jm-alphabetize-errors branch from 5765c33 to 8a1e6aa Compare August 30, 2017 15:36
@maclover7
Copy link
Contributor Author

Also AFAIK this plugin could later be applied to validate that the codes in lib/internal/errors.js and in doc/api/errors.md are in sync.

Yep, this is something that I want to work on later on.

@@ -1,3 +1,5 @@
/* esline-enable alphabetize-errors */

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.
@maclover7 maclover7 force-pushed the jm-alphabetize-errors branch from 8a1e6aa to aaec74c Compare September 1, 2017 00:27
@maclover7
Copy link
Contributor Author

Good catch, updated 👍

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

Still LGTM

@jasnell
Copy link
Member

jasnell commented Sep 1, 2017

@refack
Copy link
Contributor

refack commented Sep 1, 2017

Landed in 324aa64 b12d779

@refack refack closed this Sep 1, 2017
refack pushed a commit that referenced this pull request Sep 1, 2017
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]>
refack pushed a commit that referenced this pull request Sep 1, 2017
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]>
@maclover7 maclover7 deleted the jm-alphabetize-errors branch September 1, 2017 22:25
@Trott
Copy link
Member

Trott commented Sep 2, 2017

Using a comment to enable a custom lint rule on a single file. Very clever. I salute you. 🎉

addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 5, 2017
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]>
addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 5, 2017
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]>
@MylesBorins
Copy link
Contributor

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

jasnell pushed a commit that referenced this pull request Sep 25, 2017
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]>
@MylesBorins
Copy link
Contributor

ping re backport

@Trott
Copy link
Member

Trott commented Sep 29, 2017

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...

@Trott
Copy link
Member

Trott commented Sep 29, 2017

Actually, never mind, I have a backport-ish coming shortly.

Trott pushed a commit to Trott/io.js that referenced this pull request Sep 29, 2017
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]>
@Trott
Copy link
Member

Trott commented Sep 29, 2017

@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?

@Trott
Copy link
Member

Trott commented Sep 29, 2017

First bad commit is 3b6c00a. (make lint-js fails.)

@refack
Copy link
Contributor

refack commented Sep 29, 2017

I'll fix that with a backport of #15578

@MylesBorins
Copy link
Contributor

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

@Trott
Copy link
Member

Trott commented Sep 29, 2017

Thanks @refack and @MylesBorins. Sounds like there's nothing more for me to do here, but if I'm wrong, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
errors Issues and PRs related to JavaScript errors originated in Node.js core. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.