How to rewrite tslint rule for particular file?
Asked Answered
L

2

6

I prefer quotemark: [true, "single"], but for lib.core.es6.d.ts I need use "double".

I tried use comments like eslint:

/*tslint qoutemark: [true, "double"]*/

but it doesn't work.

Maybe I can ignore some files using tslint.json?

Lustreware answered 7/2, 2016 at 11:47 Comment(1)
It's probably best to not bother running tslint on files you don't maintain.Photoneutron
P
13

Currently you cannot change the options for a rule - you can only enable/disable a rule for specific lines of code.

For example, say you had the object-literal-sort-keys rule enabled in your tslint.json file. You could then do something like this to disable it for a portion of a file and then renable it for the rest of the file:

/* tslint:disable:object-literal-sort-keys */
const range = {
   min: 5,
   middle: 10,    // TSLint will *not* warn about unsorted keys here
   max: 20
};
/* tslint:enable:object-literal-sort-keys */

See the TSLint website for more information.

Psilomelane answered 9/2, 2016 at 17:3 Comment(0)
L
1

Hm... Comment like this work:

/* tslint:disable:variable-name quotemark:[true, "double"] */

issue solved.

Lustreware answered 7/2, 2016 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.