Skip to content

Conversation

@lancej1022
Copy link

Pull Request Name

fix(rule): no-unnecessary-arbitrary-value

Description

Fix issue where no-unnecessary-arbitrary-value would allow arbitrary hex color values even when a valid tailwind class alternative was already available as part of the theme. Add passing/failing tests for the updated hex color checks.

Motivation:
While doing some local development I noticed that the rule as it exists on master can properly catch arbitrary values such as margins/padding, but it fails to catch arbitrary colors even if theres a valid alternative available in the user's TW theme/config.

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Added passing AND failing tests for custom tailwind theme colors
    • Also included tests for "single match" (autofixable) as well as multi-match (developer must choose between multiple potential fixes)

Test Configuration:

  • OS + version: macOS Sequoia 15.7.2
  • NPM version: 8.19.2
  • Node version: 18.12.0

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
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Fix issue where `no-unnecessary-arbitrary-value` would allow arbitrary hex color values even when
a valid tailwind class alternative was already available as part of the theme.
Add passing/failing tests for the updated hex color checks.
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.

1 participant