保存到VS Code后如何修复ESLint错误

Two of the most prominent utilities in web development today are ESLint and Microsoft's Visual Studio Code. I enjoy using both, and I love the integration between both tools, but warnings from ESLint inside Visual Studio Code aren't fulfilling -- I'd rather lint errors be fixed each time I save.

当今Web开发中最著名的两个实用程序是ESLint和Microsoft的Visual Studio Code。 我喜欢同时使用这两种工具,而且我喜欢这两种工具之间的集成,但是Visual Studio Code中来自ESLint的警告并没有实现-我宁愿每次保存时都修正lint错误。

Complete the following steps to make Visual Studio Code fix any lint errors when a file is saved:

完成以下步骤以使Visual Studio Code在保存文件时修复所有棉绒错误:

  • Open the following file path: ~/Library/Application Support/Code/User/settings.json

    打开以下文件路径: ~/Library/Application Support/Code/User/settings.json

  • Within the JSON structure, add the following:

    在JSON结构中,添加以下内容:
{
    // ... Existing JSON here ...
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    }
}

Every time you save applicable files within Visual Studio Code, ESLint will be run to fix any errors.

每次在Visual Studio Code中保存适用的文件时,将运行ESLint修复任何错误。

For me this is a massive time savings. There is some risk that this task might take a while one large files but for me it's worth it.

对我来说,这可节省大量时间。 这项任务可能需要花费一个大文件一段时间,但是对我来说这是值得的。

翻译自: https://davidwalsh.name/eslint-vscode

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值