useExportsLast
¥Summary
-
规则生效日期:
v2.0.0¥Rule available since:
v2.0.0 -
诊断类别:
lint/style/useExportsLast¥Diagnostic Category:
lint/style/useExportsLast -
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
-
来源:
¥Sources:
-
与
import/exports-last相同¥Same as
import/exports-last
-
¥How to configure
{ "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
Biome v2.1 中文网 - 粤ICP备13048890号