Specifying Globals is not working
I want to set Specifying Globals in .eslintrc.js file, but it is not working. Specifying Globals - ESLint document: https://eslint.org/docs/user-guide/configuring#specifying-globals
This is my setting:
// .eslintrc.js
module.exports = {
root: true,
env: {
browser: true,
node: true
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended'
],
// add your custom rules here
rules: {
semi: [2, 'never'],
'indent': [2, 'tab'],
'no-tabs': 0,
'no-console': 'off',
'vue/max-attributes-per-line': 'off'
},
globals: {
TweenMax: false,
TimelineLite: false
}
}
When I use them in .vue file, example:
console.log(TweenMax)
And always show error:
error 'TweenMax' is not defined no-undef
How should I do?
Package version: nuxt: 2.11.0 @nuxtjs/eslint-config: 1.1.2 @nuxtjs/eslint-module: 1.1.0
globals: {
TweenMax: 'readonly',
TimelineLite: 'readonly'
}
PS: there is an NPM module for GSAP
Yes, I know that. I want to use GSAP CDN, and I import it use global setting in nuxt.config.js head.script.
When I use plugin in every *.vue file, I use comment to resolve error, like this:
// eslint-disable-next-line no-undef
const tl1 = new TimelineLite()
// eslint-disable-next-line no-undef
TweenMax.to(...)
It is not convenient.
Any updates on this issue?
I believe this is not an issue of Nuxt's config, but more like a ESLint config question - and solution is already answered in https://github.com/nuxt/eslint/issues/90#issuecomment-618463677