-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
tools: eslint rule for missing internal/error doc #16450
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.
🥇 Love this!
@@ -0,0 +1,49 @@ | |||
'use strict'; | |||
|
|||
// const prefix = 'Out of ASCIIbetical order - '; |
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.
Commented code
cc: @not-an-aardvark |
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 is really great!!
My only concern is that there might be errors that are documented, but don't exist anymore in lib/internal/errors.js
(this had come up at least once or twice). I had made my own lintdoc.js to try and deal with this (I had meant to PR into nodejs/node at some point). Not a huge deal, just probably just something collaborators should keep in mind as things land.
doc/api/errors.md
Outdated
### ERR_CRYPTO_HASH_UPDATE_FAILED | ||
|
||
Used when [`hash.update()`][] fails for any reason. This should rarely, if | ||
ever happen. |
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.
needs a comma after ever
:)
@@ -0,0 +1,49 @@ | |||
'use strict'; | |||
|
|||
// const prefix = 'Out of ASCIIbetical order - '; |
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.
✂️?
|
||
const invalidCode = 'UNDOCUMENTED ERROR CODE'; | ||
|
||
new RuleTester().run('documented-errors', rule, { |
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 could be missing something, but do we need to have this test file if we already have the lint rule, and it's enabled for lib/internal/errors.js
? In theory the lint rule should run as part of make lint
, right? 😬
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.
The test file tests the lint rule -- make lint
runs it.
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 test file is intended to test the lint rule itself. For example, if the rule had a bug where it never reported any errors, we probably wouldn't notice it when running make lint
.
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.
👍 sorry, my bad, I read RuleTester
as running the rule.
@maclover7 ... regarding codes that are in errors.md that aren't used any more, let's tackle that problem separately.. perhaps by using @watilde's md lint tool once that lands. |
PR-URL: #16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
PR-URL: #16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Landed in fb477f3 and 76b8803 |
PR-URL: nodejs/node#16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
PR-URL: nodejs/node#16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Should this be backported to
|
PR-URL: nodejs/node#16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
PR-URL: nodejs/node#16450 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc, tools