-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Chore: use ids for messages #12859
Chore: use ids for messages #12859
Conversation
@@ -204,7 +208,7 @@ module.exports = { | |||
if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasTrailingUnderscore(identifier)) { | |||
context.report({ | |||
node, | |||
message: "Unexpected dangling '_' in '{{identifier}}'.", |
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.
🙌
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.
Wow, thanks for working on this! This requires some dedication 😄 I have a few small comments, but otherwise this LGTM!
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.
Aside from resolving the discussion above, this LGTM! Thanks for doing this hero's work 💪
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.
LGTM, thanks!
Non-blocking, it might be correct to have multiple messageId's in some rules (e.g., no-restricted-syntax
) instead of a text in the code, at some point in the future.
Agreed - I noticed a couple of rules that I think could be made a bit cleaner by having them use seperate messages rather than being clever with placeholders, which I'll be aiming to improve on in my follow up PR :) |
That would be great 👍 |
Thanks for working on this! I know this isn't the most fun thing to work on and really appreciate you took the time :) |
No problem :)
To be honest, I actually enjoy this sort of work (most of the time) - theres something about tidying & updating code bases that I find rather cathartic 😄 |
* Chore: refactor `sort-vars` to use messageIds * Chore: refactor `space-infix-ops` to use messageIds * Chore: refactor `space-before-function-paren` to use messageIds * Chore: refactor `space-before-blocks` to use messageIds * Chore: refactor `spaced-comment` to use messageIds * Chore: refactor `sort-keys` to use messageIds * Chore: refactor `sort-imports` to use messageIds * Chore: refactor `semi-style` to use messageIds * Chore: refactor `semi-spacing` to use messageIds * Chore: refactor `rest-spread-spacing` to use messageIds * Chore: refactor `require-yield` to use messageIds * Chore: refactor `require-jsdoc` to use messageIds * Chore: refactor `radix` to use messageIds * Chore: refactor `quote-props` to use messageIds * Chore: refactor `prefer-template` to use messageIds * Chore: refactor `prefer-spread` to use messageIds * Chore: refactor `prefer-rest-params` to use messageIds * Chore: refactor `prefer-reflect` to use messageIds * Chore: refactor `prefer-promise-reject-errors` to use messageIds * Chore: refactor `prefer-destructuring` to use messageIds * Chore: refactor `prefer-arrow-callback` to use messageIds * Chore: refactor `padding-line-between-statements` to use messageIds * Chore: refactor `padded-blocks` to use messageIds * Chore: refactor `operator-linebreak` to use messageIds * Chore: refactor `one-var` to use messageIds * Chore: refactor `one-var-declaration-per-line` to use messageIds * Chore: refactor `object-shorthand` to use messageIds * Chore: refactor `object-property-newline` to use messageIds * Chore: refactor `object-curly-spacing` to use messageIds * Chore: refactor `object-curly-newline` to use messageIds * Chore: refactor `nonblock-statement-body-position` to use messageIds * Chore: refactor `no-with` to use messageIds * Chore: refactor `no-whitespace-before-property` to use messageIds * Chore: refactor `no-warning-comments` to use messageIds * Chore: refactor `no-var` to use messageIds * Chore: refactor `no-useless-return` to use messageIds * Chore: refactor `no-useless-rename` to use messageIds * Chore: refactor `no-useless-concat` to use messageIds * Chore: refactor `no-useless-computed-key` to use messageIds * Chore: refactor `no-useless-catch` to use messageIds * Chore: refactor `no-useless-call` to use messageIds * Chore: refactor `no-unused-vars` to use messageIds * Chore: refactor `no-unused-expressions` to use messageIds * Chore: refactor `no-unsafe-finally` to use messageIds * Chore: refactor `no-unreachable` to use messageIds * Chore: refactor `no-unneeded-ternary` to use messageIds * Chore: refactor `no-unmodified-loop-condition` to use messageIds * Chore: refactor `no-underscore-dangle` to use messageIds * Chore: refactor `no-undefined` to use messageIds * Chore: refactor `no-undef-init` to use messageIds * Chore: refactor `no-trailing-spaces` to use messageIds * Chore: refactor `no-this-before-super` to use messageIds * Chore: refactor `no-sync` to use messageIds * Chore: refactor `no-ternary` to use messageIds * Chore: refactor `no-template-curly-in-string` to use messageIds * Chore: refactor `no-tabs` to use messageIds * Chore: refactor `no-sparse-arrays` to use messageIds * Chore: refactor `no-spaced-func` to use messageIds * Chore: refactor `no-shadow-restricted-names` to use messageIds * Chore: refactor `no-sequences` to use messageIds * Chore: refactor `no-self-compare` to use messageIds * Chore: refactor `no-self-assign` to use messageIds * Chore: refactor `no-script-url` to use messageIds * Chore: refactor `no-return-await` to use messageIds * Chore: refactor `no-return-assign` to use messageIds * Chore: refactor `no-restricted-properties` to use messageIds * Chore: refactor `no-restricted-modules` to use messageIds * Chore: refactor `no-regex-spaces` to use messageIds * Chore: refactor `no-prototype-builtins` to use messageIds * Chore: refactor `no-proto` to use messageIds * Chore: refactor `no-process-exit` to use messageIds * Chore: refactor `no-process-env` to use messageIds * Chore: refactor `no-restricted-syntax` to use messageIds * Chore: refactor `no-native-reassign` to use messageIds * Chore: refactor `no-negated-in-lhs` to use messageIds * Chore: refactor `no-invalid-regexp` to use messageIds * Chore: refactor some tests to use `messageId`s * Chore: update `linter` tests to include `messageId` * Chore: correct message for `space-before-blocks` * Chore: use default values intead of `||`
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[x] Other: Helping to bring the codebase closer to standardisation.
What changes did you make? (Give an overview)
I went through the rules and added messages to a number of older rules.
I picked non-deprecated rules, and rules that could be simply changed (i.e. essentially just a prop change in context.report).
I also made a couple of changes to some of the
data
props, to better align them (i.ename
instead ofmoduleName
forno-restricted-modules
).There should be no functionality changes at all from this PR.
No new tests have been added, and no tests have been changed (apart from switching from hardcoded message to messageId + data).
I did change some tests to use
messageId
instead ofmessage
.Is there anything you'd like reviewers to focus on?
Continues on from #12715