Skip to content

Latest commit

 

History

History
86 lines (59 loc) · 2.18 KB

enforce-style-attribute.md

File metadata and controls

86 lines (59 loc) · 2.18 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.
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule allows you to selectively allow attributes on your top level style tags and warns when using an attribute that is not allowed.

"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>

"no-attributes"

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

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

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

🔧 Options

{
  "vue/enforce-style-attribute": [
    "error",
    { "allows": ["scoped", "module", "no-attributes"] }
  ]
}
  • "allows" (["scoped" | "module" | "no-attributes"]) Array of attributes to allow on a top level style tag. Default: ["scoped"]

🔍 Implementation