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

Add rule to disallow inline styles #603

Closed
marekdedic opened this issue Nov 2, 2023 · 1 comment · Fixed by #608
Closed

Add rule to disallow inline styles #603

marekdedic opened this issue Nov 2, 2023 · 1 comment · Fixed by #608
Labels
enhancement New feature or request new rule

Comments

@marekdedic
Copy link
Contributor

Motivation

When using CSP, you often want to disallow inline styles (to not have style-src: 'unsafe-inline'), I'd like to add a rule that checks this automatically

Description

The rule would look for any directive producing inline styles and error on them.

Additionaly, using svelte transitions generates inline styles (although that may change in the future if/when svelte migrates to teh web animations - see sveltejs/svelte#6662), so this rule should probably ban using them altogether (gated with a configuration option probably?)

Examples

<!-- ✗ BAD -->
<div style="anything" />
<div style:anything={true} />
<div transition:anything />

Additional comments

No response

@marekdedic marekdedic added enhancement New feature or request new rule labels Nov 2, 2023
@ota-meshi
Copy link
Member

Thank you for suggesting new rules! That rule sounds good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants