# prefer-default-export

Rule `import/prefer-default-export`. Prefer a default export if module exports a single name or multiple names.

- Source: import
- Technologies: Imports
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +2.2% last quarter
- Rank: #1095 by reach, #1602 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `import/prefer-default-export` | no | no | package `eslint-plugin-import` | [docs](https://github.com/import-js/eslint-plugin-import/blob/v2.32.0/docs/rules/prefer-default-export.md) |
| Oxlint | `import/prefer-default-export` | no | no | plugin `import`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/import/prefer-default-export.html) |

## Code examples

### Incorrect: the rule reports this

```js
export const foo = 'foo';
```

```js
export const foo = 'foo';
export const baz = 'baz';
```

### Correct: the rule accepts this

```js
export const foo = 'foo';
const bar = 'bar';
export default bar;
```

```js
export default function bar() {};
```

Examples from the Oxlint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import importPlugin from "eslint-plugin-import";

export default [
  {
    plugins: { import: importPlugin },
    rules: {
      "import/prefer-default-export": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "import"
  ],
  "rules": {
    "import/prefer-default-export": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |

## Related rules

- [import/no-dynamic-require](https://lintradar.dev/rules/import/no-dynamic-require.md): Forbid `require()` calls with expressions.
- [import/no-import-module-exports](https://lintradar.dev/rules/import/no-import-module-exports.md): Forbid import statements with CommonJS module.exports.
- [import/no-relative-packages](https://lintradar.dev/rules/import/no-relative-packages.md): Forbid importing packages through relative paths.
- [import/order](https://lintradar.dev/rules/import/order.md): Enforce a convention in module import order.
- [import/no-useless-path-segments](https://lintradar.dev/rules/import/no-useless-path-segments.md): Forbid unnecessary path segments in import and require statements.
- [import/extensions](https://lintradar.dev/rules/import/extensions.md): Ensure consistent use of file extension within the import path.

---

Web page: https://lintradar.dev/rules/import/prefer-default-export. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
