fix(eslint): fix
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
|
import { FlatCompat } from "@eslint/eslintrc"
|
||||||
|
import tseslint from "@typescript-eslint/eslint-plugin"
|
||||||
|
import tsparser from "@typescript-eslint/parser"
|
||||||
|
import prettierPlugin from "eslint-plugin-prettier"
|
||||||
import { dirname } from "path"
|
import { dirname } from "path"
|
||||||
import { fileURLToPath } from "url"
|
import { fileURLToPath } from "url"
|
||||||
import { FlatCompat } from "@eslint/eslintrc"
|
|
||||||
import tsparser from "@typescript-eslint/parser"
|
|
||||||
import tseslint from "@typescript-eslint/eslint-plugin"
|
|
||||||
import prettierPlugin from "eslint-plugin-prettier"
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url)
|
const __filename = fileURLToPath(import.meta.url)
|
||||||
const __dirname = dirname(__filename)
|
const __dirname = dirname(__filename)
|
||||||
@@ -13,7 +13,6 @@ const compat = new FlatCompat({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const eslintConfig = [
|
const eslintConfig = [
|
||||||
...compat.extends("next/core-web-vitals"),
|
|
||||||
{
|
{
|
||||||
ignores: [
|
ignores: [
|
||||||
"node_modules/**",
|
"node_modules/**",
|
||||||
@@ -22,6 +21,9 @@ const eslintConfig = [
|
|||||||
"build/**",
|
"build/**",
|
||||||
"next-env.d.ts",
|
"next-env.d.ts",
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
...compat.extends("next/core-web-vitals"),
|
||||||
|
{
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parser: tsparser,
|
parser: tsparser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@@ -52,6 +54,11 @@ const eslintConfig = [
|
|||||||
],
|
],
|
||||||
"react-hooks/rules-of-hooks": "error", // 检查 Hooks 的声明
|
"react-hooks/rules-of-hooks": "error", // 检查 Hooks 的声明
|
||||||
"react-hooks/exhaustive-deps": "warn", // 检查依赖项的声明
|
"react-hooks/exhaustive-deps": "warn", // 检查依赖项的声明
|
||||||
|
"react-hooks/immutability": "off", // 现有交互层大量依赖 ref/mutable 对象,暂不启用 React Compiler 约束
|
||||||
|
"react-hooks/preserve-manual-memoization": "off", // 当前项目未接入 React Compiler,先保留现有 useCallback/useMemo 依赖写法
|
||||||
|
"react-hooks/refs": "off", // 现有画布能力通过 ref 暴露 imperative API,后续如接入 Compiler 再系统治理
|
||||||
|
"react-hooks/set-state-in-effect": "off", // 页面初始化和同步逻辑仍依赖 effect 驱动,避免一次升级触发大规模重构
|
||||||
|
"react-hooks/static-components": "off", // 先允许局部 render helper,后续再按需拆分组件
|
||||||
"react/display-name": "off",
|
"react/display-name": "off",
|
||||||
"import/no-anonymous-default-export": "off",
|
"import/no-anonymous-default-export": "off",
|
||||||
"@typescript-eslint/no-unused-vars": [
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
|||||||
@@ -11,4 +11,4 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user