81 lines
2.4 KiB
JavaScript
81 lines
2.4 KiB
JavaScript
import comments from "@eslint-community/eslint-plugin-eslint-comments/configs";
|
|
import js from "@eslint/js";
|
|
import prettier from "eslint-config-prettier/flat";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
import { defineConfig, globalIgnores } from "eslint/config";
|
|
import globals from "globals";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default defineConfig([
|
|
{
|
|
files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
|
|
plugins: { js },
|
|
extends: ["js/recommended"],
|
|
languageOptions: { globals: globals.browser },
|
|
},
|
|
prettier,
|
|
comments.recommended,
|
|
globalIgnores(["coverage/"]),
|
|
|
|
tseslint.configs.recommendedTypeChecked.map((config) => ({ ...config, files: config.files ?? ["**/*.{ts,tsx}"] })),
|
|
{
|
|
files: ["**/*.{ts,tsx}"],
|
|
languageOptions: { parserOptions: { projectService: true } },
|
|
},
|
|
{
|
|
files: ["**/*.{ts,tsx}"],
|
|
rules: {
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"error",
|
|
{
|
|
args: "after-used",
|
|
argsIgnorePattern: "^_",
|
|
caughtErrors: "all",
|
|
caughtErrorsIgnorePattern: "^_",
|
|
destructuredArrayIgnorePattern: "^_",
|
|
varsIgnorePattern: "^_",
|
|
ignoreRestSiblings: true,
|
|
},
|
|
],
|
|
"@typescript-eslint/unbound-method": "off",
|
|
"@typescript-eslint/no-unsafe-declaration-merging": "off",
|
|
"@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }],
|
|
"@typescript-eslint/consistent-type-imports": ["warn"],
|
|
"@typescript-eslint/only-throw-error": "off",
|
|
},
|
|
},
|
|
{
|
|
files: ["**/*.{test,spec}-d.{ts,tsx}"],
|
|
rules: {
|
|
"@typescript-eslint/no-unused-vars": "off",
|
|
},
|
|
},
|
|
{
|
|
files: ["**/use*.{js,jsx,ts,tsx}", "**/*.{jsx,tsx}"],
|
|
plugins: {
|
|
react: reactPlugin,
|
|
"react-hooks": reactHooksPlugin,
|
|
},
|
|
languageOptions: {
|
|
parserOptions: {
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
},
|
|
rules: {
|
|
...reactPlugin.configs.recommended.rules,
|
|
...reactPlugin.configs["jsx-runtime"].rules,
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"react-hooks/exhaustive-deps": ["warn", { additionalHooks: "(useRenderEffect|useFabric)" }],
|
|
"react/no-children-prop": "off",
|
|
"react/no-unknown-property": "off",
|
|
},
|
|
},
|
|
]);
|