prettier / prettier/prettier

Syntax error after prettifying yarn berry release file

Open
#11,368 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang:javascript status:needs investigation
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier 2.3.2

The yarn berry file is pretty big, and prettifying it results in a syntax error.

mkdir test && cd test
yarn init -y
yarn set version berry

# remove `// prettier-ignore` from `.yarn/releases/yarn-berry.cjs`

prettier .yarn/releases/yarn-berry.cjs --write                                                                        

Run any yarn command, like

yarn -v

Error:

yarn -v                                                                                                             INT х  system Node 
.../.yarn/releases/yarn-berry.cjs:33
    C = (t, e) => () => e || t((e = { exports: {} }).exports, e), e.exports,
                                                                   ^

SyntaxError: Unexpected token '.'
prettier -v
2.3.2

node -v
v15.4.0

This syntax error does not happen on playground. I pasted the entire file and copied the output and it works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report by creating a Yarn Berry project, removing the prettier-ignore comment from .yarn/releases/yarn-berry.cjs, and running Prettier 2.3.2 on it. Compare the CLI output with the playground result and run yarn -v afterward. Done means the prettified release file no longer causes the reported syntax error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.