# no-restricted-exports

Rule `eslint/no-restricted-exports`. Disallow specified names in exports

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-restricted-exports` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-restricted-exports) |
| Oxlint | `no-restricted-exports` | no | no | plugin `eslint`, category nursery | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-restricted-exports.html) |

## Code examples

### Incorrect: the rule reports this

```js
/*eslint no-restricted-exports: ["error", {
    "restrictedNamedExports": ["foo", "bar", "Baz", "a", "b", "c", "d", "e", "👍"]
}]*/

export const foo = 1;

export function bar() {}

export class Baz {}

const a = {};
export { a };

function someFunction() {}
export { someFunction as b };

export { c } from "some_module";

export { "d" } from "some_module";

export { something as e } from "some_module";

export { "👍" } from "some_module";
```

```js
function foo() {}

export { foo as default };
```

```js
export { default } from "some_module";
```

### Correct: the rule accepts this

```js
/*eslint no-restricted-exports: ["error", {
    "restrictedNamedExports": ["foo", "bar", "Baz", "a", "b", "c", "d", "e", "👍"]
}]*/

export const quux = 1;

export function myFunction() {}

export class MyClass {}

const a = {};
export { a as myObject };

function someFunction() {}
export { someFunction };

export { c as someName } from "some_module";

export { "d" as " d " } from "some_module";

export { something } from "some_module";

export { "👍" as thumbsUp } from "some_module";
```

```js
export default function foo() {}
```

```js
/*eslint no-restricted-exports: ["error", {
    "restrictedNamedExportsPattern": "bar$"
}]*/

export const abc = 1;
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "no-restricted-exports": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-restricted-exports": "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

- [eslint/consistent-return](https://lintradar.dev/rules/eslint/consistent-return.md): Require `return` statements to either always or never specify values
- [eslint/no-underscore-dangle](https://lintradar.dev/rules/eslint/no-underscore-dangle.md): Disallow dangling underscores in identifiers
- [eslint/no-continue](https://lintradar.dev/rules/eslint/no-continue.md): Disallow `continue` statements
- [eslint/accessor-pairs](https://lintradar.dev/rules/eslint/accessor-pairs.md): Enforce getter and setter pairs in objects and classes
- [eslint/no-unmodified-loop-condition](https://lintradar.dev/rules/eslint/no-unmodified-loop-condition.md): Disallow unmodified loop conditions
- [eslint/no-console](https://lintradar.dev/rules/eslint/no-console.md): Disallow the use of `console`

---

Web page: https://lintradar.dev/rules/eslint/no-restricted-exports. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
