bamlab / bamlab/react-native-project-config

[RFC]: remove use of eslint-plugin-prettier

Open
#50 10 comments 0 reactions 0 assignees View on GitHub
⭐ enhancement 📏 eslint-plugin
Dominant language
TypeScript
Stars
9
Forks
0
Avg merge
10h 29m
Merged PRs (30d)
2

Description

### Why?

I find that having integrated `eslint-plugin-prettier` into the package deteriorates the dev experience and adds useless complexity to the esLint config.

By activating this plugin, formatting errors that are found by Prettier are now handled by esLint. This means that whenever you have a missing space or a line that needs to be split up you get those red squiggly lines in the editor, which creates some unnecessary pollution in the mind of the developper.

Moreover, [the official Prettier documentation advises against using linter to format the code](https://prettier.io/docs/en/integrating-with-linters.html):

>When searching for both Prettier and your linter on the Internet you’ll probably find more related projects. These are generally **not recommended**, but can be useful in certain circumstances.

>The downsides of those plugins are:
>You end up with a lot of red squiggly lines in your editor, which gets annoying. Prettier is supposed to make you forget about formatting – and not be in your face about it!
>They are slower than running Prettier directly.
>They’re yet one layer of indirection where things may break.

In my opinion, a better solution would be to have:
- `formatOnSave` enabled in the editor so that the dev doesn't have to care about formatting and it is done automatically,
- a script in `package.json` that can prettify the whole codebase (`prettier -w .`),
- a script in `package.json` that errors if some files are not formatted correctly, which can be useful in a pre-push hook or in a CI (`prettier -c .`).

### Rule Documentation 📜

https://github.com/prettier/eslint-plugin-prettier

### Config Selection 🛠

`recommended`

### (Optional) Additional Details 📝

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.