| 123456789101112131415161718192021222324252627282930313233 |
- import reactHooks from "eslint-plugin-react-hooks";
- import tseslint from "typescript-eslint";
- /**
- * 分成管理 D-7:仅开启 rules-of-hooks 硬门禁(条件性 Hook ⇒ 硬加载白屏)。
- * 发布前跑 `npm run lint:hooks`。⛔ 夹带其它 lint 规则(会把存量文案/禁用注释打成失败)。
- */
- export default tseslint.config(
- {
- ignores: ["dist/**", "node_modules/**"],
- },
- {
- files: ["src/**/*.{js,jsx,ts,tsx}"],
- languageOptions: {
- parser: tseslint.parser,
- parserOptions: {
- ecmaFeatures: { jsx: true },
- },
- },
- linterOptions: {
- // 存量文件里有其它规则的 eslint-disable;本配置未启用那些规则 ⇒ 关掉「未使用指令」噪音。
- reportUnusedDisableDirectives: "off",
- },
- plugins: {
- "react-hooks": reactHooks,
- },
- rules: {
- "react-hooks/rules-of-hooks": "error",
- // exhaustive-deps 本轮不进硬门禁(存量注释多,单独治理)。
- "react-hooks/exhaustive-deps": "off",
- },
- },
- );
|