-
Notifications
You must be signed in to change notification settings - Fork 22
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 proposal: no dynamic style references #14
Comments
What about things that aren't valid identifiers? I'd think that a string literal, or a template literal with no interpolations, should be permitted in bracket notation. |
Can you give me an example?
Sure, I don't really care much either way about this. |
|
Why is that not a valid identifier? |
Because it starts with a colon and contains a hyphen |
The hyphen should be fine, and the colon is potentially fine--that all depends on the underlying implementation. In our case with Aphrodite, this isn't handled very well and results in a className that contains a colon. But, it seems like these cases should be better handled by separate rules that dictate the shape of styles properties and not a rule that dictates the type of styles properties. |
I'm not sure I'm being clear - you can't do |
Dynamic style references make code more difficult to understand and interfere with static analycis. This weakens rules such as
no-unused-styles
. It would be good to have a rule that prevents this kind of coding.Bad:
I think it would also be okay to disallow the following:
Good:
The text was updated successfully, but these errors were encountered: