Closed therealgilles closed 3 months ago
If you don't want a gap after 'use client';
-- you can remove your blank group from the front of your importOrder
array:
importOrder: [
- '',
'<BUILT_IN_MODULES>',
'<THIRD_PARTY_MODULES>',
'',
'^@(/.*)$',
'^(?!.*[.]css$)[./].*$',
'.css$',
],
Does that do what you want @therealgilles?
The expected the code to stay like this:
/** @jsxImportSource @emotion/react */
'use client'
/**
* Filename.tsx
*
*/
import { ... } from '...'
It feels like the plugin is re-organized my comment, which I did not ask it to. But not a big deal.
My guess is that the 'use client'
pragma is breaking our "top of file" comment detection, and the jsdoc block is being treated as a leading comment on the first import. We can try looking into this, but it's not going to be a super-high priority.
It's alright, I'll close this issue. Thank you for taking the time to assist me and giving my issue some thoughts. With RSC, pragmas are going to become more common.
Your Environment
Describe the bug Here is the code:
It is transformed by this plugin as follows:
and that seems unexpected.
To Reproduce See above.
Expected behavior The comment is left where it was. The plugin honor the empty line specified at the top of
importOrder
.Screenshots, code sample, etc See above.
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js) Here is the
importOrder
:Not sure exactly how to fix this.