import/no-empty-named-blocks

Disallow import {} from with nothing between the braces

fixable

Also called import-x/no-empty-named-blocks

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#

example.js1 problem
import {} from "./setup";
example.js1 problem
import React, {} from "react";
example.ts1 problem
import type {} from "./types";
example.jsNo problems
import "./setup";
import React from "react";
import { useState } from "react";