Skip to content

Commit

Permalink
refactor: fix husky and lint-staged setup (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
olav committed Jun 2, 2022
1 parent 7beed26 commit 1e58594
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
12 changes: 3 additions & 9 deletions .eslintrc
Expand Up @@ -3,10 +3,7 @@
"node": true,
"jest": true
},
"extends": [
"airbnb-typescript/base",
"plugin:prettier/recommended"
],
"extends": ["airbnb-typescript/base", "plugin:prettier/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019,
Expand All @@ -32,10 +29,7 @@
"new-cap": [
"error",
{
"capIsNewExceptions": [
"Router",
"Mitm"
]
"capIsNewExceptions": ["Router", "Mitm"]
}
]
},
Expand All @@ -56,5 +50,5 @@
}
}
],
"ignorePatterns": ["**/docs/api/oas/", "examples/**"]
"ignorePatterns": ["**/docs/api/oas/", "examples/**", "scripts/**"]
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
11 changes: 3 additions & 8 deletions package.json
Expand Up @@ -36,7 +36,7 @@
"build:watch": "tsc -w",
"prebuild": "yarn run clean",
"build": "yarn run copy-templates && tsc --pretty",
"prepare": "yarn run build",
"prepare": "node scripts/husky-install && yarn run build",
"test": "NODE_ENV=test PORT=4243 jest",
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e/**",
"test:docker": "./scripts/docker-postgres.sh",
Expand Down Expand Up @@ -180,18 +180,13 @@
"json-schema": "^0.4.0"
},
"lint-staged": {
"*.js": [
"*.{js,ts}": [
"eslint --fix"
],
"*.{json,css,md}": [
"*.{json,yaml,md}": [
"prettier --write"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"prettier": {
"proseWrap": "never",
"singleQuote": true,
Expand Down
3 changes: 3 additions & 0 deletions scripts/husky-install.js
@@ -0,0 +1,3 @@
if (!process.env.CI) {
require('husky').install();
}

0 comments on commit 1e58594

Please sign in to comment.