Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Run ESLint with colors in supported environments #85

Merged
merged 5 commits into from Dec 17, 2019

Conversation

MaximDevoir
Copy link
Contributor

My guess is ESLint is disabling color formatting because it's unable to detect a TTY when invoked through execFile().

Comparision

lint-with-no-color

lint-with-color

@koddsson
Copy link
Contributor

koddsson commented Dec 6, 2019

I like this but this would get mangled when running in some CI systems that don't support color.

Maybe we can use supports-color to detect if the terminal supports color or not?

@MaximDevoir
Copy link
Contributor Author

Okay, I'll work on getting that integrated.

@MaximDevoir MaximDevoir changed the title chore: Run ESLint with color output enabled. feat: Run ESLint with colors in supported environments Dec 6, 2019
@MaximDevoir
Copy link
Contributor Author

MaximDevoir commented Dec 6, 2019

I looked through the eslint repo and it seems that they are using a very limited set of colors. Therefore, to run ESLint with the --color flag, the environment only needs to support basic colors (16 colors).

From what I gathered, ESLint uses these colors:

A basic 16-color environment is enough to support the --color flag and the modifiers are widely available.

@koddsson koddsson self-requested a review December 9, 2019 15:54
Copy link
Contributor

@koddsson koddsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good to me.

The stylish-fixes custom formatter that we ship with this project won't get these benefits since we'd need to color the output manually and I think that's probably out of scope for this PR.

@koddsson koddsson merged commit a3e66fc into github:master Dec 17, 2019
@MaximDevoir MaximDevoir deleted the feat/eslint-with-color branch December 20, 2019 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants