Expected 1 space after colon with &:not(:first-child)
Sental opened this issue ยท 8 comments
Preconditions
- In a less file if you use &:not(:first-child) it generates spacing warnings.
Steps to reproduce
- Use &:not(:first-child) in a less file.
- Run the coding standard from command line.
vendor/bin/phpcs --standard=Magento2 path/to/module
Expected result
- No Warnings are generated.
Actual result
- Warnings are generated
154 | WARNING | Expected 1 space after colon in style definition; newline found
154 | WARNING | Expected 1 space after colon in style definition; 0 found
Hi @Sental. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.
Add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Same issue experiences. Actually all pseudo classes not need require spacing after
The phpcs tools should only scan *.php (and maybe *.phtml) files, why is it being used to scan *.less files as well? That makes little sense?
@sivaschenko, could you take a look?
We have an example where this issue reproducing on a PR - magento/magento2#35101 (comment)
@ihor-sviziev yes, we'll work on it
Also found magento yelling warning non-sense at this code
.box-tocart {
.paypal:first-of-type {
margin-top: 13px;
}
}
:first-of-type totally valid. It's doesn't require space after that colon
.lib-link(
@_link-color: @primary__color,
@_link-text-decoration: none,
@_link-color-visited: @primary__color,
@_link-text-decoration-visited: none,
@_link-color-hover: @primary__color,
@_link-text-decoration-hover: underline,
@_link-color-active: @primary__color,
@_link-text-decoration-active: underline
);
Also detected new line after colon at mixins less declare => still valid with me in my point of view