vuejs / eslint-plugin-vue

Official ESLint plugin for Vue.js
https://eslint.vuejs.org/
MIT License
4.47k stars 667 forks source link

Component must be imported with defineAsyncComponent #2597

Open dmitryuk opened 2 weeks ago

dmitryuk commented 2 weeks ago

Some declared components separated to a custom webpack chunk and must be used with defineAsyncComponent and dynamic import:

// GOOD
const Tooltip = defineAsyncComponent({
    loader: () => import('../../components/Tooltip/Tooltip.vue'),
    hydrate: hydrateOnVisible(),
});

How to make a rule to prevent direct import? Because it will include the component to main chunk

// BAD
 import Tooltip from '../../components/Tooltip/Tooltip.vue';