# san/no-unused-components

禁止注册未在 templates 中使用的组件

  • ⚙️ 此规则包含于 "plugin:san/essential", "plugin:san/strongly-recommended""plugin:san/recommended".

# 📖 规则细节

该规则会提示组件未在 template 中使用。

<!-- ✓ GOOD --> <template> <div> <h2>Lorem ipsum</h2> <the-modal> <the-button>CTA</the-button> </the-modal> </div> </template> <script> import TheButton from 'components/TheButton.san' import TheModal from 'components/TheModal.san' export default { components: { 'the-button': TheButton, 'the-modal': TheModal } } </script>
Now loading...
<!-- ✗ BAD --> <template> <div> <h2>Lorem ipsum</h2> <the-modal /> </div> </template> <script> import TheButton from 'components/TheButton.san' import TheModal from 'components/TheModal.san' export default { components: { 'the-button': TheButton, // Unused component 'the-modal': TheModal // Used component } } </script>
Now loading...

# 🔧 配置

暂无。

# 🔍 实现