-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Is it possible to specify where your config file is? #246
Comments
Much like ESLint and .eslintrc Prettier resolves configuration for a given file by looking up the folder path to find a particular a .prettierrc (or the other config names) in parent folder paths, this allows you to have different configs for different folders. By violating prettier's expectations you'll have to pass a config override to everywhere you configure prettier - in this plugin, when you run prettier on the command line, when you run prettier from your editor - which will break you're ability to do per-folder overrides and sounds like you're inventing a lot of work for yourself just because you don't like having a single file in your root folder. This feature is not available as it makes it easier for people to misconfigure prettier and will lead to surprising results. Please just put your config in the root folder, or as a key in your package.json if the file annoys you that much. |
Hello Ben! Thanks for your response. Well from my point of view ESLint plugin and Prettier plugin already allow you to specify where your config file is, so just for the sake of coherence within the ecosystem would be good to get this here. I do not know the details of how this works but from my ignorant point of view seems a bit strict to not having this just because the user can misconfigure prettier easily. Do not get me wrong, I just placed all my Prettier config within my eslint configuration, so it works and I can live without this, but I am just giving my feedback. Another guy from Reddit was parsing its config file and placing the content within its eslint config everytime eslint config was read by the plugin. Anyway, thank you again Ben. |
If you'd like to send a PR for this feature I would consider it. The best extension point is probably adding an option to the second options argument that gets passed to the rule (in the same object as |
I have come across this issue and noticed that if I specify {
"prettier": "./configs/prettier.js"
} The key part for me was to specify |
It mentions it in the docs as the Shared configurations section - you're still resolving a JS file, it's just a relative file instead of a package. |
Hello all!
Is there a way to specify where your .prettierrc is placed? I have it inside a config folder rather than the root and it seems like is not found. Prettier plugin has now an option "configPath" to specify where the configuration is, so if I format the code using Prettier, the result is ok. However, I still have ESLint/Prettier complaining about using single quotes that has to be converted to double ones (I have single quotes to true) and so on. So it is like the config file is not found.
My idea is to use ESLint/Prettier with Airbnb.
Any idea how can this be resolved?
Thank you in advance and regards
The text was updated successfully, but these errors were encountered: