-
Notifications
You must be signed in to change notification settings - Fork 0
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
[RFC]: remove use of eslint-plugin-prettier #50
Comments
The reason I find it useful to have this as an eslint plugin is because I have autosave enabled in vscode so I don't necessarily do cmd + s to save my files which means I may forget to format them. In the past when working on projects where this wasn't in eslint config I frequently had errors for non formatted files. |
In theory this would be better to do this. But last time I tried I couldn't get it to work properly in VS Code without resorting to unofficial extensions like Maybe this is solved now and with the right VS Code config everything works fine, even when eslint has to apply autofixes? |
@pierrezimmermannbam Hmm I understand, what about having a pre-commit hook that formats your code so you don't forget? @matthieugicquel you mean you couldn't properly format the code with |
@antoine-cottineau I'm really not a big fan of pre-commit hooks, it's too late in your dev flow and in the end everybody ends up comitting with no-verify because it's super annoying. Formatting is rather fast though so in this case it seems reasonable. Another downside is it's one more thing to setup to have a correct dev environment |
@antoine-cottineau I mean that when I have the config you described + an eslint config with autofixes (not necessarily rules that conflict, but rules that change the formatting too), I couldn't get VS code to reliably and deterministically run the eslint autofixes first and then prettier after, which is necessary to get correctly formatted and non-broken code. |
@pierrezimmermannbam I agree with you for the pre-commit hook but I would make an exception for formatting as you don't really need it early in your dev flow. @matthieugicquel Oh okay that's a shame. In that case I understand that having esLint rules for syncing with Prettier is maybe the best solution, even if I think it's not a good one 😅 |
I have an other issue by using It happened already on the past : we could not prettify our fixtures, which occured to be in the "eslintignore" file I haven't investigate further, I will temporarly go back to the classic prettier formatter, I'll let you know if I understand what happens - or let me know if you have an other recommandation on its usage or not with BAM eslint plugin! |
Update : all I needed to do was to restart VSCode after installing the BAM eslint plugin (source: https://stackoverflow.com/a/72681182 - it makes sense, actually) |
Hi there! I wanted to share with you what the creator of vitest thinks about formatting in linting. I couldn't have a solid opinion about it. |
So, I am totally in favor of integrating Prettier into ESLint. I generally recommend completely ditching Prettier and relying on ESLint with auto-fix on save. Why? Because it's the best solution I've found in recent years to solve the countless problems I've seen with people's VSCode configurations. Issues like the vscode prettier extension acting up, forgotten eslint rules (I don't know). My experience: one tool = one single source of truth = no more hassle. Then again, maybe the VSCode Prettier extension has stopped messing around, but it drove me so crazy that I just stopped trying 😛 Also, we want to check the format with ESLint anyway (unless there's a “prettier check” mode?). So, we will need to run ESLint at some point anyway. Edit: looks like there's a |
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:
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,package.json
that can prettify the whole codebase (prettier -w .
),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
The text was updated successfully, but these errors were encountered: