类型化检查
编辑器 ESLint 报告已过时文件更改后
¥Editor ESLint reports become out-of-date after file changes
至少在 VS Code 中,类型化 linting 存在一个已知问题,即在多次更新磁盘上的文件后,文件可能会出现过时的 lint 错误。根本原因是 ESLint 没有为编辑器提供了解跨文件依赖(例如类型信息)的方法。 这会导致文件在导入的文件发生更改时接收过时的类型信息。
¥There is a known issue in at least VS Code with typed linting that files might have out-of-date lint errors after multiple updates to files on disk. The root cause is that ESLint doesn't provide a way for editors to know about cross-file dependencies, such as type information. This results in files receiving out-of-date type information when files they import from are changed.
你可能会将此视为对 any
或 error typed
值的错误 no-unsafe-*
规则投诉。其他规则可能更微妙地不正确。
¥You might see this as erroneous no-unsafe-*
rule complaints on any
or error typed
values.
Other rules may be more subtly incorrect.
目前,解决方法是在类型过期时在 VS Code 中运行 Restart ESLint Server 命令(或其他编辑器中的等效命令)。
¥For now, the workaround is to run the Restart ESLint Server command in VS Code (or an equivalent in other editors) when types get out of date.
有关更多信息,请参阅 ESLint 不重新计算文件更改的跨文件信息 (microsoft/vscode-eslint#1774)。
¥See ESLint does not re-compute cross-file information on file changes (microsoft/vscode-eslint#1774) for more information.