101 lines
2.6 KiB
JavaScript
101 lines
2.6 KiB
JavaScript
import { defineConfig } from "eslint/config";
|
|
import tsParser from "@typescript-eslint/parser";
|
|
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
import importPlugin from "eslint-plugin-import";
|
|
import prettierPlugin from "eslint-plugin-prettier";
|
|
import unusedImportsPlugin from "eslint-plugin-unused-imports";
|
|
|
|
export default defineConfig([
|
|
{
|
|
files: ["src/**/*.{ts,tsx}"],
|
|
languageOptions: {
|
|
parser: tsParser,
|
|
parserOptions: {
|
|
project: "./tsconfig.app.json",
|
|
sourceType: "module",
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
"import/resolver": {
|
|
typescript: {
|
|
alwaysTryTypes: true,
|
|
project: ["./tsconfig.json", "./tsconfig.app.json"],
|
|
},
|
|
node: {
|
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
},
|
|
},
|
|
},
|
|
plugins: {
|
|
"@typescript-eslint": tsPlugin,
|
|
react: reactPlugin,
|
|
"react-hooks": reactHooksPlugin,
|
|
import: importPlugin,
|
|
prettier: prettierPlugin,
|
|
"unused-imports": unusedImportsPlugin,
|
|
},
|
|
rules: {
|
|
"react/react-in-jsx-scope": "off",
|
|
"react/prop-types": "off",
|
|
"react-hooks/rules-of-hooks": "error",
|
|
"react-hooks/exhaustive-deps": "warn",
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
vars: "all",
|
|
varsIgnorePattern: "^_",
|
|
args: "after-used",
|
|
argsIgnorePattern: "^_",
|
|
},
|
|
],
|
|
"no-unused-vars": "off",
|
|
"unused-imports/no-unused-imports": "error",
|
|
"import/default": "off",
|
|
"import/named": "off",
|
|
"import/namespace": "error",
|
|
"import/export": "error",
|
|
"import/order": [
|
|
"error",
|
|
{
|
|
groups: ["builtin", "external", "internal"],
|
|
pathGroups: [
|
|
{
|
|
pattern: "react",
|
|
group: "external",
|
|
position: "before",
|
|
},
|
|
],
|
|
pathGroupsExcludedImportTypes: ["react"],
|
|
"newlines-between": "always",
|
|
alphabetize: {
|
|
order: "asc",
|
|
caseInsensitive: true,
|
|
},
|
|
},
|
|
],
|
|
"import/extensions": [
|
|
"error",
|
|
"ignorePackages",
|
|
{
|
|
ts: "never",
|
|
tsx: "never",
|
|
js: "never",
|
|
jsx: "never",
|
|
},
|
|
],
|
|
"prettier/prettier": "error",
|
|
},
|
|
},
|
|
{
|
|
ignores: ["dist/*"],
|
|
},
|
|
]);
|