magento / magento/magento-coding-standard

Less validate check seem incorrectly as expected

Open
#456 1 comment 0 reactions 0 assignees View on GitHub
bug Progress: ready for grooming
Dominant language
PHP
Stars
375
Forks
165
PR merge metrics
No merged PRs in 30d

Description

### Preconditions

1. Any version magento 2 (Example 2.4.6+)
2.

When i checked docs related
Sort all properties in the alphabetical order. Mixins, variables, and so on should go first.
https://devdocs.magento.com/guides/v2.3/coding-standards/code-standard-less.html. But the results validate difference than doc
mention
### Steps to reproduce

1. Change file app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less
2. Go to the code line around 154
```less
.additional-attributes {
//Some code here
}
```

Following standards => Show warning (Mixins, variables go first same as docs recommends)
```less
.additional-attributes {
.lib-table-bordered(@_table_type: clear);
.lib-table-resize(@_th-padding-left: 0, @_th-padding-right: @indent__l, @_th-padding-bottom: @indent__s, @_td-padding-bottom: @indent__s);
width: auto;
}
```

Nope this way is correct validate instead (No i don't want to follow standards). No warning anymore

```less
.additional-attributes {
width: auto;
.lib-table-bordered(@_table_type: clear);
.lib-table-resize(@_th-padding-left: 0, @_th-padding-right: @indent__l, @_th-padding-bottom: @indent__s, @_td-padding-bottom: @indent__s);
}
```

### Expected result

1. No code warning
2.

### Actual result

1. Code warning require Sort all properties in the alphabetical order.
2.

Contributor guide

Open the contributing guide

Research direction

Start with app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less around line 154 and compare the validator behavior with the linked LESS coding-standard documentation. Reproduce validation for both property and mixin orderings; done means the warning agrees with the documented ordering and the expected result is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.