useScopedStyles
Ce contenu n’est pas encore disponible dans votre langue.
Summary
Section titled “Summary”- Rule available since:
v2.4.5 - Diagnostic Category:
lint/nursery/useScopedStyles - This rule has an unsafe fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Inspired from
vue/enforce-style-attribute
- Inspired from
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "useScopedStyles": "error" } } }}Description
Section titled “Description”Enforce that <style> blocks in Vue SFCs have the scoped attribute and that <style> blocks in Astro components do not have the is:global directive.
Vue’s scoped attribute automatically scopes CSS to the component,
preventing style leakage and conflicts. Astro’s is:global attribute
allows for global styles, but without it, styles are scoped to the component by default.
Style blocks with the module attribute are exempt, as CSS Modules
is an alternative scoping mechanism.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<style>.foo { color: red; }</style><style is:global>.foo { color: red; }</style><style scoped>.foo { color: red; }</style><style module>.foo { color: red; }</style>References:
Section titled “References:”Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.