跳转到内容

Lint

作名词,lint 原指衣服上的毛絮;在 Unix 文化中,lint 指检查 C 代码的工具。作动词 to lint 表示运行 linter 扫描代码,发现未使用变量、风格违规、可疑模式等。

  1. “Run lint before you commit to catch unused imports.” (提交前先跑 lint,抓未使用的 import。)
  2. “The CI pipeline fails if lint reports any errors.” (CI 流水线在 lint 报错时会失败。)
  3. “ESLint helps teams lint JavaScript consistently.” (ESLint 帮助团队一致地检查 JavaScript。)

源自古英语或中世纪荷兰语,意为绒线、毛屑;Stephen Johnson 的 lint 程序因“挑出代码里细小杂物”而得名。

该词本身无典型词缀;编程义为隐喻延伸。

“Lint” 成为静态分析的代名词;pre-commit hook 中常包含 lint 步骤,与 formatter 配合保证代码质量。

  • 固定搭配: “lint check” (lint 检查), “lint rule” (lint 规则), “lint error” (lint 错误)
  • 工具: linter
  • 动词: lint, linting

像从衣服上挑 lint(线头)一样,从代码里挑出小问题。

“After lint flagged a shadowed variable, he renamed it and the warning disappeared.” (lint 标出变量遮蔽后,他改名警告就消失了。)