如何在VS Code中的附加Docker容器中对编辑器中打开的文件进行ESLint检查?

huangapple go评论82阅读模式
英文:

How to ESLint files opened in Editor in Attached Docker container in VS Code?

问题

我昨天切换到Docker容器中的开发,总体上运行良好。

我现在缺少的一件事是ESLint消息的可视突出显示。

  • 在我的容器中运行 pnpm run lint 产生以下结果(这是好的)

    193:6 警告:React Hook useCallback 缺少依赖项:'state.editingRecord' 和 'state.originalRecord'。要么包括它们,要么删除依赖项数组。 react-hooks/exhaustive-deps

  • 在编辑器中打开文件不会给出在第193行存在问题的视觉提示

如何在VS Code中的附加Docker容器中对编辑器中打开的文件进行ESLint检查?

期望行为:[] 应该被下划线标记。悬停在其上应该显示消息 193:6 警告:React Hook useCallback 缺少依赖项:'state.editingRecord' 和 'state.originalRecord'。要么包括它们,要么删除依赖项数组。 react-hooks/exhaustive-deps

在容器外工作时,可视突出显示正常工作。

英文:

I switched to Development in a Docker container yesterday and it's working well overall.

One thing I am missing is Visual Highlighting of ESLint messages.

  • Running pnpm run lint in my container yields (this is good)

    193:6 Warning: React Hook useCallback has missing dependencies: 'state.editingRecord' and 'state.originalRecord'. Either include them or remove the dependency array. react-hooks/exhaustive-deps

  • Opening the file in the Editor does not give a visual hint that there is a problem in line 193

如何在VS Code中的附加Docker容器中对编辑器中打开的文件进行ESLint检查?

Expected behavior: [] should be underlined. Hovering over it should give the message 193:6 Warning: React Hook useCallback has missing dependencies: 'state.editingRecord' and 'state.originalRecord'. Either include them or remove the dependency array. react-hooks/exhaustive-deps.

Visual Highlighting works when working outside of the container.

答案1

得分: 1

你需要在容器中安装ESLint扩展。在扩展视图中的扩展页面上会有一个按钮,用于“在容器中安装 <容器名称>”。就像这样:

如何在VS Code中的附加Docker容器中对编辑器中打开的文件进行ESLint检查?

英文:

You have to install the ESLint extension in the container. The extension page in the Extension View will have a button to "Install in Container &lt;container name&gt;". Like this:

如何在VS Code中的附加Docker容器中对编辑器中打开的文件进行ESLint检查?

huangapple
  • 本文由 发表于 2023年7月14日 08:35:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76684034.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定