Skip to content

Commit 2ea3c39

Browse files
committed
Allow class names with 'admin__' prefix
1 parent ffd4818 commit 2ea3c39

File tree

4 files changed

+130
-4
lines changed

4 files changed

+130
-4
lines changed

Magento2/Sniffs/Less/ClassNamingSniff.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ public function process(File $phpcsFile, $stackPtr)
6666
[implode("", $matches[0])]
6767
);
6868
}
69-
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {
69+
70+
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
71+
&& !str_starts_with($className, 'admin__')
72+
) {
7073
$phpcsFile->addError(
7174
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
7275
$stackPtr,

Magento2/Tests/Less/ClassNamingUnitTest.less

+5
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,8 @@
3030
.category-title {
3131
background: green;
3232
}
33+
34+
// @see https://github.com/magento/magento-coding-standard/issues/409
35+
.admin__allowed {
36+
background: green;
37+
}

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"ext-dom": "*",
1515
"phpcompatibility/php-compatibility": "^9.3",
1616
"squizlabs/php_codesniffer": "^3.6.1",
17-
"rector/rector": "^0.14.8"
17+
"rector/rector": "^0.14.8",
18+
"symfony/polyfill": "^1.16"
1819
},
1920
"require-dev": {
2021
"phpunit/phpunit": "^9.5.8"

composer.lock

+119-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)