From bf831b9c46047668fecf02874ff0ee95e2850db4 Mon Sep 17 00:00:00 2001 From: Ardeman Date: Tue, 25 Feb 2025 09:41:47 +0800 Subject: [PATCH] refactor: update ESLint configuration to include prettier and adjust rules --- eslint.config.mjs | 5 +++++ knip.json | 3 +-- package.json | 2 +- pnpm-lock.yaml | 13 +++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index a1f5418..a7437bb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,6 +9,7 @@ import eslintPluginUnicorn from 'eslint-plugin-unicorn' import reactPlugin from 'eslint-plugin-react' import pluginQuery from '@tanstack/eslint-plugin-query' import unusedImports from 'eslint-plugin-unused-imports' +import eslintConfigPrettier from 'eslint-config-prettier' export default tseslint.config( { ignores: ['dist', 'node_modules', '.react-router'] }, @@ -19,6 +20,7 @@ export default tseslint.config( jsxA11y.flatConfigs.recommended, importPlugin.flatConfigs.recommended, eslintPluginUnicorn.configs['flat/recommended'], + eslintConfigPrettier, ], files: ['**/*.{ts,tsx}'], languageOptions: { @@ -44,6 +46,9 @@ export default tseslint.config( extensions: ['.js', '.jsx', '.ts', '.tsx'], }, }, + react: { + version: 'detect', + }, }, rules: { ...reactHooks.configs.recommended.rules, diff --git a/knip.json b/knip.json index 3f5075a..3fc9059 100644 --- a/knip.json +++ b/knip.json @@ -13,7 +13,6 @@ "ignoreDependencies": [ "tailwindcss", "@tailwindcss/typography", - "react-router-devtools", - "eslint-import-resolver-typescript" + "react-router-devtools" ] } diff --git a/package.json b/package.json index 4d62e7f..c08a3fc 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/react-dom": "^19.0.1", "@typescript-eslint/parser": "^8.22.0", "eslint": "^8.0.1", - "eslint-import-resolver-typescript": "^3.7.0", + "eslint-config-prettier": "^10.0.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.2", "eslint-plugin-react": "^7.37.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cd8b532..92c4f35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,6 +114,9 @@ importers: eslint: specifier: ^8.0.1 version: 8.57.1 + eslint-config-prettier: + specifier: ^10.0.1 + version: 10.0.1(eslint@8.57.1) eslint-import-resolver-typescript: specifier: ^3.7.0 version: 3.7.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) @@ -2164,6 +2167,12 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + eslint-config-prettier@10.0.1: + resolution: {integrity: sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} @@ -6411,6 +6420,10 @@ snapshots: escape-string-regexp@4.0.0: {} + eslint-config-prettier@10.0.1(eslint@8.57.1): + dependencies: + eslint: 8.57.1 + eslint-import-resolver-node@0.3.9: dependencies: debug: 3.2.7