use ts-es-tree-typings, support import-equals

This commit is contained in:
Johannes Rieken
2019-12-30 14:08:44 +01:00
parent 11f9af09d7
commit 4db80066b4
14 changed files with 123 additions and 38 deletions
+9 -1
View File
@@ -4,6 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const experimental_utils_1 = require("@typescript-eslint/experimental-utils");
function createImportRuleListener(validateImport) {
function _checkImport(node) {
if (node && node.type === 'Literal' && typeof node.value === 'string') {
@@ -23,6 +24,13 @@ function createImportRuleListener(validateImport) {
_checkImport(args[0]);
}
},
// import foo = ...
[experimental_utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration]: (node) => {
const { moduleReference } = node;
if (moduleReference.type === experimental_utils_1.AST_NODE_TYPES.TSExternalModuleReference) {
_checkImport(moduleReference.expression);
}
},
// export ?? from 'module'
ExportAllDeclaration: (node) => {
_checkImport(node.source);
@@ -30,7 +38,7 @@ function createImportRuleListener(validateImport) {
// export {foo} from 'module'
ExportNamedDeclaration: (node) => {
_checkImport(node.source);
}
},
};
}
exports.createImportRuleListener = createImportRuleListener;