useExportsLast
このコンテンツはまだ日本語訳がありません。
Diagnostic Category: lint/nursery/useExportsLast
Since: vnext
Sources:
- Same as:
import/exports-last
Description
Section titled DescriptionRequire that all exports are declared after all non-export statements.
Enforces that export statements are placed at the end of the module, after all other statements.
Examples
Section titled ExamplesInvalid
Section titled Invalidexport const a = 1;const b = 2;
code-block.js:1:1 lint/nursery/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
Section titled Validconst a = 1;export const b = 2;
const a = 1;export { a };
How to configure
Section titled How to configure{ "linter": { "rules": { "nursery": { "useExportsLast": "error" } } }}