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: style tag with type="sass" is checked as CSS #532

Open
2 of 7 tasks
bminer opened this issue Jan 8, 2025 · 3 comments
Open
2 of 7 tasks

Bug: style tag with type="sass" is checked as CSS #532

bminer opened this issue Jan 8, 2025 · 3 comments
Labels
help wanted We are looking for community help

Comments

@bminer
Copy link

bminer commented Jan 8, 2025

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

@bminer
Copy link
Author

bminer commented Jan 8, 2025

I am happy to make a PR for this. I see that you are doing something similar for <script type="..."> checks.

Let me know!

@Shinigami92
Copy link
Member

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.

@Shinigami92
Copy link
Member

@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.

@Shinigami92 Shinigami92 added the help wanted We are looking for community help label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We are looking for community help
Projects
None yet
Development

No branches or pull requests

2 participants