-
Notifications
You must be signed in to change notification settings - Fork 11
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
Make @import rules require a semicolon #6
Comments
@lahmatiy Also, thanks for 1.1.0 release. Both Sass and CSS Modules syntax work well in my repository. |
PostCSS's AST doesn't store information about semicolons. So @import url('styles/elements')
@import url('styles/ui/base'); represents as single AST node: {
"type": "atrule",
"name": "import",
"params": "url('styles/elements')\n@import url('styles/ui/base')",
..
} It's a quite complicated issue. Actually there should be a parse error. Currently CSSTree lexer (that using by this plugin) tests declaration values only. It's going to support validation for at-rules and selectors a little bit later. Then it will detect that something wrong is going after Summarise, the best we can get is warning about parsing on second |
Makes sense. Thanks for the explanation. As mentioned in the other issue, I do get an indentation error warning from stylelint that at least lets me know something is wrong with the imports, but during development I only have errors enabled that lead to severe errors in the application being able to perform. Indentation errors only frustrate me while I'm developing, so I leave it as a warning until committing code. However leaving out a semicolon will fail to include the next line import and results in what I would say a pretty severe error that I would want to know about right away. |
looking forward to the updates ;) |
Hi, I found that Sample file: @import './base.css'
.abc, .def {
position: absolute;
}
.abc {
display: flex;
} When compiled by postcss & css-loader, It took me a long time debugging (and founded in It might be a postcss AST problem, but hopefully if there will be a parse error :) |
CSSTree is not ready for a full validation checking of at-rules. Anyway it's going that direction and very close to it. |
Oh, what's the workaround? |
I created an issue in the stylelint repo, but they believed this repository would be a better candidate for this type of feature.
The problem is, if you forget to include a semicolon the import on the following line will not get exectued which is pretty annoying not to have a warning for when developing.
The text was updated successfully, but these errors were encountered: