Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 548290b

Browse files
authored
Run a minor code quality checker over the repo (#8524)
* Run a minor code quality checker over the repo Largely targeted at spelling of common words and misc code issues. * Update snapshots
1 parent 89d7760 commit 548290b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+72
-72
lines changed

src/BasePlatform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default abstract class BasePlatform {
237237
}
238238

239239
/**
240-
* Restarts the application, without neccessarily reloading
240+
* Restarts the application, without necessarily reloading
241241
* any application code
242242
*/
243243
abstract reload();

src/CallHandler.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ export default class CallHandler extends EventEmitter {
948948
): Promise<void> {
949949
if (consultFirst) {
950950
// if we're consulting, we just start by placing a call to the transfer
951-
// target (passing the transferee so the actual tranfer can happen later)
951+
// target (passing the transferee so the actual transfer can happen later)
952952
this.dialNumber(destination, call);
953953
return;
954954
}

src/HtmlUtils.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const transformTags: IExtendedSanitizeOptions["transformTags"] = { // custom to
187187
delete attribs.target;
188188
}
189189
} else {
190-
// Delete the href attrib if it is falsey
190+
// Delete the href attrib if it is falsy
191191
delete attribs.href;
192192
}
193193

src/ImageUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limitations under the License.
2525
* reflect the actual height the scaled thumbnail occupies.
2626
*
2727
* This is very useful for calculating how much height a thumbnail will actually
28-
* consume in the timeline, when performing scroll offset calcuations
28+
* consume in the timeline, when performing scroll offset calculations
2929
* (e.g. scroll locking)
3030
*/
3131
export function thumbHeight(fullWidth: number, fullHeight: number, thumbWidth: number, thumbHeight: number) {

src/Rooms.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function looksLikeDirectMessageRoom(room: Room, myUserId: string): boolea
5252
// Used to split rooms via tags
5353
const tagNames = Object.keys(room.tags);
5454
// Used for 1:1 direct chats
55-
// Show 1:1 chats in seperate "Direct Messages" section as long as they haven't
55+
// Show 1:1 chats in separate "Direct Messages" section as long as they haven't
5656
// been moved to a different tag section
5757
const totalMemberCount = room.currentState.getJoinedMemberCount() +
5858
room.currentState.getInvitedMemberCount();

src/async-components/views/dialogs/security/CreateKeyBackupDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent<IProps, I
291291
changeText = _t("Use a different passphrase?");
292292
} else if (!this.state.passPhrase.startsWith(this.state.passPhraseConfirm)) {
293293
// only tell them they're wrong if they've actually gone wrong.
294-
// Security concious readers will note that if you left element-web unattended
294+
// Security conscious readers will note that if you left element-web unattended
295295
// on this screen, this would make it easy for a malicious person to guess
296296
// your passphrase one letter at a time, but they could get this faster by
297297
// just opening the browser's developer tools and reading it.

src/async-components/views/dialogs/security/CreateSecretStorageDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ export default class CreateSecretStorageDialog extends React.PureComponent<IProp
649649
changeText = _t("Use a different passphrase?");
650650
} else if (!this.state.passPhrase.startsWith(this.state.passPhraseConfirm)) {
651651
// only tell them they're wrong if they've actually gone wrong.
652-
// Security concious readers will note that if you left element-web unattended
652+
// Security conscious readers will note that if you left element-web unattended
653653
// on this screen, this would make it easy for a malicious person to guess
654654
// your passphrase one letter at a time, but they could get this faster by
655655
// just opening the browser's developer tools and reading it.

src/components/views/auth/CountryDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export default class CountryDropdown extends React.Component<IProps, IState> {
135135
});
136136

137137
// default value here too, otherwise we need to handle null / undefined
138-
// values between mounting and the initial value propgating
138+
// values between mounting and the initial value propagating
139139
const value = this.props.value || this.state.defaultCountry.iso2;
140140

141141
return <Dropdown

src/components/views/beacon/LeftPanelLiveShareWarning.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const getLabel = (hasStoppingErrors: boolean, hasLocationErrors: boolean): strin
5656
return _t('An error occurred while stopping your live location');
5757
}
5858
if (hasLocationErrors) {
59-
return _t('An error occured whilst sharing your live location');
59+
return _t('An error occurred whilst sharing your live location');
6060
}
6161
return _t('You are sharing your live location');
6262
};

src/components/views/beacon/RoomLiveShareWarning.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import LiveTimeRemaining from './LiveTimeRemaining';
2929

