Skip to content

Commit

Permalink
feat: add lint staged and commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
zigapk committed Jul 2, 2024
1 parent b95950a commit 95f0638
Show file tree
Hide file tree
Showing 7 changed files with 859 additions and 3 deletions.
1 change: 0 additions & 1 deletion .eslintcache

This file was deleted.

5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
npx --no -- commitlint --edit ${1}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 2 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// eslint-disable-next-line no-undef
module.exports = { extends: ['@commitlint/config-conventional'] };
16 changes: 15 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
"lint": "eslint . --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"format": "prettier --check --ignore-path .prettierignore .",
"format:fix": "prettier --write --ignore-path .prettierignore ."
"format:fix": "prettier --write --ignore-path .prettierignore .",
"prepare": "husky"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@crxjs/vite-plugin": "2.0.0-beta.23",
"@eslint/compat": "^1.1.0",
"@eslint/js": "^9.6.0",
Expand All @@ -30,6 +33,7 @@
"@typescript-eslint/parser": "^7.13.1",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"commitlint": "^19.3.0",
"eslint": "^9.6.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-check-file": "^2.8.0",
Expand All @@ -38,6 +42,8 @@
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-sonarjs": "^1.0.3",
"globals": "^15.7.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"postcss": "^8.4.39",
"prettier": "3.3.2",
"prettier-plugin-organize-imports": "^4.0.0",
Expand All @@ -49,5 +55,13 @@
"typescript-eslint": "^7.15.0",
"vite": "^5.3.2",
"vite-plugin-eslint": "^1.8.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --quiet --fix"
],
"**/*": [
"prettier --write --ignore-unknown"
]
}
}
Loading

0 comments on commit 95f0638

Please sign in to comment.