【问题标题】:Ignore Global variables in Codacy忽略 Codacy 中的全局变量
【发布时间】:2019-11-14 09:14:24
【问题描述】:

我在我的 angularjs 项目中使用 eslint。我的项目有一个与 Codacy 的 Github 集成(使用配置文件)。我已经在 .eslintrc 文件中配置了需要从 linting 中忽略的全局变量,如下所示:

{
  "extends": "eslint:recommended",
  "plugins": ["angular"],
  "env": {
    "browser": true,
    "jasmine": true,
    "node": true,
    "es6": true,
    "amd": true
  },
  "globals": {
    "angular": true,
    "module": true,
    "inject": true,
    "_": true,
    "L": true,
    "$": true,
    "Highcharts": true,
    "numeral": true
  },
  "rules": {
    "angular/on-watch": 0,
    "semi": 2
  }
}

这在 IDE 中运行良好,我没有收到任何错误。但是 Codacy 没有选择全局忽略的变量,并且一直抱怨角度、数字、Highcharts 等的 no-undef。

'angular' is not defined. (no-undef)
'numeral' is not defined. (no-undef)

如何修复此配置?

【问题讨论】:

    标签: angularjs eslint codacy


    【解决方案1】:

    您应该更改项目代码模式 ESLint 配置以使用 Code Patterns -> ESLint

    中的配置文件

    干杯

    【讨论】:

    • @Pankaj 你的项目根目录中有你的配置文件吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    • 1970-01-01
    • 2011-11-12
    • 2014-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多