【问题标题】:Enable JSX in Closure Linter在 Closure Linter 中启用 JSX
【发布时间】:2015-06-25 16:17:31
【问题描述】:

是否有任何选项可以将 JSX 语法与 Closure Linter 一起使用?或者是否可以将 eslint 与 Google 关闭一起使用?

我正在尝试弄清楚如何为我使用 Google 闭包库和 Facebook React 的新项目设置 linter,但我无法使用 jsx 语法使用闭包 linter,而且我不知道如何配置 .eslintrc在不获取warning "goog" is not defined 的情况下使用诸如 goog.require 之类的闭包内容

【问题讨论】:

    标签: javascript react-jsx google-closure eslint google-closure-linter


    【解决方案1】:

    我不相信闭包 linter 理解 JSX。至于配置 eslint,让它知道 'goog' 是全局的并且不显示警告,把它放在你的 .eslintrc 文件中:

    YAML

    globals:
      $: true
      goog: true
    

    JSON

    {
        "globals": {
            "$": true,
            "goog": true
        }
    }
    

    这里是 eslint documentation

    【讨论】:

      猜你喜欢
      • 2012-07-01
      • 2021-10-30
      • 2021-07-17
      • 1970-01-01
      • 2017-06-08
      • 1970-01-01
      • 2015-10-31
      • 1970-01-01
      • 2018-10-07
      相关资源
      最近更新 更多