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-ignore removes script tag in PUG #402

Closed
kumardeepakme opened this issue Jul 10, 2022 · 1 comment · Fixed by #406
Closed

Bug: prettier-ignore removes script tag in PUG #402

kumardeepakme opened this issue Jul 10, 2022 · 1 comment · Fixed by #406
Assignees
Labels
type: bug Functionality that does not work as intended/expected

Comments

@kumardeepakme
Copy link

Script tag is removed when ignoring

prettier-ignore removes script tag when ignored by //- prettier-ignore in PUG template.

Tool Version
Plugin v2.1.1
Prettier v2.7.1
Framework none
Node v16.16.0
OS mac

Prettier config

{
  "printWidth": 80,
  "tabWidth": 2,
  "useTabs": false,
  "semi": true,
  "singleQuote": true,
  "quoteProps": "as-needed",
  "jsxSingleQuote": true,
  "trailingComma": "es5",
  "bracketSpacing": true,
  "bracketSameLine": true,
  "arrowParens": "avoid",
  "endOfLine": "lf",
  "embeddedLanguageFormatting": "off",

  "pugAttributeSeparator": "none",
  "pugClosingBracketPosition": "last-line",
  "pugWrapAttributesPattern": "-1"
}

Input

//- SCRIPTS
script(async src='https://www.googletagmanager.com/gtag/js?id=AW-XXXXXXXXX')
//- prettier-ignore
script.
  window.dataLayer=window.dataLayer || []; function gtag(){dataLayer.push(arguments);}gtag('js', new Date()); gtag('config', 'AW-XXXXXXXXX');

Expected Output

It should ignore formatting of script tag and its code, But it completely removes the script tag with the code inside.

OnSave - script tag gets deleted

ezgif com-gif-maker

@Shinigami92
Copy link
Member

Shinigami92 commented Jul 10, 2022

Please search for a workaround for the next two weeks
I will be in Singapore for the next two weeks for vacation

@Shinigami92 Shinigami92 self-assigned this Jul 25, 2022
@Shinigami92 Shinigami92 added the type: bug Functionality that does not work as intended/expected label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants