Improve DX by enable automatic formatting on save (i.e., auto-fix formatting issues via ESLint/Prettier) #2633
Replies: 3 comments 6 replies
-
In my Github project, the example ESLint/Prettier configuration along with the provided links explain how this works |
Beta Was this translation helpful? Give feedback.
-
That seems pretty invasive. Although I typically use that tooling, I wouldn't want Remix to dictate what should be used. With the new Stacks feature, you can create your own templates with all your tooling configured exactly as you want. Then all your new projects can use that. |
Beta Was this translation helpful? Give feedback.
-
Maybe I was not clear enough. I would only propose to add the two dependencies and the change to .eslintrc.js. But the VS Code .vscode/settings.json shouldn't be part of the codebase or commented out. Just a small section in the documentation to know how to activate it in VS Code or other IDEs, such as IntelliJ. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Idea / What is my suggestion
With a few changes, a Remix project would be out of the box capable of automatically formatting code files on a save action. This would improve the DX for those VS Code and IntelliJ developers (most likely for other editors/IDEs too) that like this workflow.
In principle, my request is to add two dependencies and make a minor change in .eslintrc.js to make this happen. I could create a PR, if this is considered useful.
What needs to be done
In my current Remix project (Indie stack) I enabled the following ESLint/Prettier workflow for VSCode with the following steps:
extends: [
"@remix-run/eslint-config",
"@remix-run/eslint-config/node",
"@remix-run/eslint-config/jest-testing-library",
"plugin:prettier/recommended",
]
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
}
}
I'm not sure if this .vscode/settings.json should be committed but a short section in the docu on ESLint/ Prettier to explain how to enable auto-fix / auto-formatting on save for IntelliJ or VS Code would be most likely the best way.
Beta Was this translation helpful? Give feedback.
All reactions