Skip to content

Commit

Permalink
🔧 add husky config
Browse files Browse the repository at this point in the history
  • Loading branch information
lod61 committed Nov 28, 2024
1 parent 54fd8d2 commit 63e21e1
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 27 deletions.
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"

yarn lint-staged
45 changes: 27 additions & 18 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ export default [
eslint.configs.recommended,
{
files: ["**/*.{ts,tsx}"],
ignores: [
"vite.config.ts",
"dist/**/*",
"build/**/*",
"node_modules/**/*"
],
ignores: ["dist/**", "build/**", "node_modules/**"],
languageOptions: {
parser: typescript,
parserOptions: {
Expand Down Expand Up @@ -48,21 +43,35 @@ export default [
react: react,
},
rules: {
"no-console": "warn",
"no-debugger": "warn",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"react/react-in-jsx-scope": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"no-constant-condition": ["error", { checkLoops: false }],
"no-undef": "error",
"react/prop-types": "off",
"indent": ["error", 2, { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"comma-dangle": ["error", "always-multiline"],
"arrow-parens": ["error", "always"],
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": ["error", "never"],
"max-len": ["warn", {
"code": 100,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true
}],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-empty-interface": "warn",
},
settings: {
react: {
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
"build": "tsc --noEmit && vite build",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
"format": "eslint 'src/**/*.{ts,tsx}' --fix",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"validate": "yarn typecheck && yarn lint",
"prepare": "husky install"
},
"dependencies": {
Expand Down Expand Up @@ -37,15 +39,15 @@
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.5",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"typescript": "^5.2.2",
"vite": "^5.0.8",
"husky": "^8.0.0",
"lint-staged": "^15.0.0"
"vite": "^5.0.8"
},
"lint-staged": {
"*.{ts,tsx}": [
"eslint --fix",
"tsc-files --noEmit"
"git add"
]
}
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2100,10 +2100,10 @@ human-signals@^5.0.0:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28"
integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==

husky@^8.0.0:
version "8.0.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==
husky@^9.1.7:
version "9.1.7"
resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.7.tgz#d46a38035d101b46a70456a850ff4201344c0b2d"
integrity sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==

ignore@^5.2.0, ignore@^5.3.1:
version "5.3.2"
Expand Down Expand Up @@ -2498,7 +2498,7 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==

lint-staged@^15.0.0:
lint-staged@^15.2.10:
version "15.2.10"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.10.tgz#92ac222f802ba911897dcf23671da5bb80643cd2"
integrity sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==
Expand Down

0 comments on commit 63e21e1

Please sign in to comment.