Skip to content

Commit 45b7c2b

Browse files
TkDodoandrewshie-sentry
authored andcommitted
ref: set noImplicitAny compiler setting to true (#83366)
requires getsentry/getsentry#16121 refs getsentry/frontend-tsc#79 This PR turns on the `noImplicitAny` compiler setting for the `sentry` repository.
1 parent acdf1d3 commit 45b7c2b

File tree

921 files changed

+2512
-1506
lines changed

Some content is hidden

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

921 files changed

+2512
-1506
lines changed

api-docs/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ function build(originalFile, _, bundleTo) {
7878
);
7979
}
8080

81-
let originalFile;
82-
let targetDirValue;
81+
let originalFile: any;
82+
let targetDirValue: any;
8383

8484
const argv = process.argv.slice(2);
8585

config/tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
// Type checking specific options
3636
"alwaysStrict": false,
3737
"noFallthroughCasesInSwitch": true,
38-
"noImplicitAny": false,
38+
"noImplicitAny": true,
3939
"noImplicitReturns": true,
4040
"noImplicitThis": true,
4141
"noUnusedLocals": true,

eslint.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
import * as emotion from '@emotion/eslint-plugin';
1313
import eslint from '@eslint/js';
1414
import prettier from 'eslint-config-prettier';
15+
// @ts-expect-error TS(7016): Could not find a declaration file
1516
import importPlugin from 'eslint-plugin-import';
1617
import jest from 'eslint-plugin-jest';
1718
import jestDom from 'eslint-plugin-jest-dom';
1819
import react from 'eslint-plugin-react';
20+
// @ts-expect-error TS(7016): Could not find a declaration file
1921
import reactHooks from 'eslint-plugin-react-hooks';
22+
// @ts-expect-error TS(7016): Could not find a declaration file
2023
import sentry from 'eslint-plugin-sentry';
2124
import simpleImportSort from 'eslint-plugin-simple-import-sort';
2225
import testingLibrary from 'eslint-plugin-testing-library';
26+
// @ts-expect-error TS (7016): Could not find a declaration file
2327
import typescriptSortKeys from 'eslint-plugin-typescript-sort-keys';
2428
import globals from 'globals';
2529
import invariant from 'invariant';

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
"@testing-library/jest-dom": "6.4.5",
189189
"@testing-library/react": "16.0.0",
190190
"@testing-library/user-event": "14.5.2",
191+
"@types/eslint-config-prettier": "^6.11.3",
191192
"@types/node": "^22.9.1",
192193
"babel-gettext-extractor": "^4.1.3",
193194
"babel-jest": "29.7.0",

