-
-
Notifications
You must be signed in to change notification settings - Fork 930
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
declaration-block-trailing-semicolon triggers for style property with JSX syntax #3828
Comments
@SebastiaanNijland Thanks for the report and for using the template. I think this is more to do with how the Visual Code extension works than stylelint itself. I believe the extension checks, by default, all of the file types that stylelint supports e.g. So, it's a case of opting-out of the file types you don't want to check when using the extension. I believe this opt-out behaviour is normal for editor extensions. Unfortunately, this is the opposite of the current stylelint CLI behaviour where you opt-in to file types using a glob e.g. Fortunately, I believe the extension respects the ignore options in stylelint. So, you can either use the
Going forward, there's an issue (#3411) open to allow stylelint to take an opt-out approach on the CLI. I think this will make it easier for users as it'll allow them to align the CLI and editor extension behaviours.
There's a issue (#3128) to handle this in a sustainable way. Both issues are labelled as "help wanted" and are looking for someone to champion them. I think they're good issues because when combined together they'll improve the experience for users who lint styles across different file types. |
Thanks for the response! Fiddling with the ignore options seems to solve the issue for my use case. |
what if I do want to lint js files - I'm using css-in-js? I do want a |
I've patched stylelint locally, added if (decl.parent.type === 'object') {
return;
} to stylelint/lib/rules/declaration-block-trailing-semicolon/index.js Lines 42 to 48 in d197f69
Works for my particular case but has to be generalized for public usage. ping me if you're interested in this discussion |
Why did this issue get closed? The above comment is still relevant. |
The declaration-block-trailing-semicolon (set to "always") triggers when I have the following code in a JSX file:
style={{ width: '1rem' }}
Even if I add a semicolon like so:
style={{ width: '1rem;' }}
it still triggers and wants me to keep adding semicolons.
declaration-block-trailing-semicolon
Use CSS in some JSX file:
<div style={{ width: '1rem' }}>
9.9.0
but this bug has been around for a whileThis triggers in my IDE (visual code). When running the lintert through the CLI, it only checks our
scss
files.Yes, it seems related to checking css syntax in jsx files.
No error to be flagged or no linting to happen at all (or, to have this property excluded when parsing non-css files).
IDE (visual code) shows:
Expected a trailing semicolon
The text was updated successfully, but these errors were encountered: