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

Add optional eslint --fix after prettier #31

Closed
wants to merge 2 commits into from
Closed

Add optional eslint --fix after prettier #31

wants to merge 2 commits into from

Conversation

nanoander
Copy link

This is my proposal to support optional eslint --fix on .js and .jsx files (would be possible .ts and .tsx as well) after applying prettier.
I've been looking for a solution, like prettier-eslint but supporting hooks (I don't find it entirely useful running it only manually) and I didn't find anything that meet my needs.

How to use:

pretty-quick --eslintFix

Note: adding --staged is how I find it more useful

This implementation uses eslint CLIEngine API to get the eslint configuration on every js file, and the apply possible fixes. So simple, no messing options, it takes the current eslint config and goes on.
In my case, I love prettier and standard style guide, so I use prettier for every file and after that, just for js ones, I prefer to run the eslint fixer with standard configuration. This became the straightforward solution.

All current tests are passing after my modifications, but I had not enough time to write new ones.
This is a first commit, so if you consider it a useful improvement and its approach I'll take the time to write its tests and refactoring if needed. Otherwise, I'll be maintaining my own fork up to date, cos I find this a very useful tool when working on a team.

I think this could be related to an open issue, but as I'm not sure I'll wait to reference it.

@azz
Copy link
Member

azz commented May 21, 2018

Thanks for the PR. The related issue is #22 which asks for prettier-eslint support. I want to keep this package as focussed as possible, so it stays maintainable and fast (it is called pretty-quick 😆).

The dynamic requires are good, but I would have thought using prettier-eslint's API would be the way to go? That way we'll be able to take advantage of all the extra formats and inference features that module offers.

@nanoander nanoander closed this May 22, 2018
@nanoander nanoander deleted the addEslintFix branch May 22, 2018 13:13
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.

2 participants