Prohibiting the specified code detecting eslint

Sometimes we introduce external API document, eslint not recognized, there will warn compile time

eslint can disable the detection of the specified code:

Single-line comments

let map = new BMap.Map('map') // eslint-disable-line // eslint-disable-next-line let map = new BMap.Map('map') 

Multi-line comments
/* eslint-disable */
export function getAddressByLngLat (lng, lat) { return new Promise((resolve) => { let myGeo = new BMap.Geocoder() myGeo.getLocation(new BMap.Point(lng, lat), function (result) { if (result) { resolve(result) } }) }) } /* eslint-enable */

File Comments

Rules prohibit a warning for the entire file, the  /* eslint-disable */block comment at the top of the file.

You can see, eslint's not warn the compiler success

 

Guess you like

Origin www.cnblogs.com/buxiugangzi/p/12512866.html