- Issue created by @alyaj2a
- 🇮🇩Indonesia gausarts
Most of the CS issues were outdated.
Solutions:
- Update you PHPCS. Do not use global PHPCS, use per project instances. The call it in the Drupal root:
./vendor/bin/phpcs \ --standard="Drupal,DrupalPractice" -n \ --extensions="php,module,inc,install,test,profile,theme" \ web/modules/d10/ultimenu ./vendor/bin/phpcbf \ --standard="Drupal,DrupalPractice" -n \ --extensions="php,module,inc,install,test,profile,theme" \ web/modules/d10/ultimenu
- For CSS, use Stylelint. CSSLint was deprecated for stylelint. Call it:
Checking for errors:npx stylelint "web/modules/d10/ultimenu/css/*.css" npx stylelint "web/modules/d10/ultimenu/css/**/*.css"
Fixing the errors:
npx stylelint --fix "web/modules/d10/ultimenu/css/*.css" npx stylelint --fix "web/modules/d10/ultimenu/css/**/*.css"
- For JS, use ESLint.
// Located at /modules/contrib/ultimenu, run: // eslint . -o ../../eslint/ultimenu.html -f html
See here:
https://git.drupalcode.org/project/ultimenu/-/blob/3.0.x/.eslintrc.json?...
A good conflicting sample between old and new CS is this line:
FILE: .../web/modules/custom/ultimenu/src/UltimenuTool.php ---------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ---------------------------------------------------------------------------------------------------------------------- 14 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\block\BlockInterface.
The latest CS was actually the opposite of yours, and already committed here:
https://git.drupalcode.org/project/ultimenu/-/commit/f23a1323ff51badcf81...It may confuse you since they are NOT sorted alphabetically. But it should make sense to put classes in core/lib directory at first rows, then core/modules, etc. It was the latest CS change.
Please refer to Drupal CR and docs for more updated info and details.
Thank you anyway.
- Update you PHPCS. Do not use global PHPCS, use per project instances. The call it in the Drupal root: