From c91b0e4d3e787cc5b8a8bf3ef9fe5b2527074683 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Mon, 3 Jun 2024 14:45:11 +0530 Subject: [PATCH] lint --- infra/staff/.eslintrc.cjs | 37 +++++++++++++++++++++++++++++++++++- infra/staff/.prettierrc.json | 8 ++++++++ infra/staff/package.json | 20 +++++++++++++++---- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 infra/staff/.prettierrc.json diff --git a/infra/staff/.eslintrc.cjs b/infra/staff/.eslintrc.cjs index 99b4b9226c..38c2011233 100644 --- a/infra/staff/.eslintrc.cjs +++ b/infra/staff/.eslintrc.cjs @@ -1,3 +1,38 @@ +/* eslint-env node */ module.exports = { - extends: ["@/build-config/eslintrc-vite"], + root: true, + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/strict-type-checked", + "plugin:@typescript-eslint/stylistic-type-checked", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:react/jsx-runtime", + ], + plugins: ["@typescript-eslint", "react-refresh"], + parserOptions: { project: true }, + parser: "@typescript-eslint/parser", + ignorePatterns: [".eslintrc.cjs", "vite.config.ts", "dist"], + settings: { react: { version: "18.2" } }, + rules: { + /* Allow numbers to be used in template literals */ + "@typescript-eslint/restrict-template-expressions": [ + "error", + { + allowNumber: true, + }, + ], + /* Allow void expressions as the entire body of an arrow function */ + "@typescript-eslint/no-confusing-void-expression": [ + "error", + { + ignoreArrowShorthand: true, + }, + ], + "react-refresh/only-export-components": [ + "warn", + { allowConstantExport: true }, + ], + + }, }; diff --git a/infra/staff/.prettierrc.json b/infra/staff/.prettierrc.json new file mode 100644 index 0000000000..7cf8c86c77 --- /dev/null +++ b/infra/staff/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "tabWidth": 4, + "proseWrap": "always", + "plugins": [ + "prettier-plugin-organize-imports", + "prettier-plugin-packagejson" + ] +} diff --git a/infra/staff/package.json b/infra/staff/package.json index 530f7f8243..e54ca1a2ff 100644 --- a/infra/staff/package.json +++ b/infra/staff/package.json @@ -6,7 +6,9 @@ "scripts": { "build": "tsc && vite build", "dev": "vite", - "preview": "vite preview" + "preview": "vite preview", + "lint": "yarn prettier --check --log-level warn . && yarn eslint && yarn tsc", + "lint-fix": "yarn prettier --write --log-level warn . && yarn eslint --fix && yarn tsc" }, "dependencies": { "react": "^18", @@ -14,10 +16,20 @@ "zod": "^3" }, "devDependencies": { - "@/build-config": "*", "@types/react": "^18", "@types/react-dom": "^18", "@vitejs/plugin-react": "^4.2", - "vite": "^5.2" - } + "vite": "^5.2", + "eslint": "^8", + "prettier": "^3", + "typescript": "^5", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", + "eslint-plugin-react": "^7.34", + "eslint-plugin-react-hooks": "^4.6", + "eslint-plugin-react-refresh": "^0.4.7", + "prettier-plugin-organize-imports": "^3.2", + "prettier-plugin-packagejson": "^2.5" + }, + "packageManager": "yarn@1.22.21" }