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

yoda overlooks template literal #12863

Closed
yeonjuan opened this issue Feb 2, 2020 · 2 comments
Closed

yoda overlooks template literal #12863

yeonjuan opened this issue Feb 2, 2020 · 2 comments
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 bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@yeonjuan
Copy link
Member

yeonjuan commented Feb 2, 2020

Tell us about your environment

  • ESLint Version: v6.8.0
  • Node Version: v12.13.0
  • npm Version: v6.12.0

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Online Demo

/*eslint yoda: "error"*/

if (`red` === color) { // No Error
    // ...
}

What did you expect to happen?

expect an error.

What actually happened? Please include the actual, raw output from ESLint.

no error

Are you willing to submit a pull request to fix this bug?

yes

@yeonjuan yeonjuan added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Feb 2, 2020
@mdjermanovic mdjermanovic added enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Feb 3, 2020
@mdjermanovic
Copy link
Member

I think this makes sense for template literals without expressions. Someone can always use only backticks (which can be enforced with the quotes rule), so yoda as it is now wouldn't work for them.

@nzakas nzakas 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 Feb 5, 2020
@nzakas
Copy link
Member

nzakas commented Feb 5, 2020

There's consensus on this change, so marking as accepted.

montmanu pushed a commit to montmanu/eslint that referenced this issue Mar 4, 2020
…2876)

* Fix: check template literal in yoda (fixes eslint#12863)

* fix JSDOC, typo, add test cases

* add test cases

* update the documentation

* Edit jsdoc

* Add test case
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 9, 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 9, 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 bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants