Skip to content

Commit

Permalink
fix(eslint-plugin): remove imports from typescript-estree (#706)
Browse files Browse the repository at this point in the history
Fixes #705
  • Loading branch information
mikeharder authored and bradzacher committed Jul 16, 2019
1 parent 9836fb7 commit ceb2d32
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/prefer-readonly.ts
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion 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';

Expand Down
17 changes: 6 additions & 11 deletions 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 = [
{
Expand Down Expand Up @@ -55,14 +50,14 @@ export default util.createRule<Options, MessageIds>({
},
],
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({
Expand All @@ -78,14 +73,14 @@ export default util.createRule<Options, MessageIds>({
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);
}
},
Expand Down

0 comments on commit ceb2d32

Please sign in to comment.