no-trailing-spaces: Fix produces wrong results for windows style line endings #4050
Labels
accepted
There is consensus among the team that this change meets the criteria for inclusion
archived due to age
This issue has been archived; please open a new issue for any further discussion
bug
ESLint is working incorrectly
rule
Relates to ESLint's core rules
Eslint: 1.6
Parser: default
Code:
Output:
The above code is from existing unit test with
\n
: https://github.com/eslint/eslint/blob/master/tests/lib/rules/no-trailing-spaces.js#L69FYI, the above code works fine if you have
\n
line endings.Findings:
This is happening because
\n
occupies one spot on the source code array vs\r\n
occupies 2 spots. So when the fixes are calculated by the rule, it only considers one spot of line ending by default.The text was updated successfully, but these errors were encountered: