Grork Grork - 24 days ago 5
Node.js Question

Ignore specific error for eslint in the whole project

I'm using AdonisJs (NodeJS framework) and they created a function called

use
to import file like they'd be namespaces, for example
use('App/Services/User')
instead of
require('../app/Services/User')
.

The problem is that eslint will throw the error
'use' is not defined no-undef
.

At this time I have two ways:


  1. Putting an eslint comment to disable alert for that line in each file, but it's annoying

  2. Use
    require
    instead of
    use
    , but it's a lot useful the function.



Is there a way to disable "one time for all" the specific
no-undef
for the
use
function in the whole project?

Answer Source

Take a look at globals sections at .eslintrc config.

{
    "globals": {
        "use": false
    }
}