Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 2.64 KB

File metadata and controls

77 lines (55 loc) · 2.64 KB

eslint-plugin-unimport-components

npm version npm downloads bundle JSDocs License

Insert Components imports automatically in ESLint.

Usages

With Nuxt

You can use the nuxt-eslint-auto-components-import module directly, which integrates this plugin.

Suggested to use with nuxt-eslint-auto-explicit-import

With unplugin-vue-components

Important

Only supports unplugin-vue-components v28.5.0 or above

In your vite.config.ts:

import Components from 'unplugin-vue-components/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    Components({
      // other options...
      dumpComponentsInfo: true // <---
    })
  ]
})

And in your eslint.config.js:

import fs from 'node:fs'
import { createAutoComponentsInsert } from 'eslint-plugin-unimport-components'

export default [
  // your other configs...
  createAutoComponentsInsert({
    imports: JSON.parse(fs.readFileSync('.components-info.json', 'utf-8'))
  }),
]

Setup Manually

Refer to this file, where you can setup file paths and use it to insert imports.

Credits

License

MIT License © IlyaL