Skip to content

Commit

Permalink
Add Git hooks setup for linting + formatting
Browse files Browse the repository at this point in the history
If possible, a pre-commit hook will automatically apply eslint and
prettier fixes for the staged changes...
  • Loading branch information
carhartl committed Jun 22, 2023
1 parent b744e2a commit 19c9747
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .nano-staged.mjs
@@ -0,0 +1,4 @@
export default {
'*.{js,mjs}': 'eslint --fix',
'*.{html,js,json,md,mjs,yml}': 'prettier --write'
}
3 changes: 3 additions & 0 deletions .simple-git-hooks.json
@@ -0,0 +1,3 @@
{
"pre-commit": "npx nano-staged"
}
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -41,6 +41,12 @@ npm install -d

More information on this issue can be found [here](https://github.com/puppeteer/puppeteer/issues/7740) and [here](https://broddin.be/2022/09/19/fixing-the-chromium-binary-is-not-available-for-arm64/).

Optional: install Git hooks:

```bash
npx simple-git-hooks
```

To execute the build and tests run the following command in the root of the project:

```bash
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -60,12 +60,14 @@
"grunt-contrib-watch": "^1.1.0",
"grunt-exec": "^3.0.0",
"gzip-js": "^0.3.2",
"nano-staged": "^0.8.0",
"prettier": "^2.3.2",
"qunit": "^2.19.4",
"release-it": "^15.0.0",
"rollup": "^3.17.2",
"rollup-plugin-filesize": "^10.0.0",
"rollup-plugin-license": "^3.0.0"
"rollup-plugin-license": "^3.0.0",
"simple-git-hooks": "^2.8.1"
},
"engines": {
"node": ">=16"
Expand Down

0 comments on commit 19c9747

Please sign in to comment.