Skip to content

Commit 2aa4e94

Browse files
authored
build: Add @typescript-eslint/consistent-type-imports rule (#6662)
This ensures we use a `type` import when we only need type stuff.
1 parent 9ec436b commit 2aa4e94

File tree

412 files changed

+791
-703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+791
-703
lines changed

packages/angular/src/errorhandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HttpErrorResponse } from '@angular/common/http';
2-
import { ErrorHandler as AngularErrorHandler, Inject, Injectable } from '@angular/core';
2+
import type { ErrorHandler as AngularErrorHandler } from '@angular/core';
3+
import { Inject, Injectable } from '@angular/core';
34
import * as Sentry from '@sentry/browser';
45
import { captureException } from '@sentry/browser';
56
import { addExceptionMechanism, isString } from '@sentry/utils';

packages/angular/src/sdk.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { VERSION } from '@angular/core';
2-
import { BrowserOptions, init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
2+
import type { BrowserOptions } from '@sentry/browser';
3+
import { init as browserInit, SDK_VERSION, setContext } from '@sentry/browser';
34
import { logger } from '@sentry/utils';
45

56
import { ANGULAR_MINIMUM_VERSION } from './constants';

packages/angular/src/tracing.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/* eslint-disable max-lines */
2-
import { AfterViewInit, Directive, Injectable, Input, NgModule, OnDestroy, OnInit } from '@angular/core';
3-
import { ActivatedRouteSnapshot, Event, NavigationEnd, NavigationStart, ResolveEnd, Router } from '@angular/router';
2+
import type { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
3+
import { Directive, Injectable, Input, NgModule } from '@angular/core';
4+
import type { ActivatedRouteSnapshot, Event, Router } from '@angular/router';
5+
import { NavigationEnd, NavigationStart, ResolveEnd } from '@angular/router';
46
import { getCurrentHub, WINDOW } from '@sentry/browser';
5-
import { Span, Transaction, TransactionContext } from '@sentry/types';
7+
import type { Span, Transaction, TransactionContext } from '@sentry/types';
68
import { logger, stripUrlQueryAndFragment, timestampWithMs } from '@sentry/utils';
7-
import { Observable, Subscription } from 'rxjs';
9+
import type { Observable } from 'rxjs';
10+
import { Subscription } from 'rxjs';
811
import { filter, tap } from 'rxjs/operators';
912

1013
import { ANGULAR_INIT_OP, ANGULAR_OP, ANGULAR_ROUTING_OP } from './constants';

packages/angular/test/tracing.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component } from '@angular/core';
2-
import { ActivatedRouteSnapshot } from '@angular/router';
3-
import { Hub } from '@sentry/types';
2+
import type { ActivatedRouteSnapshot } from '@angular/router';
3+
import type { Hub } from '@sentry/types';
44

55
import { instrumentAngularRouting, TraceClassDecorator, TraceDirective, TraceMethodDecorator } from '../src';
66
import { getParameterizedRouteFromSnapshot } from '../src/tracing';

packages/angular/test/utils/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { Component, NgModule } from '@angular/core';
2-
import { ComponentFixture, TestBed } from '@angular/core/testing';
3-
import { Router, Routes } from '@angular/router';
2+
import type { ComponentFixture } from '@angular/core/testing';
3+
import { TestBed } from '@angular/core/testing';
4+
import type { Routes } from '@angular/router';
5+
import { Router } from '@angular/router';
46
import { RouterTestingModule } from '@angular/router/testing';
5-
import { Transaction } from '@sentry/types';
7+
import type { Transaction } from '@sentry/types';
68

79
import { instrumentAngularRouting, TraceService } from '../../src';
810

packages/browser/src/client.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
import { BaseClient, getEnvelopeEndpointWithUrlEncodedAuth, Scope, SDK_VERSION } from '@sentry/core';
2-
import type { BrowserClientReplayOptions } from '@sentry/types';
3-
import { ClientOptions, Event, EventHint, Options, Severity, SeverityLevel } from '@sentry/types';
1+
import type { Scope } from '@sentry/core';
2+
import { BaseClient, getEnvelopeEndpointWithUrlEncodedAuth, SDK_VERSION } from '@sentry/core';
3+
import type {
4+
BrowserClientReplayOptions,
5+
ClientOptions,
6+
Event,
7+
EventHint,
8+
Options,
9+
Severity,
10+
SeverityLevel,
11+
} from '@sentry/types';
412
import { createClientReportEnvelope, dsnToString, logger, serializeEnvelope } from '@sentry/utils';
513

614
import { eventFromException, eventFromMessage } from './eventbuilder';
715
import { WINDOW } from './helpers';
8-
import { Breadcrumbs } from './integrations';
16+
import type { Breadcrumbs } from './integrations';
917
import { BREADCRUMB_INTEGRATION_ID } from './integrations/breadcrumbs';
10-
import { BrowserTransportOptions } from './transports/types';
18+
import type { BrowserTransportOptions } from './transports/types';
1119
/**
1220
* Configuration options for the Sentry Browser SDK.
1321
* @see @sentry/types Options for more information.

packages/browser/src/eventbuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getCurrentHub } from '@sentry/core';
2-
import { Event, EventHint, Exception, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
2+
import type { Event, EventHint, Exception, Severity, SeverityLevel, StackFrame, StackParser } from '@sentry/types';
33
import {
44
addExceptionMechanism,
55
addExceptionTypeValue,

packages/browser/src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { captureException, withScope } from '@sentry/core';
2-
import { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';
2+
import type { DsnLike, Event as SentryEvent, Mechanism, Scope, WrappedFunction } from '@sentry/types';
33
import {
44
addExceptionMechanism,
55
addExceptionTypeValue,

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
22
/* eslint-disable max-lines */
33
import { getCurrentHub } from '@sentry/core';
4-
import { Event, Integration } from '@sentry/types';
4+
import type { Event, Integration } from '@sentry/types';
55
import {
66
addInstrumentationHandler,
77
getEventDescription,

packages/browser/src/integrations/dedupe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Event, EventProcessor, Exception, Hub, Integration, StackFrame } from '@sentry/types';
1+
import type { Event, EventProcessor, Exception, Hub, Integration, StackFrame } from '@sentry/types';
22
import { logger } from '@sentry/utils';
33

44
/** Deduplication filter */

0 commit comments

Comments
 (0)