Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Default to the stylish formatter #3460

Closed
sindresorhus opened this issue Nov 7, 2017 · 10 comments · Fixed by #4872
Closed

Default to the stylish formatter #3460

sindresorhus opened this issue Nov 7, 2017 · 10 comments · Fixed by #4872

Comments

@sindresorhus
Copy link

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.

@SamVerschueren
Copy link

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

@ajafff
Copy link
Contributor

ajafff commented Nov 7, 2017

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.

@sindresorhus
Copy link
Author

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.

@sindresorhus
Copy link
Author

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).

@ajafff
Copy link
Contributor

ajafff commented Nov 7, 2017

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

@sindresorhus
Copy link
Author

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.

@SamVerschueren
Copy link

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

@myspivey
Copy link

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.

@JoshuaKGoldberg
Copy link
Contributor

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.

@JoshuaKGoldberg
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants