Skip to content

Commit 8da5347

Browse files
lint-staged
1 parent 51cd260 commit 8da5347

File tree

4 files changed

+356
-9
lines changed

4 files changed

+356
-9
lines changed

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn lint .
4+
yarn lint-staged

lint-staged.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
// Run type-check on changes to TypeScript files
3+
'**/*.ts?(x)': () => 'yarn tsc',
4+
// Run ESLint on changes to JavaScript/TypeScript files
5+
'**/*.(ts|js)?(x)': (filenames) => `yarn lint ${filenames.join(' ')}`,
6+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"eslint-plugin-react": "^7.23.2",
3333
"eslint-plugin-react-hooks": "^4.2.0",
3434
"husky": "^6.0.0",
35+
"lint-staged": "^11.0.0",
3536
"prettier": "^2.3.0",
3637
"typescript": "^4.2.4"
3738
}

0 commit comments

Comments
 (0)