3030
const getLabel = (hasLocationPublishError: boolean, hasStopSharingError: boolean): string => {
3131
if (hasLocationPublishError) {
32-
return _t('An error occured whilst sharing your live location, please try again');
32+
return _t('An error occurred whilst sharing your live location, please try again');
3333
}
3434
if (hasStopSharingError) {
3535
return _t('An error occurred while stopping your live location, please try again');

src/components/views/dialogs/BulkRedactDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { EventType } from "matrix-js-sdk/src/@types/event";
2525
import { _t } from '../../../languageHandler';
2626
import dis from "../../../dispatcher/dispatcher";
2727
import { Action } from "../../../dispatcher/actions";
28-
import { IDialogProps } from "../dialogs/IDialogProps";
28+
import { IDialogProps } from "./IDialogProps";
2929
import BaseDialog from "../dialogs/BaseDialog";
3030
import InfoDialog from "../dialogs/InfoDialog";
3131
import DialogButtons from "../elements/DialogButtons";

src/components/views/dialogs/ExportDialog.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
263263
else onFinished(false);
264264
};
265265

266-
const confirmCanel = async () => {
266+
const confirmCancel = async () => {
267267
await exporter?.cancelExport();
268268
setExportCancelled(true);
269269
setExporting(false);
@@ -346,7 +346,7 @@ const ExportDialog: React.FC<IProps> = ({ room, onFinished }) => {
346346
hasCancel={true}
347347
cancelButton={_t("Continue")}
348348
onCancel={() => setCancelWarning(false)}
349-
onPrimaryButtonClick={confirmCanel}
349+
onPrimaryButtonClick={confirmCancel}
350350
/>
351351
</BaseDialog>
352352
);

src/components/views/dialogs/KeySignatureUploadFailedDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface IProps extends IDialogProps {
2929
error: string;
3030
}>>;
3131
source: string;
32-
continuation: () => void;
32+
continuation: () => Promise<void>;
3333
}
3434

3535
const KeySignatureUploadFailedDialog: React.FC<IProps> = ({

src/components/views/dialogs/ShareDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const socials = [
5252
}, {
5353
name: 'Reddit',
5454
img: require("../../../../res/img/social/reddit.png"),
55-
url: (url) => `http://www.reddit.com/submit?url=${url}`,
55+
url: (url) => `https://www.reddit.com/submit?url=${url}`,
5656
}, {
5757
name: 'email',
5858
img: require("../../../../res/img/social/email-1.png"),

src/components/views/dialogs/security/RestoreKeyBackupDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ enum ProgressState {
4444
}
4545

4646
interface IProps extends IDialogProps {
47-
// if false, will close the dialog as soon as the restore completes succesfully
47+
// if false, will close the dialog as soon as the restore completes successfully
4848
// default: true
4949
showSummary?: boolean;
5050
// If specified, gather the key from the user but then call the function with the backup

src/components/views/elements/AccessibleButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default function AccessibleButton({
9696
// that might receive focus as a result of the AccessibleButtonClick action
9797
// It's because we are using html buttons at a few places e.g. inside dialogs
9898
// And divs which we report as role button to assistive technologies.
99-
// Browsers handle space and enter keypresses differently and we are only adjusting to the
99+
// Browsers handle space and enter key presses differently and we are only adjusting to the
100100
// inconsistencies here
101101
newProps.onKeyDown = (e) => {
102102
const action = getKeyBindingsManager().getAccessibilityAction(e);

src/components/views/elements/AppTile.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ interface IProps {
5757
// which bypasses permission prompts as it was added explicitly by that user
5858
room?: Room;
5959
threadId?: string | null;
60-
// Specifying 'fullWidth' as true will render the app tile to fill the width of the app drawer continer.
60+
// Specifying 'fullWidth' as true will render the app tile to fill the width of the app drawer container.
6161
// This should be set to true when there is only one widget in the app drawer, otherwise it should be false.
6262
fullWidth?: boolean;
6363
// Optional. If set, renders a smaller view of the widget
@@ -288,7 +288,7 @@ export default class AppTile extends React.Component<IProps, IState> {
288288
private setupSgListeners() {
289289
this.sgWidget.on("preparing", this.onWidgetPreparing);
290290
this.sgWidget.on("ready", this.onWidgetReady);
291-
// emits when the capabilites have been setup or changed
291+
// emits when the capabilities have been set up or changed
292292
this.sgWidget.on("capabilitiesNotified", this.onWidgetCapabilitiesNotified);
293293
}
294294

@@ -543,7 +543,7 @@ export default class AppTile extends React.Component<IProps, IState> {
543543
const sandboxFlags = "allow-forms allow-popups allow-popups-to-escape-sandbox " +
544544
"allow-same-origin allow-scripts allow-presentation allow-downloads";
545545

546-
// Additional iframe feature pemissions
546+
// Additional iframe feature permissions
547547
// (see - https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-permissions-in-cross-origin-iframes and https://wicg.github.io/feature-policy/)
548548
const iframeFeatures = "microphone; camera; encrypted-media; autoplay; display-capture; clipboard-write;";
549549

src/components/views/elements/ErrorBoundary.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
5353
// in their own `console.error` invocation.
5454
logger.error(error);
5555
logger.error(
56-
"The above error occured while React was rendering the following components:",
56+
"The above error occurred while React was rendering the following components:",
5757
componentStack,
5858
);
5959
}

src/components/views/elements/LanguageDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default class LanguageDropdown extends React.Component<IProps, IState> {
9999
});
100100

101101
// default value here too, otherwise we need to handle null / undefined
102-
// values between mounting and the initial value propgating
102+
// values between mounting and the initial value propagating
103103
let language = SettingsStore.getValue("language", null, /*excludeDefault:*/true);
104104
let value = null;
105105
if (language) {

src/components/views/elements/ReplyChain.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export default class ReplyChain extends React.Component<IProps, IState> {
167167
await this.matrixClient.getEventTimeline(this.room.getUnfilteredTimelineSet(), eventId);
168168
} catch (e) {
169169
// if it fails catch the error and return early, there's no point trying to find the event in this case.
170-
// Return null as it is falsey and thus should be treated as an error (as the event cannot be resolved).
170+
// Return null as it is falsy and thus should be treated as an error (as the event cannot be resolved).
171171
return null;
172172
}
173173
return this.room.findEventById(eventId);

src/components/views/elements/SpellCheckLanguagesDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default class SpellCheckLanguagesDropdown extends React.Component<SpellCh
9999
});
100100

101101
// default value here too, otherwise we need to handle null / undefined;
102-
// values between mounting and the initial value propgating
102+
// values between mounting and the initial value propagating
103103
let language = SettingsStore.getValue("language", null, /*excludeDefault:*/true);
104104
let value = null;
105105
if (language) {

src/components/views/elements/TruncatedList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default class TruncatedList extends React.Component<IProps> {
5252
return this.props.getChildren(start, end);
5353
} else {
5454
// XXX: I'm not sure why anything would pass null into this, it seems
55-
// like a bizzare case to handle, but I'm preserving the behaviour.
55+
// like a bizarre case to handle, but I'm preserving the behaviour.
5656
// (see commit 38d5c7d5c5d5a34dc16ef5d46278315f5c57f542)
5757
return React.Children.toArray(this.props.children).filter((c) => {
5858
return c != null;

src/components/views/messages/MImageBody.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -485,14 +485,14 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
485485
return this.wrapImage(contentUrl, thumbnail);
486486
}
487487

488-
// Overidden by MStickerBody
488+
// Overridden by MStickerBody
489489
protected wrapImage(contentUrl: string, children: JSX.Element): JSX.Element {
490490
return <a href={contentUrl} target={this.props.forExport ? "_blank" : undefined} onClick={this.onClick}>
491491
{ children }
492492
</a>;
493493
}
494494

495-
// Overidden by MStickerBody
495+
// Overridden by MStickerBody
496496
protected getPlaceholder(width: number, height: number): JSX.Element {
497497
const blurhash = this.props.mxEvent.getContent().info?.[BLURHASH_FIELD];
498498

@@ -506,12 +506,12 @@ export default class MImageBody extends React.Component<IBodyProps, IState> {
506506
return <Spinner w={32} h={32} />;
507507
}
508508

509-
// Overidden by MStickerBody
509+
// Overridden by MStickerBody
510510
protected getTooltip(): JSX.Element {
511511
return null;
512512
}
513513

514-
// Overidden by MStickerBody
514+
// Overridden by MStickerBody
515515
protected getFileBody(): string | JSX.Element {
516516
if (this.props.forExport) return null;
517517
/*

src/components/views/rooms/AppsDrawer.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ interface IState {
4949
// @ts-ignore - TS wants a string key, but we know better
5050
apps: {[id: Container]: IApp[]};
5151
resizingVertical: boolean; // true when changing the height of the apps drawer
52-
resizingHorizontal: boolean; // true when chagning the distribution of the width between widgets
52+
resizingHorizontal: boolean; // true when changing the distribution of the width between widgets
5353
resizing: boolean;
5454
}
5555

@@ -259,7 +259,7 @@ export default class AppsDrawer extends React.Component<IProps, IState> {
259259
mx_AppsDrawer_2apps: apps.length === 2,
260260
mx_AppsDrawer_3apps: apps.length === 3,
261261
});
262-
const appConatiners =
262+
const appContainers =
263263
<div className="mx_AppsContainer" ref={this.collectResizer}>
264264
{ apps.map((app, i) => {
265265
if (i < 1) return app;
@@ -272,7 +272,7 @@ export default class AppsDrawer extends React.Component<IProps, IState> {
272272

273273
let drawer;
274274
if (widgetIsMaxmised) {
275-
drawer = appConatiners;
275+
drawer = appContainers;
276276
} else {
277277
drawer = <PersistentVResizer
278278
room={this.props.room}
@@ -282,7 +282,7 @@ export default class AppsDrawer extends React.Component<IProps, IState> {
282282
handleWrapperClass="mx_AppsContainer_resizerHandleContainer"
283283
className="mx_AppsContainer_resizer"
284284
resizeNotifier={this.props.resizeNotifier}>
285-
{ appConatiners }
285+
{ appContainers }
286286
</PersistentVResizer>;
287287
}
288288

src/components/views/rooms/AuxPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default class AuxPanel extends React.Component<IProps, IState> {
104104
const severity = ev.getContent().severity || "normal";
105105
const stateKey = ev.getStateKey();
106106

107-
// We want a non-empty title but can accept falsey values (e.g.
107+
// We want a non-empty title but can accept falsy values (e.g.
108108
// zero)
109109
if (title && value !== undefined) {
110110
counters.push({

src/components/views/rooms/EventTile.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ interface IProps {
212212
// whether or not to display thread info
213213
showThreadInfo?: boolean;
214214

215-
// if specified and `true`, the message his behing
215+
// if specified and `true`, the message is being
216216
// hidden for moderation from other users but is
217217
// displayed to the current user either because they're
218218
// the author or they are a moderator

src/components/views/toasts/VerificationRequestToast.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
6666
request.on(VerificationRequestEvent.Change, this.checkRequestIsPending);
6767
// We should probably have a separate class managing the active verification toasts,
6868
// rather than monitoring this in the toast component itself, since we'll get problems
69-
// like the toasdt not going away when the verification is cancelled unless it's the
69+
// like the toast not going away when the verification is cancelled unless it's the
7070
// one on the top (ie. the one that's mounted).
7171
// As a quick & dirty fix, check the toast is still relevant when it mounts (this prevents
7272
// a toast hanging around after logging in if you did a verification as part of login).

src/dispatcher/payloads/ComposerInsertPayload.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export enum ComposerType {
2828
interface IBaseComposerInsertPayload extends ActionPayload {
2929
action: Action.ComposerInsert;
3030
timelineRenderingType: TimelineRenderingType;
31-
composerType?: ComposerType; // falsey if should be re-dispatched to the correct composer
31+
composerType?: ComposerType; // falsy if should be re-dispatched to the correct composer
3232
}
3333

3434
interface IComposerInsertMentionPayload extends IBaseComposerInsertPayload {

src/editor/dom.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function getTextNodeValue(node: Node): string {
178178
if (nodeText.length !== 1) {
179179
return nodeText.replace(CARET_NODE_CHAR, "");
180180
} else {
181-
// only contains ZWS, which is ignored, so return emtpy string
181+
// only contains ZWS, which is ignored, so return empty string
182182
return "";
183183
}
184184
} else {

src/editor/operations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function formatRange(range: Range, action: Formatting): void {
3737
range.trim();
3838
}
3939

40-
// Edgecase when just selecting whitespace or new line.
40+
// Edge case when just selecting whitespace or new line.
4141
// There should be no reason to format whitespace, so we can just return.
4242
if (range.length === 0) {
4343
return;

src/i18n/strings/en_EN.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2957,11 +2957,11 @@
29572957
"View List": "View List",
29582958
"Close sidebar": "Close sidebar",
29592959
"An error occurred while stopping your live location": "An error occurred while stopping your live location",
2960-
"An error occured whilst sharing your live location": "An error occured whilst sharing your live location",
2960+
"An error occurred whilst sharing your live location": "An error occurred whilst sharing your live location",
29612961
"You are sharing your live location": "You are sharing your live location",
29622962
"%(timeRemaining)s left": "%(timeRemaining)s left",
29632963
"Live location enabled": "Live location enabled",
2964-
"An error occured whilst sharing your live location, please try again": "An error occured whilst sharing your live location, please try again",
2964+
"An error occurred whilst sharing your live location, please try again": "An error occurred whilst sharing your live location, please try again",
29652965
"An error occurred while stopping your live location, please try again": "An error occurred while stopping your live location, please try again",
29662966
"Stop sharing": "Stop sharing",
29672967
"Stop sharing and close": "Stop sharing and close",

src/indexing/BaseEventIndexManager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default abstract class BaseEventIndexManager {
9191
*
9292
* @param {MatrixEvent} ev The event that should be added to the index.
9393
* @param {IMatrixProfile} profile The profile of the event sender at the
94-
* time of the event receival.
94+
* time the event was received.
9595
*
9696
* @return {Promise} A promise that will resolve when the was queued up for
9797
* addition.

0 commit comments

Comments
 (0)