eslint-plugin-lodash icon indicating copy to clipboard operation
eslint-plugin-lodash copied to clipboard

_ is not defined error even when pragma declared

Open Quitch opened this issue 5 years ago • 0 comments

eslint v6.4.0 eslint-plugin-lodash v6.0.0

'_' is not defined.

_ is not defined is being produced as an error, seemingly regardless of the settings assigned.

I am using plugin:lodash/v3, which defines pragma as _ in its settings, yet all _ references are still causing eslint to produce an error.

An example of such code:

  newPersonalities = _.mapValues(newPersonalities, function (personality, name) {
    var result = _.assign(_.clone(baseline), personality);
    result['name'] = name;
    return result;
  });

The .eslintrc.json config:

{
  "env": {
    "browser": true,
    "node": true,
    "jquery": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:lodash/v3"
  ],
  "plugins": [
    "lodash"
  ]
}

I would expect _ to not generate an error, despite the lack of any import or require, due to the pragma setting.

Quitch avatar Sep 14 '19 23:09 Quitch