普通忽略错误
// eslint-disable-next-line 选项
// eslint-disable-next-line no-undef
如果一行有多个错误,该如何忽略呢
方法1
// eslint-disable-next-line no-unused-vars
const a = 1; // eslint-disable-next-line no-undef
console.log(b);
方法2:使用逗号或分号将它与第一个注释分隔开。
// eslint-disable-next-line no-unused-vars, no-undef
const a = 1;
console.log(b);
如何有很多行连在一起,如何批量忽略错误呢
/* eslint-disable no-undef */
const a = 1;
const b = c;
const d = 3;
/* eslint-enable no-undef */
// 或者
// eslint-disable-next-line no-undef
const a = 1;
// eslint-disable-next-line no-undef
const b = c;
// eslint-disable-next-line no-undef
const d = 3;