错误“_”未定义 no-undef
error '_' is not defined no-undef
我使用 eslint 检查我的代码,但发生错误 -- "error '_' is not defined no-undef".
我这样写代码:
new webpack.ProvidePlugin({
$: "jquery",//jquery
jQuery: "jquery",
"window.jQuery": "jquery",
_:"lodash"//lodash
})
并得到 .eslintrc.js,其中的一部分是这样的:
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery":true,
},
在我将 jquery 添加到之前,它发生了一个错误 -- "error '_' is not defined no-undef"。
但是,当我将 lodash 添加到时,就像那样“'lodash':true”。它不起作用。
你能帮帮我吗?
ESLint 不理解 lodash 库。
您需要在配置中添加一个全局部分。
"globals": {
“_“: 真的
},
我使用 eslint 检查我的代码,但发生错误 -- "error '_' is not defined no-undef".
我这样写代码:
new webpack.ProvidePlugin({
$: "jquery",//jquery
jQuery: "jquery",
"window.jQuery": "jquery",
_:"lodash"//lodash
})
并得到 .eslintrc.js,其中的一部分是这样的:
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jquery":true,
},
在我将 jquery 添加到之前,它发生了一个错误 -- "error '_' is not defined no-undef"。 但是,当我将 lodash 添加到时,就像那样“'lodash':true”。它不起作用。
你能帮帮我吗?
ESLint 不理解 lodash 库。 您需要在配置中添加一个全局部分。
"globals": { “_“: 真的 },