Skip to content
← Back to rules

import/no-empty-named-blocks Suspicious

🛠️ 💡 An auto-fix and a suggestion are available for this rule.

What it does ​

Enforces that named import blocks are not empty.

Why is this bad? ​

Empty named imports serve no practical purpose and often result from accidental deletions or tool-generated code.

Examples ​

Examples of incorrect code for this rule:

js
import {} from "mod";
import Default from "mod";

Examples of correct code for this rule:

js
import { mod } from "mod";
import Default, { mod } from "mod";

How to use ​

To enable this rule using the config file or in the CLI, you can use:

json
{
  "plugins": ["import"],
  "rules": {
    "import/no-empty-named-blocks": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  plugins: ["import"],
  rules: {
    "import/no-empty-named-blocks": "error",
  },
});
bash
oxlint --deny import/no-empty-named-blocks --import-plugin

Version ​

This rule was added in v0.16.1.

References ​