Skip to content

Commit

Permalink
feat: lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
yarre-uk committed Oct 26, 2023
1 parent f900d32 commit e2ea5e9
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo test
yarn lint-staged
14 changes: 14 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default {
// Type check TypeScript files
'**/*.(ts|tsx)': () => 'yarn tsc --noEmit',

// Lint then format TypeScript and JavaScript files
'**/*.(ts|tsx|js)': (filenames) => [
`yarn eslint --fix ${filenames.join(' ')}`,
`yarn prettier --write ${filenames.join(' ')}`,
],

// Format MarkDown and JSON
'**/*.(md|json)': (filenames) =>
`yarn prettier --write ${filenames.join(' ')}`,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"husky": "^8.0.3",
"lint-staged": "^15.0.2",
"prettier": "3.0.3",
"typescript": "^5.0.2",
"vite": "^4.4.5"
Expand Down
Loading

0 comments on commit e2ea5e9

Please sign in to comment.