lint: fix various lint issues detected by newer version of linters

Summary:
Those are detected by D52528858. However, D52528858 might have other issues
that might prevent upgrade. So I move the lint fixes to a standalone diff.

Reviewed By: evangrayk

Differential Revision: D52531364

fbshipit-source-id: 322d73ac0c74b602b5af4fd59aaf2acf5145d81a
This commit is contained in:
Jun Wu 2024-01-04 14:04:27 -08:00 committed by Facebook GitHub Bot
parent 796733929e
commit 7136155de1
16 changed files with 14 additions and 27 deletions

View File

@ -8,7 +8,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"module": "esnext",

View File

@ -6,7 +6,7 @@
*/
import type {Operation} from './operations/Operation';
import type {CommandArg, ValidatedRepoInfo} from './types';
import type {ValidatedRepoInfo} from './types';
import type {ReactNode} from 'react';
import {Delayed} from './Delayed';

View File

@ -20,7 +20,6 @@ import {commitByHash} from '../serverAPIState';
import {
commitInfoViewCurrentCommits,
commitMode,
editedCommitMessages,
latestCommitMessageFieldsWithEdits,
} from './CommitInfoState';
import {getInnerTextareaForVSCodeTextArea} from './utils';

View File

@ -13,12 +13,11 @@ import {
simulateCommits,
closeCommitInfoSidebar,
TEST_COMMIT_HISTORY,
COMMIT,
expectMessageNOTSentToServer,
openCommitInfoSidebar,
} from '../testUtils';
import {CommandRunner} from '../types';
import {fireEvent, render, screen, within} from '@testing-library/react';
import {fireEvent, render, screen} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {act} from 'react-dom/test-utils';

View File

@ -714,7 +714,7 @@ describe('CommitInfoView', () => {
expect(amendMessageButton).toBeDisabled();
});
it('shows amend message instead of amend when there are only message changes', async () => {
it('shows amend message instead of amend when there are only message changes', () => {
act(() => {
simulateUncommittedChangedFiles({
value: [{path: 'src/file1.js', status: 'M'}],

View File

@ -19,7 +19,6 @@ import {
} from '../testUtils';
import {GeneratedStatus} from '../types';
import {act, screen, render, waitFor, fireEvent, cleanup, within} from '@testing-library/react';
import {wait} from '@testing-library/user-event/dist/utils';
import fs from 'fs';
import path from 'path';
import {ComparisonType} from 'shared/Comparison';

View File

@ -54,8 +54,8 @@ describe('CommitOperation', () => {
fireEvent.click(quickCommitButton as Element);
};
const clickCheckboxForFile = async (inside: HTMLElement, fileName: string) => {
await act(async () => {
const clickCheckboxForFile = (inside: HTMLElement, fileName: string) => {
act(() => {
const checkbox = within(within(inside).getByTestId(`changed-file-${fileName}`)).getByTestId(
'file-selection-checkbox',
);
@ -83,9 +83,9 @@ describe('CommitOperation', () => {
});
});
it('runs commit with subset of files selected', async () => {
it('runs commit with subset of files selected', () => {
const commitTree = screen.getByTestId('commit-tree-root');
await clickCheckboxForFile(commitTree, 'file2.txt');
clickCheckboxForFile(commitTree, 'file2.txt');
clickQuickCommit();
@ -107,9 +107,9 @@ describe('CommitOperation', () => {
});
});
it('changed files are shown in commit info view', async () => {
it('changed files are shown in commit info view', () => {
const commitTree = screen.getByTestId('commit-tree-root');
await clickCheckboxForFile(commitTree, 'file2.txt');
clickCheckboxForFile(commitTree, 'file2.txt');
const quickInput = screen.getByTestId('quick-commit-title');

View File

@ -131,7 +131,7 @@ export function relativeDate(
const delta = reference - input;
// Use Intl.RelativeTimeFormat for non-en locales, if available.
if (getCurrentLanguage() != 'en' && typeof Intl !== undefined) {
if (getCurrentLanguage() != 'en' && typeof Intl !== 'undefined') {
for (const unit of Object.keys(units) as Array<keyof typeof units>) {
if (Math.abs(delta) > units[unit] || unit == 'minute') {
return new Intl.RelativeTimeFormat(getCurrentLanguage(), {

View File

@ -9,7 +9,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"downlevelIteration": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",

View File

@ -8,7 +8,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",

View File

@ -8,7 +8,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",

View File

@ -31,9 +31,6 @@ export declare interface TypedEventEmitter<EventName extends string, EventType>
emit(event: 'error', error: Error): boolean;
}
export class TypedEventEmitter<
// eslint-disable-next-line @typescript-eslint/no-unused-vars
EventName extends string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
EventType,
> extends EventEmitter {}
/* eslint-disable */
export class TypedEventEmitter<EventName extends string, EventType> extends EventEmitter {}
/* eslint-enable */

View File

@ -20,7 +20,7 @@ export class SelfUpdate<T extends ValueObject> implements ValueObject {
}
equals(other: unknown): boolean {
if (!(other instanceof SelfUpdate<T>)) {
if (!(other instanceof SelfUpdate)) {
return false;
}
if (this === other) {

View File

@ -9,7 +9,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"module": "esnext",

View File

@ -8,7 +8,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",

View File

@ -9,7 +9,6 @@
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"importsNotUsedAsValues": "error",
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"module": "commonjs",