add scripts for formatting

This commit is contained in:
Eduardo Quiros 2022-07-24 22:35:21 -06:00
parent 04359b8e70
commit 3e5ced6fb0
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
1 changed files with 20 additions and 0 deletions

View File

@ -4,5 +4,25 @@
"js-beautify": "^1.14.4", "js-beautify": "^1.14.4",
"lint-staged": "^13.0.3", "lint-staged": "^13.0.3",
"prettier": "^2.7.1" "prettier": "^2.7.1"
},
"scripts": {
"format": "npm run format:prettier && npm run format:html",
"format:prettier": "prettier --config .prettierrc \"src/**/*.{ts,css,less,scss,js}\" --write",
"format:html": "js-beautify --config .jsbeautifyrc --type 'html' --file 'src/**/*.html' --replace"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,css,less,scss,js}": [
"prettier --config .prettierrc --write",
"git add"
],
"*.html": [
"js-beautify --config .jsbeautifyrc --type 'html' --replace",
"git add"
]
} }
} }