简体   繁体   English

jslint-vim配置

[英]jslint-vim configuration

I used the following plugin to install jslint for vim: https://github.com/hallettj/jslint.vim . 我使用以下插件为Vim安装jslint: https : //github.com/hallettj/jslint.vim

I'm a bit confused as to how to configure this. 我对如何配置它有些困惑。

I see a list of options here http://www.jslint.com/lint.html#options , but 我在http://www.jslint.com/lint.html#options上看到了选项列表,但是

  1. in the jslint-vim plugin, where do I specify these options? 在jslint-vim插件中,应在哪里指定这些选项?
  2. What is the option for removing indenting errors 有什么消除缩进错误的选项
  3. What is the option to remove the "x variable was used before it was defined?" 删除“在定义x变量之前已使用它”的选项是什么?

in the jslint-vim plugin, where do I specify these options? 在jslint-vim插件中,应在哪里指定这些选项?

Create a .jslintrc in your home directory. 在主目录中创建一个.jslintrc The options are listed in a /**/ comment block. 这些选项在/**/注释框中列出。 There's an example in the documentation under Usage . 文档中的用法下有一个示例。 Options set in your .jslintrc will apply to jslint generally, not just the vim plugin. .jslintrc中设置的选项通常会应用于jslint,而不仅仅是vim插件。

What is the option for removing indenting errors 有什么消除缩进错误的选项

Try setting white : tolerate messy whitespace . 尝试设置white容忍混乱的空白 But this will cause other issues to pass. 但这将导致其他问题过去。

Put this in your .jslintrc : 把它放在你的.jslintrc中

/*jslint white: true */

What is the option to remove the "x variable was used before it was defined?" 删除“在定义x变量之前已使用它”的选项是什么?

The option is named undef . 该选项名为undef Put this in your .jslintrc : 把它放在你的.jslintrc中

/*jslint undef: true */

Putting those two options together: 将这两个选项放在一起:

/*jslint white: true, undef: true */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM