You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns the name of the module imported or re-exported.
22
+
* Check if an import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier).
23
+
* @param {string} importExportType An import/export type to check.
24
+
* @param {string} type Can be "named" or "namespace"
25
+
* @returns {boolean} True if import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier) and false if it doesn't.
* Returns the name of the module imported or re-exported.
122
+
* @param {ASTNode} node A node to get.
123
+
* @returns {string} The name of the module, or empty string if no name.
49
124
*/
125
+
functiongetModule(node){
126
+
if(node&&node.source&&node.source.value){
127
+
returnnode.source.value.trim();
128
+
}
129
+
return"";
130
+
}
50
131
51
132
/**
52
-
* Returns a function handling the imports of a given file
133
+
* Checks if the (import|export) can be merged with at least one import or one export, and reports if so.
53
134
* @param {RuleContext} context The ESLint rule context object.
135
+
* @param {ASTNode} node A node to get.
136
+
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
137
+
* @param {string} declarationType A declaration type can be an import or export.
54
138
* @param {boolean} includeExports Whether or not to check for exports in addition to imports.
55
-
* @param {string[]} importsInFile The array containing other imports in the file.
56
-
* @param {string[]} exportsInFile The array containing other exports in the file.
57
-
*
58
-
* @returns {nodeCallback} A function passed to ESLint to handle the statement.
* Returns a function handling the exports of a given file
188
+
* @callback nodeCallback
189
+
* @param {ASTNode} node A node to handle.
190
+
*/
191
+
192
+
/**
193
+
* Returns a function handling the (imports|exports) of a given file
78
194
* @param {RuleContext} context The ESLint rule context object.
79
-
* @param {string[]} importsInFile The array containing other imports in the file.
80
-
* @param {string[]} exportsInFile The array containing other exports in the file.
81
-
*
195
+
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
196
+
* @param {string} declarationType A declaration type can be an import or export.
197
+
*@param {boolean} includeExports Whether or not to check for exports in addition to imports.
82
198
* @returns {nodeCallback} A function passed to ESLint to handle the statement.
0 commit comments