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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user