Search code examples
angularjseslintcodacy

Ignore Global variables in Codacy


I am using eslint in my angularjs project. My project has a Github integration with Codacy (using config file). I have configured my global variables which need to be ignored from linting in the .eslintrc file as below:

{
  "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
  }
}

This works fine within the IDE and I get no errors. But Codacy doesn't pick-up the global ignored variables and keeps complaining about no-undef for angular, numeral, Highcharts etc.

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

How do I fix this configuration?


Solution

  • You should change your project code patterns ESLint configuration to use a configuration file in Code Patterns -> ESLint

    enter image description here

    Cheers