通过 <script> 包含的 ESLint 全局变量导致未定义错误
ESLint global vars included via <script> are causing undefined error
我的 React 应用程序与 WebPack 捆绑在一起,它使用通过标签包含并在 WebPack 外部定义的全局脚本(例如 jQuery)。
但我的 ESLint 配置不知道它们,我在 ESLint 中收到 'no-unded'
错误。
那么我如何告诉 ESLint 这些不是未定义的变量,或者我应该以某种方式更改我的 WebPack 配置?
您是否尝试在 .eslintric.js 配置文件中添加全局变量
module.exports = {
"env": {
"browser": true,
"node": true
},
"globals": {
"SomeVar": true
},
};
我的 React 应用程序与 WebPack 捆绑在一起,它使用通过标签包含并在 WebPack 外部定义的全局脚本(例如 jQuery)。
但我的 ESLint 配置不知道它们,我在 ESLint 中收到 'no-unded'
错误。
那么我如何告诉 ESLint 这些不是未定义的变量,或者我应该以某种方式更改我的 WebPack 配置?
您是否尝试在 .eslintric.js 配置文件中添加全局变量
module.exports = {
"env": {
"browser": true,
"node": true
},
"globals": {
"SomeVar": true
},
};