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
Correct documentation on the editorconfig
option.
#15255
Comments
https://prettier.io/docs/en/configuration#configuration-schema "editorconfig": {
"description": "Whether parse the .editorconfig file in your project and convert its properties to the corresponding Prettier configuration. This configuration will be overridden by .prettierrc, etc.",
"default": false,
"type": "boolean"
}, |
Configuring Prettier with .editorconfig, I ran into the same problem. Reading the doc and checking the JSON schema, version: "prettier": "3.0.3"
editorconfig: true # problem!
printWidth: 100
singleQuote: true
trailingComma: "es5"
semi: true
arrowParens: "avoid" Where am I going wrong? edit: even without the |
|
Maybe we can mention in the docs (here) that the CLI always reads the |
I don't think this is always true. Or at least, the cli is not respecting the use of tabs unless it's specified in the .prettierrc file. |
@shantanu-bbai I don't experience the behaviour you describe. These are my config files and I reliably get tabs as the indentation character: .prettierrc
.editorconfig
Used version of prettier is |
Hi @JoepKockelkorn, I'm fairly new to prettier and csharpier (we're just starting to use both) so its entirely possible I don't know what I'm doing. My initial plan was not to use the .prettierrc file at all (though I had planned on having an empty file in our git project just so new devs would realize that we're using prettier) and just use the .editorconfig for everything. Here are the contents of my files: .prettierrc (what I ended up having to populate instead of having an empty file - these configurations are picked up by the prettier commadline execution)
.editorconfig prettier configuration
So maybe I should step back. I was looking through the project docs and I don't believe I've found a full set of possible configuration options listed (preferably both the editorconfig and prettierrc options since they aren't exactly the same). Most of the options I've found through stackoverflow threads. Could you point me to an exhaustive set of options for prettier? Also, can you tell me what has to go in prettierrc (i.e. cannot be configured via .editorconfig) if anything? Lastly, can you tell me what I'm doing wrong with my configs (editorconfig specifically)? We're using the most recent version of prettier:
|
@shantanu-bbai I will offer my help to you, but I have no experience with csharpier. Besides, it's unclear what you're trying to achieve. What are you using these tools for, what's your goal? It's good to realise that editorconfig and prettier are both formatting tools but they slightly differ in scope and features. Editorconfig tries to bring a standardised formatting experience from the IDE perspective for nearly every file format. Without using an IDE (and plugin) to format your files, your Prettier is similar, but different. It is much more opinionated, which means that there are some settings to tweak its behaviour, but some things just work as they do without a way to configure its behaviour. Also, it only works on certain file formats, not just every file. Prettier is pluggable though, so you can make it work for xml files using https://github.com/prettier/plugin-xml, but it doesn't work out of the box in contrast to editorconfig. Also, Prettier has extensions/plugins for your IDE to format files there, but it also has a CLI to format independent of your IDE. This opens possibilities to use it in CI to guarantee your files adhere to the configured prettier format using Some settings of Prettier overlap with editorconfig settings. Try searching for 'editorconfig' on the Prettier configuration page. For those, it's better to omit them from the Prettier configuration so Prettier will read them from the The documentation websites of both tools are pretty good, so any remaining questions you have will probably be answered by reading them: |
@shantanu-bbai, it looks like Prettier's options documentation lists the printWidth
tabWidth
useTabs
Maintainers, is this an exhaustive list of settings read from |
You've missed |
The issue is related to #6176
The documentation describes a
editorconfig
option, and trying to implement results in an error (tried both ways):#6176 Says there is no
editorconfig
option, please update the documentation:https://prettier.io/docs/en/configuration#editorconfig
Having read more documentation, I think the documentation is refering to the API option: https://prettier.io/docs/en/api#prettierresolveconfigfilepath--options
Maybe the documentation should clarifying that it is a Node.js API configuration option object, and not a configuration file option, which is not an unreasonable conclusion in the given context of info about a config file
The text was updated successfully, but these errors were encountered: