Skip to content

Commit 037d32b

Browse files
committed
Add documentation for exports-last
1 parent 7e00bb2 commit 037d32b

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

Diff for: CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
77
### Fixed
88
- [`prefer-default-export`] handles re-exported default exports ([#609])
99

10+
### Added
11+
- [`exports-last`] lints that export statements are at the end of the file ([#620] + [#632])
12+
1013
## [2.0.1] - 2016-10-06
1114
### Fixed
1215
- Fixed code that relied on removed dependencies. ([#604])

Diff for: README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ I want to apologize: I have been pretty unresponsive the last few weeks. My wife
1212

1313
I am hoping to be back in action on this in the next week or two, but I need to focus on my family and work in the immediate term. Fortunately, @jfmengels is a fantastic co-maintainer and has been doing a great job responding to new issues in my absence.
1414

15-
Thanks for your patience! 😎
15+
Thanks for your patience! 😎
1616

1717
-- @benmosher
1818

@@ -79,6 +79,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
7979
**Style guide:**
8080

8181
* Ensure all imports appear before other statements ([`first`])
82+
* Ensure all exports appear after other statements ([`exports-last`])
8283
* Report repeated import of the same module in multiple places ([`no-duplicates`])
8384
* Report namespace imports ([`no-namespace`])
8485
* Ensure consistent use of file extension within the import path ([`extensions`])
@@ -89,6 +90,7 @@ This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, a
8990
* Forbid unassigned imports. ([`no-unassigned-import`])
9091

9192
[`first`]: ./docs/rules/first.md
93+
[`exports-last`]: ./docs/rules/exports-last.md
9294
[`no-duplicates`]: ./docs/rules/no-duplicates.md
9395
[`no-namespace`]: ./docs/rules/no-namespace.md
9496
[`extensions`]: ./docs/rules/extensions.md

Diff for: docs/rules/exports-last.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# exports-last
2+
3+
This rule reports all export declaration which come before any non-export statements.
4+
5+
## This will be reported
6+
7+
```JS
8+
9+
const bool = true
10+
11+
export default bool
12+
13+
const str = 'foo'
14+
15+
```
16+
17+
```JS
18+
19+
export const bool = true
20+
21+
const str = 'foo'
22+
23+
```
24+
25+
## This will not be reported
26+
27+
```JS
28+
export const bool = true
29+
30+
export default bool
31+
32+
export function func() {
33+
console.log('Hello World 🌍')
34+
}
35+
36+
export const str = 'foo'
37+
```
38+
39+
## When Not To Use It
40+
41+
If you don't mind exports being sprinkled throughout a file, you may not want to enable this rule.

0 commit comments

Comments
 (0)