{"id":19968,"library":"eslint-plugin-unimport","title":"eslint-plugin-unimport","description":"ESLint plugin (v1.0.0, latest) that automatically inserts imports from Unimport into ESLint fixes. Integrates with unplugin-auto-import and Nuxt to auto-fix missing imports in codebases using auto-import features. ESM-only since v1.0.0, requires ESLint ^9.0.0 || ^8.45.0. Differentiator: bridges Unimport's auto-import with ESLint's autofix, making auto-imported symbols explicit in source files.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/eslint-plugin-unimport","tags":["javascript","eslint","eslint-plugin","unimport","typescript"],"install":[{"cmd":"npm install eslint-plugin-unimport","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-unimport","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-unimport","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, plugin requires ESLint to function","package":"eslint","optional":false}],"imports":[{"note":"ESM-only since v1.0.0, require() will throw.","wrong":"const createAutoInsert = require('eslint-plugin-unimport')","symbol":"createAutoInsert","correct":"import { createAutoInsert } from 'eslint-plugin-unimport'"},{"note":"Default export is createAutoInsert; named export also available.","wrong":"import { default as createAutoInsert } from 'eslint-plugin-unimport'","symbol":"createAutoInsert (default)","correct":"import createAutoInsert from 'eslint-plugin-unimport'"},{"note":"ESM-only; plugin object for flat config: unimportPlugin.configs.recommended.","wrong":"const unimportPlugin = require('eslint-plugin-unimport')","symbol":"default (plugin object)","correct":"import unimportPlugin from 'eslint-plugin-unimport'"}],"quickstart":{"code":"import fs from 'node:fs';\nimport { createAutoInsert } from 'eslint-plugin-unimport';\n\nexport default [\n  {\n    plugins: {\n      unimport: (await import('eslint-plugin-unimport')).default,\n    },\n  },\n  {\n    rules: {\n      'unimport/auto-insert': 'error',\n    },\n  },\n  ...createAutoInsert({\n    imports: JSON.parse(fs.readFileSync('.unimport-items.json', 'utf-8')),\n  }),\n];\n","lang":"typescript","description":"Sets up eslint-plugin-unimport with a flat config, reading auto-import items from a JSON file."},"warnings":[{"fix":"Migrate to ESM or use dynamic import().","message":"v1.0.0 switched to ESM-only; projects using CommonJS require() will break.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure unplugin-auto-import config includes dumpUnimportItems: true and the file exists before running ESLint.","message":"The plugin requires a pre-generated .unimport-items.json from unplugin-auto-import with dumpUnimportItems: true.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use eslint.config.js/.mjs file with flat config.","message":"Flat config only; the plugin does not support legacy eslintrc format.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v1.0.0 and follow new configuration pattern.","message":"v0.x used a different plugin format; v0.0.2 had a breaking change in plugin format.","severity":"deprecated","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install the package: npm install eslint-plugin-unimport. If using require(), switch to import.","cause":"Package not installed or ESM-only require() call.","error":"Cannot find module 'eslint-plugin-unimport'"},{"fix":"Add dumpUnimportItems: true to AutoImport config and run build/dev to generate the file.","cause":"unplugin-auto-import not configured to dump items or file not generated.","error":"Error: .unimport-items.json not found"},{"fix":"Add plugin object: plugins: { unimport: (await import('eslint-plugin-unimport')).default }.","cause":"Plugin not properly registered in flat config.","error":"ESLint couldn't find the plugin 'unimport'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}