|
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat" |
|
import { FlatCompat } from "@eslint/eslintrc" |
|
import js from "@eslint/js" |
|
import typescriptPlugin from "@typescript-eslint/eslint-plugin" |
|
import tsParser from "@typescript-eslint/parser" |
|
import { defineConfig } from "eslint/config" |
|
import globals from "globals" |
|
import path from "node:path" |
|
import { fileURLToPath } from "node:url" |
|
|
|
const __filename = fileURLToPath(import.meta.url) |
|
const __dirname = path.dirname(__filename) |
|
const compat = new FlatCompat({ |
|
baseDirectory: __dirname, |
|
recommendedConfig: js.configs.recommended, |
|
allConfig: js.configs.all, |
|
}) |
|
|
|
export default defineConfig([ |
|
{ |
|
extends: fixupConfigRules( |
|
compat.extends( |
|
"eslint:recommended", |
|
"plugin:react/recommended", |
|
"plugin:react-hooks/recommended", |
|
"plugin:@typescript-eslint/recommended", |
|
), |
|
), |
|
|
|
plugins: { |
|
"@typescript-eslint": fixupPluginRules(typescriptPlugin), |
|
}, |
|
|
|
languageOptions: { |
|
globals: { |
|
...globals.browser, |
|
}, |
|
|
|
parser: tsParser, |
|
ecmaVersion: 10, |
|
sourceType: "script", |
|
|
|
parserOptions: { |
|
project: "./tsconfig.json", |
|
ecmaFeatures: { |
|
jsx: true, |
|
}, |
|
}, |
|
}, |
|
|
|
settings: { |
|
react: { |
|
version: "detect", |
|
}, |
|
}, |
|
|
|
rules: { |
|
"react/react-in-jsx-scope": "off", |
|
"react/no-unescaped-entities": "off", |
|
"@typescript-eslint/no-empty-object-type": "off", |
|
"@typescript-eslint/no-explicit-any": "off", |
|
"react/prop-types": "off", |
|
}, |
|
}, |
|
]) |
|
|