chore: pre commit hook now works for staged files only

This commit is contained in:
Michał Wójcik
2022-11-28 15:42:22 +01:00
parent ea4eec221f
commit f194ca925c
6 changed files with 18 additions and 6 deletions

View File

@@ -1,5 +1,4 @@
#!/bin/sh #!/bin/sh
. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/_/husky.sh"
npm run lint npm run pre-commit
./node_modules/.bin/lint-staged

View File

@@ -1,4 +0,0 @@
{
"*.{js,json,css,md,ts,tsx}": ["prettier --write"],
"packages/**/*.{js,json,css,md,ts,tsx}": ["prettier --write"],
}

View File

@@ -4,6 +4,7 @@
"productName": "Mudita Center", "productName": "Mudita Center",
"private": true, "private": true,
"scripts": { "scripts": {
"pre-commit": "lint-staged",
"setup": "npm install && npm run bootstrap:local", "setup": "npm install && npm run bootstrap:local",
"bootstrap:local": "lerna bootstrap", "bootstrap:local": "lerna bootstrap",
"bootstrap:ci": "lerna bootstrap --no-ci", "bootstrap:ci": "lerna bootstrap --no-ci",

View File

@@ -0,0 +1,9 @@
{
"*.{js,json,css,md,ts,tsx}": [
"prettier --write"
],
"*.{ts,tsx}": [
"npm run lint:css:lint-staged",
"npm run lint:js:lint-staged"
]
}

View File

@@ -18,8 +18,10 @@
"dev:start:renderer": "webpack serve --config webpack.config.renderer.js", "dev:start:renderer": "webpack serve --config webpack.config.renderer.js",
"LINT COMMANDS": "=========================================================", "LINT COMMANDS": "=========================================================",
"lint": "npm run lint:js && npm run lint:css", "lint": "npm run lint:js && npm run lint:css",
"lint:css:lint-staged": "stylelint",
"lint:css": "stylelint '{src,test,mocks}/**/*.{ts,tsx}'", "lint:css": "stylelint '{src,test,mocks}/**/*.{ts,tsx}'",
"lint:js": "eslint '{src,test,mocks}/**/*.{ts,tsx}' --max-warnings=0", "lint:js": "eslint '{src,test,mocks}/**/*.{ts,tsx}' --max-warnings=0",
"lint:js:lint-staged": "eslint --max-warnings=0",
"lint:typecheck": "tsc --noEmit", "lint:typecheck": "tsc --noEmit",
"lint:fix": "npm run lint:js -- --fix", "lint:fix": "npm run lint:js -- --fix",
"DIST COMMANDS": "=========================================================", "DIST COMMANDS": "=========================================================",

View File

@@ -0,0 +1,5 @@
{
"*.{js,json,css,md,ts,tsx}": [
"prettier --write"
]
}