Open pfaffle opened 5 years ago
We are having the same issue on the VS Code extension https://github.com/amatiasq/vsc-sort-imports/issues/57, changing the line endings to LF works fine.
Can it be related to the detect-newline
dependency?
https://github.com/renke/import-sort/blob/master/packages/import-sort/src/index.ts#L70
node already exposes os.EOL
maybe we should use that instead?
@jquense I think there is no guarantee the system EOL is the file's EOL. On cross-OS teams there is usually a convention for all to use the same EOL style whatever system each one uses.
My TypeScript source files have some eslint ignore lines in them next to imports at the top of the file; but when I run import-sort on them, it moves them after all of the imports so they no longer apply to the correct lines and cause my eslint rules to give me errors.
before:
after:
The files have CRLF line endings because I'm on Windows. If I save them with LF line endings and then run import-sort, it has the expected result: