-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #837 from benmosher/release-2.3.0
Release 2.3.0
- Loading branch information
Showing
32 changed files
with
602 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# no-anonymous-default-export | ||
|
||
Reports if a module's default export is unnamed. This includes several types of unnamed data types; literals, object expressions, arrays, anonymous functions, arrow functions, and anonymous class declarations. | ||
|
||
Ensuring that default exports are named helps improve the grepability of the codebase by encouraging the re-use of the same identifier for the module's default export at its declaration site and at its import sites. | ||
|
||
## Options | ||
|
||
By default, all types of anonymous default exports are forbidden, but any types can be selectively allowed by toggling them on in the options. | ||
|
||
The complete default configuration looks like this. | ||
|
||
```js | ||
"import/no-anonymous-default-export": ["error", { | ||
"allowArray": false, | ||
"allowArrowFunction": false, | ||
"allowAnonymousClass": false, | ||
"allowAnonymousFunction": false, | ||
"allowLiteral": false, | ||
"allowObject": false | ||
}] | ||
``` | ||
|
||
## Rule Details | ||
|
||
### Fail | ||
```js | ||
export default [] | ||
|
||
export default () => {} | ||
|
||
export default class {} | ||
|
||
export default function () {} | ||
|
||
export default 123 | ||
|
||
export default {} | ||
``` | ||
|
||
### Pass | ||
```js | ||
const foo = 123 | ||
export default foo | ||
|
||
export default class MyClass() {} | ||
|
||
export default function foo() {} | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowArray": true}] */ | ||
export default [] | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowArrowFunction": true}] */ | ||
export default () => {} | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousClass": true}] */ | ||
export default class {} | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowAnonymousFunction": true}] */ | ||
export default function () {} | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowLiteral": true}] */ | ||
export default 123 | ||
|
||
/* eslint import/no-anonymous-default-export: [2, {"allowObject": true}] */ | ||
export default {} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,5 @@ require(name()); | |
|
||
```js | ||
require('../name'); | ||
require('../name' + name); | ||
require(`../name`); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.