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

Rule Change: Allow for configurable properties #36

Closed
1 task
bradgarropy opened this issue Dec 19, 2024 · 1 comment
Closed
1 task

Rule Change: Allow for configurable properties #36

bradgarropy opened this issue Dec 19, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@bradgarropy
Copy link

What rule do you want to change?

no-invalid-properties

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new option

Example code

@layer utilities {
  .text-shadow-2 {
    text-shadow: 2px 2px theme('colors.purple.400');
  }
  .text-shadow-3 {
    text-shadow: 3px 3px theme('colors.purple.400');
  }
}

What does the rule currently do for this code?

Here is a minimal reproduction of the current state of things.
https://stackblitz.com/edit/no-irregular-whitespace-ey1hdv5b

Currently, the rule shows an error, as it does not understand Tailwind's custom theme property.

/home/projects/better-tailwind-support/tailwind.css
  15:26  error  Invalid value '2px 2px theme("colors.purple.400")' for property 'text-shadow'. Expected none | <shadow-t>#  css/no-invalid-properties
  18:26  error  Invalid value '3px 3px theme("colors.purple.400")' for property 'text-shadow'. Expected none | <shadow-t>#  css/no-invalid-properties

What will the rule do after it's changed?

We should introduce a new option to the rule, so we can add other supported properties, like Tailwind's theme property.

I would expect the configuration to look something like this:

"css/no-invalid-properties": ["error", "theme", "other", ...]

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

/cc @JoshuaKGoldberg

@bradgarropy bradgarropy added the enhancement New feature or request label Dec 19, 2024
@fasttime fasttime added this to Triage Dec 27, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Dec 27, 2024
@nzakas
Copy link
Member

nzakas commented Dec 30, 2024

Thanks for the suggestion. I don't think it makes sense to have such customization at the rule level. Instead, I think we need to figure out a way to set preferences like this at a higher level that all rules can inherit from. After all, if you would want every rule that deals with property values to understand theme(), not just this one, and it would be a pain to have to add this customization to every rule you enable.

So, I'll track here:
#37

@nzakas nzakas closed this as completed Dec 30, 2024
@github-project-automation github-project-automation bot moved this from Needs Triage to Complete in Triage Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Complete
Development

No branches or pull requests

2 participants