Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct issues with circular imports #4140

Merged
merged 1 commit into from Nov 15, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 '.';
armano2 marked this conversation as resolved.
Show resolved Hide resolved
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