-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Autoformat duplicates import line on saving #360
Comments
Can you post contents of an MDX file where this issue occurs? |
`---
|
.mdx file extension is not allowed for upload :'( Do you prefer on .txt ? |
Please put the smallest reproduction in a code block. Thanks! |
You can post code blocks on GitHub using tripe backticks as a code fence, like so: ```mdx
import 'hello'
# Hello from MDX
``` |
Based on your example, I am unable to reproduce the issue you’re describing. Are you sure it’s related to |
If I use the MDX extension in VsCode + If I do not use the MDX extension , it is ok If I use the MDX extension but not |
if I do manually Format with :
It is when I save the file ... I have autoformatting on save . I don't know who cause the import duplication on the chain of execution o.O |
Is it a good practice to prefix all mdx files with |
This is the output log when I save the file (if it helps)
|
This comment was marked as spam.
This comment was marked as spam.
This is also happening to me.
I'm also using frontmatter, so that might be part of it. Other MDX files in my project work tho. Something weird about this file. ---
title: Building Products People Love
subtitle: A look into product and design thinking at Notion.
date: 2020-05-19
tags: design, speaking, video
thumbnail: building-products-people-love.png
---
import PostImage from "@components/PostImage"
import PostVideo from "@components/PostVideo"
import PostVideo from "@components/PostVideo"
<PostImage
src="building-products-people-love.png"
alt="Build products people love"
/>
Building a product people love requires more than simply shipping features. It’s important to have a mission people believe in, an original brand, and an approach to product that always puts user needs first.
Thanks so much to the folks at Samsung NEXT for inviting me to speak in these crazy COVID-19 times!
<PostVideo id="EDRRwnwxMwU" /> |
Same issue here, even if I switch off ESLint and Prettier. However, if I set Could this issue have something to do with that setting now being |
This isn’t related to formatting. I managed to reproduce this issue using the following VS Code settings: {
"[mdx]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
}
}
} The issue is gone when using the latest unreleased changes. I’m not sure what fixed this, but it’s fixed in the next release. |
This comment has been minimized.
This comment has been minimized.
I'm still seeing this issue even with version 1.7.0 of the VScode MDX extension. Toggling organize imports off will remove the error, but must be considered a workaround
|
I am using Choosing Organize Imports from the command palette triggers the bug, appending all imports at the end of file. @remcohaszing sorry to bother, but shall we open a new issue or reopen this one? |
@vicary I’m not seeing this with the file you provided. Please provide an example repository with steps to reproduce. |
Encountered this problem and @remcohaszing's workaround solved it for my case. It happens when you import multiple things from something, like
works, but
not and begins to insert the same imports at the end of the file on save. |
The same thing happened to me, @mathias-falkenberg solution solved it |
Initial checklist
Affected packages and versions
@mdx-js/[email protected]
Link to runnable example
No response
Steps to reproduce
Expected behavior
Do not duplicate the import
Actual behavior
it duplicates it
Runtime
No response
Package manager
No response
OS
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: