question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I'm trying to use prettier with editorconfig but prettier doesn't respect

See original GitHub issue

I have this .editorconfig file and it works fine:

# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

If I enable prettier it doesn’t respect the editorconfig and keeps adding final new line ven for the .md files.

How to fix this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lydellcommented, Oct 1, 2018

Hi!

Prettier ends all files with a single newline, and there’s no way to disable that.

Prettier can look at your .editorconfig file to set some Prettier options. But as there’s no option to disable the final newline, Prettier can’t do anything for trim_final_newline = false. According to the docs, Prettier supports the following EditorConfig properties:

  • indent_style
  • indent_size/tab_width
  • max_line_length
0reactions
theprobugmakercommented, Oct 1, 2018

So my .editorconfig should look like this:

# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf

To imply the end of line and charset of the files, right?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prettier does not consistently respect .prettierrc, .eslintrc nor ...
I have a .prettierrc file, a .eslintrc file and even vscode settings with the same 80 print-width settings, but the extension just doesn't...
Read more >
Prettier vscode extension ignoring config files - Stack Overflow
In VS Code press Ctrl + shift + p to open command palette then chose. Preferences: Open Settings(JSON) and add the line among...
Read more >
How to configure Prettier and VSCode - Gleb Bahmutov
This blog post shows how to configure Prettier to work from command line, from VSCode and from Git hooks.
Read more >
Options - Prettier
Prettier's printWidth option does not work the same way. It is not the hard upper allowed line length limit. It is a way...
Read more >
Set up ESlint, Prettier & EditorConfig without conflicts | Theodo
Configure ESLint, Prettier and EditorConfig together without conflicts on projects using Vue, React, TypeScript or any other Framework with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found