Skip to content

Commit

Permalink
Merge pull request #203 from magento-commerce/imported-fredden-magent…
Browse files Browse the repository at this point in the history
…o-coding-standard-432

[Imported] Allow class names with 'admin__' prefix
  • Loading branch information
sidolov authored Feb 14, 2023
2 parents 1172711 + cac912c commit 5f4cb84
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Magento2/Sniffs/Less/ClassNamingSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public function process(File $phpcsFile, $stackPtr)
[implode("", $matches[0])]
);
}
if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false) {

if (strpos($className, self::STRING_HELPER_CLASSES_PREFIX, 2) !== false
&& !str_starts_with($className, 'admin__')
) {
$phpcsFile->addError(
'CSS class names should be separated with "-" (dash) instead of "_" (underscore)',
$stackPtr,
Expand Down
5 changes: 5 additions & 0 deletions Magento2/Tests/Less/ClassNamingUnitTest.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@
.category-title {
background: green;
}

// @see https://github.com/magento/magento-coding-standard/issues/409
.admin__allowed {
background: green;
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"ext-dom": "*",
"phpcompatibility/php-compatibility": "^9.3",
"squizlabs/php_codesniffer": "^3.6.1",
"rector/rector": "^0.15.10"
"rector/rector": "^0.15.10",
"symfony/polyfill": "^1.16"
},
"require-dev": {
"phpunit/phpunit": "^9.5.8"
Expand Down
121 changes: 119 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5f4cb84

Please sign in to comment.