Repository navigation
Description
Lots of comments are marked with a
Unexpected unknown type selector "foo" (selector-type-no-unknown)
error
Which rule, if any, is the bug related to?
selector-type-no-unknown
What CSS is needed to reproduce the bug?
.foo1, // this comments is marked as an error
.foo2 {
color: #fff;
}What stylelint configuration is needed to reproduce the bug?
{
"ignoreFiles": "*/vendors/**/*",
"rules": {
"block-no-empty": true,
"block-closing-brace-empty-line-before": "never",
"block-opening-brace-space-before": "always",
"color-hex-case": "lower",
"color-hex-length": "short",
"color-no-invalid-hex": true,
"color-named": "never",
"declaration-block-semicolon-newline-after": "always",
"declaration-block-trailing-semicolon": "always",
"declaration-colon-space-after": "always",
"declaration-no-important": true,
"font-weight-notation": "numeric",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-whitespace-after": "always",
"indentation": [4, {
"except": ["value"]
}],
"length-zero-no-unit": true,
"max-empty-lines": 2,
"max-nesting-depth": [
5,{
"ignore": ["blockless-at-rules"]
}
],
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-name-case": "lower",
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"no-duplicate-selectors": true,
"no-eol-whitespace": [true, {
"ignore": ["empty-lines"]
}],
"no-missing-end-of-source-newline": true,
"number-leading-zero": "always",
"property-no-unknown": true,
"property-case": "lower",
"rule-empty-line-before": [ "always", {
"except": ["first-nested"],
"ignore": ["after-comment"]
} ],
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-attribute-quotes": "always",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-newline-after": "always",
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-colon-notation": "double",
"selector-type-case": "lower",
"selector-max-id": 0,
"selector-pseudo-class-no-unknown": true,
"selector-type-no-unknown": true,
"string-quotes": "double",
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": "lower",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never"
}
}
Which version of stylelint are you using?
9.9.0
How are you running stylelint: CLI, PostCSS plugin, Node.js API?
gulp-stylelint with stylelint-report.txt
and VSCode
Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?
less
What did you expect to happen?
"No warnings to be flagged."
What actually happened (e.g. what warnings or errors did you get)?
Unexpected unknown type selector "this" (selector-type-no-unknown)
Unexpected unknown type selector "comments" (selector-type-no-unknown)
Unexpected unknown type selector "is" (selector-type-no-unknown)
Unexpected unknown type selector "marked" (selector-type-no-unknown)
Unexpected unknown type selector "as" (selector-type-no-unknown)
Unexpected unknown type selector "an" (selector-type-no-unknown)
Unexpected unknown type selector "error" (selector-type-no-unknown)
Activity
hudochenkov commentedon Apr 25, 2019
Thanks for the report and for using the template.
I can reproduce this issue in demo when syntax is set to Less. When I set it to SCSS there is no issue. In rule code I don't see anything SCSS specific.
Looks like there is another issue with a comment inside selector in Less #3975. My guess it's postcss-less having hard time parse selector with a comment inside it.
ntwb commentedon Apr 26, 2019
Maybe we can enhance our existing tests here so that any future postcss-less release we'll be ready for in this regard?
hudochenkov commentedon Apr 26, 2019
If we just add these examples to tests, then our tests will fails all the time.
ha404 commentedon Aug 28, 2019
The same thing happens to
styled-componentsin JS.Move comments out of class lists
Update git submodules
jeddy3 commentedon Jan 17, 2022
Closing as related to custom syntaxes.