Skip to content

ref(eslint): Remove unused eslint-disable directives #10771

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

Merged
merged 1 commit into from
Feb 22, 2024
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
1 change: 0 additions & 1 deletion dev-packages/e2e-tests/prepare.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
/* eslint-disable no-console */
import * as dotenv from 'dotenv';

Expand Down
1 change: 0 additions & 1 deletion dev-packages/e2e-tests/publish-packages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import * as childProcess from 'child_process';
import * as path from 'path';
import * as glob from 'glob';
Expand Down
1 change: 0 additions & 1 deletion dev-packages/e2e-tests/run.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
/* eslint-disable no-console */
import { spawn } from 'child_process';
import { resolve } from 'path';
Expand Down
8 changes: 3 additions & 5 deletions packages/browser/test/unit/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ describe('SentryBrowser', () => {
getCurrentScope().setUser(EX_USER);
setCurrentClient(client);

// eslint-disable-next-line deprecation/deprecation
showReportDialog({ eventId: 'foobar' });

expect(getReportDialogEndpoint).toHaveBeenCalledTimes(1);
Expand All @@ -106,7 +105,6 @@ describe('SentryBrowser', () => {
setCurrentClient(client);

const DIALOG_OPTION_USER = { email: '[email protected]' };
// eslint-disable-next-line deprecation/deprecation
showReportDialog({ eventId: 'foobar', user: DIALOG_OPTION_USER });

expect(getReportDialogEndpoint).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -140,7 +138,7 @@ describe('SentryBrowser', () => {

it('should call `onClose` when receiving `__sentry_reportdialog_closed__` MessageEvent', async () => {
const onClose = jest.fn();
// eslint-disable-next-line deprecation/deprecation

showReportDialog({ eventId: 'foobar', onClose });

await waitForPostMessage('__sentry_reportdialog_closed__');
Expand All @@ -155,7 +153,7 @@ describe('SentryBrowser', () => {
const onClose = jest.fn(() => {
throw new Error();
});
// eslint-disable-next-line deprecation/deprecation

showReportDialog({ eventId: 'foobar', onClose });

await waitForPostMessage('__sentry_reportdialog_closed__');
Expand All @@ -168,7 +166,7 @@ describe('SentryBrowser', () => {

it('should not call `onClose` for other MessageEvents', async () => {
const onClose = jest.fn();
// eslint-disable-next-line deprecation/deprecation

showReportDialog({ eventId: 'foobar', onClose });

await waitForPostMessage('some_message');
Expand Down
1 change: 0 additions & 1 deletion packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export { bunServerIntegration } from './integrations/bunserver';
const INTEGRATIONS = {
// eslint-disable-next-line deprecation/deprecation
...CoreIntegrations,
// eslint-disable-next-line deprecation/deprecation
...NodeIntegrations,
BunServer,
};
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/baseclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public captureException(exception: any, hint?: EventHint, scope?: Scope): string | undefined {
// ensure we haven't captured this very object before
if (checkOrSetAlreadyCaught(exception)) {
Expand Down Expand Up @@ -857,7 +857,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
/**
* @inheritDoc
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public abstract eventFromException(_exception: any, _hint?: EventHint): PromiseLike<Event>;

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/integrations/inboundfilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ function _getPossibleEventMessages(event: Event): string[] {
let lastException;
try {
// @ts-expect-error Try catching to save bundle size
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
lastException = event.exception.values[event.exception.values.length - 1];
} catch (e) {
// try catching to save bundle size checking existence of variables
Expand All @@ -198,7 +197,6 @@ function _getPossibleEventMessages(event: Event): string[] {
function _isSentryError(event: Event): boolean {
try {
// @ts-expect-error can't be a sentry error if undefined
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return event.exception.values[0].type === 'SentryError';
} catch (e) {
// ignore
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tracing/hubextensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function _startTransaction(
The transaction will not be sampled. Please use the ${configInstrumenter} instrumentation to start transactions.`,
);

// eslint-disable-next-line deprecation/deprecation
transactionContext.sampled = false;
}

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tracing/idletransaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
import type { Hub, SpanTimeInput, TransactionContext } from '@sentry/types';
import { logger, timestampInSeconds } from '@sentry/utils';

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tracing/sampling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export function sampleTransaction<T extends Transaction>(
*/
function isValidSampleRate(rate: unknown): boolean {
// we need to check NaN explicitly because it's of type 'number' and therefore wouldn't get caught by this typecheck
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if (isNaN(rate) || !(typeof rate === 'number' || typeof rate === 'boolean')) {
DEBUG_BUILD &&
logger.warn(
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/tracing/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export class Transaction extends SentrySpan implements TransactionInterface {
}

// This sadly conflicts with the getter/setter ordering :(
/* eslint-disable @typescript-eslint/member-ordering */

/**
* Get the metadata for this transaction.
Expand Down
1 change: 0 additions & 1 deletion packages/core/test/lib/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable deprecation/deprecation */
import type { ClientOptions, DsnComponents } from '@sentry/types';
import { makeDsn } from '@sentry/utils';

Expand Down
2 changes: 0 additions & 2 deletions packages/core/test/lib/session.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable deprecation/deprecation */

import type { SessionContext } from '@sentry/types';
import { timestampInSeconds } from '@sentry/utils';

Expand Down
2 changes: 0 additions & 2 deletions packages/core/test/lib/sessionflusher.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable deprecation/deprecation */

import type { Client } from '@sentry/types';

import { SessionFlusher } from '../../src/sessionflusher';
Expand Down
1 change: 0 additions & 1 deletion packages/core/test/lib/tracing/span.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { TRACE_FLAG_NONE, TRACE_FLAG_SAMPLED, spanToJSON } from '../../../src/ut

describe('span', () => {
describe('name', () => {
/* eslint-disable deprecation/deprecation */
it('works with name', () => {
const span = new SentrySpan({ name: 'span name' });
expect(spanToJSON(span).description).toEqual('span name');
Expand Down
3 changes: 0 additions & 3 deletions packages/core/test/mocks/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ export class TestClient extends BaseClient<TestClientOptions> {
TestClient.instance = this;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
public eventFromException(exception: any): PromiseLike<Event> {
const event: Event = {
exception: {
values: [
{
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
type: exception.name,
value: exception.message,
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
Expand Down Expand Up @@ -86,7 +84,6 @@ export class TestClient extends BaseClient<TestClientOptions> {
super.sendEvent(event, hint);
return;
}
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
TestClient.sendEventCalled && TestClient.sendEventCalled(event);
}

Expand Down
1 change: 0 additions & 1 deletion packages/feedback/test/utils/TestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class TestClient extends BaseClient<TestClientOptions> {
exception: {
values: [
{
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
type: exception.name,
value: exception.message,
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
Expand Down
1 change: 0 additions & 1 deletion packages/node/src/integrations/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ function _createWrappedRequestMethodFactory(
return function wrappedMethod(this: unknown, ...args: RequestMethodArgs): http.ClientRequest {
const requestArgs = normalizeRequestArgs(httpModule, args);
const requestOptions = requestArgs[0];
// eslint-disable-next-line deprecation/deprecation
const rawRequestUrl = extractRawUrl(requestOptions);
const requestUrl = extractUrl(requestOptions);
const client = getClient();
Expand Down
1 change: 0 additions & 1 deletion packages/profiling-node/src/cpu_profiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export function importCppBindingsModule(): PrivateV8CpuProfilerBindings {
return require(`${binaryPath}.node`);
}

/* eslint-disable no-fallthrough */
// We need the fallthrough so that in the end, we can fallback to the require dynamice require.
// This is for cases where precompiled binaries were not provided, but may have been compiled from source.
if (platform === 'darwin') {
Expand Down
1 change: 0 additions & 1 deletion packages/profiling-node/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ export class ProfilingIntegration implements Integration {

// Remove the profile from the transaction context before sending, relay will take care of the rest.
if (profileContext) {
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
delete profiledTransaction.contexts?.['profile'];
}

Expand Down
1 change: 0 additions & 1 deletion packages/profiling-node/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import type { DebugImage } from './types';

// We require the file because if we import it, it will be included in the bundle.
// I guess tsc does not check file contents when it's imported.
// eslint-disable-next-line
const THREAD_ID_STRING = String(threadId);
const THREAD_NAME = isMainThread ? 'main' : 'worker';
const FORMAT_VERSION = '1';
Expand Down
1 change: 0 additions & 1 deletion packages/replay/src/util/getReplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { replayIntegration } from '../integration';
/**
* This is a small utility to get a type-safe instance of the Replay integration.
*/
// eslint-disable-next-line deprecation/deprecation
export function getReplay(): ReturnType<typeof replayIntegration> | undefined {
const client = getClient();
return client && client.getIntegrationByName<ReturnType<typeof replayIntegration>>('Replay');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
import type { IdleTransaction } from '@sentry/core';
import { getActiveSpan } from '@sentry/core';
import { getCurrentHub } from '@sentry/core';
Expand Down
1 change: 0 additions & 1 deletion packages/tracing-internal/src/browser/browsertracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ export class BrowserTracing implements Integration {
this._latestRouteSource = finalContext.attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
}

// eslint-disable-next-line deprecation/deprecation
if (finalContext.sampled === false) {
DEBUG_BUILD && logger.log(`[Tracing] Will not send ${finalContext.op} transaction because of beforeNavigate.`);
}
Expand Down
1 change: 0 additions & 1 deletion packages/tracing-internal/src/node/integrations/mongo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export class Mongo implements LazyLoadedIntegration<MongoModule> {
fill(collection.prototype, operation, function (orig: () => void | Promise<unknown>) {
return function (this: unknown, ...args: unknown[]) {
const lastArg = args[args.length - 1];
// eslint-disable-next-line deprecation/deprecation
const hub = getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const scope = hub.getScope();
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export interface Client<O extends ClientOptions = ClientOptions> {
init(): void;

/** Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`. */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
eventFromException(exception: any, hint?: EventHint): PromiseLike<Event>;

/** Creates an {@link Event} from primitive inputs to `captureMessage`. */
Expand Down
1 change: 0 additions & 1 deletion packages/types/src/startSpanOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ export interface StartSpanOptions extends TransactionContext {
/**
* @deprecated Use attributes instead.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: { [key: string]: any };

/**
Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ function _htmlElementAsString(el: unknown, keyAttrs?: string[]): string {
out.push(`#${elem.id}`);
}

// eslint-disable-next-line prefer-const
className = elem.className;
if (className && isString(className)) {
classes = className.split(/\s+/);
Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/instrument/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type { HandlerDataFetch } from '@sentry/types';

import { fill } from '../object';
Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/is.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */

import type { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';

Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/node-stack-trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export function filenameIsInApp(filename: string, isNative: boolean = false): bo
}

/** Node Stack line parser */
// eslint-disable-next-line complexity
export function node(getModule?: GetModuleFn): StackLineParserFn {
const FILENAME_MATCH = /^\s*[-]{4,}$/;
const FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function isNodeEnv(): boolean {
*
* @param request The module path to resolve
*/
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function dynamicRequire(mod: any, request: string): any {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return mod.require(request);
Expand Down
1 change: 0 additions & 1 deletion packages/utils/src/object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable max-lines */
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { WrappedFunction } from '@sentry/types';

Expand Down
3 changes: 0 additions & 3 deletions packages/utils/src/syncpromise.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable @typescript-eslint/explicit-function-return-type */
/* eslint-disable @typescript-eslint/typedef */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { isThenable } from './is';

Expand Down Expand Up @@ -182,7 +180,6 @@ class SyncPromise<T> implements PromiseLike<T> {
}

if (this._state === States.RESOLVED) {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
handler[1](this._value as unknown as any);
}

Expand Down
2 changes: 0 additions & 2 deletions packages/utils/test/normalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,13 @@ describe('normalize()', () => {
});

test('circular arrays', () => {
// eslint-disable-next-line @typescript-eslint/ban-types
const obj: object[] = [];
obj.push(obj);
obj.push(obj);
expect(normalize(obj)).toEqual(['[Circular ~]', '[Circular ~]']);
});

test('circular arrays with intermediaries', () => {
// eslint-disable-next-line @typescript-eslint/ban-types
const obj: object[] = [];
obj.push({ name: 'Alice', self: obj });
obj.push({ name: 'Bob', self: obj });
Expand Down
1 change: 0 additions & 1 deletion packages/utils/test/syncpromise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ describe('SyncPromise', () => {

let foo: number = 1;

// eslint-disable-next-line @typescript-eslint/no-floating-promises
new SyncPromise<number>(_ => {
foo = 2;
});
Expand Down