Skip to content
Open
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
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ module.exports = {
'types/**',
'scripts/*.js',
],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
reportUnusedDisableDirectives: true,
overrides: [
{
Expand All @@ -36,6 +39,9 @@ module.exports = {
parserOptions: {
project: ['tsconfig.test.json'],
},
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
files: ['scripts/**/*.ts'],
Expand Down
7 changes: 7 additions & 0 deletions dev-packages/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['../.eslintrc.js'],
rules: {
// tests often have just cause to do evil
'@typescript-eslint/no-explicit-any': 'off',
},
};
2 changes: 1 addition & 1 deletion dev-packages/browser-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
ignorePatterns: [
'suites/**/subject.js',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/bundler-tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['../../.eslintrc.js'],
extends: ['../.eslintrc.js'],
parserOptions: {
sourceType: 'module',
},
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/clear-cache-gh-action/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
parserOptions: {
sourceType: 'module',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/cloudflare-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
overrides: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { GoogleGenAIChat, GoogleGenAIClient, GoogleGenAIResponse } from '@s
export class MockGoogleGenAI implements GoogleGenAIClient {
public models: {
generateContent: (...args: unknown[]) => Promise<GoogleGenAIResponse>;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
generateContentStream: (...args: unknown[]) => Promise<AsyncGenerator<GoogleGenAIResponse, any, unknown>>;
};
public chats: {
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/e2e-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
ignorePatterns: ['test-applications/**', 'tmp/**'],
parserOptions: {
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/external-contributor-gh-action/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
parserOptions: {
sourceType: 'module',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-core-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-integration-tests/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/node-overhead-gh-action/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/rollup-utils/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
ignorePatterns: ['otelLoaderTemplate.js.tmpl'],
sourceType: 'module',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/size-limit-gh-action/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
parserOptions: {
sourceType: 'module',
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/test-utils/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
node: true,
},
// todo: remove regexp plugin from here once we add it to base.js eslint config for the whole project
extends: ['../../.eslintrc.js', 'plugin:regexp/recommended'],
extends: ['../.eslintrc.js', 'plugin:regexp/recommended'],
plugins: ['regexp'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

/* eslint-disable @typescript-eslint/no-explicit-any */
import type { Context as OtelContext, Span } from '@opentelemetry/api';
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
import type { Context } from 'aws-lambda';
Expand Down
14 changes: 7 additions & 7 deletions packages/cloudflare/src/durableobject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type MethodWrapperOptions = {
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type OriginalMethod = (...args: any[]) => any;
type UncheckedMethod = (...args: any[]) => any;
type OriginalMethod = UncheckedMethod;

function wrapMethodWithSentry<T extends OriginalMethod>(
wrapperOptions: MethodWrapperOptions,
Expand Down Expand Up @@ -269,8 +270,7 @@ export function instrumentDurableObjectWithSentry<
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
(obj as any)[method] = wrapMethodWithSentry(
{ options, context, spanName: method, spanOp: 'rpc' },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value as (...args: any[]) => any,
value as UncheckedMethod,
);
}
}
Expand Down Expand Up @@ -332,7 +332,7 @@ function instrumentPrototype<T extends NewableFunction>(target: T, methodsToInst
}

// Create a wrapper that gets context/options from the instance at runtime
const wrappedMethod = function (this: any, ...args: any[]): unknown {
const wrappedMethod = function (this: unknown, ...args: unknown[]): unknown {
const thisWithSentry = this as {
__SENTRY_CONTEXT__: DurableObjectState;
__SENTRY_OPTIONS__: CloudflareOptions;
Expand All @@ -342,7 +342,7 @@ function instrumentPrototype<T extends NewableFunction>(target: T, methodsToInst

if (!instanceOptions) {
// Fallback to original method if no Sentry data found
return (originalMethod as (...args: any[]) => any).apply(this, args);
return (originalMethod as UncheckedMethod).apply(this, args);
}

// Use the existing wrapper but with instance-specific context/options
Expand All @@ -353,12 +353,12 @@ function instrumentPrototype<T extends NewableFunction>(target: T, methodsToInst
spanName: methodName,
spanOp: 'rpc',
},
originalMethod as (...args: any[]) => any,
originalMethod as UncheckedMethod,
undefined,
true, // noMark = true since we'll mark the prototype method
);

return (wrapper as (...args: any[]) => any).apply(this, args);
return wrapper.apply(this, args);
};

markAsInstrumented(wrappedMethod);
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/integrations/supabase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Based on Kamil Ogórek's work on:
// https://github.com/supabase-community/sentry-integration-js

/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-lines */
import { addBreadcrumb } from '../breadcrumbs';
import { DEBUG_BUILD } from '../debug-build';
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/types-hoist/breadcrumb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface Breadcrumb {
*
* @summary Arbitrary data associated with this breadcrumb.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: { [key: string]: any };

/**
Expand All @@ -70,6 +71,7 @@ export interface Breadcrumb {

/** JSDoc */
export interface BreadcrumbHint {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}

Expand All @@ -90,6 +92,7 @@ export interface XhrBreadcrumbData {
}

export interface FetchBreadcrumbHint {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
input: any[];
data?: unknown;
response?: unknown;
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types-hoist/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export interface ResponseContext extends Record<string, unknown> {
}

export interface TraceContext extends Record<string, unknown> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: { [key: string]: any };
op?: string;
parent_span_id?: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types-hoist/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
* Just an Error object with arbitrary attributes attached to it.
*/
export interface ExtendedError extends Error {
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
1 change: 1 addition & 0 deletions packages/core/src/types-hoist/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface EventHint {
syntheticException?: Error | null;
originalException?: unknown;
attachments?: Attachment[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data?: any;
integrations?: string[];
}
2 changes: 2 additions & 0 deletions packages/core/src/types-hoist/instrument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface SentryFetchData {
}

export interface HandlerDataFetch {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: any[];
fetchData: SentryFetchData; // This data is among other things dumped directly onto the fetch breadcrumb data
startTimestamp: number;
Expand Down Expand Up @@ -74,6 +75,7 @@ export interface HandlerDataDom {

export interface HandlerDataConsole {
level: ConsoleLevel;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
args: any[];
}

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types-hoist/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ export interface Integration {
* An integration in function form.
* This is expected to return an integration.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type IntegrationFn<IntegrationType = Integration> = (...rest: any[]) => IntegrationType;
2 changes: 2 additions & 0 deletions packages/core/src/types-hoist/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { QueryParams } from './request';
* Data extracted from an incoming request to a node server
*/
export interface ExtractedNodeRequestData {
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;

/** Specific headers from the request */
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/types-hoist/polymorphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,14 @@ type NextjsRequest = NodeRequest & {
[key: string]: string;
};
query?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};
};

type ExpressRequest = NodeRequest & {
baseUrl?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body?: string | { [key: string]: any };
host?: string;
hostname?: string;
Expand All @@ -70,9 +72,11 @@ type ExpressRequest = NodeRequest & {
];
};
query?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};
user?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};
_reconstructedRoute?: string;
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/types-hoist/samplingcontext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import type { SpanAttributes } from './span';
* Context data passed by the user when starting a transaction, to be used by the tracesSampler method.
*/
export interface CustomSamplingContext {
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/types-hoist/stackframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ export interface StackFrame {
in_app?: boolean;
instruction_addr?: string;
addr_mode?: string;
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
vars?: { [key: string]: any };
debug_id?: string;
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
module_metadata?: any;
}
2 changes: 2 additions & 0 deletions packages/core/src/types-hoist/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* An interface describing a user of an application or a handled request.
*/
export interface User {
// TODO: fix in v11, convert any to unknown
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
id?: string | number;
ip_address?: string | null;
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/utils/aggregate-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ function aggregateExceptionsFromError(
// Recursively call this function in order to walk down a chain of errors
if (isInstanceOf(error[key], Error)) {
applyExceptionGroupFieldsForParentException(exception, exceptionId);
const newException = exceptionFromErrorImplementation(parser, error[key]);
const newException = exceptionFromErrorImplementation(parser, error[key] as Error);
const newExceptionId = newExceptions.length;
applyExceptionGroupFieldsForChildException(newException, key, newExceptionId, exceptionId);
newExceptions = aggregateExceptionsFromError(
exceptionFromErrorImplementation,
parser,
limit,
error[key],
error[key] as ExtendedError,
key,
[newException, ...newExceptions],
newException,
Expand All @@ -78,14 +78,14 @@ function aggregateExceptionsFromError(
error.errors.forEach((childError, i) => {
if (isInstanceOf(childError, Error)) {
applyExceptionGroupFieldsForParentException(exception, exceptionId);
const newException = exceptionFromErrorImplementation(parser, childError);
const newException = exceptionFromErrorImplementation(parser, childError as Error);
const newExceptionId = newExceptions.length;
applyExceptionGroupFieldsForChildException(newException, `errors[${i}]`, newExceptionId, exceptionId);
newExceptions = aggregateExceptionsFromError(
exceptionFromErrorImplementation,
parser,
limit,
childError,
childError as ExtendedError,
key,
[newException, ...newExceptions],
newException,
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/utils/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ export function isSyntheticEvent(wat: unknown): boolean {
* @param base A constructor to be used in a check.
* @returns A boolean representing the result.
*/
export function isInstanceOf(wat: any, base: any): boolean {
// TODO: fix in v11, convert any to unknown
// export function isInstanceOf<T>(wat: unknown, base: { new (...args: any[]): T }): wat is T {
export function isInstanceOf<T>(wat: any, base: any): wat is T {
try {
return wat instanceof base;
} catch {
Expand Down
Loading
Loading