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:
@@ -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 */
|
||||
}
|
||||
|
||||
Vendored
-9
@@ -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 */
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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 = "";
|
||||
}
|
||||
},
|
||||
|
||||
-1
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
/**
|
||||
|
||||
@@ -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"];
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = {};
|
||||
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
@@ -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<
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user