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

Parameters after double-dash not working #47

Open
Xerillio opened this issue Nov 14, 2021 · 2 comments
Open

Parameters after double-dash not working #47

Xerillio opened this issue Nov 14, 2021 · 2 comments

Comments

@Xerillio
Copy link
Contributor

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 eslint/eslint#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 - 00a8759
    • Acts like the parameter 'eff-no-source' (not currently mentioned in the README). The parameter takes precedence.
  • EFF_BY_ISSUE - 06ea4c5
    • Acts like the parameter 'eff-by-issue'. The parameter takes precedence.
  • EFF_CODE_FRAME_OPTIONS - a5b28f3
    • New adjustable feature. Allows overwriting the default output of the Babel code frames.
  • EFF_RULE_SEARCH_LINK - 8200396
    • 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.
@royriojas
Copy link
Owner

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

Really appreciate all your contributions

@Xerillio
Copy link
Contributor Author

@royriojas Glad to hear it.

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

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 a pull request may close this issue.

2 participants