Auto-fix lint errors
This commit is contained in:
parent
4c5720a573
commit
ae0a8b8da4
625 changed files with 3170 additions and 3232 deletions
|
@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useCallback, useState} from "react";
|
||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||
import {Room} from "matrix-js-sdk/src/models/room";
|
||||
import { useCallback, useState } from "react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
|
||||
import {useEventEmitter} from "./useEventEmitter";
|
||||
import { useEventEmitter } from "./useEventEmitter";
|
||||
|
||||
const tryGetContent = <T extends {}>(ev?: MatrixEvent) => ev ? ev.getContent<T>() : undefined;
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useEffect, useRef} from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
import {ActionPayload} from "../dispatcher/payloads";
|
||||
import {Dispatcher} from "flux";
|
||||
import { ActionPayload } from "../dispatcher/payloads";
|
||||
import { Dispatcher } from "flux";
|
||||
|
||||
// Hook to simplify listening to flux dispatches
|
||||
export const useDispatcher = (dispatcher: Dispatcher<ActionPayload>, handler: (payload: ActionPayload) => void) => {
|
||||
|
|
|
@ -14,8 +14,8 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useRef, useEffect} from "react";
|
||||
import type {EventEmitter} from "events";
|
||||
import { useRef, useEffect } from "react";
|
||||
import type { EventEmitter } from "events";
|
||||
|
||||
type Handler = (...args: any[]) => void;
|
||||
|
||||
|
|
|
@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useCallback, useState} from "react";
|
||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
|
||||
import {Room} from "matrix-js-sdk/src/models/room";
|
||||
import { useCallback, useState } from "react";
|
||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
|
||||
import {useEventEmitter} from "./useEventEmitter";
|
||||
import { useEventEmitter } from "./useEventEmitter";
|
||||
|
||||
// Hook to simplify watching whether a Matrix room is encrypted, returns undefined if room is undefined
|
||||
export function useIsEncrypted(cli: MatrixClient, room?: Room): boolean | undefined {
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {Dispatch, SetStateAction, useCallback, useEffect, useState} from "react";
|
||||
import { Dispatch, SetStateAction, useCallback, useEffect, useState } from "react";
|
||||
|
||||
const getValue = <T>(key: string, initialValue: T): T => {
|
||||
try {
|
||||
|
|
|
@ -14,19 +14,19 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useState} from "react";
|
||||
import {Room} from "matrix-js-sdk/src/models/room";
|
||||
import {RoomMember} from "matrix-js-sdk/src/models/room-member";
|
||||
import { useState } from "react";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
|
||||
import {useEventEmitter} from "./useEventEmitter";
|
||||
import {throttle} from "lodash";
|
||||
import { useEventEmitter } from "./useEventEmitter";
|
||||
import { throttle } from "lodash";
|
||||
|
||||
// Hook to simplify watching Matrix Room joined members
|
||||
export const useRoomMembers = (room: Room, throttleWait = 250) => {
|
||||
const [members, setMembers] = useState<RoomMember[]>(room.getJoinedMembers());
|
||||
useEventEmitter(room.currentState, "RoomState.members", throttle(() => {
|
||||
setMembers(room.getJoinedMembers());
|
||||
}, throttleWait, {leading: true, trailing: true}));
|
||||
}, throttleWait, { leading: true, trailing: true }));
|
||||
return members;
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,6 @@ export const useRoomMemberCount = (room: Room, throttleWait = 250) => {
|
|||
const [count, setCount] = useState<number>(room.getJoinedMemberCount());
|
||||
useEventEmitter(room.currentState, "RoomState.members", throttle(() => {
|
||||
setCount(room.getJoinedMemberCount());
|
||||
}, throttleWait, {leading: true, trailing: true}));
|
||||
}, throttleWait, { leading: true, trailing: true }));
|
||||
return count;
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useEffect, useState} from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import SettingsStore from '../settings/SettingsStore';
|
||||
|
||||
// Hook to fetch the value of a setting and dynamically update when it changes
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useState} from "react";
|
||||
import { useState } from "react";
|
||||
|
||||
// Hook to simplify managing state of arrays of a common type
|
||||
export const useStateArray = <T>(initialSize: number, initialState: T | T[]): [T[], (i: number, v: T) => void] => {
|
||||
|
@ -25,5 +25,5 @@ export const useStateArray = <T>(initialSize: number, initialState: T | T[]): [T
|
|||
const copy = [...data];
|
||||
copy[index] = value;
|
||||
return copy;
|
||||
})]
|
||||
})];
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {Dispatch, SetStateAction, useState} from "react";
|
||||
import { Dispatch, SetStateAction, useState } from "react";
|
||||
|
||||
// Hook to simplify interactions with a store-backed state values
|
||||
// Returns value and method to change the state value
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {Dispatch, SetStateAction, useState} from "react";
|
||||
import { Dispatch, SetStateAction, useState } from "react";
|
||||
|
||||
// Hook to simplify toggling of a boolean state value
|
||||
// Returns value, method to toggle boolean value and method to set the boolean value
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import {useEffect, useRef, useState} from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
type Handler = () => void;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue