Specifies that the JS file does not use the ESLint syntax check

Source: Internet
Author: User

Demand

When we actually develop, we often need to introduce third-party developed programs. Some cannot be installed through NPM, only manually put files into the project. The actual development of these projects did not follow the strict ESLint syntax. This time we need to manually configure ESLint .

Use

ESLintis designed to be fully configurable, you can switch each rule, or you can customize the rules. The configuration of each rule is not explained in detail here, only a simple and practical way to not use grammar checking for a specified file ESLint .

Suppress rule warnings throughout file scope

will be /* eslint-disable */ placed at the top of the file

/* eslint-disable */alert(‘foo‘);
Temporary suppression rule warning in file

Wrap blocks of code that need to be ignored in comments

/* eslint-disable */alert(‘foo‘);/* eslint-enable */
Enable or disable warnings for a specified rule

Wrap blocks of code that need to be ignored in comments

/* eslint-disable no-alert, no-console */alert(‘foo‘);console.log(‘bar‘);/* eslint-enable no-alert, no-console */
Disable rule warnings for a specified row

There are two forms of this method, see below.

alert(‘foo‘); // eslint-disable-line// eslint-disable-next-linealert(‘foo‘);
Disables a specified rule on a specified line
alert(‘foo‘); // eslint-disable-line no-alert// eslint-disable-next-line no-alertalert(‘foo‘);
To disable multiple rules on a particular line
alert(‘foo‘); // eslint-disable-line no-alert, quotes, semi// eslint-disable-next-line no-alert, quotes, semialert(‘foo‘);

Specifies that the JS file does not use the ESLint syntax check

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.