3

Related to my question about the as-syntax, I wanted to look up the tslint rules in order to figure out what went wrong. Alas, I only see error messages of my tslint run like this:

ERROR: src/Metronome/JobFetcher.ts[13, 32]: Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.
ERROR: src/Metronome/JobConfig.ts[20, 1]: Consecutive blank lines are forbidden
ERROR: src/Metronome/JobFetcher.ts[7, 23]: ' should be "

What is missing here is the rule that caused that error. For example, I know that the line ' should be " relates to the rule quotemark in my tsconfig.json:

"quotemark": [
    true,
    "double",
    "avoid-escape"
],

Yet I do not know that for the other rules and since I rely upon tslint:recommended for the bulk of my configuration, it becomes hard for me to look them up once an error occurs I have not seen before, as happened with as-syntax, which I only solved by googling for the as syntax, not via the reference documentation of tslint.

How to know which rules of my tslint config caused the error message?

k0pernikus
  • 60,309
  • 67
  • 216
  • 347

1 Answers1

5

verbose output formatter prints rule name:

$ ./node_modules/.bin/tslint --format verbose --config tslint.js src/render/renderer.ts
ERROR: (no-unused-expression) src/render/renderer.ts[23, 5]: unused expression, expected an assignment or function call
ERROR: (semicolon) src/render/renderer.ts[104, 11]: Missing semicolon
ERROR: (semicolon) src/render/renderer.ts[110, 48]: Missing semicolon
Kirill Dmitrenko
  • 3,474
  • 23
  • 31