eslint-plugin-tailwindcss icon indicating copy to clipboard operation
eslint-plugin-tailwindcss copied to clipboard

Fix `parseNodeRecursive`: Correctly recurse into TemplateLiteral expressions

Open mpsijm opened this issue 2 years ago • 0 comments

Fix parseNodeRecursive: Correctly recurse into TemplateLiteral expressions

Description

In the fuction parseNodeRecursive of lib/util/ast.js, the case for TemplateListeral nodes would always recurse over exp.right for all expressions in the template. However, these expressions are not necessarily binary expressions. Removing the .right will make sure that e.g. ConditionalExpressions are also checked.

Type of change

Please delete options that are not relevant.

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I've added a test to tests/lib/rules/no-custom-classname.js and tests/lib/rules/no-contradicting-classname.js.

Test Configuration:

  • OS + version: Arch Linux (last upgraded today)
  • NPM version: 8.5.5
  • Node version: 16.14.2

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [ ] ~~I have commented my code, particularly in hard-to-understand areas~~
  • [ ] ~~I have made corresponding changes to the documentation~~
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [ ] ~~Any dependent changes have been merged and published in downstream modules~~
  • [x] I have checked my code and corrected any misspellings

mpsijm avatar Apr 22 '22 11:04 mpsijm