Skip to content
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

deno fmt lexical parse error #9650

Closed
aricart opened this issue Mar 2, 2021 · 2 comments · Fixed by #9742
Closed

deno fmt lexical parse error #9650

aricart opened this issue Mar 2, 2021 · 2 comments · Fixed by #9742
Labels
bug Something isn't working correctly deno fmt Related to the "deno fmt" subcommand or dprint

Comments

@aricart
Copy link
Contributor

aricart commented Mar 2, 2021

If you have some dodgy code like this:

export class X {

  constructor() {
  }
  bad(target :number) {
    const d = 1;
    const min = 0;
    const max = 100;
    console.log("x", `duration ${d} not in range - ${min}${d} && ${max}${d}`),;
  }
}

Note the trailing , before the ;.

and run deno fmt, you get:

❯ deno fmt
memory allocation of 18446744073709551615 bytes failed
[1]    8481 abort      deno fmt
@ry ry added the bug Something isn't working correctly label Mar 2, 2021
@kitsonk kitsonk added the deno fmt Related to the "deno fmt" subcommand or dprint label Mar 2, 2021
@kdy1
Copy link

kdy1 commented Mar 3, 2021

I tried this and I found that the parser reports errors for this.

kdy1 added a commit to kdy1/swc that referenced this issue Mar 3, 2021
kdy1 added a commit to swc-project/swc that referenced this issue Mar 3, 2021
swc_ecma_parser:
 - Fix lexing of template literals. (denoland/deno#9620)
 - Ensure that denoland/deno#9650 is not a bug of parser.
@dsherret
Copy link
Member

dsherret commented Mar 3, 2021

@kdy1 yeah, this is a dprint problem with its code for printing diagnostics. See here: dprint/dprint-plugin-typescript#113 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly deno fmt Related to the "deno fmt" subcommand or dprint
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants