Disabling tslint for a block of code with tslint:disable does not work
Asked Answered
S

3

7

I'm trying to disable TSlint (Version: typescript 3.5.2, tslint 5.18.0) for a block of code in a VueJS project but it doesn't seems to work (it still displays errors and warning for this block at compilation with npm run serve)

I've already tried to use commented tslint:disable and eslint-disable without success.

Thanks for your help

Spalato answered 4/7, 2019 at 10:47 Comment(0)
H
8

Recently I have faced same issue in my Angular project below is how I solved my problem.

  // tslint:disable
  (event.keyCode >= A && event.keyCode <= Z) ||
  (event.keyCode >= ZERO && event.keyCode <= NINE) ||
  event.keyCode === SPACE ||
  (this.preventHomeEndKeyPropagation &&
  (event.keyCode === HOME || event.keyCode === END))
  // tslint:enable
Haaf answered 15/7, 2020 at 12:15 Comment(0)
G
3

The one way left: use // @ts-ignore over every line you want to skip checking (i hope the block is not too large)

Gambit answered 4/7, 2019 at 11:24 Comment(1)
Thanks for your suggestion but this doesn't work either... It seems like npm run serve invokes another linter than TSlint but I don't know which one nor do I know how to disable it for few linesSpalato
H
3

You can also disable a specific rule for a block of code like that:

// tslint:disable:max-line-length
...your code here
// tslint:enable:max-line-length
Haddington answered 17/1, 2022 at 12:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.