【问题标题】:How can I get jscs to use the --fix option from grunt?如何让 jscs 使用 grunt 的 --fix 选项?
【发布时间】:2015-04-29 12:55:50
【问题描述】:

使用 grunt-jscs,我想让它使用 --fix 选项自动重新格式化代码。如何将命令行选项传递给 jscs?我已尝试添加 args 和选项,但无法正常工作。

我的 gruntfile 有:

jscs: {
    all: {
        src: [
            '*.js',
        ]
    },
    options: {
        config: "/path/to/.jscsrc",
    }
},

【问题讨论】:

标签: javascript gruntjs jscs


【解决方案1】:

fix option 从 v1.8.0 开始在 grunt-jscs 中可用。

这样指定:

jscs: {
  src: "path/to/files/*.js",
  options: {
    fix: true,
    config: ".jscsrc"
  }
}

【讨论】:

    【解决方案2】:

    似乎是包作者的热门请求,目前不可用...

    https://github.com/jscs-dev/grunt-jscs/issues/82

    也许很快https://github.com/jscs-dev/grunt-jscs/pull/84

    【讨论】:

    • 是的。我刚刚看到了这个拉取请求。
    猜你喜欢
    • 2016-03-15
    • 2015-10-26
    • 2019-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-13
    相关资源
    最近更新 更多