Eslint and prettier setup for an opensource project

Hello Everyone,
I have an open-source react project. I want to know how to manage contributions to my projects. Recently, some contributors made Pull Request, and there were so many commits in the PR apart from the actual commit code like single quotes changes to double quotes.
You can see in this commit.

I want to know how to avoid these types of commits.
I read on the internet that I need to use eslint and prettier to avoid this, so, I tried to set up the eslint + prettier on the root of the project folder.
Anyone can guide me How to setup it properly in my react app so, I can avoid these types of commit?

Any suggestions apart from this to manage the project contributions. Any help would be much appreciated.

Github Repo Link: https://github.com/rishipurwar1/coding-space

First, this contributor is being a bit rude - it’s perfectly OK to reject a PR for including a bunch of style changes that are unrelated to the functional changes.

If you want to add a tool to your repository to prevent this sort of formatting wars stuff, my general workflow would be

  1. make a new branch
  2. add the configuration files for whatever style tool that you want to use
  3. apply the style changes
  4. add a file with notes to future contributors explaining procedures for making correctly formatted PRs
  5. merge this new branch with the style changes into your main branch
1 Like

Thanks for your response.
I added eslint, prettier and husky to avoid this. Are these tools are enough to avoid styling conflicts?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.