-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.
Description
Prettier 2.0.2
Playground link
--arrow-parens avoid
--parser babel
--no-semi
--single-quote
--trailing-comma none
You may wonder what would be the use case for this kind of behavior. It happened to me as I wrote a generator cli for a project creating several files based on user input data and automatically applying a prettier format when those are generated. One of the files provides the empty import statement with the comment in the middle of the curly braces to invite the developer to import what he should from a precise package.
I currently use the first version commented with // works
in the example to work around the issue.
Input:
// works
import {} from 'something'
// breaks
import { /* comment */ } from 'some-package'
// breaks too
import {
// Comment
} from 'some other package'
Output:
// works
import {} from 'something'
// breaks
import /* comment */ 'some-package'
// breaks too
import // Comment
'some other package'
Expected behavior:
// works
import {} from 'something'
// breaks
import { /* comment */ } from 'some-package'
// breaks too
import {
// Comment
} from 'some other package'
Metadata
Metadata
Assignees
Labels
lang:javascriptIssues affecting JSIssues affecting JSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.