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: Adopt eslint-plugin/prefer-message-ids rule internally #14841

Merged
merged 6 commits into from Jul 30, 2021

Conversation

bmish
Copy link
Sponsor Member

@bmish bmish commented Jul 27, 2021

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[X] Other, please explain:

What changes did you make? (Give an overview)

The public rule eslint-plugin/prefer-message-ids is more robust than our internal version, and it's also valuable for us to dogfood this public rule as it's the same one that third-party plugin authors will use. So this PR deletes our custom version and switches us to the public rule for internal usage.

Follow-up to #14823.

CC: @aladdin-add

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

No.

@eslint-github-bot eslint-github-bot bot added the triage An ESLint team member will look at this issue soon label Jul 27, 2021
Copy link
Member

@aladdin-add aladdin-add left a comment

👍

Copy link
Member

@mdjermanovic mdjermanovic left a comment

It makes sense to enable eslint-plugin/prefer-message-ids, as it catches some things that internal-rules/consistent-meta-messages doesn't (e.g., someone could define meta.messages but still mistakenly use message in context.report()).

However, it doesn't work for rules where context is passed to functions that eventually call context.report(), like no-duplicate-imports or padding-lines-between-statements, so maybe we should use both the plugin rule and the internal rule?

@bmish
Copy link
Sponsor Member Author

bmish commented Jul 28, 2021

It is true that we can't always detect all usages of context.report since it may be used inside helper functions. If we're worried about that, how about I update eslint-plugin/prefer-message-ids to also flag a violation when meta.messages is missing? That's a new rule I just wrote and I would much prefer to have one comprehensive rule (covering both situations) rather than rely on two.

UPDATE: fix in eslint-community/eslint-plugin-eslint-plugin#173.

@mdjermanovic
Copy link
Member

mdjermanovic commented Jul 28, 2021

If we're worried about that, how about I update eslint-plugin/prefer-message-ids to also flag a violation when meta.messages is missing? That's a new rule I just wrote and I would much prefer to have one comprehensive rule (covering both situations) rather than rely on two.

Makes sense to me 👍

nzakas
nzakas approved these changes Jul 29, 2021
@nzakas nzakas added chore This change is not user-facing and removed triage An ESLint team member will look at this issue soon labels Jul 29, 2021
nzakas
nzakas approved these changes Jul 30, 2021
@bmish
Copy link
Sponsor Member Author

bmish commented Jul 30, 2021

@mdjermanovic I have updated the rule to handle that case so this PR is ready to be merged :)

@btmills btmills merged commit 3c78a7b into eslint:master Jul 30, 2021
14 checks passed
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jan 27, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

5 participants