{"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,"search_vec":"'8.45.0':47 '9.0.0':46 'auto':22,28,36,53,61 'auto-fix':27 'auto-import':35,52,60 'autofix':58 'automat':10 'bridg':49 'codebas':33 'differenti':48 'eslint':2,5,16,45,56,69,71 'eslint-plugin':70 'eslint-plugin-unimport':1 'esm':40 'esm-on':39 'explicit':64 'featur':38 'file':67 'fix':17,29 'import':12,23,31,37,54,62 'insert':11 'integr':18 'javascript':68 'latest':8 'make':59 'miss':30 'nuxt':25 'plugin':3,6,72 'requir':44 'sinc':42 'sourc':66 'symbol':63 'typescript':74 'unimport':4,14,50,73 'unplugin':21 'unplugin-auto-import':20 'use':34 'v1.0.0':7,43","created_at":"2026-04-25T11:20:38.163858+00:00","updated_at":"2026-04-25T11:20:38.163858+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/antfu/eslint-plugin-unimport","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-unimport","openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}