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

Update the ESLint valid-styles rule to use a strict CSS value parser. #728

Open
nmn opened this issue Oct 9, 2024 · 0 comments
Open

Update the ESLint valid-styles rule to use a strict CSS value parser. #728

nmn opened this issue Oct 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nmn
Copy link
Contributor

nmn commented Oct 9, 2024

The ESlint valid-styles rules was initially created by refactoring static types. As such, in many cases it allows arbitrary strings when only a particular CSS type should be allowed.

We have some occasional use regular expressions, but, overall, the the rule is far too permissive and easily allows invalid CSS values.


The Task

The ESLint rule should be updated to use a proper CSS value parser to properly validate the values used with StyleX. For example, a width must be a valid length, CSS variable or calc expression and not just any arbitrary string.

The nmn/css-value-parser can be used as the parser for this use-case. (See also, #721 and #722)

@nmn nmn changed the title Use a full parser to lint style values strictly Update the ESLint valid-styles rule to use a strict CSS value parser. Oct 9, 2024
@nmn nmn added the enhancement New feature or request label Oct 9, 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
None yet
Development

No branches or pull requests

1 participant