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
@@ -50,16 +50,13 @@ export const test = base.extend<Fixtures>({
extraEnv: {},
extraArgs: [],
// eslint-disable-next-line no-empty-pattern
stdout: async ({}, use) => {
await use(new CapturedPassThrough());
},
// eslint-disable-next-line no-empty-pattern
stderr: async ({}, use) => {
await use(new CapturedPassThrough());
},
// eslint-disable-next-line no-empty-pattern
tmpDir: async ({}, use) => {
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), "element-desktop-tests-"));
await use(tmpDir);
-1
View File
@@ -38,7 +38,6 @@ async function main(): Promise<void> {
// Can be specified multiple times for the copy command to bundle
// multiple arches into a single universal output module)
for (;;) {
// eslint-disable-line no-constant-condition
const targetIndex = process.argv.indexOf("--target");
if (targetIndex === -1) break;
-2
View File
@@ -10,10 +10,8 @@ import { type BrowserWindow } from "electron";
import { type AppLocalization } from "../language-helper.js";
// global type extensions need to use var for whatever reason
/* eslint-disable no-var */
declare global {
var mainWindow: BrowserWindow | null;
var appQuitting: boolean;
var appLocalization: AppLocalization;
}
/* eslint-enable no-var */
-2
View File
@@ -11,7 +11,6 @@ declare module "matrix-seshat" {
passphrase?: string;
}
/* eslint-disable camelcase */
interface IMatrixEvent {
event_id: string;
sender: string;
@@ -49,7 +48,6 @@ declare module "matrix-seshat" {
context: ISearchContext;
}>;
}
/* eslint-enable camelcase */
interface ICheckpoint {
roomId: string;
-1
View File
@@ -22,7 +22,6 @@ import {
protocol,
desktopCapturer,
} from "electron";
// eslint-disable-next-line n/file-extension-in-import
import * as Sentry from "@sentry/electron/main";
import path, { dirname } from "node:path";
import windowStateKeeper from "electron-window-state";
-1
View File
@@ -77,7 +77,6 @@ export class AppLocalization {
if (store.has(AppLocalization.STORE_KEY)) {
const locales = store.get(AppLocalization.STORE_KEY);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.setAppLocale(locales!);
}
@@ -14,7 +14,6 @@ import { isDendrite } from "../../plugins/homeserver/dendrite";
const email = "user@nowhere.dummy";
const test = base.extend({
// eslint-disable-next-line no-empty-pattern
credentials: async ({}, use, testInfo) => {
await use({
username: `user_${testInfo.testId}`,
-1
View File
@@ -93,7 +93,6 @@ export const test = base.extend<TestFixtures>({
await bot.onTestFinished(testInfo);
},
// eslint-disable-next-line no-empty-pattern
webserver: async ({}, use) => {
const webserver = new Webserver();
await use(webserver);
@@ -13,7 +13,6 @@ import { type Fixtures } from "../../../element-web-test.ts";
export const legacyOAuthHomeserver: Fixtures = {
oAuthServer: [
// eslint-disable-next-line no-empty-pattern
async ({}, use) => {
const server = new OAuthServer();
await use(server);
-53
View File
@@ -58,56 +58,3 @@ class Some extends Optional {
}
}
const None = new Optional();
class FetchStatus {
constructor(opt = {}) {
this.opt = { at: Date.now(), ...opt };
}
map(f) {
return this;
}
flatMap(f) {
return this;
}
}
class Success extends FetchStatus {
static of(value) {
return new Success(value);
}
constructor(value, opt) {
super(opt);
this.value = value;
}
map(f) {
return new Success(f(this.value), this.opt);
}
flatMap(f) {
return f(this.value, this.opt);
}
fold({ success }) {
return success instanceof Function ? success(this.value, this.opt) : undefined;
}
}
class Pending extends FetchStatus {
static of(opt) {
return new Pending(opt);
}
constructor(opt) {
super(opt);
}
fold({ pending }) {
return pending instanceof Function ? pending(this.opt) : undefined;
}
}
class FetchError extends FetchStatus {
static of(reason, opt) {
return new FetchError(reason, opt);
}
constructor(reason, opt) {
super(opt);
this.reason = reason;
}
fold({ error }) {
return error instanceof Function ? error(this.reason, this.opt) : undefined;
}
}
+1 -3
View File
@@ -11,8 +11,7 @@ import type * as commonmark from "commonmark";
declare module "commonmark" {
export type Attr = [key: string, value: string];
/* eslint-disable @typescript-eslint/naming-convention */
interface HtmlRenderer {
export interface HtmlRenderer {
// As far as @types/commonmark is concerned, these are not public, so add them
// https://github.com/commonmark/commonmark.js/blob/master/lib/render/html.js#L272-L296
text: (this: commonmark.HtmlRenderer, node: commonmark.Node) => void;
@@ -42,5 +41,4 @@ declare module "commonmark" {
lit: (this: commonmark.HtmlRenderer, text: string) => void;
cr: (this: commonmark.HtmlRenderer) => void;
}
/* eslint-enable @typescript-eslint/naming-convention */
}
-9
View File
@@ -38,8 +38,6 @@ import { type ModuleApiType } from "../modules/Api.ts";
import type { RoomListStoreV3Class } from "../stores/room-list-v3/RoomListStoreV3.ts";
import { type SDKContextClass } from "../contexts/SDKContextClass.ts";
/* eslint-disable @typescript-eslint/naming-convention */
type ElectronChannel =
| "app_onAction"
| "before-quit"
@@ -177,7 +175,6 @@ declare global {
},
): void;
// eslint-disable-next-line no-var
var grecaptcha:
| undefined
| {
@@ -192,14 +189,8 @@ declare global {
isReady: () => boolean;
};
// eslint-disable-next-line no-var, camelcase
var mx_rage_logger: ConsoleLogger;
// eslint-disable-next-line no-var, camelcase
var mx_rage_initPromise: Promise<void>;
// eslint-disable-next-line no-var, camelcase
var mx_rage_initStoragePromise: Promise<void>;
// eslint-disable-next-line no-var, camelcase
var mx_rage_store: IndexedDBLogStore;
}
/* eslint-enable @typescript-eslint/naming-convention */
-1
View File
@@ -102,7 +102,6 @@ export const transformTags: NonNullable<IOptions["transformTags"]> = {
}
return { tagName, attribs };
},
// eslint-disable-next-line @typescript-eslint/naming-convention
"*": function (tagName: string, attribs: sanitizeHtml.Attributes) {
// Delete any style previously assigned, style is an allowedTag for font, span & img,
// because attributes are stripped after transforming.
-10
View File
@@ -35,7 +35,6 @@ describe("Markdown parser test", () => {
].join("\n");
it("tests that links with markdown empasis in them are getting properly HTML formatted", () => {
/* eslint-disable max-len */
const expectedResult = [
"<p>Test1:<br />#_foonetic_xkcd:matrix.org<br />http://google.com/_thing_<br />https://matrix.org/_matrix/client/foo/123_<br />#_foonetic_xkcd:matrix.org</p>",
"<p>Test1A:<br />#_foonetic_xkcd:matrix.org<br />http://google.com/_thing_<br />https://matrix.org/_matrix/client/foo/123_<br />#_foonetic_xkcd:matrix.org</p>",
@@ -43,7 +42,6 @@ describe("Markdown parser test", () => {
"<p>Test3:<br />https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org<br />https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org</p>",
"",
].join("\n");
/* eslint-enable max-len */
const md = new Markdown(testString);
expect(md.toHTML()).toEqual(expectedResult);
});
@@ -69,7 +67,6 @@ describe("Markdown parser test", () => {
"<https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org>",
"<https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org>",
].join("\n");
/* eslint-disable max-len */
/**
* NOTE: I'm not entirely sure if those "<"" and ">" should be visible in here for #_foonetic_xkcd:matrix.org
* but it seems to be actually working properly
@@ -81,7 +78,6 @@ describe("Markdown parser test", () => {
'<p>Test3:<br /><a href="https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org">https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org</a><br /><a href="https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org">https://riot.im/app/#/room/#_foonetic_xkcd:matrix.org</a></p>',
"",
].join("\n");
/* eslint-enable max-len */
const md = new Markdown(test);
expect(md.toHTML()).toEqual(expectedResult);
});
@@ -114,7 +110,6 @@ describe("Markdown parser test", () => {
});
it('expects that links with emphasis are "escaped" correctly', () => {
/* eslint-disable max-len */
const testString = [
"http://domain.xyz/foo/bar-_stuff-like-this_-in-it.jpg" +
" " +
@@ -139,22 +134,18 @@ describe("Markdown parser test", () => {
"https://example.com/_test__test2_test3__",
"https://example.com/_test__test2",
].join("<br />");
/* eslint-enable max-len */
const md = new Markdown(testString);
expect(md.toHTML()).toEqual(expectedResult);
});
it("expects that the link part will not be accidentally added to <strong>", () => {
/* eslint-disable max-len */
const testString = `https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py`;
const expectedResult = "https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py";
/* eslint-enable max-len */
const md = new Markdown(testString);
expect(md.toHTML()).toEqual(expectedResult);
});
it("expects that the link part will not be accidentally added to <strong> for multiline links", () => {
/* eslint-disable max-len */
const testString = [
"https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py" +
" " +
@@ -171,7 +162,6 @@ describe("Markdown parser test", () => {
" " +
"https://github.com/matrix-org/synapse/blob/develop/synapse/module_api/__init__.py",
].join("<br />");
/* eslint-enable max-len */
const md = new Markdown(testString);
expect(md.toHTML()).toEqual(expectedResult);
});
-1
View File
@@ -38,7 +38,6 @@ export const SAFE_LOCALPART_REGEX = /^[a-z0-9=_\-./]+$/;
* If present the screen to redirect to after a successful login or register.
*/
export async function startAnyRegistrationFlow(
// eslint-disable-next-line camelcase
options: { go_home_on_cancel?: boolean; go_welcome_on_cancel?: boolean; screen_after?: boolean } = {},
): Promise<void> {
const modal = Modal.createDialog(QuestionDialog, {
@@ -151,7 +151,6 @@ export const AutocompleteInput: React.FC<AutocompleteInputProps> = ({
{isFocused && suggestions.length ? (
<div
className="mx_AutocompleteInput_matches"
// eslint-disable-next-line react-compiler/react-compiler
style={{ top: editorContainerRef.current?.clientHeight }}
data-testid="autocomplete-matches"
>
@@ -425,11 +425,7 @@ export default class ContextMenu extends React.PureComponent<React.PropsWithChil
}
// filter props that are invalid for DOM elements
const {
hasBackground: _hasBackground, // eslint-disable-line @typescript-eslint/no-unused-vars
onFinished: _onFinished, // eslint-disable-line @typescript-eslint/no-unused-vars
...divProps
} = props;
const { hasBackground: _hasBackground, onFinished: _onFinished, ...divProps } = props;
return (
<RovingTabIndexProvider handleHomeEnd handleUpDown onKeyDown={this.onKeyDown}>
@@ -579,7 +575,6 @@ type ContextMenuTuple<T> = [
(ev?: SyntheticEvent) => void,
(val: boolean) => void,
];
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
export const useContextMenu = <T extends HTMLElement = HTMLElement>(
inputRef?: RefObject<T | null>,
): ContextMenuTuple<T> => {
@@ -601,7 +596,6 @@ export const useContextMenu = <T extends HTMLElement = HTMLElement>(
setIsOpen(false);
};
// eslint-disable-next-line react-compiler/react-compiler
return [button.current ? isOpen : false, button, open, close, setIsOpen];
};
@@ -169,7 +169,6 @@ export default class IndicatorScrollbar<T extends keyof JSX.IntrinsicElements> e
};
public render(): React.ReactNode {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { children, trackHorizontalOverflow, verticalScrollsHorizontally, className, ...otherProps } = this.props;
const leftIndicatorStyle = { left: this.state.leftIndicatorOffset };
@@ -84,7 +84,7 @@ interface IProps {
// transitioned to PWLU)
onRegistered: (this: void, credentials: IMatrixClientCreds) => Promise<MatrixClient>;
hideToSRUsers: boolean;
// eslint-disable-next-line camelcase
page_type?: string;
threepidInvite?: IThreepidInvite;
roomOobData?: IOOBData;
@@ -179,7 +179,6 @@ interface IState {
// What the LoggedInView would be showing if visible.
// A member of the enum for standard pages or a string for those provided by
// a module.
// eslint-disable-next-line camelcase
page_type?: PageType | string;
// The ID of the room we're viewing. This is either populated directly
// in the case where we view a room by ID or by RoomView when it resolves
@@ -188,11 +187,8 @@ interface IState {
// If we're trying to just view a user ID (i.e. /user URL), this is it
currentUserId: string | null;
// Parameters used in the registration dance with the IS
// eslint-disable-next-line camelcase
register_client_secret?: string;
// eslint-disable-next-line camelcase
register_session_id?: string;
// eslint-disable-next-line camelcase
register_id_sid?: string;
isMobileRegistration?: boolean;
// When showing Modal dialogs we need to set aria-hidden on the root app element
@@ -118,9 +118,7 @@ class LoginComponent extends React.PureComponent<IProps, IState> {
"m.login.password": this.renderPasswordStep,
// CAS and SSO are the same thing, modulo the url we link to
// eslint-disable-next-line @typescript-eslint/naming-convention
"m.login.cas": () => this.renderSsoStep("cas"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"m.login.sso": () => this.renderSsoStep("sso"),
"oauthNativeFlow": () => this.renderOAuth2Step(),
};
@@ -178,13 +178,11 @@ export class PasswordAuthEntry extends React.Component<IAuthEntryProps, IPasswor
}
}
/* eslint-disable camelcase */
interface IRecaptchaAuthEntryProps extends IAuthEntryProps {
stageParams?: {
public_key?: string;
};
}
/* eslint-enable camelcase */
export class RecaptchaAuthEntry extends React.Component<IRecaptchaAuthEntryProps> {
public static LOGIN_TYPE = AuthType.Recaptcha;
@@ -197,7 +197,6 @@ const Entry: React.FC<IEntryProps<any>> = ({ room, type, content, matrixClient:
*/
const transformEvent = (event: MatrixEvent, cli: MatrixClient): { type: string; content: IContent } => {
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
"m.relates_to": _, // strip relations - in future we will attach a relation pointing at the original event
// We're taking a shallow copy here to avoid https://github.com/vector-im/element-web/issues/10924
...content
@@ -35,7 +35,6 @@ interface IState {
phase: number;
sasVerified: boolean;
opponentProfile: {
// eslint-disable-next-line camelcase
avatar_url?: string;
displayname?: string;
} | null;
@@ -801,7 +801,6 @@ export default class InviteDialog extends React.PureComponent<Props, IInviteDial
e.preventDefault();
// Update the IS in account data. Actually using it may trigger terms.
// eslint-disable-next-line react-hooks/rules-of-hooks
setToDefaultIdentityServer(MatrixClientPeg.safeGet());
this.setState({ canUseIdentityServer: true, tryingIdentityServer: false });
};
@@ -63,7 +63,6 @@ export default class EventTilePreview extends React.Component<IProps, IState> {
private fakeEvent({ message }: IState): MatrixEvent {
// Fake it till we make it
/* eslint-disable quote-props */
const rawEvent = {
type: "m.room.message",
sender: this.props.userId,
@@ -86,7 +85,6 @@ export default class EventTilePreview extends React.Component<IProps, IState> {
room_id: "!999999999999999999:example.org",
};
const event = new MatrixEvent(rawEvent);
/* eslint-enable quote-props */
// Fake it more
event.sender = {
@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
Please see LICENSE files in the repository root for full details.
*/
import React from "react"; // eslint-disable-line no-unused-vars
import React from "react";
//see src/resizer for the actual resizing code, this is just the DOM for the resize handle
interface IResizeHandleProps {
@@ -76,11 +76,8 @@ export const Container: React.FC<{
export interface IPowerLevelsContent {
events?: Record<string, number>;
// eslint-disable-next-line camelcase
users_default?: number;
// eslint-disable-next-line camelcase
events_default?: number;
// eslint-disable-next-line camelcase
state_default?: number;
ban?: number;
kick?: number;
@@ -108,7 +108,6 @@ export function ReadReceiptGroup({
readReceiptPosition = readReceiptMap[userId];
if (!readReceiptPosition) {
readReceiptPosition = {};
// eslint-disable-next-line react-compiler/react-compiler
readReceiptMap[userId] = readReceiptPosition;
}
}
@@ -21,7 +21,6 @@ export function useComposerFunctions(
() => ({
clear: () => {
if (ref.current) {
// eslint-disable-next-line react-compiler/react-compiler
ref.current.innerHTML = "";
}
},
@@ -12,7 +12,6 @@ export function usePlainTextInitialization(initialContent = "", ref: RefObject<H
useEffect(() => {
// always read and write the ref.current using .innerHTML for consistency in linebreak and HTML entity handling
if (ref.current) {
// eslint-disable-next-line react-compiler/react-compiler
ref.current.innerHTML = initialContent;
}
}, [ref, initialContent]);
@@ -33,25 +33,19 @@ interface IBridgeStateEvent {
protocol: {
id: string;
displayname?: string;
// eslint-disable-next-line camelcase
avatar_url?: string;
// eslint-disable-next-line camelcase
external_url?: string;
};
network?: {
id: string;
displayname?: string;
// eslint-disable-next-line camelcase
avatar_url?: string;
// eslint-disable-next-line camelcase
external_url?: string;
};
channel: {
id: string;
displayname?: string;
// eslint-disable-next-line camelcase
avatar_url?: string;
// eslint-disable-next-line camelcase
external_url?: string;
};
}
@@ -313,7 +313,6 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
};
public render(): React.ReactNode {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const {
space,
activeSpaces,
@@ -366,7 +365,6 @@ export class SpaceItem extends React.PureComponent<IItemProps, IItemState> {
</AccessibleButton>
) : null;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { tabIndex, ...restDragHandleProps } = dragHandleProps || {};
const selected = activeSpaces.includes(space.roomId);
+1 -1
View File
@@ -58,7 +58,7 @@ const ScopedRoomContext = createContext<EfficientContext<ContextValue> | undefin
// Uses react memo and leverages splatting the value to ensure that the context is only updated when the state changes (shallow compare)
export const ScopedRoomContextProvider = memo(
({ children, ...state }: { children: ReactNode } & ContextValue): JSX.Element => {
// eslint-disable-next-line react-compiler/react-compiler,react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
const context = useMemo(() => new EfficientContext<ContextValue>(state), []);
useEffect(() => {
context.setState(state);
-2
View File
@@ -51,8 +51,6 @@ import { SDKContextClass } from "./contexts/SDKContextClass.ts";
import SdkConfig from "./SdkConfig";
// we define a number of interfaces which take their names from the js-sdk
/* eslint-disable camelcase */
export interface IOpts {
dmUserId?: string;
/**
+1 -1
View File
@@ -80,7 +80,7 @@ export class MatrixDispatcher {
/**
* Dispatches a payload to all registered callbacks.
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
private _dispatch = (payload: ActionPayload): void => {
invariant(!this.isDispatching(), "Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.");
this.startDispatching(payload);
@@ -13,6 +13,5 @@ import { type ActionPayload } from "../payloads";
export interface AfterLeaveRoomPayload extends ActionPayload {
action: Action.AfterLeaveRoom;
// eslint-disable-next-line camelcase
room_id?: Room["roomId"];
}
@@ -11,6 +11,5 @@ import { type Action } from "../actions";
export interface DoAfterSyncPreparedPayload<T extends ActionPayload> extends Pick<ActionPayload, "action"> {
action: Action.DoAfterSyncPrepared;
// eslint-disable-next-line camelcase
deferred_action: T;
}
@@ -12,7 +12,6 @@ import { type IJoinRoomOpts } from "matrix-js-sdk/src/matrix";
import { type ActionPayload } from "../payloads";
import { type Action } from "../actions";
/* eslint-disable camelcase */
export interface JoinRoomPayload extends Pick<ActionPayload, "action"> {
action: Action.JoinRoom;
@@ -24,4 +23,3 @@ export interface JoinRoomPayload extends Pick<ActionPayload, "action"> {
canAskToJoin?: boolean;
}
/* eslint-enable camelcase */
@@ -11,7 +11,6 @@ import { type JoinedRoom as JoinedRoomEvent } from "@matrix-org/analytics-events
import { type ActionPayload } from "../payloads";
import { type Action } from "../actions";
/* eslint-disable camelcase */
export interface JoinRoomReadyPayload extends Pick<ActionPayload, "action"> {
action: Action.JoinRoomReady;
roomId: string;
@@ -19,4 +18,3 @@ export interface JoinRoomReadyPayload extends Pick<ActionPayload, "action"> {
// additional parameters for the purpose of metrics & instrumentation
metricsTrigger: JoinedRoomEvent["trigger"];
}
/* eslint-enable camelcase */
@@ -9,10 +9,8 @@ Please see LICENSE files in the repository root for full details.
import { type ActionPayload } from "../payloads";
import { type Action } from "../actions";
/* eslint-disable camelcase */
export interface ThreadPayload extends Pick<ActionPayload, "action"> {
action: Action.ViewThread;
thread_id: string | null;
}
/* eslint-enable camelcase */
@@ -11,7 +11,6 @@ import { type ActionPayload } from "../payloads";
export interface ViewHomePagePayload extends ActionPayload {
action: Action.ViewHomePage;
// eslint-disable-next-line camelcase
context_switch?: boolean;
justRegistered?: boolean;
}
@@ -13,9 +13,7 @@ import { type Action } from "../actions";
export interface ViewRoomErrorPayload extends Pick<ActionPayload, "action"> {
action: Action.ViewRoomError;
// eslint-disable-next-line camelcase
room_id: Room["roomId"] | null;
// eslint-disable-next-line camelcase
room_alias?: string;
err?: MatrixError;
}
@@ -18,7 +18,6 @@ import { type AtLeastOne } from "../../@types/common";
export type FocusNextType = "composer" | "threadsPanel" | undefined;
/* eslint-disable camelcase */
interface BaseViewRoomPayload extends Pick<ActionPayload, "action"> {
action: Action.ViewRoom;
@@ -58,4 +57,3 @@ export type ViewRoomPayload = BaseViewRoomPayload &
room_alias?: string;
focusNext: FocusNextType; // wat to focus after room switch. Defaults to 'composer' if undefined.
}>;
/* eslint-enable camelcase */
@@ -13,6 +13,5 @@ import { type Action } from "../actions";
export interface ViewStartChatOrReusePayload extends Pick<ActionPayload, "action"> {
action: Action.ViewStartChatOrReuse;
// eslint-disable-next-line camelcase
user_id: User["userId"];
}
+1 -1
View File
@@ -34,7 +34,7 @@ export function useAsyncRefreshMemo<T>(fn: Fn<T>, deps: DependencyList, initialV
return () => {
discard = true;
};
}, deps); // eslint-disable-line react-hooks/exhaustive-deps,react-compiler/react-compiler
}, deps); // eslint-disable-line react-hooks/exhaustive-deps
useEffect(refresh, [refresh]);
return [value, refresh];
}
+2 -2
View File
@@ -160,7 +160,7 @@ export function useEventEmitterAsyncState<T, Events extends string, Arguments ex
rerunArgs.push(args);
return;
}
running = true; // eslint-disable-line react-hooks/exhaustive-deps
running = true;
// Note: We need to use .then notation instead of async/await,
// because async/await would cause this function to return a
// promise, which `useEffect` doesn't like.
@@ -177,7 +177,7 @@ export function useEventEmitterAsyncState<T, Events extends string, Arguments ex
}
});
},
[fn, ...deps], // eslint-disable-line react-compiler/react-compiler, react-hooks/exhaustive-deps
[fn, ...deps], // eslint-disable-line react-hooks/exhaustive-deps
);
// re-run when the emitter changes
-1
View File
@@ -23,7 +23,6 @@ const createMemberFromProfile = (userId: string, profile: IMatrixProfile): RoomM
return { avatar_url: profile.avatar_url };
},
getDirectionalContent: function () {
// eslint-disable-next-line
return this.getContent();
},
} as MatrixEvent;
@@ -25,7 +25,6 @@ export const useNotificationState = (room: Room): [RoomNotifState | undefined, (
setNotificationState(echoChamber.notificationVolume);
}
});
// eslint-disable-next-line react-compiler/react-compiler
const setter = useCallback((state: RoomNotifState) => (echoChamber.notificationVolume = state), [echoChamber]);
return [notificationState, setter];
};
@@ -14,7 +14,6 @@ import {
} from "matrix-js-sdk/src/matrix";
// The following interfaces take their names and member names from seshat and the spec
/* eslint-disable camelcase */
/** A record of a place to resume crawling events in a given room. */
export interface ICrawlerCheckpoint {
+2 -2
View File
@@ -24,8 +24,8 @@ import { Action } from "../dispatcher/actions";
export class Mjolnir {
private static instance?: Mjolnir;
private _lists: BanList[] = []; // eslint-disable-line @typescript-eslint/naming-convention
private _roomIds: string[] = []; // eslint-disable-line @typescript-eslint/naming-convention
private _lists: BanList[] = [];
private _roomIds: string[] = [];
private mjolnirWatchRef?: string;
private dispatcherRef?: string;
-2
View File
@@ -60,7 +60,6 @@ export class ModuleApi implements Api {
return ModuleApi._instance;
}
/* eslint-disable @typescript-eslint/naming-convention */
public async _registerLegacyModule(LegacyModule: RuntimeModuleConstructor): Promise<void> {
ModuleRunner.instance.registerModule((api) => new LegacyModule(api));
}
@@ -80,7 +79,6 @@ export class ModuleApi implements Api {
) => void = legacyCustomisationsFactory(WidgetPermissionCustomisations);
public readonly _registerLegacyWidgetVariablesCustomisations =
legacyCustomisationsFactory(WidgetVariableCustomisations);
/* eslint-enable @typescript-eslint/naming-convention */
public readonly navigation = new NavigationApi();
public readonly openDialog = openDialog;
-4
View File
@@ -14,8 +14,6 @@ import { MatrixClientPeg } from "./MatrixClientPeg";
import SettingsStore from "./settings/SettingsStore";
import { type IConfigOptions } from "./IConfigOptions";
/* eslint-disable camelcase */
type StorageContext = {
storageManager_persisted?: string;
storageManager_quota?: string;
@@ -58,8 +56,6 @@ type Contexts = {
storage: StorageContext;
};
/* eslint-enable camelcase */
async function getStorageContext(): Promise<StorageContext> {
const result: StorageContext = {};
-1
View File
@@ -426,7 +426,6 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> {
const existingLiveBeaconIdsForRoom = this.getLiveBeaconIds(roomId);
await Promise.all(existingLiveBeaconIdsForRoom.map((beaconId) => this.stopBeacon(beaconId)));
// eslint-disable-next-line camelcase
const { event_id } = await doMaybeLocalRoomAction(
roomId,
(actualRoomId: string) => this.matrixClient!.unstable_createLiveBeacon(actualRoomId, beaconInfoContent),
+1 -1
View File
@@ -209,7 +209,7 @@ export class RoomViewStore extends EventEmitter {
if (this.lockedToRoomId && payload.room_id && this.lockedToRoomId !== payload.room_id) {
return;
}
// eslint-disable-line @typescript-eslint/naming-convention
switch (payload.action) {
// view_room:
// - room_alias: '#somealias:matrix.org'
+5 -6
View File
@@ -15,13 +15,13 @@ import { type RoomType } from "matrix-js-sdk/src/matrix";
export interface IThreepidInviteWireFormat {
email: string;
signurl: string;
room_name: string; // eslint-disable-line camelcase
room_avatar_url: string; // eslint-disable-line camelcase
inviter_name: string; // eslint-disable-line camelcase
room_name: string;
room_avatar_url: string;
inviter_name: string;
// TODO: Figure out if these are ever populated
guest_access_token?: string; // eslint-disable-line camelcase
guest_user_id?: string; // eslint-disable-line camelcase
guest_access_token?: string;
guest_user_id?: string;
}
interface IPersistedThreepidInvite extends IThreepidInviteWireFormat {
@@ -46,7 +46,6 @@ export interface IOOBData {
name?: string; // The room's name
avatarUrl?: string; // The mxc:// avatar URL for the room
inviterName?: string; // The display name of the person who invited us to the room
// eslint-disable-next-line camelcase
room_name?: string; // The name of the room, to be used until we are told better by the server
roomType?: RoomType | string; // The type of the room, to be used until we are told better by the server
}
+1 -5
View File
@@ -84,11 +84,7 @@ export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
public disposeRecording(voiceRecordingId: string): Promise<void> {
this.state[voiceRecordingId]?.destroy(); // stops internally
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[voiceRecordingId]: _toDelete,
...newState
} = this.state;
const { [voiceRecordingId]: _toDelete, ...newState } = this.state;
// unexpectedly AsyncStore.updateState merges state
// AsyncStore.reset actually just *sets*
return this.reset(newState);
@@ -39,7 +39,7 @@ const ROOM_PREVIEW_CHANGED = "room_preview_changed";
const MAX_EVENTS_BACKWARDS = 50;
// type merging ftw
type TAG_ANY = "im.vector.any"; // eslint-disable-line @typescript-eslint/naming-convention
type TAG_ANY = "im.vector.any";
const TAG_ANY: TAG_ANY = "im.vector.any";
export interface MessagePreview {
@@ -56,6 +56,6 @@ export interface IHangupCallApiRequest extends IWidgetApiRequest {
*/
export interface IViewRoomApiRequest extends IWidgetApiRequest {
data: {
room_id: string; // eslint-disable-line camelcase
room_id: string;
};
}
+1 -1
View File
@@ -47,7 +47,7 @@ interface CompoundTheme {
export type CustomTheme = {
name: string;
is_dark?: boolean; // eslint-disable-line camelcase
is_dark?: boolean;
colors?: {
[key: string]: string;
};
@@ -50,10 +50,8 @@ describe("FixedRollingArray", () => {
expect(previous - current).toBe(1);
if (i === 1) {
// eslint-disable-next-line jest/no-conditional-expect
expect(previous).toBe(maxValue);
} else if (i === width) {
// eslint-disable-next-line jest/no-conditional-expect
expect(current).toBe(minValue);
}
}
+1 -1
View File
@@ -108,7 +108,7 @@ export async function decryptMegolmKeyFile(data: ArrayBuffer, password: string):
export async function encryptMegolmKeyFile(
data: string,
password: string,
options?: { kdf_rounds?: number }, // eslint-disable-line camelcase
options?: { kdf_rounds?: number },
): Promise<ArrayBuffer> {
options = options || {};
const kdfRounds = options.kdf_rounds || 500000;
-1
View File
@@ -217,7 +217,6 @@ export async function getSessionLock(onNewInstance: () => Promise<void>): Promis
window.localStorage.setItem(SESSION_LOCK_CONSTANTS.STORAGE_ITEM_CLAIMANT, sessionIdentifier);
// now, wait for the lock to be free.
// eslint-disable-next-line no-constant-condition
while (true) {
const remaining = checkLock();
-2
View File
@@ -33,14 +33,12 @@ describe("snakeToCamel", () => {
});
describe("SnakedObject", () => {
/* eslint-disable camelcase*/
const input = {
snake_case: "woot",
snakeCase: "oh no", // ensure different value from snake_case for tests
camelCase: "fallback",
};
const snake = new SnakedObject(input);
/* eslint-enable camelcase*/
it("should prefer snake_case keys", () => {
expect(snake.get("snake_case")).toBe(input.snake_case);
-2
View File
@@ -15,7 +15,6 @@ const E2EE_WK_KEY_DEPRECATED = "im.vector.riot.e2ee";
export const TILE_SERVER_WK_KEY = new UnstableValue("m.tile_server", "org.matrix.msc3488.tile_server");
const EMBEDDED_PAGES_WK_PROPERTY = "io.element.embedded_pages";
/* eslint-disable camelcase */
export interface ICallBehaviourWellKnown {
widget_build_url?: string;
ignore_dm?: boolean;
@@ -39,7 +38,6 @@ export interface ITileServerWellKnown {
export interface IEmbeddedPagesWellKnown {
home_url?: string;
}
/* eslint-enable camelcase */
export function getCallBehaviourWellKnown(matrixClient: MatrixClient): ICallBehaviourWellKnown {
const clientWellKnown = matrixClient.getClientWellKnown();
-2
View File
@@ -12,7 +12,6 @@ import { type IWidget } from "matrix-widget-api";
export interface IApp extends IWidget {
"roomId": string;
"eventId"?: string; // not present on virtual widgets
// eslint-disable-next-line camelcase
"avatar_url"?: string; // MSC2765 https://github.com/matrix-org/matrix-doc/pull/2765
// Whether the widget was created from `widget_build_url` and thus is a call widget of some kind
"io.element.managed_hybrid"?: boolean;
@@ -22,7 +21,6 @@ export interface IWidgetEvent {
id: string;
type: string;
sender: string;
// eslint-disable-next-line camelcase
state_key: string;
content: IApp;
}
@@ -23,7 +23,6 @@ const makeDeviceExtendedInfo = (
client: clientName && [clientName, clientVersion].filter(Boolean).join(" "),
});
/* eslint-disable max-len */
const ANDROID_UA = [
// New User Agent Implementation
"Element dbg/1.5.0-dev (Xiaomi Mi 9T; Android 11; RKQ1.200826.002 test-keys; Flavour GooglePlay; MatrixAndroidSdk2 1.5.2)",
@@ -108,7 +107,6 @@ const MISC_EXPECTED_RESULT = [
makeDeviceExtendedInfo(DeviceType.Unknown, undefined, undefined, undefined, undefined),
makeDeviceExtendedInfo(DeviceType.Unknown, undefined, undefined, undefined, undefined),
];
/* eslint-disable max-len */
describe("parseUserAgent()", () => {
it("returns deviceType unknown when user agent is falsy", () => {
-1
View File
@@ -119,7 +119,6 @@ export class DirectoryMember extends Member {
private readonly displayName?: string;
private readonly avatarUrl?: string;
// eslint-disable-next-line camelcase
public constructor(userDirResult: { user_id: string; display_name?: string; avatar_url?: string }) {
super();
this._userId = userDirResult.user_id;
-1
View File
@@ -94,7 +94,6 @@ export async function waitForMember(
}
return new Promise<boolean>((resolve) => {
// eslint-disable-next-line @typescript-eslint/naming-convention
handler = function (_, __, member: RoomMember) {
if (member.userId !== userId) return;
if (member.roomId !== roomId) return;
@@ -68,7 +68,6 @@ const monitorSyncedRule = async (
if (outOfSyncRules.length) {
await updateExistingPushRulesWithActions(
matrixClient,
// eslint-disable-next-line camelcase, @typescript-eslint/naming-convention
outOfSyncRules.map(({ rule_id }) => rule_id),
primaryRule.enabled ? primaryRule.actions : undefined,
);
-1
View File
@@ -52,7 +52,6 @@ async function pickleKeyToAesKey(pickleKey: string): Promise<Uint8Array<ArrayBuf
{
name: "HKDF",
hash: "SHA-256",
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/879
salt: new Uint8Array(32),
info: new Uint8Array(0),
-1
View File
@@ -257,7 +257,6 @@ start().catch((err) => {
// with some basic styling to make the iframe full page
document.body.style.removeProperty("height");
const iframe = document.createElement("iframe");
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore - typescript seems to only like the IE syntax for iframe sandboxing
iframe["sandbox"] = "";
iframe.src = supportedBrowser ? "static/unable-to-load.html" : "static/incompatible-browser.html";
-1
View File
@@ -392,7 +392,6 @@ async function joinConference(audioInput?: string | null, videoInput?: string |
logger.log("Got OpenID Connect token");
if (!openIdToken?.access_token) {
// eslint-disable-line camelcase
// We've failing to get a token, don't try to init conference
logger.warn("Expected to have an OpenID credential, cannot initialize widget.");
document.getElementById("widgetActionContainer")!.innerText = "Failed to load Jitsi widget";
@@ -154,7 +154,7 @@ describe("BaseOngoingCallViewModel", () => {
const vm = new BaseOngoingCallViewModel({ mxEvent, cli, callStore, roomId, legacyCallHandler });
vm.join();
const [_, room, callType, platformCallType] = vi.mocked(placeCall).mock.calls[0];
const [, room, callType, platformCallType] = vi.mocked(placeCall).mock.calls[0];
expect(room.roomId).toStrictEqual(roomId);
expect(callType).toStrictEqual(CallType.Video);
expect(platformCallType).toStrictEqual(PlatformCallType.ElementCall);
+1 -1
View File
@@ -26,7 +26,7 @@ import { ElementWidgetCapabilities } from "../stores/widgets/ElementWidgetCapabi
import { MatrixClientPeg } from "../MatrixClientPeg";
import TextWithTooltip from "../components/views/elements/TextWithTooltip";
type GENERIC_WIDGET_KIND = "generic"; // eslint-disable-line @typescript-eslint/naming-convention
type GENERIC_WIDGET_KIND = "generic";
const GENERIC_WIDGET_KIND: GENERIC_WIDGET_KIND = "generic";
type SendRecvStaticCapText = Partial<
-4
View File
@@ -18,13 +18,11 @@ import WidgetStore, { type IApp } from "../stores/WidgetStore";
import SdkConfig from "../SdkConfig";
import { getJoinedNonFunctionalMembers } from "../utils/room/getJoinedNonFunctionalMembers";
/* eslint-disable camelcase */
interface IManagedHybridWidgetData {
widget_id: string;
widget: IWidget;
layout: IStoredLayout;
}
/* eslint-enable camelcase */
function getWidgetBuildUrl(room: Room): string | undefined {
const functionalMembers = getJoinedNonFunctionalMembers(room);
@@ -40,7 +38,6 @@ function getWidgetBuildUrl(room: Room): string | undefined {
if (isDm && wellKnown?.ignore_dm) {
return undefined;
}
/* eslint-disable-next-line camelcase */
return wellKnown?.widget_build_url;
}
@@ -56,7 +53,6 @@ export async function addManagedHybridWidget(room: Room): Promise<void> {
}
// Get widget data
/* eslint-disable-next-line camelcase */
const widgetBuildUrl = getWidgetBuildUrl(room);
if (!widgetBuildUrl) {
return;
-1
View File
@@ -16,7 +16,6 @@ import { PredictableRandom } from "./test-utils/predictableRandom";
import * as rageshake from "../src/rageshake/rageshake";
declare global {
// eslint-disable-next-line no-var
var IS_REACT_ACT_ENVIRONMENT: boolean;
}
-1
View File
@@ -417,7 +417,6 @@ type MakeEventProps = MakeEventPassThruProps & {
redacts?: string;
content: IContent;
room?: Room["roomId"]; // to-device messages are roomless
// eslint-disable-next-line camelcase
prev_content?: IContent;
unsigned?: IUnsigned;
status?: EventStatus;
@@ -84,7 +84,6 @@ describe("PictureInPictureDragger", () => {
<PictureInPictureDragger>
{[
({ onStartMoving }) => (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
<div onMouseDown={onStartMoving} onClick={clickSpy}>
Hello
</div>
@@ -62,7 +62,6 @@ describe("<Pill>", () => {
} as PillProps;
// wrap Pill with a div to allow testing of event bubbling
renderResult = render(
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
<SDKContext.Provider value={mockSdkContext}>
<div onClick={pillParentClickHandler}>
<Pill {...withDefault} />
@@ -214,10 +214,8 @@ describe("MessageComposer", () => {
it(`should${value ? "" : " not"} display the button`, () => {
if (value) {
// eslint-disable-next-line jest/no-conditional-expect
expect(screen.getByLabelText(buttonLabel)).toBeInTheDocument();
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(screen.queryByLabelText(buttonLabel)).not.toBeInTheDocument();
}
});
@@ -240,10 +238,8 @@ describe("MessageComposer", () => {
it(`should${!value || "not"} display the button`, () => {
if (!value) {
// eslint-disable-next-line jest/no-conditional-expect
expect(screen.getByLabelText(buttonLabel)).toBeInTheDocument();
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(screen.queryByLabelText(buttonLabel)).not.toBeInTheDocument();
}
});
@@ -347,10 +347,8 @@ describe("SendWysiwygComposer", () => {
expect(leftIcon).toBeInTheDocument();
expect(leftIcon).toHaveClass("mx_E2EIcon");
if (expectedLabel) {
// eslint-disable-next-line jest/no-conditional-expect
expect(leftIcon).toHaveAccessibleName(expectedLabel);
} else {
// eslint-disable-next-line jest/no-conditional-expect
expect(leftIcon.querySelector("svg")).not.toBeInTheDocument();
}
});
@@ -536,7 +536,6 @@ describe("WysiwygComposer", () => {
await waitFor(() => {
const selection = document.getSelection();
if (selection) {
// eslint-disable-next-line jest/no-conditional-expect
expect(selection.focusNode?.textContent).toEqual("other");
}
});
@@ -53,7 +53,6 @@ const createTransitionEndEvent = (): Event => {
// TransitionEvent constructor does not exist.
// This is needed because of the following check
// https://github.com/atlassian/react-beautiful-dnd/blob/master/src/view/draggable/draggable.jsx#L130
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(event as any).propertyName = "transform";
return event;
@@ -65,7 +65,6 @@ describe("StorageManager", () => {
beforeEach(async () => {
await populateHealthySession();
// eslint-disable-next-line no-global-assign
indexedDB = new IDBFactory();
});
@@ -109,13 +108,11 @@ describe("StorageManager", () => {
});
it("should not be healthy if no indexeddb", async () => {
// eslint-disable-next-line no-global-assign
indexedDB = {} as IDBFactory;
const result = await StorageManager.checkConsistency();
expect(result.healthy).toBe(false);
// eslint-disable-next-line no-global-assign
indexedDB = new IDBFactory();
});
});
+1 -1
View File
@@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.
import { withMermaid } from "vitepress-plugin-mermaid";
function customPathResolver(href: string, currentPath: string) {
function customPathResolver(href: string, currentPath: string): string {
const [link, fragment] = href.split("#", 2);
if (currentPath === "index.md") {
if (link.startsWith("./docs/")) {
-1
View File
@@ -27,6 +27,5 @@ export const Theme = z.object({
export type Theme = z.infer<typeof Theme>;
declare module "styled-components" {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface DefaultTheme extends Theme {}
}
+104 -75
View File
@@ -41,7 +41,7 @@ export default defineConfig({
},
options: {
typeAware: true,
reportUnusedDisableDirectives: "off",
reportUnusedDisableDirectives: "warn",
maxWarnings: 0,
denyWarnings: true,
},
@@ -94,6 +94,15 @@ export default defineConfig({
],
"prefer-const": ["error", { destructuring: "all" }],
"import/first": "error",
"typescript/no-require-imports": "error",
"new-cap": "error",
"no-empty-pattern": "error",
"typescript/no-unsafe-function-type": "error",
"react/rules-of-hooks": "error",
"no-extend-native": "error",
"no-inner-declarations": "error",
"no-var": "error",
"typescript/no-unnecessary-type-constraint": "error",
"unicorn/no-instanceof-array": "error",
"no-restricted-globals": ["error", ...defaultRestrictedGlobals],
@@ -108,11 +117,16 @@ export default defineConfig({
// Allow the use of underscore to show args are not used.
// This is helpful for seeing that a function implements
// an interface but won't be using one of it's arguments.
"typescript/no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
"no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
// Disable some rules here, but they are enabled for src
"typescript/explicit-function-return-type": "off",
"typescript/explicit-member-accessibility": "off",
// Require method signatures to be explicit to help make signature changes more obvious in review
"typescript/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"typescript/explicit-member-accessibility": "error",
// Require us to be more explicit about type conversions to help prevent bugs
"typescript/no-base-to-string": ["error"],
@@ -146,8 +160,6 @@ export default defineConfig({
"typescript/no-redundant-type-constituents": "off",
"typescript/no-useless-default-assignment": "off",
"typescript/no-duplicate-type-constituents": "off",
"no-unused-vars": "off",
"eslint/no-unused-vars": "off",
"typescript/no-floating-promises": "off",
"typescript/no-implied-eval": "off",
"typescript/no-misused-spread": "off",
@@ -174,7 +186,71 @@ export default defineConfig({
},
overrides: [
{
files: ["apps/web/src/**/*"],
files: ["apps/web/src/**/*", "{packages,modules}/*/src/**/*"],
rules: {
"no-restricted-globals": [
"error",
defaultRestrictedGlobals,
{
name: "Buffer",
message: "Buffer is not available in the web.",
},
],
},
},
{
files: ["{packages,apps,modules}/*/src/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
name: "events",
message: "Please use TypedEventEmitter instead",
},
],
// Enable this in the future, it has a lot of false positives right now
// "react/react-compiler": "error",
},
},
{
files: ["packages/shared-components/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "react",
importNames: ["act"],
message: "Please use @test-utils instead.",
},
{
name: "@testing-library/react",
message: "Please use @test-utils instead",
},
],
},
],
// This would be good to apply globally in the future
"react/forbid-elements": [
"error",
{
forbid: [
{ element: "h1", message: "Use Compound <Heading> instead" },
{ element: "h2", message: "Use Compound <Heading> instead" },
{ element: "h3", message: "Use Compound <Heading> instead" },
{ element: "h4", message: "Use Compound <Heading> instead" },
{ element: "h5", message: "Use Compound <Heading> instead" },
{ element: "h6", message: "Use Compound <Heading> instead" },
],
},
],
},
},
{
files: ["apps/web/**/*"],
rules: {
"no-restricted-properties": [
"error",
@@ -306,78 +382,24 @@ export default defineConfig({
},
},
{
files: ["apps/web/src/**/*", "{packages,modules}/*/src/**/*"],
files: [
"apps/*/playwright/**/*",
"packages/playwright-common/**/*",
"modules/*/e2e/**/*",
"modules/playwright/**/*",
],
rules: {
"no-restricted-globals": [
"error",
defaultRestrictedGlobals,
{
name: "Buffer",
message: "Buffer is not available in the web.",
},
],
},
},
{
files: ["packages/shared-components/**/*"],
rules: {
"no-restricted-imports": [
"error",
{
paths: [
{
name: "react",
importNames: ["act"],
message: "Please use @test-utils instead.",
},
],
},
],
// This would be good to apply globally in the future
"react/forbid-elements": [
"error",
{
forbid: [
{ element: "h1", message: "Use Compound <Heading> instead" },
{ element: "h2", message: "Use Compound <Heading> instead" },
{ element: "h3", message: "Use Compound <Heading> instead" },
{ element: "h4", message: "Use Compound <Heading> instead" },
{ element: "h5", message: "Use Compound <Heading> instead" },
{ element: "h6", message: "Use Compound <Heading> instead" },
],
},
],
},
},
{
files: ["{packages,apps,modules/*/src/**/*"],
rules: {
"no-console": "error",
// Require method signatures to be explicit to help make signature changes more obvious in review
"typescript/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"typescript/explicit-member-accessibility": "error",
"no-restricted-imports": [
"error",
{
name: "events",
message: "Please use TypedEventEmitter instead",
},
],
"react/react-compiler": "error",
// This is a common pattern for Playwright fixtures
"no-empty-pattern": "off",
// Playwright has a `use` method for fixtures which confuses this rule
"react-hooks/rules-of-hooks": "off",
},
},
{
files: [
"{packages,apps,modules}/*/src/**/*.{test,stories}.{ts,tsx}",
"{packages,apps,modules}/*/src/{tests,__mocks__}/*.{ts,tsx}",
"{packages,apps,modules}/*/src/{tests,test}/*.{ts,tsx}",
"{packages,apps,modules}/*/src/**/__mocks__/*.{ts,tsx}",
"{packages,apps,modules}/*/{test,playwright,e2e}/**/*",
"{packages,apps,modules}/*/playwright.config.ts",
"{packages,apps,modules}/*/.storybook/**/*",
@@ -386,7 +408,6 @@ export default defineConfig({
rules: {
// Tests can be linted a little more flexibly
// We don't need super strict typing in test utilities
"no-empty-pattern": "off",
"no-import-assign": "off",
"no-unsafe-optional-chaining": "off",
"typescript/no-empty-object-type": "off",
@@ -412,6 +433,8 @@ export default defineConfig({
},
],
"jsdoc/check-tag-names": "off",
"typescript/explicit-function-return-type": "off",
"typescript/explicit-member-accessibility": "off",
// Disable a11y rules for components in tests
"jsx-a11y/role-has-required-aria-props": "off",
@@ -446,6 +469,12 @@ export default defineConfig({
"storybook/no-uninstalled-addons": "error",
},
},
{
files: ["**/*.{cjs,js}"],
rules: {
"typescript/no-require-imports": "off",
},
},
],
});
-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()}

Some files were not shown because too many files have changed in this diff Show More