build: add JS formatting commands

This commit is contained in:
Ben Goldsworthy 2021-04-15 03:20:58 +01:00
parent 2cff59f28c
commit d7a372ae2b
3 changed files with 14 additions and 0 deletions

6
.prettierignore Normal file
View file

@ -0,0 +1,6 @@
dist/
docs/
vendor/
node_modules/
*.min.js
jquery.tools.js

View file

@ -8,12 +8,16 @@
"build": "./_tools/build.sh",
"lint": "composer run lint:php && npm run lint",
"lint:fix": "composer run lint:php:fix && npm run lint:fix",
"format": "npm run format",
"format:fix": "npm run format:fix",
"lint:php": "./vendor/bin/phpcs --standard='WordPress' --colors --encoding=utf-8 -n -p --ignore=*/vendor/* ./*.php ./*/*.php ./*/*/*.php",
"lint:php:fix": "./vendor/bin/phpcbf --standard='WordPress' --encoding=utf-8 -p --ignore=*/vendor/* ./*.php ./*/*.php ./*/*/*.php",
"lint:css": "npm run lint:css",
"lint:css:fix": "npm run lint:css:fix",
"lint:js": "npm run lint:js",
"lint:js:fix": "npm run lint:js:fix",
"format:js": "npm run format:js",
"format:js:fix": "npm run format:js:fix",
"docs": "./vendor/bin/phpdoc -d . -t ./docs --ignore vendor/",
"commit": "./vendor/bin/php-commitizen commit -- ./.php-commitizen.php",
"post-install-cmd": "./_tools/setup.sh"

View file

@ -1,5 +1,9 @@
{
"scripts": {
"format": "npm run format:js",
"format:fix": "npm run format:js:fix",
"format:js": "prettier --config .prettierrc './js/*.js'",
"format:js:fix": "npm run format:js -- --write",
"lint": "npm run lint:js && npm run lint:css",
"lint:fix": "npm run lint:js:fix && npm run lint:css:fix",
"lint:js": "eslint \"./js/*.js\"",