Skip to content
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 clarification notes about EditorConfig #13828

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SiarheiBobryk
Copy link

@SiarheiBobryk SiarheiBobryk commented Nov 12, 2022

Description

Although I'm not a Prettier expert, IMHO the section about the EditorConfig integration is not super clear, to be honest. So I'd add some more words about the relationships between Prettier and EditorConfig.

Please correct me, if I'm missing something.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@SiarheiBobryk
Copy link
Author

Can anyone please review it?

Copy link
Member

@fisker fisker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks.


However, the API _doesn't_ respect `.editorconfig` by default, in order to avoid potential editor integration issues. To opt in, add `editorconfig: true` to the [`prettier.resolveConfig`](https://prettier.io/docs/en/api.html#prettierresolveconfigfilepath--options) options.

> Note: Rules that are set in `.editorconfig` can be overridden by their corresponding rules from `.prettierrc.js`, therefore rules from `.editorconfig` can be used as a fallback for files that Prettier doesn't support. See the languages list supported by Prettier [here](https://prettier.io/docs/en/index.html)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this part: "rules from .editorconfig can be used as a fallback for files that Prettier doesn't support". What does this mean?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say there is a set of rules in .prettier.js and an environment that doesn't support prettier (the not widely used programming language that is not in the Prettier support list for instance).

However, we still have .editorconfig, which has better support for most IDEs.

For example, if, for the reasons above, the printWidth Prettier rule cannot be used, we still have its EditorConfig's alternative max_line_length that will be used as a fallback value.

Does it answer your question, @thorn0?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you mean now, but this isn't clear from the proposed paragraph. A better wording is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants