Skip to content

Commit

Permalink
fix: correct issues with circular imports (#4140)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Nov 15, 2021
1 parent 87cfc6a commit 4c87b24
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/no-restricted-imports.ts
@@ -1,5 +1,5 @@
import { TSESTree } from '@typescript-eslint/experimental-utils';
import {
import type {
ArrayOfStringOrObject,
ArrayOfStringOrObjectPatterns,
} from 'eslint/lib/rules/no-restricted-imports';
Expand Down
11 changes: 6 additions & 5 deletions packages/eslint-plugin/src/util/collectUnusedVariables.ts
@@ -1,11 +1,12 @@
import {
AST_NODE_TYPES,
TSESLint,
ASTUtils,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import { ImplicitLibVariable } from '@typescript-eslint/scope-manager';
import { Visitor } from '@typescript-eslint/scope-manager/dist/referencer/Visitor';
import * as util from '.';
import { nullThrows } from './nullThrows';

class UnusedVarsVisitor<
TMessageIds extends string,
Expand All @@ -24,7 +25,7 @@ class UnusedVarsVisitor<
visitChildrenEvenIfSelectorExists: true,
});

this.#scopeManager = util.nullThrows(
this.#scopeManager = nullThrows(
context.getSourceCode().scopeManager,
'Missing required scope manager',
);
Expand Down Expand Up @@ -545,11 +546,11 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean {
function isInLoop(node: TSESTree.Node): boolean {
let currentNode: TSESTree.Node | undefined = node;
while (currentNode) {
if (util.isFunction(currentNode)) {
if (ASTUtils.isFunction(currentNode)) {
break;
}

if (util.isLoop(currentNode)) {
if (ASTUtils.isLoop(currentNode)) {
return true;
}

Expand Down Expand Up @@ -620,7 +621,7 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean {
function getUpperFunction(node: TSESTree.Node): TSESTree.Node | null {
let currentNode: TSESTree.Node | undefined = node;
while (currentNode) {
if (util.isFunction(currentNode)) {
if (ASTUtils.isFunction(currentNode)) {
return currentNode;
}
currentNode = currentNode.parent;
Expand Down
3 changes: 2 additions & 1 deletion packages/eslint-plugin/src/util/isTypeReadonly.ts
Expand Up @@ -7,7 +7,8 @@ import {
isSymbolFlagSet,
} from 'tsutils';
import * as ts from 'typescript';
import { getTypeOfPropertyOfType, nullThrows, NullThrowsReasons } from '.';
import { nullThrows, NullThrowsReasons } from './nullThrows';
import { getTypeOfPropertyOfType } from './propertyTypes';

const enum Readonlyness {
/** the type cannot be handled by the function */
Expand Down
2 changes: 1 addition & 1 deletion packages/scope-manager/src/referencer/PatternVisitor.ts
@@ -1,5 +1,5 @@
import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/types';
import { VisitorBase, VisitorOptions } from './Visitor';
import { VisitorBase, VisitorOptions } from './VisitorBase';

type PatternVisitorCallback = (
pattern: TSESTree.Identifier,
Expand Down

0 comments on commit 4c87b24

Please sign in to comment.