Issue Type: Bug
I'm seeing a lint error after copying (some code in View Raw, in the browser) and pasting into a new document.
The error:
Expected linebreaks to be 'LF' but found 'CRLF'.eslint(linebreak-style)
A Quick Fix is offered, but no matter if I attempt to apply to one line or all lines with the problem it is never resolved and the error persists.
VS Code version: Code 1.35.1 (c7d83e57cd18f18026a8162d042843bda1bcf21f, 2019-06-12T14:30:02.622Z)
OS version: Windows_NT x64 10.0.17763
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 x 3000)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled|
|Load (avg)|undefined|
|Memory (System)|15.80GB (8.77GB free)|
|Process Argv||
|Screen Reader|no|
|VM|0%|
Extensions (9)
Extension|Author (truncated)|Version
---|---|---
react-hooks-snippets|AlD|1.1.5
open-html-in-browser|cod|0.1.21
vscode-eslint|dba|1.9.0
todo-tree|Gru|0.0.138
svn-scm|joh|1.54.3
intellij-idea-keybindings|k--|0.2.33
start-git-bash|McC|1.2.1
js-jsx-snippets|sky|0.3.0
vscode-maven|vsc|0.17.1
I still believe it is a bug to offer a _Quick Fix_ and not have that fix work, but seconds after posting this Bug Report I noticed in the very bottom right of VS Code, only when focused on my new file, there is 'CLRF'.
I then selected all in the file and clicked 'CLRF' and the setting toggled to 'LF'.
That fixed my file.
I've been trying to fix this for the past day and your comment saved me.
In my set up I have eslint and prettierjs plugins installed. I've tried toggling all different settings but none of them would fix this issue. Prettier would format the entire file but the crlf problem would remain. Clicking the quick-fix option would also have no effect.
Thankfully my project is small so this wasn't a problem to change every file's setting to LF.
Also you need to change the following setting so that newly created files will have LF:

LF problem in a JS file.

Quick fix attempts to fix the problem, I can see the page refresh, but the file remains unix/LF.
Quick fix works with other ESLinting issues.
Manually selecting the EOL sequence from the status bar to CRLF changes the file to windows/CRLF and fixes the issue.

Ok so try ESLint from the command line: eslint --fix
Where eslintrc.js linebreak-style
rules: {
'linebreak-style': ['error', 'windows'], // changes the file to CRLF
}
rules: {
'linebreak-style': ['error', 'unix'], // changes the file to LF
}
I hope this has been helpful
The underlying problem here is that VS Code abstracts the line ending away (it is basically an array of lines) and hence it is not obvious on how to manipulate the line endings. Need to dig deeper.
You can use an .editorconfig for specifying line endings
And use the code-eol extension to visualize the end of line.
@dbaeumer - if the code-eol plugin can do it, I think the information is available somewhere.
The methods in https://warlord0blog.wordpress.com/2019/09/04/vscode-crlf-vs-lf-battle/ work well.
@subz390 You saved me
Thanks @subz390
I was having the same problem the CRLF/LF toggle does not work. This can occur when '\n' is a literal rather than an LF character. Open the file. Select CTRL+H, Select the .* (regex) to the right of the search bar. Select any '\n' literal in your open file. You should see \\n in the search bar. In the replace bar enter \n. Select replace all. This should do the trick for you. You'll notice the files to include bar. You can perform this global search and replace for all relevant files.
Most helpful comment
I still believe it is a bug to offer a _Quick Fix_ and not have that fix work, but seconds after posting this Bug Report I noticed in the very bottom right of VS Code, only when focused on my new file, there is 'CLRF'.
I then selected all in the file and clicked 'CLRF' and the setting toggled to 'LF'.
That fixed my file.