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: Test formatted integers in no-dupe-keys (refs #13568) #13626

Merged
merged 1 commit into from Aug 29, 2020

Conversation

btmills
Copy link
Member

@btmills btmills commented Aug 28, 2020

Prerequisites checklist

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

[x] Other, please explain:

Add additional rule tests for numeric separators as part of #13568.

What changes did you make? (Give an overview)

This adds tests for numeric literal object keys that aren't digit-only decimal integer literals, including ES6 binary and octal literals, ES2020 bigint literals, and ES2021 numeric separators. The valid tests have similar-looking literals that are distinct keys, and the invalid tests have differently-formatted literals that result in duplicate keys.

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

This is in addition to #13574 and #13581. Are there any other rules that might be affected?

This adds tests for numeric literal object keys that aren't digit-only
decimal integer literals, including ES6 binary and octal literals,
ES2020 bigint literals, and ES2021 numeric separators. The valid tests
have similar-looking literals that are distinct keys, and the invalid
tests have differently-formatted literals that result in duplicate keys.
@btmills btmills added rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion chore This change is not user-facing new syntax This issue is related to new syntax that has reached stage 4 labels Aug 28, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Aug 28, 2020
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! Makes sense to verify this rule.

Are there any other rules that might be affected?

I'd guess all rules where the value of the literal is important would be affected if we were using something else instead of Literal#value, like Number(node.raw) or +token.value.

It's probably a fairly long list to double-check, and it might include:

  • Most of the rules that work on properties of object literals/classes.
  • Rules that compare two nodes, like no-self-assign.
  • Misc rules, like no-magic-numbers (with "ignore"), yoda (with "exceptRange") and maybe some more.

@kaicataldo
Copy link
Member

LGTM, thanks!

@kaicataldo kaicataldo merged commit a320324 into master Aug 29, 2020
@kaicataldo kaicataldo deleted the numeric-separators-no-dupe-keys branch August 29, 2020 00:38
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Mar 18, 2021
@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 Mar 18, 2021
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 new syntax This issue is related to new syntax that has reached stage 4 rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants