指定js文件不使用 ESLint 语法检查

  1. 整个文件范围内禁止规则出现警告,将/* eslint-disable */放置于文件最顶部
/* eslint-disable */
复制代码
  1. 在文件中临时禁止规则出现警告,将需要忽略的代码块用注释包裹起来
/* eslint-disable */
    alert('foo');
/* eslint-enable */
复制代码
  1. 对指定规则的启用或者禁用警告,将需要忽略的代码块用注释包裹起来
/* eslint-disable no-alert, no-console */
    alert('foo');
    console.log('bar');
/* eslint-enable no-alert, no-console */
复制代码
  1. 对指定行禁用规则警告,有两种形式
alert('foo'); // eslint-disable-line

// eslint-disable-next-line
alert('foo');
复制代码
  1. 在指定行上禁用指定的某个规则
alert('foo'); // eslint-disable-line no-alert

// eslint-disable-next-line no-alert
alert('foo');
复制代码
  1. 在某个特定的行上禁用多个规则
alert('foo'); // eslint-disable-line no-alert, quotes, semi

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

你可能感兴趣的:(指定js文件不使用 ESLint 语法检查)