|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
935 bytes
|
| Line | |
|---|
| 1 | # import/exports-last
|
|---|
| 2 |
|
|---|
| 3 | <!-- end auto-generated rule header -->
|
|---|
| 4 |
|
|---|
| 5 | This rule enforces that all exports are declared at the bottom of the file. This rule will report any export declarations that comes before any non-export statements.
|
|---|
| 6 |
|
|---|
| 7 | ## This will be reported
|
|---|
| 8 |
|
|---|
| 9 | ```JS
|
|---|
| 10 |
|
|---|
| 11 | const bool = true
|
|---|
| 12 |
|
|---|
| 13 | export default bool
|
|---|
| 14 |
|
|---|
| 15 | const str = 'foo'
|
|---|
| 16 |
|
|---|
| 17 | ```
|
|---|
| 18 |
|
|---|
| 19 | ```JS
|
|---|
| 20 |
|
|---|
| 21 | export const bool = true
|
|---|
| 22 |
|
|---|
| 23 | const str = 'foo'
|
|---|
| 24 |
|
|---|
| 25 | ```
|
|---|
| 26 |
|
|---|
| 27 | ## This will not be reported
|
|---|
| 28 |
|
|---|
| 29 | ```JS
|
|---|
| 30 | const arr = ['bar']
|
|---|
| 31 |
|
|---|
| 32 | export const bool = true
|
|---|
| 33 |
|
|---|
| 34 | export default bool
|
|---|
| 35 |
|
|---|
| 36 | export function func() {
|
|---|
| 37 | console.log('Hello World 🌍')
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | export const str = 'foo'
|
|---|
| 41 | ```
|
|---|
| 42 |
|
|---|
| 43 | ## When Not To Use It
|
|---|
| 44 |
|
|---|
| 45 | If you don't mind exports being sprinkled throughout a file, you may not want to enable this rule.
|
|---|
| 46 |
|
|---|
| 47 | ### ES6 exports only
|
|---|
| 48 |
|
|---|
| 49 | The exports-last rule is currently only working on ES6 exports. You may not want to enable this rule if you're using CommonJS exports.
|
|---|
| 50 |
|
|---|
| 51 | If you need CommonJS support feel free to open an issue or create a PR.
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.