Skip to content

Latest commit

 

History

History
98 lines (73 loc) · 2.24 KB

no-restricted-component-names.md

File metadata and controls

98 lines (73 loc) · 2.24 KB
pageClass sidebarDepth title description since
rule-details
0
vue/no-restricted-component-names
disallow specific component names
v9.15.0

vue/no-restricted-component-names

disallow specific component names

  • 💡 Some problems reported by this rule are manually fixable by editor suggestions.

📖 Rule Details

This rule allows you to specify component names that you don't want to use in your application.

<!-- ✗ BAD -->
<script>
export default {
  name: 'Disallow',
}
</script>
<!-- ✓ GOOD -->
<script>
export default {
  name: 'Allow',
}
</script>

🔧 Options

This rule takes a list of strings, where each string is a component name or pattern to be restricted:

{
  "vue/no-restricted-component-names": ["error", "foo", "/^Disallow/"]
}

Alternatively, you can specify an object with a name property and an optional message and suggest property:

{
  "vue/no-restricted-component-names": [
    "error",
    {
      "name": "Disallow",
      "message": "Please do not use `Disallow` as a component name",
      "suggest": "allow"
    },
    {
      "name": "/^custom/",
      "message": "Please do not use component names starting with 'custom'"
    }
  ]
}
<!-- ✗ BAD -->
<script>
export default {
  name: 'Disallow',
}
</script>

👫 Related Rules

🚀 Version

This rule was introduced in eslint-plugin-vue v9.15.0

🔍 Implementation