-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Skip single characters was not printed. Please report this error! #15007
Comments
Please use the issue template to help us reproduce the bug. What source code was producing the error? |
@kachkaev, I also have the same issue in typescript file after I updated to prettier 3.0.0 from 2.8.8
output in vscode:
|
Ok I think I got the problem. The Code in Question:const a = {
project: "SchemaCheck.String()",
ns_dcs: [
"SchemaCheck.StringArray()",
(props:any) => {
const val = props.value as string[]
if (val.length == 2) return undefined // return success
else return { message: 'array must include 2 items' }
},
],
} ResultSo by formatting the former coed using prettier playground, I received the following error:
This error specifically refers to the one-line comment "return success" being adjacent to a real return statement. Solution: Curly bracketsby adding curly brackets to the if-statement I was able to successfully run The Codeconst f = (props:any) => {
const val = props.value as string[]
if (val.length == 2){
return undefined // return success
}
else return { message: 'array must include 2 items' }
} The Reason - trying to prettify the comment as code because of "return ..."I think Edit: @kachkaev That should give you more than enough info to take it from here 😄 |
I'm also seeing this and sharing my source code in case it helps :). This code results in a if (dataStorePageViewsInitLocked) return; // Already locked from a previous run, so return early. |
when ever i try to format my js file , it gives me this error
["ERROR" - 10:30:02 PM] Error formatting document.
["ERROR" - 10:30:02 PM] Comment "Skip single characters" was not printed. Please report this error!
The text was updated successfully, but these errors were encountered: