Tslint: Default to the `stylish` formatter

Created on 7 Nov 2017  路  10Comments  路  Source: palantir/tslint

I think TSLint should have a nice out-of-the-box experience. The current default prose formatter is not very nice. It doesn't even show the rule name.

ESLint, for example, defaults to their stylish formatter. So does XO.

Breaking Change Enhancement

Most helpful comment

At the very least it would be nice to have an option in tslint.json that allows us to set which formatter we want to use by default.

All 10 comments

I agree. Especially the missing rule name is quite annoying.

Related: #2228

I think the output of verbose and prose is more user friendly since you can simply click on the error location and your IDE will automatically open the correct file at the correct location.

Maybe we can make this configurable in tslint.json. Though I don't know what we would do when there are multiple config files involved.

I think the output of verbose and prose is more user friendly since you can simply click on the error location and your IDE will automatically open the correct file at the correct location.

With what IDE? It's using the format index.ts[28, 18], but most terminals and editors expect the format index.ts:28:18.

How about adding that feature to the stylish formatter then? This is what I've been using for years in the JS world and users are very happy about it: https://github.com/sindresorhus/eslint-formatter-pretty (This one actually hides the column/line using ansi escapes, so the filename title is clickable, but the column/line is not visible).

With what IDE? It's using the format index.ts[28, 18], but most terminals and editors expect the format index.ts:28:18.

I'm talking about VSCode. Visual Studio also supports this.
However, if there is a problem with compatibility, we could change the behavior in the next major version.

This one actually hides the column/line using ansi escapes, so the filename title is clickable, but the column/line is not visible

I don't get how that would work when there are multiple lint errors in one file. The output of stylish is

myFile.ts
1:14  semicolon  Missing semicolon
2:10  semicolon  Missing semicolon

I don't get how that would work when there are multiple lint errors in one file. The output of stylish is

The line/column is hidden in the title. So the output is actually:

myFile.ts:1:14
1:14  semicolon  Missing semicolon
2:10  semicolon  Missing semicolon

You only get the first lint violation, but that's usually good enough, as the editor plugin takes over from there.

This would be much easier to scan through the output. The current default output is a nightmare when you have quite a few errors.

At the very least it would be nice to have an option in tslint.json that allows us to set which formatter we want to use by default.

Now that the stylish formatter has clickable file names, let's adopt TypeScript's --pretty defaults. If the console supports it, it sounds like we should default to stylish; otherwise, we should default to verbose.

Removing the Type: Breaking Change label per #4811. Now accepting PRs!

Was this page helpful?
0 / 5 - 0 ratings