Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

finding: 45 条 eslint-disable 指令已经失效(ESLint 每次都在报,但淹没在 10437 条 warning 里),其中 20 条压的是 error 级 ratchet no-console #4833

Closed

Description

@yinlianghui

量于 objectstack-ai/objectstack#25947 的测量型派发,实测基线 origin/main @ 610de765f。与 objectstack-ai/objectstack#25947 相邻但不同事实:#4806 说的是未使用的变量/导入,这条说的是未使用的抑制注释,互不包含,所以单独留档。observation-class:今天没有用户会因此出错。

现象

仓根 pnpm exec eslint . -f json 覆盖 3173 个文件,实测 0 errors / 10437 warnings,共 11 个不同 rule id。其中 45 条的 ruleId 是 null —— 它们不是某条规则的报告,而是 ESLint 自己的 "Unused eslint-disable directive (no problems were reported from 'X')",即这条 eslint-disable 压的问题已经不存在了。

按被压制的规则拆分:

20  no-console
10  react-hooks/exhaustive-deps
 4  eqeqeq
 3  no-constant-condition
 2  no-new-func
 2  react-hooks/set-state-in-effect
 4  其余

为什么一直没人看见

  • ESLint 9+ 对这一类默认就是 warn,eslint.config.js 没有设 linterOptions.reportUnusedDisableDirectives,所以它一直在报。
  • 但 .github/workflows/lint.yml 有意不设 --max-warnings(注释写明 "This gate is about errors")。这 45 条占 10437 条 warning 的 0.43%,而同一片 warning 里 79.2% 是 no-explicit-any。于是它每次 CI 都被打印、每次都没人读。

为什么值得记一笔

20 条压的是 no-console,而 eslint.config.js 把 no-console 设成 error,是 #4029 专门加的 ratchet。一条挂在 error 级 ratchet 上、实际已经不需要的 eslint-disable,正是后来的人会当成"这里有正当理由"而照抄的注释 —— 抑制注释的说服力来自"它必须存在",一旦不必存在,它就只剩误导。

处置方向(仅列,不预判)

linterOptions.reportUnusedDisableDirectives: 'error'(或 CLI 的 --report-unused-disable-directives-severity=error)正好只让这一类变红。与 objectstack-ai/objectstack#25947 里那些动辄数百上千的 warning 类别不同,这一类总量就是 45,且每一条的修法都是删掉一行注释,可以一次清干净、当天就把门关上。

参考位置

  • eslint.config.js(未设 linterOptions)
  • .github/workflows/lint.yml:20-28(有意不设 --max-warnings 的那段)

关联:#4806(量于此)、#4029(no-console 这条 ratchet 的出处)。

Activity

  1. self-assigned this
    on Aug 16, 2026
  2. yinlianghui commented on Aug 16, 2026

    @yinlianghui
    ContributorAuthor

    【分诊晋级 + 认领】objectui 分片 PM(session_01GTRjn8xBqp75dk7kFupVRt):finding → pm:queue 并派发(批次 11 补位)。晋级依据:ESLint 自身每轮都在报的失效指令(判据即 Unused eslint-disable directive 报文,零猜测),其中 20 条压着 error 级 no-console 棘轮属实际风险面。分支:claude/issue-4833-stale-eslint-disable。前置门:PR #4844(R1)auto-merge 在队,落 main 后再切 —— R1 使 4 处手写 no-unused-vars 豁免转为失效(45→49),一次清不返工。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions