2016-03-02 63 views

回答

12

您可以在VSCode设置json文件中添加扩展级配置。通过命令面板中打开此:

  • F1
  • 型 “用户设置”
  • 回车

添加规则eslint.options喜欢这一点,因为每eslint documentation

// Place your settings in this file to overwrite the default settings 
{ 
    "eslint.options": { 
     "rules": { 
      "quotes": [2, "double"] 
     } 
    } 
} 

您可以通过命令面板打开“工作区设置”将其添加到工作区级配置中。这将在您的项目中创建一个./vscode/settings.json文件。

+0

这个例子不是很有效 - 我刚才了解到'eslint.options'是[CLIEngine](http://eslint.org/docs/developer-guide/nodejs-api#cliengine)而不是['.eslintrc'](http://eslint.org/docs/user-guide/formatters/index.html#eslintrc) –

+0

你的意思是扩展文档中的链接不应该指向http:/ /eslint.org/docs/developer-guide/nodejs-api#cliengine? –

+0

请参阅Erich Gammas对此[vscode-eslint pull请求]的评论(https://github.com/Microsoft/vscode-eslint/pull/4)。 –