-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Enable
import/export
rule (#16843)
- Loading branch information
1 parent
e02d9ef
commit ea5fcb8
Showing
5 changed files
with
196 additions
and
129 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.yarn/patches/eslint-plugin-import-npm-2.30.0-4fd74d3ee6.patch
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,37 @@ | ||
diff --git a/lib/rules/export.js b/lib/rules/export.js | ||
index a155254c8e4c00816ef0cb128ab8c8b6d60be838..8baf0fbd492ad5d34b6e2932afe78bced223cdbc 100644 | ||
--- a/lib/rules/export.js | ||
+++ b/lib/rules/export.js | ||
@@ -39,17 +39,21 @@ var tsTypePrefix = 'type:'; | ||
function isTypescriptFunctionOverloads(nodes) { | ||
var nodesArr = Array.from(nodes); | ||
|
||
- var idents = (0, _arrayPrototype2['default'])( | ||
- nodesArr, | ||
- function (node) {return node.declaration && ( | ||
- node.declaration.type === 'TSDeclareFunction' // eslint 6+ | ||
- || node.declaration.type === 'TSEmptyBodyFunctionDeclaration' // eslint 4-5 | ||
- ) ? | ||
- node.declaration.id.name : | ||
- [];}); | ||
- | ||
- if (new Set(idents).size !== idents.length) { | ||
- return true; | ||
+ if (nodesArr[0].type === "ExportDefaultDeclaration") { | ||
+ let num = 0; | ||
+ for (const node of nodesArr) { | ||
+ if ( | ||
+ // eslint 6+ | ||
+ node.declaration.type === 'TSDeclareFunction' || | ||
+ // eslint 4-5 | ||
+ node.declaration.type === 'TSEmptyBodyFunctionDeclaration' | ||
+ ) { | ||
+ num++; | ||
+ } | ||
+ } | ||
+ if (num === nodesArr.length - 1) { | ||
+ return true; | ||
+ } | ||
} | ||
|
||
var types = new Set(nodesArr.map(function (node) {return node.parent.type;})); |
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.