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
Add @babel/eslint-plugin-development-internal #11376
Conversation
18ab35d
to
9f3ef4d
Compare
eslint/babel-eslint-plugin-internal/src/rules/dry-error-messages.js
Outdated
Show resolved
Hide resolved
eslint/babel-eslint-plugin-internal/src/rules/dry-error-messages.js
Outdated
Show resolved
Hide resolved
|
||
export default { | ||
meta: { | ||
type: "suggestion", |
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.
Does suggestion
make CI fail? (I'd like it to do so)
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.
In this case, "suggestion"
is referring to what type of rule this is (i.e. it enforces a code style choice rather than a possible code error). It can still be configured as "off"
, "warning"
, or "error"
in our config :)
@@ -0,0 +1,36 @@ | |||
{ | |||
"name": "@babel/eslint-plugin-internal", |
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'd prefer to call this @babel/eslint-plugin-development-internal
, since it's more similar to @babel/eslint-plugin-development
than to @babel/eslint-plugin
.
Good job! I think that this rule is ok as-is; if we need to enforce more things we can always update it/create other rules. |
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.
TIL awesome AST selectors.
@kaicataldo Is this still "WIP"? |
I was planning to add a readme as well as enable the rule, but I’m also fine with doing that in a follow up PR since folks already reviewed this. |
@kaicataldo lets add the readme and enable it |
GitHub now allows converting WIP PRs to Draft PRs 😄 |
Apologies for the delay! Will be getting to this in the next day or two now that I'm healthy again. |
Is there a way to include this in the top level |
If just specifying |
5506f49
to
62817aa
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5506f49:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/24389/ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1f885a3:
|
bad9509
to
7372bf8
Compare
Was hoping to land this before I go on vacation, but please feel free to merge/fix up if you'd like to before I get back. Otherwise, I'll follow up when I return! |
This is ready for final review. |
7372bf8
to
c4b99e5
Compare
5ba8da2
to
bc991ac
Compare
bc991ac
to
1f885a3
Compare
As discussed, this PR implements a custom ESLint rule that enforces using error messages imported from a specific, configured module.
I still need to add a README and want to add more test cases, but figured I should get a WIP PR up so that I can get some early feedback. Comments/open questions:
errorModule
. We could potentially add more validation, but in this case I think Flow covers our bases.RuleTester
utility into the shared fixtures package.