Skip to content

Latest commit

 

History

History
86 lines (58 loc) · 2.03 KB

enforce-style-attribute.md

File metadata and controls

86 lines (58 loc) · 2.03 KB
pageClass sidebarDepth title description
rule-details
0
vue/enforce-style-attribute
enforce or forbid the use of the `scoped` and `module` attributes in SFC top level style tags

vue/enforce-style-attribute

enforce or forbid the use of the scoped and module attributes in SFC top level style tags

  • This rule has not been released yet.

📖 Rule Details

This rule allows you to explicitly allow the use of the scoped and module attributes on your top level style tags.

"scoped"

<!-- ✓ GOOD -->
<style scoped></style>
<style lang="scss" src="../path/to/style.scss" scoped></style>

<!-- ✗ BAD -->
<style module></style>

<!-- ✗ BAD -->
<style></style>

"module"

<!-- ✓ GOOD -->
<style module></style>

<!-- ✗ BAD -->
<style scoped></style>

<!-- ✗ BAD -->
<style></style>

"plain"

<!-- ✓ GOOD -->
<style></style>

<!-- ✗ BAD -->
<style scoped></style>

<!-- ✗ BAD -->
<style module></style>

🔧 Options

{
  "vue/enforce-style-attribute": [
    "error",
    { "allow": ["scoped", "module", "plain"] }
  ]
}
  • "allow" (["scoped" | "module" | "plain"]) Array of attributes to allow on a top level style tag. The option plain is used to allow style tags that have neither the scoped nor module attributes. Default: ["scoped"]

🔍 Implementation