Skip to content

endOfLine changed from auto to LF in v2.0.0 doesn't take effect #1327

Open
@snebjorn

Description

@snebjorn

Summary

Line endings was changed from auto to LF in prettier v2.0.0. However this doesn't change CRLF files to LF when formatting.

Github Repository to Reproduce Issue

Any CRLF file prettier supports will do

Steps To Reproduce:

Use prettier v2 default config

  1. Open a CRLF file (ie .ts) that is otherwise correctly formatted
  2. Observe that vscode doesn't report line ending errors
  3. Open command pallet and run "Format document with..." select "prettier"
  4. Observe that line endings are still CRLF and prettier still doesn't report errors

Expected result

Prettier should report line ending errors.
Prettier should change line endings to LF on format.

Actual result

Line endings are still CRLF after formatting.

Additional information

VS Code Version: 1.44.1

Prettier Extension Version: 4.4.0

OS and version: Windows 1909

.prettierrc

{
  "singleQuote": true,
  "printWidth": 200
}

.editorconfig

# Editor configuration, see http://editorconfig.org
root = true

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

[*.md]
max_line_length = off
trim_trailing_whitespace = false

Prettier Log Output

["INFO" - 02.27.47] Formatting ~\Repos\akita\libs\akita\src\lib\updateEntities.ts
["INFO" - 02.27.47] Using ignore file (if present) at ~\Repos\akita\.prettierignore
["INFO" - 02.27.47] Loaded module '[email protected]' from '~\Repos\akita\node_modules\prettier\index.js'
["INFO" - 02.27.47] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 02.27.47] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 02.27.47] Prettier Options:
{
  "filepath": "~\\Repos\\akita\\libs\\akita\\src\\lib\\updateEntities.ts",
  "parser": "typescript",
  "useTabs": false,
  "tabWidth": 2,
  "singleQuote": true,
  "printWidth": 200
}
["INFO" - 02.27.47] Formatting completed in 26.475699ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp-wantedNot something we plan on doing, but we will take a pull request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions