Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

import/no-named-default

Disallow import { default as name } in favor of import name

import { default as React } from "react" and import React from "react" do the same thing. The second is shorter, and it's the form readers expect.

Configure

Off by default. To turn it on:

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

Examples

Reported:

import { default as React, useState } from "react";
import type { default as User } from "./user";

Not reported:

import React, { useState } from "react";
import type User from "./user";

A name marked with type inside the braces isn't reported either:

import { type default as User, loadUser } from "./user";