-
-
Notifications
You must be signed in to change notification settings - Fork 29
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 new rules no-missing-message-ids
and no-unused-message-ids
#254
Add new rules no-missing-message-ids
and no-unused-message-ids
#254
Conversation
43a3550
to
d91d1a0
Compare
no-invalid-message-ids
no-missing-message-ids
and no-unused-message-ids
806decb
to
c1e6abf
Compare
c1e6abf
to
da64dc0
Compare
This is ready for review. These rules were fairly-challenging to implement given the number of false positives originally when I ran them on the ESLint codebase but I've solved all the issues. |
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.
Looks so great! 💯
I've tested it in a few repos:
- eslint
- eslint-plugin-node
- eslint-plugin-react
- acorn (to find unexpected crashes on no-eslint-rule js)
It's working very well, thanks! 👍
lib/rules/no-missing-message-ids.js
Outdated
fixable: null, | ||
schema: [], | ||
messages: { | ||
missingMessage: '`meta.messages` is missing this `messageId`.', |
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.
could the message be clearer, e.g. messageId "foo"
?
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.
Yes updated.
@aladdin-add updated the messages and I also fixed some false positives affecting eslint-plugin-unicorn due to variable message object keys. |
…ds and add messageId to messages
68b7e43
to
3a9825f
Compare
Fixes #57.
Detects:
messageId
that does not existmeta.messages
that is unusedThese were implemented as separate rules because:
Note that I eliminated many possible false positive scenarios by testing these rules on the ESLint codebase.
TODO
Rename torequire-valid-message-ids
no-missing-message-ids
andno-unused-message-ids
since the unused message ID check can have false positives when variables or helper functions are usedAfter this is merged:
no-missing-placeholders
andno-unused-placeholders
to handle messageIds #252