chore: Improve pre-commit (#7818)

This commit is contained in:
sp.wack 2025-04-11 20:55:26 +04:00 committed by GitHub
parent 36e092e0ac
commit d114c45135
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 39 additions and 36 deletions

View File

@ -1,7 +1,7 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"
"project": "./tsconfig.json",
},
"extends": [
"airbnb",
@ -11,15 +11,12 @@
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:@tanstack/query/recommended"
],
"plugins": [
"prettier"
"plugin:@tanstack/query/recommended",
],
"plugins": ["prettier", "unused-imports"],
"rules": {
"prettier/prettier": [
"error"
],
"unused-imports/no-unused-imports": "error",
"prettier/prettier": ["error"],
// Resolves https://stackoverflow.com/questions/59265981/typescript-eslint-missing-file-extension-ts-import-extensions/59268871#59268871
"import/extensions": [
"error",
@ -27,32 +24,26 @@
{
"": "never",
"ts": "never",
"tsx": "never"
}
]
"tsx": "never",
},
],
},
"settings": {
"react": {
"version": "detect"
}
"version": "detect",
},
},
"overrides": [
{
"files": [
"*.ts",
"*.tsx"
],
"files": ["*.ts", "*.tsx"],
"rules": {
// Allow state modification in reduce and Redux reducers
"no-param-reassign": [
"error",
{
"props": true,
"ignorePropertyModificationsFor": [
"acc",
"state"
]
}
"ignorePropertyModificationsFor": ["acc", "state"],
},
],
// For https://stackoverflow.com/questions/55844608/stuck-with-eslint-error-i-e-separately-loops-should-be-avoided-in-favor-of-arra
"no-restricted-syntax": "off",
@ -66,24 +57,19 @@
2,
{
"required": {
"some": [
"nesting",
"id"
]
}
}
"some": ["nesting", "id"],
},
},
],
"react/prop-types": "off",
"react/no-array-index-key": "off",
"react-hooks/exhaustive-deps": "off",
"import/no-extraneous-dependencies": "off",
"react/react-in-jsx-scope": "off"
"react/react-in-jsx-scope": "off",
},
"parserOptions": {
"project": [
"**/tsconfig.json"
]
}
}
]
"project": ["**/tsconfig.json"],
},
},
],
}

View File

@ -1,4 +1,3 @@
cd frontend
npm run check-unlocalized-strings
npx lint-staged
npm test

View File

@ -83,6 +83,7 @@
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^4.1.4",
"husky": "^9.1.7",
"jsdom": "^26.0.0",
"lint-staged": "^15.5.0",
@ -9173,6 +9174,22 @@
"semver": "bin/semver.js"
}
},
"node_modules/eslint-plugin-unused-imports": {
"version": "4.1.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz",
"integrity": "sha512-YptD6IzQjDardkl0POxnnRBhU1OEePMV0nd6siHaRBbd+lyh6NAhFEobiznKU7kTsSsDeSD62Pe7kAM1b7dAZQ==",
"dev": true,
"license": "MIT",
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^8.0.0-0 || ^7.0.0 || ^6.0.0 || ^5.0.0",
"eslint": "^9.0.0 || ^8.0.0"
},
"peerDependenciesMeta": {
"@typescript-eslint/eslint-plugin": {
"optional": true
}
}
},
"node_modules/eslint-scope": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",

View File

@ -107,6 +107,7 @@
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-unused-imports": "^4.1.4",
"husky": "^9.1.7",
"jsdom": "^26.0.0",
"lint-staged": "^15.5.0",