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

Chore: use ids for messages #12859

Merged
merged 80 commits into from Feb 5, 2020
Merged

Chore: use ids for messages #12859

merged 80 commits into from Feb 5, 2020

Conversation

G-Rath
Copy link
Contributor

@G-Rath G-Rath commented Feb 1, 2020

Prerequisites checklist

  • I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

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.e name instead of moduleName for no-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 of message.

Is there anything you'd like reviewers to focus on?


Continues on from #12715

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Feb 1, 2020
@@ -204,7 +208,7 @@ module.exports = {
if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasTrailingUnderscore(identifier)) {
context.report({
node,
message: "Unexpected dangling '_' in '{{identifier}}'.",
Copy link
Member

Choose a reason for hiding this comment

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

🙌

@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Feb 4, 2020
Copy link
Member

@kaicataldo kaicataldo left a 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!

lib/rules/space-before-blocks.js Outdated Show resolved Hide resolved
tests/lib/rules/no-octal-escape.js Show resolved Hide resolved
tests/lib/rules/no-unused-vars.js Outdated Show resolved Hide resolved
tests/lib/rules/no-unused-vars.js Outdated Show resolved Hide resolved
Copy link
Member

@kaicataldo kaicataldo left a 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 💪

Copy link
Member

@mdjermanovic mdjermanovic left a 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.

@G-Rath
Copy link
Contributor Author

G-Rath commented Feb 4, 2020

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 :)

@mdjermanovic
Copy link
Member

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 👍

@kaicataldo
Copy link
Member

Thanks for working on this! I know this isn't the most fun thing to work on and really appreciate you took the time :)

@kaicataldo kaicataldo merged commit 3734a66 into eslint:master Feb 5, 2020
@kaicataldo kaicataldo changed the title Use ids for messages Chore: use ids for messages Feb 5, 2020
@G-Rath G-Rath deleted the use-ids-for-messages branch February 5, 2020 22:10
@G-Rath
Copy link
Contributor Author

G-Rath commented Feb 5, 2020

No problem :)

I know this isn't the most fun thing to work on

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 😄

montmanu pushed a commit to montmanu/eslint that referenced this pull request Mar 4, 2020
* 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 `||`
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 5, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants