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
Add Prettier configuration file (prettier.config.js) #3713
Add Prettier configuration file (prettier.config.js) #3713
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3713 +/- ##
=======================================
Coverage 93.34% 93.34%
=======================================
Files 178 178
Lines 1849 1849
Branches 332 332
=======================================
Hits 1726 1726
Misses 105 105
Partials 18 18 Continue to review full report at Codecov.
|
(Correction to printWidth, 100 is the Airbnb recommendation but 80 is the Prettier default.) |
The Prettier config file doesn't actually read in .editorconfig, which I found out today: This is not obvious from their API*, but the effect is that a valid Prettier config file basically makes .editorconfig irrelevant (the only .editorconfig exclusive option is the UTF-8 option, which is the default for VS Code). Additionally, line endings are most appropriately handled by .gitattributes as per PR #3760, though there is nothing wrong with enforcing them in the Prettier config file. I don't see a strong reason to delete the .editorconfig file, however. But as discussed in this PR #3713, the current expectation for developers is that they have their VS Code or other IDE settings for Prettier configured per the Airbnb defaults used by this tailwindlabs/tailwindcss project. The majority of Tailwind projects have Prettier config files, except the main one. Cheers! *Reference: https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath--options |
So I don't know a ton about how all of this stuff is configured but this causes all of the options to be duplicated in .eslintrc.json as well as in prettier.config.js. Surely there's a way to just have this stuff in one place? |
Hey @adamwathan! I tried to organize this to make it easy to read:
1. Why
|
ReferencesSource 1
from https://www.npmjs.com/package/eslint-plugin-prettier Source 2 Source 3 |
Thanks makes sense now! |
A Prettier configuration file is needed for those of us who aren't using the Airbnb style guide as our default Prettier configuration.
The EditorConfig configuration file .editorconfig doesn't cover all of the custom Prettier settings specified in the .eslintrc.json file.
This prettier.config.js file includes the
editorconfig: true
setting to read .editorconfig automatically as well as comments about settings that vary from Prettier's defaults.What does this do?
This pull request fixes the eslint(prettier/prettier) errors while coding using the Prettier extension for VSCode without needing to run the
npm run style -- --fix
command.Currently, only users with a custom Prettier configuration in VS Code matching Airbnb's style guide won't see ESLint errors in every TailwindCSS file. Everybody else with Prettier configured will see errors until they run the ESLint --fix command.
The text was updated successfully, but these errors were encountered: