Skip to main content
interlace
Plugin: import-nextRules

no-named-default

Forbid named default exports

💼 This rule is enabled in the following configs: recommended, typescript.

Rule Details

A default export has its own import spelling. Taking it through the named block, import { default as x } from 'm', is a roundabout way to write import x from 'm'. This rule reports it however default is written (an identifier or the string 'default') and also in a type import (import type x from 'm' is the equivalent).

A re-export, export { default as x } from 'm', is not an import and is not reported.

❌ Incorrect

import { default as config } from './config';
import { 'default' as config2 } from './config';
import type { default as Config } from './config';

✅ Correct

import config from './config';
import type Config from './config';
export { default as config } from './config';

Options

[]

No options.

When Not To Use It

Never needed; the default import spelling always exists.

Use this rule

npm install -D oxlint-plugin-import-next
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-import-next"],  "rules": {    "import-next/no-named-default": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-import-next'],    rules: {      'import-next/no-named-default': '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.