0.1.2 • Published 7 months ago

eslint-plugin-unimport v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

eslint-plugin-unimport

npm version npm downloads bundle JSDocs License

Insert imports automatically from Unimport in ESLint.

Usages

With Nuxt

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

With unplugin-auto-import

In your vite.config.ts:

import AutoImport from 'unplugin-auto-import/vite'
import { defineConfig } from 'vite'

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

And in your eslint.config.js:

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

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

Setup Manually

Refer to this file, where you can create your temporary unimport instance and use it to insert imports.

Sponsors

License

MIT License © 2023-PRESENT Anthony Fu