// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format import storybook from "eslint-plugin-storybook"; import js from "@eslint/js"; import globals from "globals"; import react from "eslint-plugin-react"; import reactHooks from "eslint-plugin-react-hooks"; import reactRefresh from "eslint-plugin-react-refresh"; import tseslint from "typescript-eslint"; import { defineConfig, globalIgnores } from "eslint/config"; export default defineConfig([globalIgnores(["dist"]), { files: ["**/*.{ts,tsx}"], ignores: ["vite.config.ts"], extends: [ js.configs.recommended, tseslint.configs.recommended, react.configs.flat.recommended, reactHooks.configs.flat.recommended, reactRefresh.configs.vite, ], languageOptions: { ecmaVersion: 2020, globals: globals.browser, parserOptions: { project: ["./tsconfig.app.json"], tsconfigRootDir: import.meta.dirname, }, }, rules: { // React 17+ uses the new JSX transform, no need to import React "react/react-in-jsx-scope": "off", "react/jsx-uses-react": "off", }, settings: { react: { version: "detect", runtime: "automatic", }, "import/resolver": { typescript: { project: "./tsconfig.app.json", }, }, }, }, // Separate config for vite.config.ts to avoid tsconfig project restriction { files: ["vite.config.ts"], extends: [js.configs.recommended, tseslint.configs.recommended], languageOptions: { ecmaVersion: 2020, globals: globals.node, }, }, ...storybook.configs["flat/recommended"]]);