简体   繁体   中英

tslint:disable not working properly

I'm using VSCode, and have TSLint plugin installed. Apart from this I also have eslint configured for my app. However, for one line, I'm trying to disable eslint with the below code.

if (!Intl) {
  // eslint-disable-next-line global-require no-global-assign
  Intl = require('intl')
}

However, when I run my linter it still shows an error. What am I doing wrong?

Usually with vs code, you can just put your cursor on the offending line and type Ctrl + . and the ide will add the appropriate rule.

the syntax you are looking for is // tslint:disable-next-line:max-line-length

Turn out that when specifying multiple rules a , is required in between the rules.

if (!Intl) {
  // eslint-disable-next-line global-require, no-global-assign
  Intl = require('intl')
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM