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

Bug: Prettier errorneously removes semicolon in-between expressions #431

Open
lephuongbg opened this issue Feb 2, 2023 · 8 comments
Open

Comments

@lephuongbg
Copy link

Info

Tool Version
Plugin v2.4.1
Prettier v2.8.3
Framework vue
Node v16
OS linux

Prettier config

{
    "printWidth": 120,
    "endOfLine": "lf",
    "tabWidth": 4,
    "singleQuote": true,
    "semi": false,
    "trailingComma": "all",
    "arrowParens": "avoid",
    "bracketSpacing": false,
    "vueIndentScriptAndStyle": true,
    "proseWrap": "never",
    "pugAttributeSeparator": "as-needed",
    "bracketSameLine": true,
    "pugSortAttributesBeginning": [
        "^(is|v-is)$",
        "^v-for$",
        "^(v-if|v-else-if|v-else|v-show|v-cloak)$",
        "^(v-once|v-pre)$",
        "^id$",
        "^ref$", "^key$", "^(v-slot|slot)$",
        "^v-model$",
        "^v-.+$"
    ],
    "pugSortAttributesEnd": [
        "^@.+$",
        "^v-on$",
        "^v-text$",
        "^v-html$"
    ],
    "pugSortAttributes": "asc"
}

Input

<template lang="pug">
input#dropzone.image-input(
        @drop.stop.prevent='onDrop($event.dataTransfer.files); dragging = false')
</template>

Output or Error

image

Expected Output

Should be unchanged

Additional Context

@Shinigami92
Copy link
Member

Could you first try out pugSemi: true?
Maybe this is already sufficient enough

@lephuongbg
Copy link
Author

lephuongbg commented Feb 3, 2023

My workaround is to stay on v2.3 for now, which still works.

@lephuongbg
Copy link
Author

On 2.4.1, I tried setting {"pugSemi": true} but met this error:

[error] Error: Invalid --pug-semi value. Expected null, false, "" or "true", but received true.

I then tried changing it to {"pugSemi":"true"} but then met other error:

[PugPrinter]: Error: Invalid semi value. Expected true or false, but received "true".

@Shinigami92
Copy link
Member

Ah yeah, this is a known issue prettier/prettier#9204

@dragon-fish
Copy link

dragon-fish commented Feb 13, 2023

I met the same issue

P.S.

"@prettier/plugin-pug": "^2.4.1"
"prettier": "^2.8.3"

@dragon-fish
Copy link

FYI. Downgrade prettier to 2.7.1 can fix the issue for me temporarily.

@lephuongbg
Copy link
Author

@Shinigami92 Do we have any path forward for resolving this yet?

@Shinigami92
Copy link
Member

@Shinigami92 Do we have any path forward for resolving this yet?

Please ask this in the related prettier issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants