Skip to content

jsx-one-expression-per-line with CRLF on Windows #1893

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

Closed
luissmg opened this issue Jul 23, 2018 · 13 comments
Closed

jsx-one-expression-per-line with CRLF on Windows #1893

luissmg opened this issue Jul 23, 2018 · 13 comments

Comments

@luissmg
Copy link

luissmg commented Jul 23, 2018

The rule always triggers, even when I have an expression per line, as the rule expects.

imagem

Then I realized that I am on Windows and the line break is done with a \r\n(CRLF). What I did was to change it to what Linux and OSX do and make the line breack as \n (LF). The plugin then works as expected.

Is it supposed to work only with that type of line break?

@ljharb
Copy link
Member

ljharb commented Jul 23, 2018

I wouldn't expect anyone on any platform, including Windows, to use anything but normal LF, since CRLF breaks so many things.

@luissmg
Copy link
Author

luissmg commented Jul 25, 2018

Well, Git expects you, by default (at least on Windows), to use CRLF. If you don't do it, it automatically changes it. Yes, I know you can change that and add a configuration. But why? VSCode does the same. He uses the Windows CRLF. Unless you want to change that in all your files in your project, I think the rule should detect this.

@ljharb
Copy link
Member

ljharb commented Jul 25, 2018

Yes, you should be changing that in all files in all projects, and also using git config to ensure that you convert everything to LF on clone/commit/etc.

(I also think the rule should detect it, however)

@luissmg
Copy link
Author

luissmg commented Jul 25, 2018

Yes, I am not defending that what I am doing is the right or wrong thing to do. Just saying that are other possibilities.
Will add tests ASAP and merge them.

@Hugo-Polloli
Copy link

I have the same problem on Windows yet my EOL is set to LF.

@dominic-p
Copy link

dominic-p commented Jun 12, 2019

Yes, you should be changing that in all files in all projects

I'm running into this myself, so I thought I would chime in. The default and recommended setting when installing Git on Windows is core.autocrlf = true which converts line endings to CRLF on Windows and commits them as LF.

Unless I'm missing something, in that configuration, you are indeed expected to have CRLF in your files when editing on Windows.

autocrlf

@ljharb
Copy link
Member

ljharb commented Jun 12, 2019

@dominic-p the option you want to select is the second one, imo.

@dominic-p
Copy link

@ljharb, that's understandable. I'm just pointing out that since it's the default and the Git recommendation, we're not talking about an edge case here. It might be worth supporting.

Thanks, btw, for all the work you do on this config. It's super helpful.

@ljharb
Copy link
Member

ljharb commented Jun 13, 2019

A PR that handles line endings regardless of LF or CLRF throughout the plugin would be appreciated.

@dominic-p
Copy link

I can take a stab at it, but I've never worked with eslint code before. Any pointers on where to start?

@ljharb
Copy link
Member

ljharb commented Jun 14, 2019

I'd start by writing the test cases :-)

@ljharb
Copy link
Member

ljharb commented Aug 20, 2021

@luissmg is there any chance this is fixed in the latest version of the plugin?

@ljharb
Copy link
Member

ljharb commented Feb 6, 2022

Closing, but will be happy to reopen if there's still something actionable.

@ljharb ljharb closed this as completed Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants