Skip to content

useExportsLast

¥Summary

¥How to configure

biome.json
{
"linter": {
"rules": {
"style": {
"useExportsLast": "error"
}
}
}
}

¥Description

要求所有导出语句必须在所有非导出语句之后声明。

¥Require that all exports are declared after all non-export statements.

强制 export 语句放在模块末尾,所有其他语句之后。

¥Enforces that export statements are placed at the end of the module, after all other statements.

¥Examples

¥Invalid

export const a = 1;
const b = 2;
code-block.js:1:1 lint/style/useExportsLast ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

All exports should be declared after all non-export statements.

> 1 │ export const a = 1;
^^^^^^^^^^^^^^^^^^^
2 │ const b = 2;
3 │

Move this statement before the export statements to keep all exports at the end of the module.

¥Valid

const a = 1;
export const b = 2;
const a = 1;
export { a };

¥Related links