From 87e3dd52ce0f316dc96f8d7ae236d4da79d80b4e Mon Sep 17 00:00:00 2001 From: Marais Rossouw Date: Mon, 10 Feb 2020 07:02:20 +1000 Subject: [PATCH] chore: Runs prettier as a pre-commit hook --- .prettierignore | 1 + package.json | 13 ++++++++----- .../css-modules--false/src/not_scoped.module.css | 2 +- .../css-modules--null/src/scoped.module.css | 2 +- .../css-modules--string/src/scoped.module.css | 2 +- .../css-modules--true/src/scoped.module.css | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7773828 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/package.json b/package.json index e99087c..3bd5b5b 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "lint": "eslint src", "test": "npm run -s lint && npm run -s build && cross-env BABEL_ENV=test jest", "jest": "cross-env BABEL_ENV=test jest", + "format": "prettier --write \"{*,{src,test}/**/*}.+(js|css)\"", "release": "npm run -s prepare && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish" }, "repository": "developit/microbundle", @@ -25,11 +26,13 @@ "lint-staged": { "{src,test}/**/*.js": [ "eslint --fix", - "git add" + "prettier --write" + ], + "{*,{src,test}/**/*}.+(js|css)": [ + "prettier --write" ], "*.md": [ - "prettier --write", - "git add" + "prettier --write" ] }, "jest": { @@ -106,9 +109,9 @@ "eslint-plugin-prettier": "^3.1.2", "esm": "^3.2.22", "fs-extra": "^8.1.0", - "husky": "^3.1.0", + "husky": "^4.2.1", "jest": "^24.8.0", - "lint-staged": "^9.5.0", + "lint-staged": "^10.0.7", "npm-merge-driver-install": "^1.1.1", "prettier": "^1.19.1", "regenerator-runtime": "^0.13.3", diff --git a/test/fixtures/css-modules--false/src/not_scoped.module.css b/test/fixtures/css-modules--false/src/not_scoped.module.css index f8b6605..a62eab4 100644 --- a/test/fixtures/css-modules--false/src/not_scoped.module.css +++ b/test/fixtures/css-modules--false/src/not_scoped.module.css @@ -1,3 +1,3 @@ .not_scoped_class { - color: pink; + color: pink; } diff --git a/test/fixtures/css-modules--null/src/scoped.module.css b/test/fixtures/css-modules--null/src/scoped.module.css index 8da77b3..6f3e3e1 100644 --- a/test/fixtures/css-modules--null/src/scoped.module.css +++ b/test/fixtures/css-modules--null/src/scoped.module.css @@ -1,3 +1,3 @@ .scoped_class { - color: pink; + color: pink; } diff --git a/test/fixtures/css-modules--string/src/scoped.module.css b/test/fixtures/css-modules--string/src/scoped.module.css index 8da77b3..6f3e3e1 100644 --- a/test/fixtures/css-modules--string/src/scoped.module.css +++ b/test/fixtures/css-modules--string/src/scoped.module.css @@ -1,3 +1,3 @@ .scoped_class { - color: pink; + color: pink; } diff --git a/test/fixtures/css-modules--true/src/scoped.module.css b/test/fixtures/css-modules--true/src/scoped.module.css index 8da77b3..6f3e3e1 100644 --- a/test/fixtures/css-modules--true/src/scoped.module.css +++ b/test/fixtures/css-modules--true/src/scoped.module.css @@ -1,3 +1,3 @@ .scoped_class { - color: pink; + color: pink; }