From 6199c337ea23421dbe6cc2b64461ba834561cb35 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 10 Jan 2022 12:57:20 +0000 Subject: [PATCH] Fix spacing errors (#7484) --- package.json | 4 +-- src/CountlyAnalytics.ts | 2 +- src/Markdown.ts | 2 +- src/components/structures/EmbeddedPage.tsx | 2 +- .../structures/auth/Registration.tsx | 2 +- .../views/dialogs/ModalWidgetDialog.tsx | 2 +- src/components/views/elements/FacePile.tsx | 2 +- src/components/views/messages/MPollBody.tsx | 4 +-- .../views/right_panel/RoomHeaderButtons.tsx | 2 +- src/components/views/right_panel/UserInfo.tsx | 2 +- src/components/views/rooms/EventTile.tsx | 14 ++++---- src/components/views/rooms/MemberList.tsx | 2 +- .../views/settings/ThemeChoicePanel.tsx | 2 +- .../views/settings/account/EmailAddresses.tsx | 2 +- .../tabs/user/HelpUserSettingsTab.tsx | 2 +- .../tabs/user/LabsUserSettingsTab.tsx | 2 +- .../tabs/user/SecurityUserSettingsTab.tsx | 4 +-- src/utils/FormattingUtils.ts | 2 +- src/verification.ts | 2 +- test/PosthogAnalytics-test.ts | 4 +-- .../views/messages/MPollBody-test.tsx | 10 +++--- .../views/rooms/SendMessageComposer-test.tsx | 8 ++--- test/end-to-end-tests/has-custom-app.js | 2 +- test/end-to-end-tests/src/session.ts | 2 +- test/stores/WidgetLayoutStore-test.ts | 2 +- yarn.lock | 36 ++++++++++++++++--- 26 files changed, 74 insertions(+), 46 deletions(-) diff --git a/package.json b/package.json index 8831f25725..b25780a8ff 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ "emojibase-data": "^6.2.0", "emojibase-regex": "^5.1.3", "escape-html": "^1.0.3", - "eslint-plugin-import": "^2.25.2", "file-saver": "^2.0.5", "filesize": "6.1.0", "flux": "2.1.1", @@ -166,8 +165,9 @@ "enzyme-to-json": "^3.6.2", "eslint": "7.18.0", "eslint-config-google": "^0.14.0", + "eslint-plugin-import": "^2.25.4", "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-matrix-org": "github:matrix-org/eslint-plugin-matrix-org#2fc59ae12ff551e91c41a1b185be25c77ad02190", + "eslint-plugin-matrix-org": "^0.4.0", "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.2.0", "glob": "^7.1.6", diff --git a/src/CountlyAnalytics.ts b/src/CountlyAnalytics.ts index da0021c2cf..bb4db04cc2 100644 --- a/src/CountlyAnalytics.ts +++ b/src/CountlyAnalytics.ts @@ -439,7 +439,7 @@ export default class CountlyAnalytics { public async disable() { if (this.disabled) return; - await this.track("Opt-Out" ); + await this.track("Opt-Out"); this.endSession(); window.clearInterval(this.heartbeatIntervalId); window.clearTimeout(this.activityIntervalId); diff --git a/src/Markdown.ts b/src/Markdown.ts index a086e9516e..e24c9b7287 100644 --- a/src/Markdown.ts +++ b/src/Markdown.ts @@ -212,7 +212,7 @@ export default class Markdown { const walker = this.parsed.walker(); let ev; - while ( (ev = walker.next()) ) { + while (ev = walker.next()) { const node = ev.node; if (TEXT_NODES.indexOf(node.type) > -1) { // definitely text diff --git a/src/components/structures/EmbeddedPage.tsx b/src/components/structures/EmbeddedPage.tsx index b29a1a43d6..4b309a1838 100644 --- a/src/components/structures/EmbeddedPage.tsx +++ b/src/components/structures/EmbeddedPage.tsx @@ -86,7 +86,7 @@ export default class EmbeddedPage extends React.PureComponent { return; } - body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>this.translate(g1)); + body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1) => this.translate(g1)); if (this.props.replaceMap) { Object.keys(this.props.replaceMap).forEach(key => { diff --git a/src/components/structures/auth/Registration.tsx b/src/components/structures/auth/Registration.tsx index 298df8b13b..828ca8d79d 100644 --- a/src/components/structures/auth/Registration.tsx +++ b/src/components/structures/auth/Registration.tsx @@ -363,7 +363,7 @@ export default class Registration extends React.Component { return Promise.resolve(); } const matrixClient = MatrixClientPeg.get(); - return matrixClient.getPushers().then((resp)=>{ + return matrixClient.getPushers().then((resp) => { const pushers = resp.pushers; for (let i = 0; i < pushers.length; ++i) { if (pushers[i].kind === 'email') { diff --git a/src/components/views/dialogs/ModalWidgetDialog.tsx b/src/components/views/dialogs/ModalWidgetDialog.tsx index 1b44753478..057dff5d53 100644 --- a/src/components/views/dialogs/ModalWidgetDialog.tsx +++ b/src/components/views/dialogs/ModalWidgetDialog.tsx @@ -80,7 +80,7 @@ export default class ModalWidgetDialog extends React.PureComponent { members.length > numShown ? : null } { shownMembers.map(m => - ) } + ) } { onlyKnownUsers && { _t("%(count)s people you know have already joined", { count: members.length }) } diff --git a/src/components/views/messages/MPollBody.tsx b/src/components/views/messages/MPollBody.tsx index 51c895414b..bc04338c83 100644 --- a/src/components/views/messages/MPollBody.tsx +++ b/src/components/views/messages/MPollBody.tsx @@ -329,7 +329,7 @@ export default class MPollBody extends React.Component { } const newEventIds = newEvents.map((mxEvent: MatrixEvent) => mxEvent.getId()); this.seenEventIds = this.seenEventIds.concat(newEventIds); - this.setState( { selected: newSelected } ); + this.setState({ selected: newSelected }); } private totalVotes(collectedVotes: Map): number { @@ -381,7 +381,7 @@ export default class MPollBody extends React.Component { ); } } else { - totalText = _t( "Based on %(count)s votes", { count: totalVotes } ); + totalText = _t("Based on %(count)s votes", { count: totalVotes }); } return
diff --git a/src/components/views/right_panel/RoomHeaderButtons.tsx b/src/components/views/right_panel/RoomHeaderButtons.tsx index 4fa6c5585f..2864caed18 100644 --- a/src/components/views/right_panel/RoomHeaderButtons.tsx +++ b/src/components/views/right_panel/RoomHeaderButtons.tsx @@ -265,7 +265,7 @@ export default class RoomHeaderButtons extends HeaderButtons { return <> { Array.from(rightPanelPhaseButtons.keys()).map((phase) => - ( this.props.excludedRightPanelPhaseButtons.includes(phase) + (this.props.excludedRightPanelPhaseButtons.includes(phase) ? null : rightPanelPhaseButtons.get(phase))) } diff --git a/src/components/views/right_panel/UserInfo.tsx b/src/components/views/right_panel/UserInfo.tsx index d7911fc9d6..03c624f0c1 100644 --- a/src/components/views/right_panel/UserInfo.tsx +++ b/src/components/views/right_panel/UserInfo.tsx @@ -94,7 +94,7 @@ const disambiguateDevices = (devices: IDevice[]) => { } for (const name in names) { if (names[name].length > 1) { - names[name].forEach((j)=>{ + names[name].forEach((j) => { devices[j].ambiguous = true; }); } diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index adca79329e..3ea0b7b4dc 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -1245,16 +1245,16 @@ export default class EventTile extends React.Component {

{ this.state.previouslyRequestedKeys ? - _t( 'Your key share request has been sent - please check your other sessions ' + - 'for key share requests.') : - _t( 'Key share requests are sent to your other sessions automatically. If you ' + - 'rejected or dismissed the key share request on your other sessions, click ' + - 'here to request the keys for this session again.') + _t('Your key share request has been sent - please check your other sessions ' + + 'for key share requests.') : + _t('Key share requests are sent to your other sessions automatically. If you ' + + 'rejected or dismissed the key share request on your other sessions, click ' + + 'here to request the keys for this session again.') }

- { _t( 'If your other sessions do not have the key for this message you will not ' + - 'be able to decrypt them.') + { _t('If your other sessions do not have the key for this message you will not ' + + 'be able to decrypt them.') }

; diff --git a/src/components/views/rooms/MemberList.tsx b/src/components/views/rooms/MemberList.tsx index 3d88b366d4..7bbebcbb5f 100644 --- a/src/components/views/rooms/MemberList.tsx +++ b/src/components/views/rooms/MemberList.tsx @@ -309,7 +309,7 @@ export default class MemberList extends React.Component { return this.createOverflowTile(overflowCount, totalCount, this.showMoreInvitedMemberList); }; - private createOverflowTile = (overflowCount: number, totalCount: number, onClick: () => void): JSX.Element=> { + private createOverflowTile = (overflowCount: number, totalCount: number, onClick: () => void): JSX.Element => { // For now we'll pretend this is any entity. It should probably be a separate tile. const text = _t("and %(count)s others...", { count: overflowCount }); return ( diff --git a/src/components/views/settings/ThemeChoicePanel.tsx b/src/components/views/settings/ThemeChoicePanel.tsx index 3c6d42e594..4adc3a1967 100644 --- a/src/components/views/settings/ThemeChoicePanel.tsx +++ b/src/components/views/settings/ThemeChoicePanel.tsx @@ -170,7 +170,7 @@ export default class ThemeChoicePanel extends React.Component { checked={isHighContrastTheme(this.state.theme)} onChange={(e) => this.highContrastThemeChanged(e.target.checked)} > - { _t( "Use high contrast" ) } + { _t("Use high contrast") }
; } diff --git a/src/components/views/settings/account/EmailAddresses.tsx b/src/components/views/settings/account/EmailAddresses.tsx index ba725c5225..75a72f192c 100644 --- a/src/components/views/settings/account/EmailAddresses.tsx +++ b/src/components/views/settings/account/EmailAddresses.tsx @@ -93,7 +93,7 @@ export class ExistingEmailAddress extends React.Component - { _t("Remove %(email)s?", { email: this.props.email.address } ) } + { _t("Remove %(email)s?", { email: this.props.email.address }) }
{ _t("Access Token") }
{ _t("Your access token gives full access to your account." - + " Do not share it with anyone." ) } + + " Do not share it with anyone.") }
{ MatrixClientPeg.get().getAccessToken() } { let betaSection; if (betas.length) { betaSection =
- { betas.map(f => ) } + { betas.map(f => ) }
; } diff --git a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.tsx b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.tsx index f37e2f336f..ef9902e551 100644 --- a/src/components/views/settings/tabs/user/SecurityUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/SecurityUserSettingsTab.tsx @@ -96,10 +96,10 @@ export default class SecurityUserSettingsTab extends React.Component { + private onAction = ({ action }: ActionPayload) => { if (action === "ignore_state_changed") { const ignoredUserIds = MatrixClientPeg.get().getIgnoredUsers(); - const newWaitingUnignored = this.state.waitingUnignored.filter(e=> ignoredUserIds.includes(e)); + const newWaitingUnignored = this.state.waitingUnignored.filter(e => ignoredUserIds.includes(e)); this.setState({ ignoredUserIds, waitingUnignored: newWaitingUnignored }); } }; diff --git a/src/utils/FormattingUtils.ts b/src/utils/FormattingUtils.ts index 265deaed38..935cfa5842 100644 --- a/src/utils/FormattingUtils.ts +++ b/src/utils/FormattingUtils.ts @@ -131,7 +131,7 @@ export function formatCommaSeparatedList(items: Array, ite } if (remaining > 0) { - return _t("%(items)s and %(count)s others", { items: joinedItems, count: remaining } ); + return _t("%(items)s and %(count)s others", { items: joinedItems, count: remaining }); } else { return _t("%(items)s and %(lastItem)s", { items: joinedItems, lastItem }); } diff --git a/src/verification.ts b/src/verification.ts index 80747e3b00..619a674dce 100644 --- a/src/verification.ts +++ b/src/verification.ts @@ -124,7 +124,7 @@ function setRightPanel(state: IRightPanelCardState) { } } -export function pendingVerificationRequestForUser(user: User | RoomMember | GroupMember ) { +export function pendingVerificationRequestForUser(user: User | RoomMember | GroupMember) { const cli = MatrixClientPeg.get(); const dmRoom = findDMForUser(cli, user.userId); if (dmRoom) { diff --git a/test/PosthogAnalytics-test.ts b/test/PosthogAnalytics-test.ts index 5e2b69db92..4f87957a45 100644 --- a/test/PosthogAnalytics-test.ts +++ b/test/PosthogAnalytics-test.ts @@ -157,7 +157,7 @@ describe("PosthogAnalytics", () => { getAccountDataFromServer = jest.fn().mockResolvedValue(null); setAccountData = jest.fn().mockResolvedValue({}); } - await analytics.identifyUser(new FakeClient(), () => "analytics_id" ); + await analytics.identifyUser(new FakeClient(), () => "analytics_id"); expect(fakePosthog.identify.mock.calls[0][0]).toBe("analytics_id"); }); @@ -173,7 +173,7 @@ describe("PosthogAnalytics", () => { getAccountDataFromServer = jest.fn().mockResolvedValue({ id: "existing_analytics_id" }); setAccountData = jest.fn().mockResolvedValue({}); } - await analytics.identifyUser(new FakeClient(), () => "new_analytics_id" ); + await analytics.identifyUser(new FakeClient(), () => "new_analytics_id"); expect(fakePosthog.identify.mock.calls[0][0]).toBe("existing_analytics_id"); }); }); diff --git a/test/components/views/messages/MPollBody-test.tsx b/test/components/views/messages/MPollBody-test.tsx index fa8f123930..66ae8382ba 100644 --- a/test/components/views/messages/MPollBody-test.tsx +++ b/test/components/views/messages/MPollBody-test.tsx @@ -461,7 +461,7 @@ describe("MPollBody", () => { txnId?: string, callback?: Callback, ): Promise => { - receivedEvents.push( { roomId, eventType, content, txnId, callback } ); + receivedEvents.push({ roomId, eventType, content, txnId, callback }); return Promise.resolve({ "event_id": "fake_tracked_send_id" }); }; @@ -482,7 +482,7 @@ describe("MPollBody", () => { txnId?: string, callback?: Callback, ): Promise => { - receivedEvents.push( { roomId, eventType, content, txnId, callback } ); + receivedEvents.push({ roomId, eventType, content, txnId, callback }); return Promise.resolve({ "event_id": "fake_tracked_send_id" }); }; @@ -506,7 +506,7 @@ describe("MPollBody", () => { txnId?: string, callback?: Callback, ): Promise => { - receivedEvents.push( { roomId, eventType, content, txnId, callback } ); + receivedEvents.push({ roomId, eventType, content, txnId, callback }); return Promise.resolve({ "event_id": "fake_tracked_send_id" }); }; @@ -528,7 +528,7 @@ describe("MPollBody", () => { txnId?: string, callback?: Callback, ): Promise => { - receivedEvents.push( { roomId, eventType, content, txnId, callback } ); + receivedEvents.push({ roomId, eventType, content, txnId, callback }); return Promise.resolve({ "event_id": "fake_tracked_send_id" }); }; @@ -553,7 +553,7 @@ describe("MPollBody", () => { txnId?: string, callback?: Callback, ): Promise => { - receivedEvents.push( { roomId, eventType, content, txnId, callback } ); + receivedEvents.push({ roomId, eventType, content, txnId, callback }); return Promise.resolve({ "event_id": "fake_tracked_send_id" }); }; diff --git a/test/components/views/rooms/SendMessageComposer-test.tsx b/test/components/views/rooms/SendMessageComposer-test.tsx index 9c1a558a86..e48f05f214 100644 --- a/test/components/views/rooms/SendMessageComposer-test.tsx +++ b/test/components/views/rooms/SendMessageComposer-test.tsx @@ -340,10 +340,10 @@ describe('', () => { const model2 = new EditorModel([], createPartCreator(), createRenderer()); const model3 = new EditorModel([], createPartCreator(), createRenderer()); const model4 = new EditorModel([], createPartCreator(), createRenderer()); - model.update("+😊hello", "insertText", new DocumentOffset( 8, true)); - model2.update(" +😊", "insertText", new DocumentOffset( 4, true)); - model3.update("+ 😊😊", "insertText", new DocumentOffset( 6, true)); - model4.update("+smiley", "insertText", new DocumentOffset( 7, true)); + model.update("+😊hello", "insertText", new DocumentOffset(8, true)); + model2.update(" +😊", "insertText", new DocumentOffset(4, true)); + model3.update("+ 😊😊", "insertText", new DocumentOffset(6, true)); + model4.update("+smiley", "insertText", new DocumentOffset(7, true)); expect(isQuickReaction(model)).toBeFalsy(); expect(isQuickReaction(model2)).toBeFalsy(); diff --git a/test/end-to-end-tests/has-custom-app.js b/test/end-to-end-tests/has-custom-app.js index 00184088fd..43784b6852 100644 --- a/test/end-to-end-tests/has-custom-app.js +++ b/test/end-to-end-tests/has-custom-app.js @@ -21,4 +21,4 @@ if (idx !== -1) { const value = process.argv[idx + 1]; hasAppUrl = !!value; } -process.stdout.write(hasAppUrl ? "1" : "0" ); +process.stdout.write(hasAppUrl ? "1" : "0"); diff --git a/test/end-to-end-tests/src/session.ts b/test/end-to-end-tests/src/session.ts index 84f9b66e56..cce2e657bd 100644 --- a/test/end-to-end-tests/src/session.ts +++ b/test/end-to-end-tests/src/session.ts @@ -114,7 +114,7 @@ export class ElementSession { }; } - public async printElements(label: string, elements: puppeteer.ElementHandle[] ): Promise { + public async printElements(label: string, elements: puppeteer.ElementHandle[]): Promise { console.log(label, await Promise.all(elements.map(this.getOuterHTML))); } diff --git a/test/stores/WidgetLayoutStore-test.ts b/test/stores/WidgetLayoutStore-test.ts index 038a489f72..bff3d97386 100644 --- a/test/stores/WidgetLayoutStore-test.ts +++ b/test/stores/WidgetLayoutStore-test.ts @@ -28,7 +28,7 @@ const mockRoom = { currentState: { getStateEvents: (_l, _x) => { return { - getId: ()=>"$layoutEventId", + getId: () => "$layoutEventId", getContent: () => null, }; }, diff --git a/yarn.lock b/yarn.lock index c4c6adce1b..8193c73830 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3692,6 +3692,14 @@ eslint-module-utils@^2.7.1: find-up "^2.1.0" pkg-dir "^2.0.0" +eslint-module-utils@^2.7.2: + version "2.7.2" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.2.tgz#1d0aa455dcf41052339b63cada8ab5fd57577129" + integrity sha512-zquepFnWCY2ISMFwD/DqzaM++H+7PDzOpUvotJWm/y1BAFt5R4oeULgdrTejKqLkz7MA/tgstsUMNYc7wNdTrg== + dependencies: + debug "^3.2.7" + find-up "^2.1.0" + eslint-plugin-import@^2.25.2: version "2.25.3" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz#a554b5f66e08fb4f6dc99221866e57cfff824766" @@ -3711,6 +3719,25 @@ eslint-plugin-import@^2.25.2: resolve "^1.20.0" tsconfig-paths "^3.11.0" +eslint-plugin-import@^2.25.4: + version "2.25.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz#322f3f916a4e9e991ac7af32032c25ce313209f1" + integrity sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA== + dependencies: + array-includes "^3.1.4" + array.prototype.flat "^1.2.5" + debug "^2.6.9" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.6" + eslint-module-utils "^2.7.2" + has "^1.0.3" + is-core-module "^2.8.0" + is-glob "^4.0.3" + minimatch "^3.0.4" + object.values "^1.1.5" + resolve "^1.20.0" + tsconfig-paths "^3.12.0" + eslint-plugin-jsx-a11y@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.5.1.tgz#cdbf2df901040ca140b6ec14715c988889c2a6d8" @@ -3729,9 +3756,10 @@ eslint-plugin-jsx-a11y@^6.5.1: language-tags "^1.0.5" minimatch "^3.0.4" -"eslint-plugin-matrix-org@github:matrix-org/eslint-plugin-matrix-org#2fc59ae12ff551e91c41a1b185be25c77ad02190": - version "0.3.5" - resolved "https://codeload.github.com/matrix-org/eslint-plugin-matrix-org/tar.gz/2fc59ae12ff551e91c41a1b185be25c77ad02190" +eslint-plugin-matrix-org@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-matrix-org/-/eslint-plugin-matrix-org-0.4.0.tgz#de2d2db1cd471d637728133ce9a2b921690e5cd1" + integrity sha512-yVkNwtc33qtrQB4PPzpU+PUdFzdkENPan3JF4zhtAQJRUYXyvKEXnYSrXLUWYRXoYFxs9LbyI2CnhJL/RnHJaQ== eslint-plugin-react-hooks@^4.2.0: version "4.3.0" @@ -8458,7 +8486,7 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== -tsconfig-paths@^3.11.0: +tsconfig-paths@^3.11.0, tsconfig-paths@^3.12.0: version "3.12.0" resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz#19769aca6ee8f6a1a341e38c8fa45dd9fb18899b" integrity sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==