Bug: style tag with `type="sass"` is checked as CSS
Plugin Version
v3.2.0
Prettier Version
v3.4.2
Which frameworks are affected?
- [X] none
- [ ] vue
- [ ] angular
- [ ] svelte
Node Version
v23.4.0
Which operating systems have you used?
- [ ] Linux
- [ ] macOS
- [X] 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
I am happy to make a PR for this. I see that you are doing something similar for <script type="..."> checks.
Let me know!
I am happy to make a PR for this. I see that you are doing something similar for
<script type="...">checks.Let me know!
Yeah, sounds reasonable to me, go for it.
However I hope you do not encounter to many problems with outdated dependencies but I can update these before doing next release.
@bminer just to notify you, the dependencies are really up to date right now and you can easily just init the project locally after clone with pnpm run preflight and start from there.