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

Fix parseNodeRecursive: Correctly recurse into TemplateLiteral expressions #138

Conversation

mpsijm
Copy link
Contributor

@mpsijm mpsijm commented Apr 22, 2022

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.

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

  • My code follows the style guidelines of this project
  • 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
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@mpsijm mpsijm force-pushed the fix/template-condition-expressions branch from 2bbb65a to 2150235 Compare April 26, 2022 12:48
@mpsijm mpsijm force-pushed the fix/template-condition-expressions branch from 2150235 to ab0a975 Compare June 13, 2022 08:03
…essions

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.
@mpsijm mpsijm force-pushed the fix/template-condition-expressions branch from ab0a975 to ca752c9 Compare July 11, 2022 06:49
@francoismassart francoismassart merged commit c42e6e3 into francoismassart:master Aug 26, 2022
@francoismassart
Copy link
Owner

Thank your for your contribution, I just released it on the beta channel:
npm i eslint-plugin-tailwindcss@3.6.1-beta.0
I'll release it on 3.6.1 next week.

@mpsijm mpsijm deleted the fix/template-condition-expressions branch August 30, 2022 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants