Tweak oxlint config & delint our code (#34301)

* Remove stale max-len disablements

* Remove stale camelCase & naming-convention disablements

* Remove stale ban-ts-comment disablements

* Remove stale no-var disablements

* Remove stale no-empty-property disablements

* Remove stale react rule disablements

* Remove stale no-constant-condition disablements

* Remove stale no-unused-vars disablements

* Remove stale disablements for disabled rules

* fixup camelcase

* Remove dead code

* Tidy code

* Tweak oxlint config
This commit is contained in:
Michael Telatynski
2026-07-17 07:55:31 +00:00
committed by GitHub
parent 6290be95fd
commit b51c5ed8a7
110 changed files with 134 additions and 322 deletions
-1
View File
@@ -6,7 +6,6 @@ Please see LICENSE files in the repository root for full details.
*/
declare global {
// eslint-disable-next-line no-var
var __VERSION__: string; // injected by vite
}
@@ -5,7 +5,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- optional interface, will gracefully degrade to `any` if `react-sdk-module-api` isn't installed
import type { ModuleApi, RuntimeModule } from "@matrix-org/react-sdk-module-api";
@@ -19,7 +18,6 @@ export type RuntimeModuleConstructor = new (api: ModuleApi) => RuntimeModule;
* @alpha
* @deprecated in favour of the new module API
*/
/* eslint-disable @typescript-eslint/naming-convention */
export interface LegacyModuleApiExtension {
/**
* Register a legacy module based on \@matrix-org/react-sdk-module-api
@@ -84,7 +84,6 @@ export interface Services {
export const test = base.extend<TestFixtures, WorkerOptions & Services>({
logger: [
// eslint-disable-next-line no-empty-pattern
async ({}, use) => {
const logger = new Logger();
await use(logger);
@@ -92,7 +91,6 @@ export const test = base.extend<TestFixtures, WorkerOptions & Services>({
{ scope: "worker" },
],
network: [
// eslint-disable-next-line no-empty-pattern
async ({}, use) => {
const network = await new Network().start();
await use(network);
@@ -152,7 +150,6 @@ export const test = base.extend<TestFixtures, WorkerOptions & Services>({
{ scope: "worker" },
],
mas: [
// eslint-disable-next-line no-empty-pattern
async ({}, use) => {
// we stub the mas fixture to allow `homeserver` to depend on it to ensure
// when it is specified by `masHomeserver` it is started before the homeserver
@@ -24,6 +24,7 @@ export const languageAddon: Addon = {
title: "Language Selector",
type: types.TOOL,
render: ({ active }) => {
// oxlint-disable-next-line react-hooks/rules-of-hooks
const [globals, updateGlobals] = useGlobals();
const selectedLanguage = globals.language || "en";
@@ -605,7 +605,6 @@ export const useRovingTabIndex = <T extends HTMLElement>(
});
}, []); // eslint-disable-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-compiler/react-compiler
const isActive = context.state.activeNode === nodeRef.current;
return [onFocus, isActive, ref, nodeRef];
};
@@ -11,7 +11,6 @@ import React, { type JSX, type ComponentProps, type JSXElementConstructor, useMe
import styles from "./Flex.module.css";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type FlexProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> = {
/**
* The type of the HTML element
@@ -61,7 +60,6 @@ type FlexProps<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any
/**
* A flexbox container helper
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function Flex<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any> = "div">({
as = "div",
display = "flex",
@@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
*/
import { describe, it, expect, vitest } from "vitest";
import { render } from "@testing-library/react";
import { render } from "@test-utils";
import { Toast } from "@vector-im/compound-web";
import React, { type JSX } from "react";
@@ -104,7 +104,6 @@ describe("linkify-matrix", () => {
},
]);
});
// eslint-disable-next-line max-len
it("should properly parse IPs v6 while ignoring dangling comma when without port name as the domain name", () => {
const test = char + "username:[1234:5678::abcd]:";
expect(isLinkable(test)).toEqual(true);
@@ -90,13 +90,11 @@ function parseOpaqueIdsToMatrixIds({
const additionalDomainpartTokens = [HYPHEN];
const matrixToken = linkifyjs.createTokenClass(name, { isLink: true });
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const matrixTokenState = new linkifyjs.State(matrixToken) as any as linkifyjs.State<linkifyjs.MultiToken>; // linkify doesn't appear to type this correctly
const matrixTokenWithPort = linkifyjs.createTokenClass(name, { isLink: true });
const matrixTokenWithPortState = new linkifyjs.State(
matrixTokenWithPort,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) as any as linkifyjs.State<linkifyjs.MultiToken>; // linkify doesn't appear to type this correctly
const initialState = parser.start.tt(token);
@@ -60,7 +60,6 @@ export function useCreateAutoDisposedViewModel<B extends BaseViewModel<unknown,
* Or to put it in another way, the only reason to use this hook is to create/dispose the view-model
* and that is something that should only happen at the start/end of the lifecycle of this component.
*/
// eslint-disable-next-line react-compiler/react-compiler
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
@@ -78,7 +78,6 @@ export function MoreOptionContent({ vm }: MoreOptionContentProps): JSX.Element {
const hasSections = snapshot.sections.length > 0;
const isInSection = useMemo(() => snapshot.sections.some((section) => section.isSelected), [snapshot.sections]);
return (
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div onKeyDown={(e) => e.stopPropagation()}>
{snapshot.canMarkAsRead && (
<MenuItem
@@ -59,7 +59,6 @@ export function RoomListItemNotificationMenu({ vm }: RoomListItemNotificationMen
</IconButton>
}
>
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
// We don't want keyboard navigation events to bubble up to the ListView changing the focused item
onKeyDown={(e) => e.stopPropagation()}
@@ -20,7 +20,6 @@ describe("<RoomListItemWrapper /> keyboard re-dispatch", () => {
const user = userEvent.setup();
const onKeyDown = vi.fn();
render(
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div onKeyDown={onKeyDown}>
<Sections roomIndexInSection={0} isFocused={true} />
</div>,
@@ -40,7 +39,6 @@ describe("<RoomListItemWrapper /> keyboard re-dispatch", () => {
const user = userEvent.setup();
const onKeyDown = vi.fn();
render(
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div onKeyDown={onKeyDown}>
<Sections roomIndexInSection={2} isFocused={true} />
</div>,
@@ -92,7 +92,6 @@ function MenuComponent({ vm }: MenuComponentProps): JSX.Element {
</IconButton>
}
>
{/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}
<div
// We don't want keyboard navigation events to bubble up to the ListView changing the focused item
onKeyDown={(e) => e.stopPropagation()}
@@ -87,7 +87,6 @@ describe("<RoomListSectionHeaderView /> stories", () => {
const user = userEvent.setup();
const onKeyDown = vi.fn();
render(
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div onKeyDown={onKeyDown}>
<Default isFocused={true} />
</div>,
@@ -46,7 +46,6 @@ export const mockAvatar = (name: string): React.ReactElement => (
*/
export const renderAvatar = (room: Room): React.ReactElement => {
// Cast to any to access properties - in real usage, the room object from the SDK will have these
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return mockAvatar((room as any)?.name || "Room");
};
@@ -7,7 +7,7 @@
import React from "react";
import { describe, expect, it } from "vitest";
import { render } from "@testing-library/react";
import { render } from "@test-utils";
import { HistoryVisibilityBadge } from "./HistoryVisibilityBadge.tsx";
@@ -86,7 +86,6 @@ export const WidgetPipView: FC<WidgetPipViewProps> = ({ vm, RoomAvatar }) => {
// if the user interacts with a mouse. Hence there is no use in providing an accessible alternative.
// In the future we might consider introducing alternative shortcuts for moving the PiP around
// with the keyboard.
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div data-testid="widget-pip-container" className={styles.container} onMouseDown={vm.onStartMoving}>
<div className={styles.header}>
<IconButton
@@ -5,11 +5,10 @@
* Please see LICENSE files in the repository root for full details.
*/
import { render, screen } from "@test-utils";
import { render, screen, waitFor } from "@test-utils";
import { composeStories } from "@storybook/react-vite";
import React, { createRef } from "react";
import { describe, it, expect } from "vitest";
import { waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { BaseViewModel } from "../../../core/viewmodel/BaseViewModel";
@@ -63,7 +63,6 @@ const iconClasses: Record<E2ePadlockIcon, string> = {
export function E2ePadlock({ icon, title, className }: Readonly<E2ePadlockProps>): JSX.Element {
// We specify isTriggerInteractive=true and make the div interactive manually as a workaround for
// https://github.com/element-hq/compound/issues/294
/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
return (
<Tooltip label={title} isTriggerInteractive={true}>
<div
@@ -77,5 +76,4 @@ export function E2ePadlock({ icon, title, className }: Readonly<E2ePadlockProps>
</div>
</Tooltip>
);
/* eslint-enable jsx-a11y/no-noninteractive-tabindex */
}
@@ -210,7 +210,6 @@ export function VideoBodyView({
<span className={rootClassName}>
<div className={resolvedContainerClassName} style={containerStyle} data-video-body-mask-target="">
{/* Captions will be supplied from app-side data once the VM wiring is in place. */}
{/* eslint-disable-next-line jsx-a11y/media-has-caption */}
<video
className={styles.video}
ref={videoRef}