From b8bdbc7dc843ad7ba45692cd13788460af5ace7b Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Thu, 13 Jun 2019 18:09:15 +0200 Subject: [PATCH] feat: Add scripts to format and lint with prettier --- .prettierignore | 4 ++++ package.json | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..30b5e5e96f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +**/.cache +**/public +client/static +fixtures diff --git a/package.json b/package.json index e66b7484f0..5907c10a53 100644 --- a/package.json +++ b/package.json @@ -20,11 +20,14 @@ "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", "format": "npm run lint:js -- --fix", + "format:other": "npm run prettier -- --write", "hooks:install": "node node_modules/husky/husky.js install", "hooks:uninstall": "node node_modules/husky/husky.js uninstall", "lint": "npm-run-all -p lint:*", "lint:challenges": "cd ./curriculum && npm run lint", "lint:js": "eslint .", + "lint:other": "npm run prettier -- --debug-check", + "prettier": "prettier \"**/*.{md,css}\"", "postinstall": "npm run bootstrap", "seed": "npm-run-all -p seed:*", "seed:auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser", @@ -71,14 +74,18 @@ "slugg": "^1.2.1" }, "lint-staged": { - "*.js": [ - "eslint --fix", - "git add" - ], - "./curriculum/challenges/**/*.md": [ - "node ./curriculum/tools/lint", - "git add" - ] + "linters": { + "*.js": [ + "eslint --fix", + "git add" + ], + "*.md": "node ./curriculum/tools/lint", + "*.{md,css}": [ + "prettier --write", + "git add" + ] + }, + "concurrent": false }, "husky": { "hooks": {