Skip to content

Commit 88f9b46

Browse files
committed
Improve organization of linting commands
1 parent 6d8ca55 commit 88f9b46

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,3 @@ jobs:
5050

5151
- name: Lint
5252
run: npm run lint
53-
54-
- name: PHPStan
55-
run: composer analyze

.lintstagedrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
"composer.*": () => "vendor/bin/composer-normalize",
2+
"composer.*": () => "npm run lint:composer",
33
"package.json": [
44
"npm run lint:pkg-json"
55
],
@@ -9,5 +9,5 @@ module.exports = {
99
"**/*.php": [
1010
"npm run lint:php",
1111
],
12-
'*.php': () => 'composer analyze'
12+
'*.php': () => 'npm run lint:phpstan'
1313
};

bin/phpcbf.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
# Wrap phpcbf to turn 1 success exit code into 0 code.
33
# See https://github.com/squizlabs/PHP_CodeSniffer/issues/1818#issuecomment-354420927
44

5-
root=$( dirname "$0" )/..
6-
7-
"$root/vendor/bin/phpcbf" $@
5+
composer exec phpcbf $@
86
exit=$?
97

108
# Exit code 1 is used to indicate that all fixable errors were fixed correctly.

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
},
4040
"scripts": {
4141
"analyze": "if [ -z $TEST_SKIP_PHPSTAN ]; then phpstan --version; phpstan analyze --ansi; fi",
42+
"normalize": "composer-normalize",
4243
"phpcs": "phpcs",
44+
"phpcbf": "bin/phpcbf.sh",
4345
"zip": "git archive --format=zip HEAD > syntax-highlighting-code-block.zip && unzip -l syntax-highlighting-code-block.zip"
4446
}
4547
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,16 @@
5353
"check-licenses": "wp-scripts check-licenses",
5454

5555
"lint": "npm-run-all --parallel lint:*",
56+
"lint:composer": "composer normalize --dry-run",
57+
"lint:composer:fix": "composer normalize",
5658
"lint:css": "wp-scripts lint-style",
5759
"lint:css:fix": "npm run lint:css -- --fix",
5860
"lint:js": "wp-scripts lint-js",
5961
"lint:js:fix": "wp-scripts lint-js --fix",
6062
"lint:js:report": "npm run lint:js -- --output-file lint-js-report.json --format json .",
61-
"lint:php": "vendor/bin/phpcs",
62-
"lint:php:fix": "./bin/phpcbf.sh",
63+
"lint:php": "composer phpcs",
64+
"lint:php:fix": "composer phpcbf",
65+
"lint:phpstan": "composer analyze",
6366
"lint:pkg-json": "wp-scripts lint-pkg-json . --ignorePath .gitignore",
6467
"start": "wp-scripts start src/index.js src/customize-controls.js --output-path=build",
6568
"update-wordpress-packages": "npm install --save-dev --save-exact $(npm outdated --parseable | cut -d':' -f 4 | grep @wordpress)",

0 commit comments

Comments
 (0)