Skip to content

Expected 1 space after colon with &:not(:first-child) #395

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

Open
Sental opened this issue May 25, 2022 · 8 comments
Open

Expected 1 space after colon with &:not(:first-child) #395

Sental opened this issue May 25, 2022 · 8 comments
Labels

Comments

@Sental
Copy link

Sental commented May 25, 2022

Preconditions

  1. In a less file if you use &:not(:first-child) it generates spacing warnings.

Steps to reproduce

  1. Use &:not(:first-child) in a less file.
  2. Run the coding standard from command line. vendor/bin/phpcs --standard=Magento2 path/to/module

Expected result

  1. No Warnings are generated.

Actual result

  1. 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
@Sental Sental added the bug Something isn't working label May 25, 2022
@m2-assistant
Copy link

m2-assistant bot commented May 25, 2022

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


@mrtuvn
Copy link

mrtuvn commented Jun 6, 2022

Same issue experiences. Actually all pseudo classes not need require spacing after

@hostep
Copy link
Contributor

hostep commented Jun 6, 2022

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?

@ihor-sviziev
Copy link
Collaborator

@sivaschenko, could you take a look?
We have an example where this issue reproducing on a PR - magento/magento2#35101 (comment)

@sivaschenko
Copy link
Member

@ihor-sviziev yes, we'll work on it

@svera
Copy link
Contributor

svera commented Jun 21, 2022

@Sental @mrtuvn just released version 25 which should fix this issue.

@ihor-sviziev
Copy link
Collaborator

ihor-sviziev commented Jun 21, 2022

I guess the changes are the following: #405

@Sental, could you confirm that issue is solved now?

@mrtuvn
Copy link

mrtuvn commented Apr 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants