prettier / prettier/plugin-pug
Bug: style tag with `type="sass"` is checked as CSS
Open
Nobody has claimed this yet.
help wanted
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 49
- Avg merge
- 4h 26m
- Merged PRs (30d)
- 8
Description
Plugin Version
v3.2.0
Prettier Version
v3.4.2
Which frameworks are affected?
- none
- vue
- angular
- svelte
Node Version
v23.4.0
Which operating systems have you used?
- Linux
- macOS
- Windows
Prettier config
{
"semi": false,
"proseWrap": "always",
"plugins": ["@prettier/plugin-pug"],
"overrides": [
{
"files": "*.riot",
"options": { "parser": "pug" }
}
]
}
Input
logo
img(src="{logoURL}" alt="Logo" width="150")
script.
import logoURL from "/assets/logo.png"
export default {
logoURL,
}
style(type="sass").
:host
display: inline
Output or Error
[error] src/components/logo.riot: Error: SyntaxError: CssSyntaxError: Unknown word (2:2)
[error] 1 | :host
[error] > 2 | display: inline
[error] | ^
[error] at x.build (file:///U:/Repositories/urc-ac-simulator/web/node_modules/@prettier/plugin-pug/dist/index.js:52:4305)
[error] at async Object.print (file:///U:/Repositories/urc-ac-simulator/web/node_modules/@prettier/plugin-pug/dist/index.js:81:295)
[error] at async printAstToDoc (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/index.mjs:19979:16)
[error] at async coreFormat (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/index.mjs:20393:14)
[error] at async formatWithCursor (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/index.mjs:20598:14)
[error] at async formatFiles (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/internal/cli.mjs:3235:18)
[error] at async main (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/internal/cli.mjs:3887:5)
[error] at async Module.run (file:///U:/Repositories/urc-ac-simulator/web/node_modules/prettier/internal/cli.mjs:3833:5)
Expected Output
No error. Don't bother validating a `style` tag with a non-CSS `type` attribute.
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the provided .riot input and the @prettier/plugin-pug configuration, focusing on the style tag with type="sass". Trace the plugin's style-processing entry point from the reported stack and verify that formatting completes without CSS validation for non-CSS types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100