diff --git a/.eslintrc.json b/.eslintrc.json index 106162b9..db78eb3f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,15 +1,8 @@ { "root": true, "parser": "@typescript-eslint/parser", - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended" - ], - "plugins": [ - "@typescript-eslint/eslint-plugin", - "simple-import-sort", - "unused-imports" - ], + "extends": ["plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], + "plugins": ["@typescript-eslint/eslint-plugin", "simple-import-sort", "unused-imports"], "rules": { // TypeScript ESLint "@typescript-eslint/no-unused-vars": "off", @@ -35,12 +28,10 @@ }, "overrides": [ { - "files": [ - "*.js" - ], + "files": ["*.js"], "rules": { "@typescript-eslint/no-var-requires": "off" } } ] -} \ No newline at end of file +} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..02444ade --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +pnpm install +pnpm run lint +pnpm run format \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..69a9a603 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +dist +.next +__ENV.js +node_modules \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 0442d311..9be88e01 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,8 +12,5 @@ "i18n-ally.localesPaths": ["client/public/locales"], "i18n-ally.namespace": true, "i18n-ally.pathMatcher": "{locale}/{namespaces}.{ext}", - "i18n-ally.sortKeys": true, - "[jsonc]": { - "editor.defaultFormatter": "vscode.json-language-features" - } + "i18n-ally.sortKeys": true } diff --git a/client/.eslintrc.json b/client/.eslintrc.json index eade8f0a..e3778175 100644 --- a/client/.eslintrc.json +++ b/client/.eslintrc.json @@ -1,14 +1,8 @@ { - "extends": [ - "../.eslintrc.json", - "next/core-web-vitals" - ], - "ignorePatterns": [ - ".next", - "__ENV.js" - ], + "extends": ["../.eslintrc.json", "next/core-web-vitals"], + "ignorePatterns": [".next", "__ENV.js"], "rules": { "@next/next/no-img-element": "off", "@next/next/no-sync-scripts": "off" } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 2b139fed..2b018b3b 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,9 @@ } }, "scripts": { + "prepare": "husky install", + "lint": "eslint --fix --ext .js,.ts,.tsx .", + "format": "prettier --write \"./**/*.{js,ts,tsx,json}\"", "dev:schema": "pnpm -F schema dev", "dev:server": "pnpm -F server start:dev", "dev:client": "pnpm -F client dev", @@ -40,6 +43,7 @@ "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-unused-imports": "^2.0.0", + "husky": "^7.0.4", "prettier": "^2.5.1", "typescript": "^4.5.5" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 172763b4..0ef3b22f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,6 +16,7 @@ importers: eslint-plugin-prettier: ^4.0.0 eslint-plugin-simple-import-sort: ^7.0.0 eslint-plugin-unused-imports: ^2.0.0 + husky: ^7.0.4 prettier: ^2.5.1 typescript: ^4.5.5 dependencies: @@ -32,6 +33,7 @@ importers: eslint-plugin-prettier: 4.0.0_f3d13a703a9c1079e3d1af6044603beb eslint-plugin-simple-import-sort: 7.0.0_eslint@8.10.0 eslint-plugin-unused-imports: 2.0.0_5048693f84252cfc01b1f5d975a3323d + husky: 7.0.4 prettier: 2.5.1 typescript: 4.5.5 @@ -4888,6 +4890,12 @@ packages: engines: {node: '>=8.12.0'} dev: true + /husky/7.0.4: + resolution: {integrity: sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==} + engines: {node: '>=12'} + hasBin: true + dev: true + /i18next-fs-backend/1.1.4: resolution: {integrity: sha512-/MfAGMP0jHonV966uFf9PkWWuDjPYLIcsipnSO3NxpNtAgRUKLTwvm85fEmsF6hGeu0zbZiCQ3W74jwO6K9uXA==} dev: false