-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
jslint fails with linebreak on windows #6912
Comments
It sounds like you have |
Thanks @bnoordhuis , @silverwind . However as seen in git's help message, I am using the recommended setting |
Recently linebreak-style rule was added in jslint which expects linebreaks to be unix style i.e. `LR` by default. However windows has linebreak `CRLF` (`git config auto.crlf=true`) causing this rule to fail for all `*.js` files present in repo. I have disabled the rule for now and opened nodejs/node#6912 to get the right rule for windows user.
You can configure |
Windows CI servers use I believe most users who compile on Windows have cc @nodejs/testing |
I don't understand this comment. This issue is about our test suite, not node-on-windows in general. |
The main purpose of the lint rule is to let contributors know if they are about to submit code (in a PR) that does not conform to the existing code base. If the typical user setup on Windows is to have git convert line endings to CRLF on check-out and back to LF on check-in, then the lint rule should probably be removed. If that's an atypical setup or a setup we want to discourage for other reasons, then the lint rule should remain as-is. I don't think there's much to be gained by adding complexity and having the rule check for different line endings on different platforms. That probably would not solve any real issues, and might create a few new ones. |
@bnoordhuis , I think @joaocgreis meant node contributors working on windows platform. I agree with @Trott . Instead of complicating things here, we should remove |
All files in the repository should have UNIX line endings. Contributors are expected to follow the project's conventions and the new lint rule helps with that. I don't see how that is controversial.
That seems like a very weak argument. You're either saying that Windows IDEs are defective or that Windows developers are too lazy and/or clueless to configure their editor. Both seem implausible. |
Line endings on Windows are different than on Unix. As awkward as it may seem, it's a platform difference that we simply have to live with. IMO, |
Without this lint rule, how would you catch CRLFs when someone has It's not a rhetorical question. Windows line endings have slipped in several times over the years. They broke the build at least once (25a5e90) although that wasn't in the test suite. The only solution I can think of is a new CI lint check but that seems like a lot of effort when people just have to run |
I'd be OK with a separate ESLint config file for CI only that included just two things:
|
Recently linebreak-style rule was added in jslint which expects linebreaks to be unix style i.e. `LF` by default. However windows has linebreak `CRLF` (`git config auto.crlf=true`) causing this rule to fail for all `*.js` files present in repo. I have disabled the rule for now and opened nodejs/node#6912 to get the right rule for windows user. PR-URL: nodejs#73 Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
Moving away from CRLF line endings, like disabling core.autocrlf, is the wrong answer to this issue. If we did something like that, all js test files would have LF line endings, and possible bugs affecting only CRLF js files would not be caught. We should check for the correct line endings in the linter because the repository should contain only LF line endings, as @bnoordhuis mentioned above. @Trott, I think the rule should be used everywhere, not only in CI. I am working on a PR to fix this. |
That describes the current situation. |
If you have concerns that node doesn't handle CRLF correctly in all cases, we can add regression tests and whitelist them. That would be a good addition regardless of the outcome of this issue. |
@bnoordhuis I believe that CRLF is handled correctly now because we are testing it in CI. We should keep testing it in general (all files on Windows machines) and not only some specific test, because CRLF is the correct line ending on Windows. |
PR: #7019 |
Line breaks on Windows should be CRLF, but Node also supports LF. Hence, do not check line breaks on Windows, when running vcbuild jslint. Fixes: nodejs#6912
Line breaks on Windows should be CRLF, but Node also supports LF. Hence, do not check line breaks on Windows, when running vcbuild jslint. Fixes: #6912 PR-URL: #8785 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Line breaks on Windows should be CRLF, but Node also supports LF. Hence, do not check line breaks on Windows, when running vcbuild jslint. Fixes: #6912 PR-URL: #8785 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
After e77e935 changes made by @Trott, jslint error fails on windows machine because
linebreak-style
rule expects linebreaks to beLF
but on windows they areCRLF
and this fails thelinebreak-style
rule for all*.js
files.The text was updated successfully, but these errors were encountered: