feat: Add scripts to format and lint with prettier

This commit is contained in:
Oliver Eyton-Williams
2019-06-13 18:09:15 +02:00
committed by mrugesh
parent b440851381
commit b8bdbc7dc8
2 changed files with 19 additions and 8 deletions

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
**/.cache
**/public
client/static
fixtures

View File

@ -20,11 +20,14 @@
"docker:test:init": "docker-compose -f docker-compose.tests.yml run -u root --rm tests bash change_volumes_owner.sh", "docker:test:init": "docker-compose -f docker-compose.tests.yml run -u root --rm tests bash change_volumes_owner.sh",
"ensure-env": "cross-env DEBUG=fcc:* node ./tools/scripts/build/ensure-env.js", "ensure-env": "cross-env DEBUG=fcc:* node ./tools/scripts/build/ensure-env.js",
"format": "npm run lint:js -- --fix", "format": "npm run lint:js -- --fix",
"format:other": "npm run prettier -- --write",
"hooks:install": "node node_modules/husky/husky.js install", "hooks:install": "node node_modules/husky/husky.js install",
"hooks:uninstall": "node node_modules/husky/husky.js uninstall", "hooks:uninstall": "node node_modules/husky/husky.js uninstall",
"lint": "npm-run-all -p lint:*", "lint": "npm-run-all -p lint:*",
"lint:challenges": "cd ./curriculum && npm run lint", "lint:challenges": "cd ./curriculum && npm run lint",
"lint:js": "eslint .", "lint:js": "eslint .",
"lint:other": "npm run prettier -- --debug-check",
"prettier": "prettier \"**/*.{md,css}\"",
"postinstall": "npm run bootstrap", "postinstall": "npm run bootstrap",
"seed": "npm-run-all -p seed:*", "seed": "npm-run-all -p seed:*",
"seed:auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser", "seed:auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser",
@ -71,14 +74,18 @@
"slugg": "^1.2.1" "slugg": "^1.2.1"
}, },
"lint-staged": { "lint-staged": {
"*.js": [ "linters": {
"eslint --fix", "*.js": [
"git add" "eslint --fix",
], "git add"
"./curriculum/challenges/**/*.md": [ ],
"node ./curriculum/tools/lint", "*.md": "node ./curriculum/tools/lint",
"git add" "*.{md,css}": [
] "prettier --write",
"git add"
]
},
"concurrent": false
}, },
"husky": { "husky": {
"hooks": { "hooks": {