prettier-plugin-sort-imports
prettier-plugin-sort-imports copied to clipboard
whitespace on top
Your Environment
- plugin version: 3.1.1
- Prettier version: 2.3.2
- node version 14
Describe the bug
The plugin removes the whitespace before the imports' block, but it should not be affected at all.
To Reproduce
Input:
/* istanbul ignore file */
import foo from 'foo';
Output:
/* istanbul ignore file */
import foo from 'foo';
Expected behavior
/* istanbul ignore file */
import foo from 'foo';
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": false,
"arrowParens": "always",
"importOrder": ["^@(.*)/(.*)$", "^#/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
@byara The "input" example above is properly handled by Prettier (if several lines added between the comment and the first import, then just 1 empty line remains) but once added this plugin, it removes all the whitespace.
Same behaviour using single or multi-line comments (// ...
or /* ... */
).
Looks like this PR wanted to fix this issue: https://github.com/trivago/prettier-plugin-sort-imports/pull/24 @ayusharma @byara Can you provide any info why that PR was closed? Is this planned to be fixed? Thanks!
Looks like this PR wanted to fix this issue: #24 @ayusharma @byara Can you provide any info why that PR was closed? Is this planned to be fixed? Thanks!
Same. Hope this feature can be considered. In the projects I work on, we put the Apache License
at the top. So we want to have a blank line between it and the actual code.
Thank you for creating this project. ❤️ It's very useful.
I'm seeing the same issues with copyright blocks on top of our files. It's removing the blank separator line.
Same problem with copyright blocks in our project.