no-empty-named-blocks
Forbid empty named import blocks
💼 This rule is enabled in the following configs: recommended, typescript.
🔧 This rule is automatically fixable by the --fix CLI option.
💡 This rule is manually fixable by editor suggestions.
Rule Details
An empty named block imports or re-exports nothing; it is usually left over after the last specifier was removed. This rule reports:
import {} from 'm'andimport type {} from 'm';import a, {} from 'm'(the fix drops, {});export {} from 'm'andexport type {} from 'm'.
The braces are read as tokens, not text: a comment inside them (import { /* none */ } from 'm') leaves them empty, and a {} inside a comment is no block. A local export {} marks a file as a module and is not reported; a side-effect import 'm' has no block.
import {} from 'm' and export {} from 'm' still load and run m, so the autofix keeps that: it rewrites them to import 'm', carrying over any import attributes. Deleting the statement would silently drop a polyfill, a stylesheet or a registration. A type-only statement (import type {} from 'm', export type {} from 'm') loads nothing, and the fix removes it. To delete a value statement entirely, use the "Remove empty import statement" suggestion.
❌ Incorrect
import {} from './setup';
import config from './config';
export {} from './types';✅ Correct
import './setup';
import config from './config';
export {};Options
[]No options.
When Not To Use It
Never needed; an empty block has no meaning a side-effect import does not express better.
Use this rule
npm install -D oxlint-plugin-import-next{ "jsPlugins": ["oxlint-plugin-import-next"], "rules": { "import-next/no-empty-named-blocks": "error" }}import { defineConfig } from 'vite-plus';export default defineConfig({ lint: { jsPlugins: ['oxlint-plugin-import-next'], rules: { 'import-next/no-empty-named-blocks': 'error', }, },});oxlint-plugin-import-next re-exports eslint-plugin-import-next/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.
Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.