mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
refactor: fix husky and lint-staged setup (#1654)
This commit is contained in:
parent
7beed26cf6
commit
1e5859425f
12
.eslintrc
12
.eslintrc
@ -3,10 +3,7 @@
|
|||||||
"node": true,
|
"node": true,
|
||||||
"jest": true
|
"jest": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": ["airbnb-typescript/base", "plugin:prettier/recommended"],
|
||||||
"airbnb-typescript/base",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 2019,
|
"ecmaVersion": 2019,
|
||||||
@ -32,10 +29,7 @@
|
|||||||
"new-cap": [
|
"new-cap": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"capIsNewExceptions": [
|
"capIsNewExceptions": ["Router", "Mitm"]
|
||||||
"Router",
|
|
||||||
"Mitm"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -56,5 +50,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ignorePatterns": ["**/docs/api/oas/", "examples/**"]
|
"ignorePatterns": ["**/docs/api/oas/", "examples/**", "scripts/**"]
|
||||||
}
|
}
|
||||||
|
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npx lint-staged
|
11
package.json
11
package.json
@ -36,7 +36,7 @@
|
|||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"prebuild": "yarn run clean",
|
"prebuild": "yarn run clean",
|
||||||
"build": "yarn run copy-templates && tsc --pretty",
|
"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": "NODE_ENV=test PORT=4243 jest",
|
||||||
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e/**",
|
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e/**",
|
||||||
"test:docker": "./scripts/docker-postgres.sh",
|
"test:docker": "./scripts/docker-postgres.sh",
|
||||||
@ -180,18 +180,13 @@
|
|||||||
"json-schema": "^0.4.0"
|
"json-schema": "^0.4.0"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.js": [
|
"*.{js,ts}": [
|
||||||
"eslint --fix"
|
"eslint --fix"
|
||||||
],
|
],
|
||||||
"*.{json,css,md}": [
|
"*.{json,yaml,md}": [
|
||||||
"prettier --write"
|
"prettier --write"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"husky": {
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "lint-staged"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"proseWrap": "never",
|
"proseWrap": "never",
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
|
3
scripts/husky-install.js
Normal file
3
scripts/husky-install.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
if (!process.env.CI) {
|
||||||
|
require('husky').install();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user