static/app/__mocks__/api.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ class Client implements ApiNamespace.Client {
196196
const asyncDelay = Client.asyncDelay;
197197

198198
return (...args: T) => {
199-
// @ts-expect-error
200-
if (RealApi.hasProjectBeenRenamed(...args)) {
199+
if ((RealApi.hasProjectBeenRenamed as any)(...args)) {
201200
return;
202201
}
203202
respond(asyncDelay, func, ...args);

static/app/actionCreators/formSearch.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ const createSearchMap = ({
3030
return listOfFields.map<FormSearchField>(field => ({
3131
...other,
3232
route,
33-
title: typeof field !== 'function' ? (field.label as string) : undefined,
34-
description: typeof field !== 'function' ? (field.help as string) : undefined,
35-
field,
33+
title: typeof field !== 'function' ? (field?.label as string) : undefined,
34+
description: typeof field !== 'function' ? (field?.help as string) : undefined,
35+
field: field!,
3636
}));
3737
};
3838

@@ -42,7 +42,7 @@ export function loadSearchMap() {
4242
const context = require.context('../data/forms', true, /\.tsx?$/);
4343

4444
// Get a list of all form fields defined in `../data/forms`
45-
const allFormFields: FormSearchField[] = context.keys().flatMap(key => {
45+
const allFormFields: FormSearchField[] = context.keys().flatMap((key: any) => {
4646
const mod = context(key);
4747

4848
// Since we're dynamically importing an entire directly, there could be malformed modules defined?

static/app/actionCreators/group.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,12 @@ export function paramsToQueryArgs(params: ParamsType): QueryArgs {
256256
// only include date filters if they are not null/undefined
257257
if (params.query) {
258258
['start', 'end', 'period', 'utc'].forEach(prop => {
259-
if (params[prop] !== null && params[prop] !== undefined) {
260-
p[prop === 'period' ? 'statsPeriod' : prop] = params[prop];
259+
if (
260+
params[prop as keyof typeof params] !== null &&
261+
params[prop as keyof typeof params] !== undefined
262+
) {
263+
(p as any)[prop === 'period' ? 'statsPeriod' : prop] =
264+
params[prop as keyof typeof params];
261265
}
262266
});
263267
}

static/app/actionCreators/indicator.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,9 @@ export function addMessage(
5151

5252
// XXX: Debug for https://sentry.io/organizations/sentry/issues/1595204979/
5353
if (
54-
// @ts-expect-error
55-
typeof msg?.message !== 'undefined' &&
56-
// @ts-expect-error
57-
typeof msg?.code !== 'undefined' &&
58-
// @ts-expect-error
59-
typeof msg?.extra !== 'undefined'
54+
typeof (msg as any)?.message !== 'undefined' &&
55+
typeof (msg as any)?.code !== 'undefined' &&
56+
typeof (msg as any)?.extra !== 'undefined'
6057
) {
6158
Sentry.captureException(new Error('Attempt to XHR response to Indicators'));
6259
}

static/app/actionCreators/monitors.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export async function updateMonitor(
7070
// If we are updating a single value in the monitor we can read the
7171
// validation error for that key, otherwise fallback to the default error
7272
const validationError =
73-
updateKeys.length === 1 ? respError.responseJSON?.[updateKeys[0]!]?.[0] : undefined;
73+
updateKeys.length === 1
74+
? (respError.responseJSON?.[updateKeys[0]!] as any)?.[0]
75+
: undefined;
7476

7577
logException(err);
7678
addErrorMessage(validationError ?? t('Unable to update monitor.'));

static/app/actionCreators/prompts.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,12 @@ export async function batchedPromptsCheck<T extends readonly string[]>(
290290
for (const featureName of features) {
291291
const item = responseFeatures[featureName];
292292
if (item) {
293-
result[featureName] = {
293+
(result as any)[featureName] = {
294294
dismissedTime: item.dismissed_ts,
295295
snoozedTime: item.snoozed_ts,
296296
};
297297
} else {
298-
result[featureName] = null;
298+
(result as any)[featureName] = null;
299299
}
300300
}
301301
return result as {[key in T[number]]: PromptData};

static/app/api.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export class Client {
356356

357357
// Check if API response is a 302 -- means project slug was renamed and user
358358
// needs to be redirected
359-
// @ts-expect-error
359+
// @ts-ignore TS(2556): A spread argument must either have a tuple type or... Remove this comment to see the full error message
360360
if (hasProjectBeenRenamed(...args)) {
361361
return undefined;
362362
}

static/app/chartcuterie/discover.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ discoverCharts.push({
5050
}
5151

5252
const stats = Object.keys(data.stats).map(key =>
53-
Object.assign({}, {key}, data.stats[key])
53+
Object.assign({}, {key}, (data.stats as any)[key])
5454
);
5555
const color = theme.charts.getColorPalette(stats.length - 2);
5656

@@ -113,7 +113,7 @@ discoverCharts.push({
113113
}
114114

115115
const stats = Object.keys(data.stats).map(key =>
116-
Object.assign({}, {key}, data.stats[key])
116+
Object.assign({}, {key}, (data.stats as any)[key])
117117
);
118118
const color = theme.charts.getColorPalette(stats.length - 2);
119119

@@ -369,7 +369,7 @@ discoverCharts.push({
369369
}
370370

371371
const stats = Object.keys(data.stats).map(key =>
372-
Object.assign({}, {key}, data.stats[key])
372+
Object.assign({}, {key}, (data.stats as any)[key])
373373
);
374374
const color = theme.charts.getColorPalette(stats.length - 2) ?? [];
375375
const previousPeriodColor = lightenHexToRgb(color);

static/app/components/autoplayVideo.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const makeProxyMock = (video: Partial<HTMLVideoElement>) => {
2424
{current: video},
2525
{
2626
get(obj, prop) {
27-
return obj[prop];
27+
return obj[prop as never];
2828
},
2929
set(_obj, _prop) {
3030
return true;

static/app/components/avatarChooser.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class AvatarChooser extends Component<Props, State> {
101101
return resp;
102102
}
103103
const isColor = type === 'sentryAppColor';
104-
return {avatar: resp?.avatars?.find(({color}) => color === isColor) ?? undefined};
104+
return {
105+
avatar: resp?.avatars?.find(({color}: any) => color === isColor) ?? undefined,
106+
};
105107
}
106108

107109
handleError(msg: string) {

static/app/components/charts/areaChart.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export function transformToAreaSeries({
2727
name: seriesName,
2828
data: data.map(({name, value}) => [name, value]),
2929
lineStyle: {
30-
color: colors?.[i],
30+
color: (colors as any)?.[i],
3131
opacity: 1,
3232
width: 0.4,
3333
},
3434
areaStyle: {
35-
color: colors?.[i],
35+
color: (colors as any)?.[i],
3636
opacity: 1.0,
3737
},
3838
// Define the z level so that the series remain stacked in the correct order

static/app/components/charts/barChartZoom.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ class BarChartZoom extends Component<Props> {
8484
* we can let the native zoom animation on the chart complete
8585
* before we update URL state and re-render
8686
*/
87-
handleChartFinished = (_props, chart) => {
87+
handleChartFinished = (_props: any, chart: any) => {
8888
if (typeof this.zooming === 'function') {
8989
this.zooming();
9090
this.zooming = null;
9191
}
9292

9393
// This attempts to activate the area zoom toolbox feature
94-
const zoom = chart._componentsViews?.find(c => c._features?.dataZoom);
94+
const zoom = chart._componentsViews?.find((c: any) => c._features?.dataZoom);
9595
if (zoom && !zoom._features.dataZoom._isZoomActive) {
9696
// Calling dispatchAction will re-trigger handleChartFinished
9797
chart.dispatchAction({
@@ -102,7 +102,7 @@ class BarChartZoom extends Component<Props> {
102102
}
103103
};
104104

105-
handleDataZoom = (evt, chart) => {
105+
handleDataZoom = (evt: any, chart: any) => {
106106
const model = chart.getModel();
107107
const {startValue, endValue} = model._payload.batch[0];
108108

static/app/components/charts/baseChart.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -419,14 +419,14 @@ function BaseChartUnwrapped({
419419
type: 'line',
420420
itemStyle: {...(s.lineStyle ?? {})},
421421
markLine:
422-
s?.data?.[0]?.[1] !== undefined
422+
(s?.data?.[0] as any)?.[1] !== undefined
423423
? MarkLine({
424424
silent: true,
425425
lineStyle: {
426426
type: 'solid',
427427
width: 1.5,
428428
},
429-
data: [{yAxis: s?.data?.[0]?.[1]}],
429+
data: [{yAxis: (s?.data?.[0] as any)?.[1]}],
430430
label: {
431431
show: false,
432432
},
@@ -606,22 +606,23 @@ function BaseChartUnwrapped({
606606
const eventsMap = useMemo(
607607
() =>
608608
({
609-
click: (props, instance: ECharts) => {
609+
click: (props: any, instance: ECharts) => {
610610
handleClick(props, instance);
611611
onClick?.(props, instance);
612612
},
613-
highlight: (props, instance: ECharts) => onHighlight?.(props, instance),
614-
mouseout: (props, instance: ECharts) => onMouseOut?.(props, instance),
615-
mouseover: (props, instance: ECharts) => onMouseOver?.(props, instance),
616-
datazoom: (props, instance: ECharts) => onDataZoom?.(props, instance),
617-
restore: (props, instance: ECharts) => onRestore?.(props, instance),
618-
finished: (props, instance: ECharts) => onFinished?.(props, instance),
619-
rendered: (props, instance: ECharts) => onRendered?.(props, instance),
620-
legendselectchanged: (props, instance: ECharts) =>
613+
highlight: (props: any, instance: ECharts) => onHighlight?.(props, instance),
614+
mouseout: (props: any, instance: ECharts) => onMouseOut?.(props, instance),
615+
mouseover: (props: any, instance: ECharts) => onMouseOver?.(props, instance),
616+
datazoom: (props: any, instance: ECharts) => onDataZoom?.(props, instance),
617+
restore: (props: any, instance: ECharts) => onRestore?.(props, instance),
618+
finished: (props: any, instance: ECharts) => onFinished?.(props, instance),
619+
rendered: (props: any, instance: ECharts) => onRendered?.(props, instance),
620+
legendselectchanged: (props: any, instance: ECharts) =>
621621
onLegendSelectChanged?.(props, instance),
622-
brush: (props, instance: ECharts) => onBrushStart?.(props, instance),
623-
brushend: (props, instance: ECharts) => onBrushEnd?.(props, instance),
624-
brushselected: (props, instance: ECharts) => onBrushSelected?.(props, instance),
622+
brush: (props: any, instance: ECharts) => onBrushStart?.(props, instance),
623+
brushend: (props: any, instance: ECharts) => onBrushEnd?.(props, instance),
624+
brushselected: (props: any, instance: ECharts) =>
625+
onBrushSelected?.(props, instance),
625626
}) as ReactEchartProps['onEvents'],
626627
[
627628
onClick,

static/app/components/charts/chartZoom.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ChartZoom extends Component<Props> {
115115
* Save current period state from period in props to be used
116116
* in handling chart's zoom history state
117117
*/
118-
saveCurrentPeriod = props => {
118+
saveCurrentPeriod = (props: any) => {
119119
this.currentPeriod = {
120120
period: props.period,
121121
start: getDate(props.start),
@@ -132,7 +132,7 @@ class ChartZoom extends Component<Props> {
132132
*
133133
* Saves a callback function to be called after chart animation is completed
134134
*/
135-
setPeriod = ({period, start, end}, saveHistory = false) => {
135+
setPeriod = ({period, start, end}: any, saveHistory = false) => {
136136
const {router, onZoom, usePageDate, saveOnZoom} = this.props;
137137
const startFormatted = getDate(start);
138138
const endFormatted = getDate(end);
@@ -200,7 +200,7 @@ class ChartZoom extends Component<Props> {
200200
this.$chart.addEventListener('mousedown', this.handleMouseDown);
201201
};
202202

203-
handleKeyDown = evt => {
203+
handleKeyDown = (evt: any) => {
204204
if (!this.chart) {
205205
return;
206206
}
@@ -225,7 +225,7 @@ class ChartZoom extends Component<Props> {
225225
*
226226
* Updates URL state to reflect initial params
227227
*/
228-
handleZoomRestore = (evt, chart) => {
228+
handleZoomRestore = (evt: any, chart: any) => {
229229
if (this.isCancellingZoom) {
230230
// If this restore is caused by a zoom cancel, do not run handlers!
231231
// The regular handler restores to the earliest point in the zoom history
@@ -263,7 +263,7 @@ class ChartZoom extends Component<Props> {
263263
document.body.removeEventListener('keydown', this.handleKeyDown, true);
264264
};
265265

266-
handleDataZoom = (evt, chart) => {
266+
handleDataZoom = (evt: any, chart: any) => {
267267
const model = chart.getModel();
268268
const {startValue, endValue} = model._payload.batch[0];
269269

@@ -295,14 +295,14 @@ class ChartZoom extends Component<Props> {
295295
* we can let the native zoom animation on the chart complete
296296
* before we update URL state and re-render
297297
*/
298-
handleChartFinished = (_props, chart) => {
298+
handleChartFinished = (_props: any, chart: any) => {
299299
if (typeof this.zooming === 'function') {
300300
this.zooming();
301301
this.zooming = null;
302302
}
303303

304304
// This attempts to activate the area zoom toolbox feature
305-
const zoom = chart._componentsViews?.find(c => c._features?.dataZoom);
305+
const zoom = chart._componentsViews?.find((c: any) => c._features?.dataZoom);
306306
if (zoom && !zoom._features.dataZoom._isZoomActive) {
307307
// Calling dispatchAction will re-trigger handleChartFinished
308308
chart.dispatchAction({

static/app/components/charts/components/xAxis.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {Theme} from '@emotion/react';
22
import type {XAXisComponentOption} from 'echarts';
3+
import type {TimeAxisLabelFormatterOption} from 'echarts/types/src/coord/axisCommonTypes';
34
import merge from 'lodash/merge';
45

56
import type {BaseChartProps} from 'sentry/components/charts/baseChart';
@@ -84,8 +85,7 @@ function XAxis({
8485
showMaxLabel: false,
8586
showMinLabel: false,
8687

87-
// @ts-expect-error formatter type is missing
88-
formatter: AxisLabelFormatter,
88+
formatter: AxisLabelFormatter as TimeAxisLabelFormatterOption,
8989
},
9090
axisPointer: {
9191
show: true,

static/app/components/charts/eventsChart.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,20 @@ class Chart extends Component<ChartProps, State> {
162162
return AreaChart;
163163
}
164164

165-
handleLegendSelectChanged = legendChange => {
165+
handleLegendSelectChanged = (legendChange: any) => {
166166
const {disableableSeries = []} = this.props;
167167
const {selected} = legendChange;
168-
const seriesSelection = Object.keys(selected).reduce((state, key) => {
169-
// we only want them to be able to disable the Releases&Other series,
170-
// and not any of the other possible series here
171-
const disableable =
172-
['Releases', 'Other'].includes(key) || disableableSeries.includes(key);
173-
state[key] = disableable ? selected[key] : true;
174-
return state;
175-
}, {});
168+
const seriesSelection = Object.keys(selected).reduce(
169+
(state, key) => {
170+
// we only want them to be able to disable the Releases&Other series,
171+
// and not any of the other possible series here
172+
const disableable =
173+
['Releases', 'Other'].includes(key) || disableableSeries.includes(key);
174+
state[key] = disableable ? selected[key] : true;
175+
return state;
176+
},
177+
{} as Record<string, boolean>
178+
);
176179

177180
// we have to force an update here otherwise ECharts will
178181
// update its internal state and disable the series

0 commit comments

Comments
 (0)