royriojas / eslint-friendly-formatter

A simple formatter/reporter for ESLint that's friendly with Sublime Text and iterm2 "click to open file" functionality
MIT License
198 stars 28 forks source link

Parameters after double-dash not working #47

Open Xerillio opened 2 years ago

Xerillio commented 2 years ago

The issue

I've tried customizing the output from the formatter using the suggested approach with a double-dash in front to allow the formatter to read those parameters that ESLint otherwise does not support passing to the formatter. I'm not sure if this is caused by a later version of ESLint (since it was added to the README in this project) or if it's a terminal specific issue. An example of running ESLint with this formatter:

eslint . --ext .js,.jsx,.ts,.tsx -f friendly -- --eff-by-issue

In the output I get:

Oops! Something went wrong! :(

ESLint: 8.1.0

No files matching the pattern "--eff-by-issue" were found.
Please check for typing mistakes in the pattern.

This is when running from PowerShell and the result is the same from Git Bash on Windows.

Solutions

I see in https://github.com/eslint/eslint/issues/3013 that there was talk about outputting the ESLint results as JSON to stdout to allow external utilities to do the same as a formatter and thus allowing more control over/customizability of the formatter. Is this formatter mirrored in another CLI tool?

If not, as an alternative, I've added some of the parameters as environment variables in my fork: Xerillio/eslint-friendly-formatter. If this seems like an acceptable solution, I'll gladly create a PR for it. It includes the following so far, but could be updated to cover all parameters if preferred:

royriojas commented 2 years ago

hi @Xerillio, those features seem reasonable. Feel free to open a MR

Really appreciate all your contributions

Xerillio commented 2 years ago

@royriojas Glad to hear it.

I added an env var version of the CLI option --eff-filter - EFF_FILTER as well. See #48.