I ran 4.0.0-alpha.3 and 4.0.0-alpha.4 on my large monorepo codebase, and found a couple places where the parsing crashed, with a useless error message:
$ yarn prettier --write […]/devices.service.ts
[error] […]/devices.service.ts: SyntaxError: Unexpected token (48:76)
[error] // and thus follows all the lines of the file.
I have a workaround for our repo (remove the jsx parser plugin) -- all our code is typescript-based, so this isn't a problem for us. Not sure what mixed ts/tsx/js/jsx codebases are supposed to do.
Your Environment
Describe the bug
I ran 4.0.0-alpha.3 and 4.0.0-alpha.4 on my large monorepo codebase, and found a couple places where the parsing crashed, with a useless error message:
To Reproduce
jsx
in yourimportOrderParserPlugins
// Minimal replication: a();
// Less minimal: // export class SomeClass { // async someMethod( // anArg:string // ): Promise {
// return {
// a: something.a,
// b: something.b,
// };
// }
// }
Serialized Error: { "clone": "Function",
"code": "BABEL_PARSER_SYNTAX_ERROR",
"codeFrame": " 1 |
2 | import { b } from "b";
3 | import { a } from "a";
4 |
5 | // Minimal replication:
6 | a();
7 |",
"details": {
"expected": null,
},
"loc": {
"column": 0,
"constructor": "Function",
"index": 284,
"line": 19,
},
"pos": 284,
"reasonCode": "UnexpectedToken",
}
Contribute to @ianvs/prettier-plugin-sort-imports