From 70fca793138182d3bf1a1b67d51490ea9ea8f420 Mon Sep 17 00:00:00 2001 From: christianfuttrup Date: Thu, 2 Jan 2025 18:03:21 +0100 Subject: [PATCH] Added React version to eslint config file --- eslint.config.js | 73 +++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 6bc47fe1..2f7ce09a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -2,7 +2,7 @@ import { fixupPluginRules } from "@eslint/compat"; import { FlatCompat } from "@eslint/eslintrc"; import js from "@eslint/js"; import globals from "globals"; -import reactPlugin from 'eslint-plugin-react'; +import reactPlugin from "eslint-plugin-react"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; @@ -49,46 +49,55 @@ export default tseslint.config( alwaysTryTypes: true, }, }, + react: { + version: "detect", + }, }, rules: { ...reactHooks.configs.recommended.rules, "@typescript-eslint/no-empty-object-type": "off", - "@typescript-eslint/no-unused-vars": ["error", { - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_", - "caughtErrorsIgnorePattern": "^_" - }], - "import/order": ["error", { - "groups": [ - "builtin", - "external", - "internal", - ["parent", "sibling"], - "index", - "object", - "type", - "unknown" - ], - "pathGroups": [ - { - "pattern": "@*", - "group": "internal", - "position": "after" - } - ], - "pathGroupsExcludedImportTypes": ["builtin", "internal"], - "newlines-between": "always", - "alphabetize": { - "order": "asc", - "caseInsensitive": true - } - }], + "@typescript-eslint/no-unused-vars": [ + "error", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], + "import/order": [ + "error", + { + groups: [ + "builtin", + "external", + "internal", + ["parent", "sibling"], + "index", + "object", + "type", + "unknown", + ], + pathGroups: [ + { + pattern: "@*", + group: "internal", + position: "after", + }, + ], + pathGroupsExcludedImportTypes: ["builtin", "internal"], + "newlines-between": "always", + alphabetize: { + order: "asc", + caseInsensitive: true, + }, + }, + ], "react/react-in-jsx-scope": "off", "react-refresh/only-export-components": [ "warn", { allowConstantExport: true }, ], - "semi": ["error", "always"], + semi: ["error", "always"], }, } );