Skip to content

Commit

Permalink
chore: add lint-staged (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
maou-shonen authored Oct 24, 2024
1 parent 8a69ddf commit 3577d62
Show file tree
Hide file tree
Showing 4 changed files with 402 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
npm run format
npm run typecheck
npm run lint
npx lint-staged
9 changes: 9 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
// The Typescript compiler can't type-check a single file, it needs to run on
// the whole project. To do that we use a function (instead of a string or
// array) so that no matter what file or how many, we will always run the same
// command.
"*.{ts,tsx}": () => "tsc --noEmit",
"*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"],
"*": "prettier --ignore-unknown --write",
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"scripts": {
"prepare": "husky",
"build": "tsup-node",
"format": "prettier --write .",
"format": "prettier --write src",
"typecheck": "tsc",
"lint": "eslint --quiet .",
"test": "vitest run",
Expand All @@ -58,6 +58,7 @@
"eslint": "^9.13.0",
"hono": "^4.6.6",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"tsup": "^8.3.0",
"typescript-eslint": "^8.11.0",
Expand Down
Loading

0 comments on commit 3577d62

Please sign in to comment.