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:
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?
Take a look at globals sections at .eslintrc config.
{
"globals": {
"use": false
}
}
You can configure you eslint on your .eslintrc.json
Reference on their official page: https://eslint.org/docs/user-guide/configuring
For no-undef rule, you can add global in the configuration by
{
"globals": {
"var1": true,
"var2": false
}
}
Also specified in their documentation: https://eslint.org/docs/user-guide/configuring#specifying-globals
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With