Skip to content

Commit 85ce74d

Browse files
authored
Enable noUnusedParameters and @typescript-eslint/no-unused-vars and clean up a few more things (#5576)
2 parents bbc48b2 + dbdb2a7 commit 85ce74d

36 files changed

+54
-78
lines changed

eslint.config.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,25 @@ export default [
140140
'no-else-return': 'error',
141141
'no-nested-ternary': 'error',
142142

143+
'@typescript-eslint/no-unused-vars': [
144+
'error',
145+
{
146+
args: 'all',
147+
argsIgnorePattern: '^_',
148+
caughtErrors: 'all',
149+
caughtErrorsIgnorePattern: '^_',
150+
destructuredArrayIgnorePattern: '^_',
151+
varsIgnorePattern: '^_',
152+
ignoreRestSiblings: true,
153+
},
154+
],
155+
143156
// Use `import type` everywhere we can.
144157
'@typescript-eslint/consistent-type-imports': 'error',
145158
// Allow `as any` escape hatches
146159
'@typescript-eslint/no-explicit-any': 'off',
147160
// Disable a rule that the TypeScript FAQ disapproves of
148161
'@typescript-eslint/no-empty-object-type': 'off',
149-
// Should enable this soon, mostly finds `catch (e)` with unused e
150-
'@typescript-eslint/no-unused-vars': 'off',
151162
// TypeScript imports react-jsx into .tsx files for us
152163
'react/react-in-jsx-scope': 'off',
153164
// Allow @ts-expect-error annotations with descriptions.

profile-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const path = require('path');
88
module.exports = {
99
serveAndOpen(host, profilerUrl, profilePath, openOptions) {
1010
// Create a simple http server serving the profile file.
11-
const profileServer = http.createServer((req, res) => {
11+
const profileServer = http.createServer((_req, res) => {
1212
res.setHeader('Access-Control-Allow-Origin', profilerUrl);
1313
const fileStream = fs.createReadStream(profilePath);
1414
fileStream.pipe(res);

src/app-logic/create-store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default function initializeStore(): Store {
1818
if (process.env.NODE_ENV === 'development') {
1919
loggerMiddleware = createLogger({
2020
collapsed: true,
21-
titleFormatter: (action, time, duration) =>
21+
titleFormatter: (action, _time, duration) =>
2222
`[action] ${action.type} (in ${duration.toFixed(2)} ms)`,
2323
logErrors: false,
2424
duration: true,

src/components/app/AppLocalizationProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class AppLocalizationInit extends React.PureComponent<InitProps> {
137137
console.warn(
138138
`The stored locale information (${strPreviouslyRequestedLocales}) looks incorrect.`
139139
);
140-
} catch (e) {
140+
} catch (_e) {
141141
console.warn(
142142
`We got an error when trying to parse the previously stored locale information (${strPreviouslyRequestedLocales}).`
143143
);

src/components/app/CodeLoadingOverlay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function CodeLoadingOverlay({ source }: CodeLoadingOverlayProps) {
1717
let host;
1818
try {
1919
host = new URL(url).host;
20-
} catch (e) {
20+
} catch (_e) {
2121
host = url;
2222
}
2323
return (

src/components/flame-graph/Canvas.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ class FlameGraphCanvasImpl extends React.PureComponent<Props> {
422422
? this._getTimingsForCallNodeIndex(
423423
callNodeIndex,
424424
callNodeInfo,
425-
interval,
426425
unfilteredThread,
427426
ctssSampleIndexOffset,
428427
categories,

src/components/network-chart/NetworkChartRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ export class NetworkChartRow extends React.PureComponent<
380380
try {
381381
const uri = new URL(this._cropNameToUrl(url));
382382
return uri;
383-
} catch (e) {
383+
} catch (_e) {
384384
return null;
385385
}
386386
}

src/components/shared/AssemblyView-codemirror.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import type {
2929
Address,
3030
LineTimings,
3131
LineNumber,
32-
NativeSymbolInfo,
3332
DecodedInstruction,
3433
} from 'firefox-profiler/types';
3534

@@ -179,7 +178,6 @@ export class AssemblyViewEditor {
179178
// Create a CodeMirror editor and add it as a child element of domParent.
180179
constructor(
181180
initialAssemblyCode: DecodedInstruction[],
182-
nativeSymbol: NativeSymbolInfo,
183181
addressTimings: AddressTimings,
184182
domParent: Element
185183
) {

src/components/shared/AssemblyView.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export class AssemblyView extends React.PureComponent<AssemblyViewProps> {
149149
const { AssemblyViewEditor } = codeMirrorModule;
150150
const editor = new AssemblyViewEditor(
151151
this._getAssemblyCodeOrFallback(),
152-
this.props.nativeSymbol,
153152
this.props.timings,
154153
domParent
155154
);

src/components/shared/ButtonWithPanel/ArrowPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class ArrowPanel extends React.PureComponent<Props, State> {
8989

9090
// We're calling open and close callbacks in componentDidUpdate because they
9191
// often run side-effects, so we want them out of the render phase.
92-
override componentDidUpdate(prevProps: Props, prevState: State) {
92+
override componentDidUpdate(_prevProps: Props, prevState: State) {
9393
if (!prevState.open && this.state.open) {
9494
// Opening
9595
this.props.onOpen();

0 commit comments

Comments
 (0)