Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

import/no-empty-named-blocks

Disallow import {} from with nothing between the braces

Empty braces in an import are usually left over after someone deleted the last name. The import still loads and runs the module, but it doesn't say whether that's on purpose.

--fix removes the braces if the import also has a default import. An import that has nothing but {} isn't fixed, because deleting it would stop the module from being loaded. It comes with two suggestions instead: delete the import, or keep it as import "./setup".

Configure

Off by default. To turn it on:

bunfig.toml
[lint.rules]
"import/no-empty-named-blocks" = "error" # or "warn"

Examples

Reported:

import {} from "./setup";
import React, {} from "react";
import type {} from "./types";

Not reported:

import "./setup";
import React from "react";
import { useState } from "react";