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

Enable the valid-styles lint rule to evaluate all static expressions #726

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

Enable the valid-styles lint rule to evaluate all static expressions #726

nmn opened this issue Oct 9, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nmn
Copy link
Contributor

nmn commented Oct 9, 2024

Background

The Babel plugin uses a forked version of path.evaluate() from Babel to be able to statically evaluate a large number of static expressions during compilation. In addition to being able to evaluate simple expressions such as addition and string interpolation, the forked functionality can also:

  • Evaluate imports from .stylex.js files without actually reading the file. It resolves the file path, and the uses the locally known export name and key to hash and re-compute the original variable strings.
  • Evaluate simple pure arrow functions that do not have a function body (wrapped in {}) and return a simple expression instead.

Task

The Eslint valid-styles rule should be refactor and enhanced to be able to do the same evaluation that the Babel plugin does so it is able to more effectively validate the styles being used.

@nmn nmn added enhancement New feature or request help wanted Extra attention is needed labels 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 help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant