From d7a372ae2b31e3d4dbdeefd83e93671abaaf2c5b Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Thu, 15 Apr 2021 03:20:58 +0100 Subject: [PATCH] build: add JS formatting commands --- .prettierignore | 6 ++++++ composer.json | 4 ++++ package.json | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..4fbc898 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +dist/ +docs/ +vendor/ +node_modules/ +*.min.js +jquery.tools.js diff --git a/composer.json b/composer.json index ebe8fbc..b8374a9 100644 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/package.json b/package.json index 3c79856..d3582a6 100644 --- a/package.json +++ b/package.json @@ -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\"",