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

Prettier should pick up .editorconfig by default or via configuration #1186

Open
theodm opened this issue Apr 26, 2022 · 1 comment · May be fixed by #2364
Open

Prettier should pick up .editorconfig by default or via configuration #1186

theodm opened this issue Apr 26, 2022 · 1 comment · May be fixed by #2364

Comments

@theodm
Copy link

theodm commented Apr 26, 2022

Feature Request:

Prettier usually picks up the '.editorconfig'-File of the project. The following variables will be evaluated:

  • end_of_line
  • indent_style
  • indent_size/tab_width
  • max_line_length

As far as I can see the .editorconfig of the project is currently not being picked up. There's no way to configure spotless to explicitly use a .editorconfig-File. As workaround I currently reconfigure the desired properties:

<...>.config(prettierConfig)

val prettierConfig = mapOf("tabWidth" to 4, "printWidth" to 80)

So my proposal is to ideally support .editorconfig without dedicated config, as alternative the .editorconfig could be supplied as another configuration parameter.

@theodm theodm changed the title Make prettier pick up .editorconfig Prettier should pick up .editorconfig by default or via configuration Apr 26, 2022
@nedtwigg
Copy link
Member

the .editorconfig of the project is currently not being picked up

This is correct. If it were being accounted for, it would have to be included as part of this class

private static class State extends NpmFormatterStepStateBase implements Serializable {
private static final long serialVersionUID = -539537027004745812L;
private final PrettierConfig prettierConfig;
State(String stepName, Map<String, String> devDependencies, File buildDir, NpmPathResolver npmPathResolver, PrettierConfig prettierConfig) throws IOException {

so that it could be taken into consideration for up-to-date checks. Probably you would have to declare something like prettier().editorConfig() to trigger a search for .editorconfig files in this or a parent directory.

Happy to take a PR for such a feature.

@skuznets0v skuznets0v linked a pull request Dec 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants