eslint-friendly-formatter
eslint-friendly-formatter copied to clipboard
Parameters after double-dash not working
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:
-
EFF_NO_SOURCE - 00a875982f8a7cdfda55cc9fb76743559a25d491
- Acts like the parameter 'eff-no-source' (not currently mentioned in the README). The parameter takes precedence.
-
EFF_BY_ISSUE - 06ea4c5df3e2d1f66beab3511ba98cae2fdfe8b1
- Acts like the parameter 'eff-by-issue'. The parameter takes precedence.
-
EFF_CODE_FRAME_OPTIONS - a5b28f3ad51f86327cbd1a87f42c063e2b50322e
- New adjustable feature. Allows overwriting the default output of the Babel code frames.
-
EFF_RULE_SEARCH_LINK - 82003961b0a9836e5e87fba7c7c7a055e4655a8a
- New adjustable feature. Allows overwriting the default link prefix to non-standard ESLint rules which currently points to Google Search. I prefer Duck Duck Go for instance.
hi @Xerillio, those features seem reasonable. Feel free to open a MR
Really appreciate all your contributions
@royriojas Glad to hear it.
I added an env var version of the CLI option --eff-filter
- EFF_FILTER
as well. See #48.