整个文件范围内禁止出现警告

将/* eslint-disable */放置于文件最顶部

/* eslint-disable */
alert('foo');

在文件中临时禁止规则出现警告

将需要忽略的代码块用注释包裹起来

/* eslint-disable */
e._key = 'a';
/* eslint-enable */

对指定规则的启用或者禁用警告

将需要忽略的代码块用注释包裹起来

/* eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/* eslint-enable no-alert, no-console */

对指定行禁用规则警告

// 对当前行禁用规则警告
alert('foo'); // eslint-disable-line
// 对下一行禁用规则警告
// eslint-disable-next-line
alert('foo');

在指定行上禁用指定的某个规则

alert('foo'); // eslint-disable-line no-alert

// eslint-disable-next-line no-alert
alert('foo');

// eslint-disable-next-line max-len
isUserManageReviewOperate: _.get(rolePermissions, Permission.PERMISSION_USER_MANAGE_REVIEW_OPERATE),

在某个特定的行上禁用多个规则

alert('foo'); // eslint-disable-line no-alert, quotes, semi

// eslint-disable-next-line no-alert, quotes, semi
alert('foo');

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2021-07-28
  • 2021-06-10
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
  • 2021-11-03
  • 2021-10-02
  • 2022-12-23
相关资源
相似解决方案