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

Bun could not run prettier cli, crashed with the error #289

Open
1 task
seitbekir opened this issue Mar 24, 2024 · 0 comments
Open
1 task

Bun could not run prettier cli, crashed with the error #289

seitbekir opened this issue Mar 24, 2024 · 0 comments

Comments

@seitbekir
Copy link

Your Environment

  • Prettier version: 3.2.5
  • bun version: 1.0.35
  • package manager: bun
  • IDE: VScode
  • OS: MacOS 13.5.1
  • PC: Apple M1

Describe the bug

I got an error trying to run script via package.json.

To Reproduce

add script "prettier": "prettier . --write"

... workdir % bun add --dev @trivago/prettier-plugin-sort-imports
... workdir % bun run prettier
$ prettier . --write
[error] Property expression of ExpressionStatement expected node to be of a type ["Expression"] but instead got "StringLiteral"
error: script "prettier" exited with code 1

Expected behavior

Formatting should run.

Screenshots, code sample, etc

See above

Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)

{
    "tabWidth": 4,
    "useTabs": false,
    "semi": true,
    "singleQuote": true,
    "trailingComma": "all",
    "bracketSpacing": true,
    "arrowParens": "always",
    "endOfLine": "lf",
    "plugins": ["@trivago/prettier-plugin-sort-imports"],
    "importOrder": [
        "^@/types/(.*)$",
        "^@/data/(.*)$",
        "^@/assets/(.*)$",
        "^[../]",
        "^[./]"
    ],
    "importOrderSeparation": true,
    "importOrderSortSpecifiers": true,
    "importOrderParserPlugins": ["typescript", "jsx"]
}

Error log

... workdir % bun prettier --log-level debug
$ prettier . --write --log-level debug
[debug] normalized argv: {"":["."],"cache":false,"color":true,"editorconfig":true,"write":true,"logLevel":"debug","configPrecedence":"cli-override","debugRepeat":0,"ignorePath":[".gitignore",".prettierignore"],"plugins":[],"_":["."],"__raw":{"_":["."],"cache":false,"color":true,"editorconfig":true,"write":true,"log-level":"debug","config-precedence":"cli-override","debug-repeat":0,"ignore-path":[".gitignore",".prettierignore"],"plugin":[]}}
[debug] resolve config from '/Users/macbookair13/node-dev/shiplog/.editorconfig'
[debug] loaded options `{"useTabs":false,"tabWidth":4,"endOfLine":"lf","semi":true,"singleQuote":true,"trailingComma":"all","bracketSpacing":true,"jsxBracketSameLine":false,"arrowParens":"always","plugins":["@trivago/prettier-plugin-sort-imports"],"importOrder":["^@/types/(.*)$","^@/data/(.*)$","^@/assets/(.*)$","^[../]","^[./]"],"importOrderSeparation":true,"importOrderSortSpecifiers":true,"importOrderParserPlugins":["typescript","jsx"]}`
[error] Property expression of ExpressionStatement expected node to be of a type ["Expression"] but instead got "StringLiteral"
error: script "prettier" exited with code 1

Contribute to @trivago/prettier-plugin-sort-imports

  • I'm willing to fix this bug 🥇
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant