From ceb2d32030cfa032613f8b862821421d6979e9dc Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 15 Jul 2019 21:13:21 -0700 Subject: [PATCH] fix(eslint-plugin): remove imports from typescript-estree (#706) Fixes #705 --- .../eslint-plugin/src/rules/prefer-readonly.ts | 5 ++++- .../src/rules/prefer-regexp-exec.ts | 2 +- .../src/rules/triple-slash-reference.ts | 17 ++++++----------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 24685d30676..c82aaf45ab3 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -2,7 +2,10 @@ import * as tsutils from 'tsutils'; import ts from 'typescript'; import * as util from '../util'; import { typeIsOrHasBaseType } from '../util'; -import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; type MessageIds = 'preferReadonly'; diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index ffcf5aef975..dae7b8f13c1 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -1,4 +1,4 @@ -import { TSESTree } from '@typescript-eslint/typescript-estree'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; import { createRule, getParserServices, getTypeName } from '../util'; import { getStaticValue } from 'eslint-utils'; diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 286f445c966..906efaa7db8 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -1,10 +1,5 @@ import * as util from '../util'; -import { - Literal, - Node, - TSExternalModuleReference, -} from '@typescript-eslint/typescript-estree/dist/ts-estree/ts-estree'; -import { TSESTree } from '@typescript-eslint/typescript-estree'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; type Options = [ { @@ -55,14 +50,14 @@ export default util.createRule({ }, ], create(context, [{ lib, path, types }]) { - let programNode: Node; + let programNode: TSESTree.Node; const sourceCode = context.getSourceCode(); const references: ({ comment: TSESTree.Comment; importName: string; })[] = []; - function hasMatchingReference(source: Literal) { + function hasMatchingReference(source: TSESTree.Literal) { references.forEach(reference => { if (reference.importName === source.value) { context.report({ @@ -78,14 +73,14 @@ export default util.createRule({ return { ImportDeclaration(node) { if (programNode) { - const source = node.source as Literal; + const source = node.source as TSESTree.Literal; hasMatchingReference(source); } }, TSImportEqualsDeclaration(node) { if (programNode) { - const source = (node.moduleReference as TSExternalModuleReference) - .expression as Literal; + const source = (node.moduleReference as TSESTree.TSExternalModuleReference) + .expression as TSESTree.Literal; hasMatchingReference(source); } },