From a100f69d21bd301d36bfb584f55dc5052a8fc1fe Mon Sep 17 00:00:00 2001 From: Rami Yushuvaev Date: Mon, 25 May 2026 21:14:20 +0300 Subject: [PATCH] Internal: add linters --- .buildignore | 1 + .stylelintrc | 24 ++++++++++++++++++++++++ composer.json | 4 ++-- package.json | 6 ++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 .stylelintrc diff --git a/.buildignore b/.buildignore index c199bf70..6b201f42 100644 --- a/.buildignore +++ b/.buildignore @@ -25,6 +25,7 @@ webpack.config.js .eslintignore .eslintrc.js .npmrc +.stylelintrc tests/ test-results/ diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 00000000..88e0b307 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,24 @@ +{ + "extends": "@wordpress/stylelint-config", + "rules": { + "selector-class-pattern": null, + "selector-id-pattern": null + }, + "overrides": [ + { + "files": ["**/*.scss"], + "plugins": ["stylelint-scss"], + "rules": { + "at-rule-no-unknown": null, + "scss/at-rule-no-unknown": true + } + } + ], + "ignoreFiles": [ + "**/node_modules/**", + "**/vendor/**", + "assets/**", + "coverage/**", + "tests/**" + ] +} diff --git a/composer.json b/composer.json index 7a103f51..6d860aab 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ } }, "scripts": { - "lint": "phpcs --extensions=php --standard=./phpcs.xml --ignore=node_modules,vendor,assets,tmp -p .", - "lint:fix": "vendor/bin/phpcbf --extensions=php --standard=./phpcs.xml --ignore=node_modules,vendor,assets,tmp .", + "lint:php": "vendor/bin/phpcs --extensions=php --standard=./phpcs.xml --ignore=node_modules,vendor,assets,tmp -p .", + "lint:php:fix": "vendor/bin/phpcbf --extensions=php --standard=./phpcs.xml --ignore=node_modules,vendor,assets,tmp .", "test": "phpunit --testsuite hello-elementor", "test:install": "bash ./bin/install-wp-tests-local.sh" } diff --git a/package.json b/package.json index 996c6a51..f5fa5b77 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,13 @@ "start": "wp-scripts start", "build:dev": "composer update && composer install && wp-scripts build --env=developemntWithWatch", "build:prod": "composer install --no-dev && wp-scripts build --env=production", + "lint": "npm run lint:css && npm run lint:js && npm run lint:php", + "lint:css": "wp-scripts lint-style", + "lint:css:fix": "wp-scripts lint-style --fix", "lint:js": "wp-scripts lint-js", + "lint:js:fix": "wp-scripts lint-js --fix", + "lint:php": "composer lint:php", + "lint:php:fix": "composer lint:php:fix", "clean:build": "rm -rf assets && rm -rf $npm_package_name", "build:dir": "npm run clean:build && npm run build:prod && rsync -av --exclude-from=.buildignore . $npm_package_name", "package": "npm run clean:build && npm run build:prod && rsync -av --exclude-from=.buildignore . $npm_package_name",