-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add option to warn when missing semicolons #1402
base: main
Are you sure you want to change the base?
Conversation
what would be the use case for |
From my understanding we only wanted the warning on the |
As we want to keep our implementation similar to CSS: Semicolons are not strictly required at the end of each line in a CSS file. However, they are necessary to separate declarations within a CSS rule. For example: h1 {
color: blue;
font-size: 20px;
} In this example, the semicolons are needed to separate the h1 {
color: blue
} Despite this, it's considered good practice to always include semicolons, even for the last declaration in a rule, to avoid potential errors and maintain consistency in the code. Also shouldn't this be in |
Isn’t the code inside a rule supposed to match the target platform? In Swift you don’t need a semicolon at the end of each statement, as long as they are separated by a newline. |
I'm not super tied to the implementation and I think there is time for us to debate on this. If we were to lean in the direction of the upstream UI framework then we should go all-in and rather than newline use On the other side, separating the top line modifiers/rules by |
The semicolons are delimiters between modifiers, the stylesheet lib doesn't know about modifiers and so this functionality has to be in the client libraries. Once Jetpack arrives and we consolidate functionality into
I'll leave it as configurable for now. |
f2caced
to
6129156
Compare
@NduatiK thank you, let me dig in after v0.3 is released. I want us to come to a consensus if we will go the route of leaning into the native UI framework's own deliminator or semicolons. |
I need to look into what Jetpack and possibly WinUI3 (Maui?) need for this as I want to make sure this doesn't paint us in a corner with a single framework |
Addresses #182
When calling the parser you can now specify that warnings be emitted on the console if semicolons are missing. When parsing using the
expect_semicolons?
option:The value would be false (or not set) in most places, but set to true when parsing the
style
attribute on elements.