【问题标题】:Emacs flymake-jslint show all errorsEmacs flymake-jslint 显示所有错误
【发布时间】:2014-11-19 15:30:24
【问题描述】:

我想在emacs中使用jslint,所以我安装了包flymake-jslintflymake-cursor。 我有非常简单的 javascript 文件:

/*global desc, task, jake, fail, complete */
"use strict";
task("example", function() {
    var x = 5
    console.log("asdf");
});

Flymake 正确突出显示 var x = 5,我在迷你缓冲区中得到 Unused 'x'.。但是,当我从命令行运行 jslint 时,我得到:

$ jslint jakefile.js

jakefile.js
 #1 Expected exactly one space between 'function' and '('.
    task("example", function() { // Line 3, Pos 25
 #2 Expected ';' and instead saw 'console'.
    var x = 5 // Line 4, Pos 14
 #3 Unused 'x'.
    var x = 5 // Line 4, Pos 9

有没有办法配置flymake-jslint 向我显示那些非语法错误,例如“预期空间”?

【问题讨论】:

  • This 建议您可以在配置文件中设置选项:自定义 flymake-jslint 选项。在 Windows 上,将 flymake-jslint-command 设置为:~/.emacs.d/jslint.bat 或者,您应该能够添加 /*jslint white:false */ (等)以确保对混乱空白的容忍度 off 逐个文件。但请先尝试配置路由。

标签: javascript emacs jslint flymake


【解决方案1】:

我找到了答案:)

有一个名为flymake-jslint-args 的配置变量。当我运行describe-variable 时,它向我展示了这样的内容:

flymake-jslint-args 是在`flymake-jslint.el' 中定义的一个变量。它的 值为 ("--white" "--undef" "--nomen" "--regexp" "--plusplus" "--bitwise" "--newcap" "--sloppy" "--vars" "--eqeq")

文档:jslint 可执行文件的命令行参数。

所有这些命令行参数都是错误类型,在运行 jslint 时将被忽略,因此我将此变量设置为 ()

(setq flymake-jslint-args ())

现在我得到了所有的错误,就像我想要的那样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多