Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/prefer-readonly.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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