Skip to content

style: prettier ignore all files outside of the src folder

Marwan Zibaoui requested to merge prettierignore into next

Opening this MR to gather feedback:

It is quite common for developers to configure their code editor to "format on save". I know I love to use that feature, it even has the neat side effect of validating the syntax of the code, as code with syntax errors cannot be automatically formatted.

Now in our repository, only files under the /src folder are formatted with prettier. This means that developers with format on save enabled must be careful to always "save without formatting" or simply saving the file will cause it to have changes.

We can solve this problem by adding a .prettierignore file that lets code editor know which files should and should not be formatted. Moreover this also explicitly encodes the fact that only files in the src folder are formatted with prettier.

This is also in line with our usage of eslint where we achieve the same result by having the .eslintrc.js file in the src folder, making it explicit that the eslint config only applies to that folder. In the case of prettier i believe an ignore file is better as moving the config file to the folder would not solve the "disabling format on save" issue.

Please like and subscribe and let me know what you think in the comment section 👇 🙏

Edited by Marwan Zibaoui

Merge request reports