xsnow
机遇总是留给有准备的人

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

将/* 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');
posted on 2019-09-27 10:40  xsnow  阅读(3080)  评论(0编辑  收藏  举报