Skip to content

Commit

Permalink
删除已过时的配置
Browse files Browse the repository at this point in the history
现在 eslint.validate 已换为 eslint.probe,默认值包含 ts 文件。typescript.tsdk 不用配置也自动添加项目中的 typescript。参考 [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#settings-options)。
  • Loading branch information
pyvadev authored and xcatliu committed Apr 24, 2024
1 parent d7bac3e commit f6797e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Binary file removed assets/vscode-eslint-error.png
Binary file not shown.
19 changes: 1 addition & 18 deletions engineering/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,7 @@ type Foo = {};

要在 VSCode 中集成 ESLint 检查,我们需要先安装 ESLint 插件,点击「扩展」按钮,搜索 ESLint,然后安装即可。

VSCode 中的 ESLint 插件默认是不会检查 `.ts` 后缀的,需要在「文件 => 首选项 => 设置 => 工作区」中(也可以在项目根目录下创建一个配置文件 `.vscode/settings.json`),添加以下配置:

```json
{
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript"
],
"typescript.tsdk": "node_modules/typescript/lib"
}
```

这时再打开一个 `.ts` 文件,将鼠标移到红色提示处,即可看到这样的报错信息了:

![VSCode ESLint 错误信息](../assets/vscode-eslint-error.png)

我们还可以开启保存时自动修复的功能,通过配置:
通过配置 VSCode,可以开启保存时自动修复的功能:

```json
{
Expand Down

0 comments on commit f6797e1

Please sign in to comment.