[英]How to handle unused variable in js files eslint errors?
I have two different js files one is called alert.js 我有两个不同的js文件,一个叫做alert.js
alert.js alert.js
function alerts(){ alert('HI'); }
Another one is called draw.js 另一个叫做draw.js
function call_alert(){ alerts(); }
When you have functions or variables that are defined in the global scope in one file but used in another, you can use exported comments to tell ESLint that they're intended to be used elsewhere. 如果在一个文件中具有在全局范围中定义但在另一个文件中使用的函数或变量,则可以使用导出的注释来告诉ESLint它们打算在其他地方使用。 (Note that this doesn't apply to Node.js or ES modules, which don't have global scope.)
(请注意,这不适用于没有全局范围的Node.js或ES模块。)
/* exported alerts */
function alerts() {
alert('HI');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.