Fix all hints discovered by the new linter
`npm run eslintfix`
Change-Id: Ic07aede1b95e7dd53bbd05c062e2afcef5508c10
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
index e5aefa3..90f0699 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.ts
@@ -400,8 +400,8 @@
// TODO(TS): The following condition seems always false, because params
// never has detailType property. Remove it.
if (
- ((params as unknown) as AdminSubsectionLink).detailType &&
- ((params as unknown) as AdminSubsectionLink).detailType !== detailType
+ (params as unknown as AdminSubsectionLink).detailType &&
+ (params as unknown as AdminSubsectionLink).detailType !== detailType
) {
return '';
}
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access-interfaces.ts b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access-interfaces.ts
index 869a416..08493c5 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access-interfaces.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access-interfaces.ts
@@ -72,7 +72,8 @@
extends PermissionRuleInfo,
PropertyTreeNode {}
-export type PermissionAccessSection = PermissionArrayItem<EditableAccessSectionInfo>;
+export type PermissionAccessSection =
+ PermissionArrayItem<EditableAccessSectionInfo>;
export interface NewlyAddedGroupInfo {
name: string;
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
index 411bb27..9c98545 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.ts
@@ -445,7 +445,7 @@
}
this._recursivelyUpdateAddRemoveObj(
- (this._local as unknown) as PropertyTreeNode,
+ this._local as unknown as PropertyTreeNode,
addRemoveObj
);
@@ -470,9 +470,11 @@
this.set(['_local', newRef], section);
flush();
// Template already instantiated at this point
- (this.root!.querySelector(
- 'gr-access-section:last-of-type'
- ) as GrAccessSection).editReference();
+ (
+ this.root!.querySelector(
+ 'gr-access-section:last-of-type'
+ ) as GrAccessSection
+ ).editReference();
}
_getObjforSave(): ProjectAccessInput | undefined {
@@ -486,10 +488,10 @@
fireAlert(this, NOTHING_TO_SAVE);
return;
}
- const obj: ProjectAccessInput = ({
+ const obj: ProjectAccessInput = {
add: addRemoveObj.add,
remove: addRemoveObj.remove,
- } as unknown) as ProjectAccessInput;
+ } as unknown as ProjectAccessInput;
if (addRemoveObj.parent) {
obj.parent = addRemoveObj.parent;
}
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.ts b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.ts
index 8511b90..e243974 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.ts
+++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.ts
@@ -261,7 +261,7 @@
}
_handleEditRevision(e: PolymerDomRepeatEvent<BranchInfo | TagInfo>) {
- this._revisedRef = (e.model.get('item.revision') as unknown) as GitRef;
+ this._revisedRef = e.model.get('item.revision') as unknown as GitRef;
this._isEditing = true;
}
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.ts
index f67b65a..84bc1e2 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-view/gr-change-list-view.ts
@@ -48,7 +48,8 @@
const USER_QUERY_PATTERN = /^owner:\s?("[^"]+"|[^ ]+)$/;
-const REPO_QUERY_PATTERN = /^project:\s?("[^"]+"|[^ ]+)(\sstatus\s?:(open|"open"))?$/;
+const REPO_QUERY_PATTERN =
+ /^project:\s?("[^"]+"|[^ ]+)(\sstatus\s?:(open|"open"))?$/;
const LIMIT_OPERATOR_PATTERN = /\blimit:(\d+)/i;
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
index 4277dac..133dfa0 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts
@@ -162,7 +162,7 @@
this.cursor.scrollMode = ScrollMode.KEEP_VISIBLE;
this.cursor.focusOnMove = true;
this.addEventListener('keydown', e =>
- this._scopedKeydownHandler((e as unknown) as CustomKeyboardEvent)
+ this._scopedKeydownHandler(e as unknown as CustomKeyboardEvent)
);
}
@@ -180,9 +180,8 @@
getPluginLoader()
.awaitPluginsLoaded()
.then(() => {
- this._dynamicHeaderEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-list-header'
- );
+ this._dynamicHeaderEndpoints =
+ getPluginEndpoints().getDynamicEndpoints('change-list-header');
});
}
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
index 6c30649..db5b64e 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
@@ -343,7 +343,8 @@
@customElement('gr-change-actions')
export class GrChangeActions
extends PolymerElement
- implements GrChangeActionsElement {
+ implements GrChangeActionsElement
+{
static get template() {
return htmlTemplate;
}
@@ -1610,7 +1611,7 @@
return this.restApiService.getResponseObject(response).then(obj => {
switch (action.__key) {
case ChangeActions.REVERT: {
- const revertChangeInfo: ChangeInfo = (obj as unknown) as ChangeInfo;
+ const revertChangeInfo: ChangeInfo = obj as unknown as ChangeInfo;
this._waitForChangeReachable(revertChangeInfo._number)
.then(() => this._setReviewOnRevert(revertChangeInfo._number))
.then(() => {
@@ -1619,7 +1620,7 @@
break;
}
case RevisionActions.CHERRYPICK: {
- const cherrypickChangeInfo: ChangeInfo = (obj as unknown) as ChangeInfo;
+ const cherrypickChangeInfo: ChangeInfo = obj as unknown as ChangeInfo;
this._waitForChangeReachable(cherrypickChangeInfo._number).then(
() => {
GerritNav.navigateToChange(cherrypickChangeInfo);
@@ -1641,7 +1642,7 @@
fireReload(this, true);
break;
case ChangeActions.REVERT_SUBMISSION: {
- const revertSubmistionInfo = (obj as unknown) as RevertSubmissionInfo;
+ const revertSubmistionInfo = obj as unknown as RevertSubmissionInfo;
if (
!revertSubmistionInfo.revert_changes ||
!revertSubmistionInfo.revert_changes.length
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
index e13b8b9..906300f 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
@@ -1679,9 +1679,8 @@
});
test('is first in list of secondary actions', () => {
- const approveButton = element.$.secondaryActions.querySelector(
- 'gr-button'
- );
+ const approveButton =
+ element.$.secondaryActions.querySelector('gr-button');
assert.equal(approveButton!.getAttribute('data-label'), 'foo+1');
});
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
index 62037ef..40e8685 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.ts
@@ -722,9 +722,9 @@
}
// Cannot use `this.$.ID` syntax because the element exists inside of a
// dom-if.
- (this.shadowRoot!.querySelector(
- '.topicEditableLabel'
- ) as GrEditableLabel).open();
+ (
+ this.shadowRoot!.querySelector('.topicEditableLabel') as GrEditableLabel
+ ).open();
}
_getReviewerSuggestionsProvider(change?: ParsedChangeInfo) {
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
index a70d03f..cb4c9a4 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata_test.ts
@@ -415,7 +415,8 @@
test('_getNonOwnerRole that it does not return committer', () => {
// Set the committer email to be the same as the owner.
- change!.revisions.rev1.commit!.committer.email = 'abc@def' as EmailAddress;
+ change!.revisions.rev1.commit!.committer.email =
+ 'abc@def' as EmailAddress;
assert.isNotOk(
element._getNonOwnerRole(change, element._CHANGE_ROLE.COMMITTER)
);
@@ -633,14 +634,12 @@
});
test('_showAddTopic', () => {
- const changeRecord: ElementPropertyDeepChange<
- GrChangeMetadata,
- 'change'
- > = {
- base: {...createParsedChange()},
- path: '',
- value: undefined,
- };
+ const changeRecord: ElementPropertyDeepChange<GrChangeMetadata, 'change'> =
+ {
+ base: {...createParsedChange()},
+ path: '',
+ value: undefined,
+ };
assert.isTrue(element._showAddTopic(undefined, false));
assert.isTrue(element._showAddTopic(changeRecord, false));
assert.isFalse(element._showAddTopic(changeRecord, true));
@@ -650,14 +649,12 @@
});
test('_showTopicChip', () => {
- const changeRecord: ElementPropertyDeepChange<
- GrChangeMetadata,
- 'change'
- > = {
- base: {...createParsedChange()},
- path: '',
- value: undefined,
- };
+ const changeRecord: ElementPropertyDeepChange<GrChangeMetadata, 'change'> =
+ {
+ base: {...createParsedChange()},
+ path: '',
+ value: undefined,
+ };
assert.isFalse(element._showTopicChip(undefined, false));
assert.isFalse(element._showTopicChip(changeRecord, false));
assert.isFalse(element._showTopicChip(changeRecord, true));
@@ -667,14 +664,12 @@
});
test('_showCherryPickOf', () => {
- const changeRecord: ElementPropertyDeepChange<
- GrChangeMetadata,
- 'change'
- > = {
- base: {...createParsedChange()},
- path: '',
- value: undefined,
- };
+ const changeRecord: ElementPropertyDeepChange<GrChangeMetadata, 'change'> =
+ {
+ base: {...createParsedChange()},
+ path: '',
+ value: undefined,
+ };
assert.isFalse(element._showCherryPickOf(undefined));
assert.isFalse(element._showCherryPickOf(changeRecord));
changeRecord.base!.cherry_pick_of_change = 123 as NumericChangeId;
@@ -697,7 +692,7 @@
test: {
all: [{_account_id: 1 as AccountId, name: 'bojack', value: 1}],
default_value: 0,
- values: ([] as unknown) as LabelValueToDescriptionMap,
+ values: [] as unknown as LabelValueToDescriptionMap,
},
},
removable_reviewers: [],
@@ -750,7 +745,7 @@
test: {
all: [{_account_id: 1 as AccountId, name: 'bojack', value: 1}],
default_value: 0,
- values: ([] as unknown) as LabelValueToDescriptionMap,
+ values: [] as unknown as LabelValueToDescriptionMap,
},
},
removable_reviewers: [],
@@ -807,7 +802,7 @@
test: {
all: [{_account_id: 1 as AccountId, name: 'bojack', value: 1}],
default_value: 0,
- values: ([] as unknown) as LabelValueToDescriptionMap,
+ values: [] as unknown as LabelValueToDescriptionMap,
},
},
removable_reviewers: [],
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index 6cda197..d2f4485 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -654,12 +654,10 @@
getPluginLoader()
.awaitPluginsLoaded()
.then(() => {
- this._dynamicTabHeaderEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-tab-header'
- );
- this._dynamicTabContentEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-tab-content'
- );
+ this._dynamicTabHeaderEndpoints =
+ getPluginEndpoints().getDynamicEndpoints('change-view-tab-header');
+ this._dynamicTabContentEndpoints =
+ getPluginEndpoints().getDynamicEndpoints('change-view-tab-content');
if (
this._dynamicTabContentEndpoints.length !==
this._dynamicTabHeaderEndpoints.length
@@ -811,9 +809,8 @@
* Changes active primary tab.
*/
_setActivePrimaryTab(e: SwitchTabEvent) {
- const primaryTabs = this.shadowRoot!.querySelector<PaperTabsElement>(
- '#primaryTabs'
- );
+ const primaryTabs =
+ this.shadowRoot!.querySelector<PaperTabsElement>('#primaryTabs');
const activeTabName = this._setActiveTab(
primaryTabs,
{
@@ -831,12 +828,10 @@
activeTabName
);
if (pluginIndex !== -1) {
- this._selectedTabPluginEndpoint = this._dynamicTabContentEndpoints[
- pluginIndex
- ];
- this._selectedTabPluginHeader = this._dynamicTabHeaderEndpoints[
- pluginIndex
- ];
+ this._selectedTabPluginEndpoint =
+ this._dynamicTabContentEndpoints[pluginIndex];
+ this._selectedTabPluginHeader =
+ this._dynamicTabHeaderEndpoints[pluginIndex];
} else {
this._selectedTabPluginEndpoint = '';
this._selectedTabPluginHeader = '';
@@ -1859,10 +1854,10 @@
// TODO(TS): code needs second thought,
// it might be that nulls were assigned to trigger some bindings
if (!change.topic) {
- change.topic = (null as unknown) as undefined;
+ change.topic = null as unknown as undefined;
}
if (!change.reviewer_updates) {
- change.reviewer_updates = (null as unknown) as undefined;
+ change.reviewer_updates = null as unknown as undefined;
}
const latestRevisionSha = this._getLatestRevisionSHA(change);
if (!latestRevisionSha)
@@ -2411,9 +2406,10 @@
_handleFileActionTap(e: CustomEvent<{path: string; action: string}>) {
e.preventDefault();
- const controls = this.$.fileListHeader.shadowRoot!.querySelector<GrEditControls>(
- '#editControls'
- );
+ const controls =
+ this.$.fileListHeader.shadowRoot!.querySelector<GrEditControls>(
+ '#editControls'
+ );
if (!controls) throw new Error('Missing edit controls');
assertIsDefined(this._change, '_change');
if (!this._patchRange)
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
index ba4a91a..5508ee0 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
@@ -1041,9 +1041,8 @@
const expectedStatuses = [ChangeStates.MERGED, ChangeStates.WIP];
assert.deepEqual(element._changeStatuses, expectedStatuses);
flush();
- const statusChips = element.shadowRoot!.querySelectorAll(
- 'gr-change-status'
- );
+ const statusChips =
+ element.shadowRoot!.querySelectorAll('gr-change-status');
assert.equal(statusChips.length, 2);
});
@@ -1459,7 +1458,8 @@
.stub(element, 'loadData')
.callsFake(() => Promise.resolve());
const collapseStub = sinon.stub(element.$.fileList, 'collapseAllDiffs');
- const value: AppElementChangeViewParams = createAppElementChangeViewParams();
+ const value: AppElementChangeViewParams =
+ createAppElementChangeViewParams();
element.params = value;
await flush();
assert.isTrue(reloadStub.calledOnce);
@@ -1474,7 +1474,8 @@
const recreateSpy = sinon.spy();
element.addEventListener('recreate-change-view', recreateSpy);
- const value: AppElementChangeViewParams = createAppElementChangeViewParams();
+ const value: AppElementChangeViewParams =
+ createAppElementChangeViewParams();
element.params = value;
await flush();
assert.isFalse(recreateSpy.calledOnce);
@@ -1873,10 +1874,10 @@
const div = document.createElement('div');
element.$.replyDialog.draft = '> quote text\n\n some draft text';
element.$.replyDialog.quote = '> quote text\n\n';
- const e = ({
+ const e = {
target: div,
preventDefault: sinon.spy(),
- } as unknown) as MouseEvent;
+ } as unknown as MouseEvent;
element._handleReplyTap(e);
assert.equal(
element.$.replyDialog.draft,
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
index 12952a2..550a7cc 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.ts
@@ -361,7 +361,7 @@
this.fileCursor.cursorTargetClass = 'selected';
this.fileCursor.focusOnMove = true;
this.addEventListener('keydown', e =>
- this._scopedKeydownHandler((e as unknown) as CustomKeyboardEvent)
+ this._scopedKeydownHandler(e as unknown as CustomKeyboardEvent)
);
}
@@ -379,18 +379,22 @@
this._dynamicHeaderEndpoints = getPluginEndpoints().getDynamicEndpoints(
'change-view-file-list-header'
);
- this._dynamicContentEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-file-list-content'
- );
- this._dynamicPrependedHeaderEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-file-list-header-prepend'
- );
- this._dynamicPrependedContentEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-file-list-content-prepend'
- );
- this._dynamicSummaryEndpoints = getPluginEndpoints().getDynamicEndpoints(
- 'change-view-file-list-summary'
- );
+ this._dynamicContentEndpoints =
+ getPluginEndpoints().getDynamicEndpoints(
+ 'change-view-file-list-content'
+ );
+ this._dynamicPrependedHeaderEndpoints =
+ getPluginEndpoints().getDynamicEndpoints(
+ 'change-view-file-list-header-prepend'
+ );
+ this._dynamicPrependedContentEndpoints =
+ getPluginEndpoints().getDynamicEndpoints(
+ 'change-view-file-list-content-prepend'
+ );
+ this._dynamicSummaryEndpoints =
+ getPluginEndpoints().getDynamicEndpoints(
+ 'change-view-file-list-summary'
+ );
if (
this._dynamicHeaderEndpoints.length !==
@@ -435,7 +439,7 @@
// TODO(TS): e is not an instance of CustomKeyboardEvent.
// However, to fix it we should fix keyboard-shortcut-mixin first
// The keyboard-shortcut-mixin will be updated in a separate change
- this._handleOpenFile((e as unknown) as CustomKeyboardEvent);
+ this._handleOpenFile(e as unknown as CustomKeyboardEvent);
}
}
diff --git a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
index b4fa4a8..02416ff 100644
--- a/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
+++ b/polygerrit-ui/app/elements/change/gr-label-score-row/gr-label-score-row.ts
@@ -133,9 +133,10 @@
if (side === 'start') {
return new Array(startPosition);
}
- const endPosition = this.labelValues[
- Number(permittedLabels[label][permittedLabels[label].length - 1])
- ];
+ const endPosition =
+ this.labelValues[
+ Number(permittedLabels[label][permittedLabels[label].length - 1])
+ ];
return new Array(Object.keys(this.labelValues).length - endPosition - 1);
}
diff --git a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
index d3ea97a..cae7a5a 100644
--- a/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-message/gr-message_test.ts
@@ -610,7 +610,8 @@
comments: [
{
...createComment(),
- change_message_id: '6a07f64a82f96e7337ca5f7f84cfc73abf8ac2a3' as ChangeMessageId,
+ change_message_id:
+ '6a07f64a82f96e7337ca5f7f84cfc73abf8ac2a3' as ChangeMessageId,
patch_set: 1 as PatchSetNum,
id: 'e365b138_bed65caa' as UrlEncodedCommentId,
updated: '2020-05-15 13:35:56.000000000' as Timestamp,
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
index 360d7de..a68796c 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
@@ -177,8 +177,8 @@
html`<div
class="${classMap({
['relatedChangeLine']: true,
- ['show-when-collapsed']: relatedChangesMarkersPredicate(index)
- .showWhenCollapsed,
+ ['show-when-collapsed']:
+ relatedChangesMarkersPredicate(index).showWhenCollapsed,
})}"
>
${this.renderMarkers(
@@ -232,9 +232,8 @@
html`<div
class="${classMap({
['relatedChangeLine']: true,
- ['show-when-collapsed']: submittedTogetherMarkersPredicate(
- index
- ).showWhenCollapsed,
+ ['show-when-collapsed']:
+ submittedTogetherMarkersPredicate(index).showWhenCollapsed,
})}"
>
${this.renderMarkers(
@@ -280,8 +279,8 @@
html`<div
class="${classMap({
['relatedChangeLine']: true,
- ['show-when-collapsed']: sameTopicMarkersPredicate(index)
- .showWhenCollapsed,
+ ['show-when-collapsed']:
+ sameTopicMarkersPredicate(index).showWhenCollapsed,
})}"
>
${this.renderMarkers(
@@ -323,8 +322,8 @@
html`<div
class="${classMap({
['relatedChangeLine']: true,
- ['show-when-collapsed']: mergeConflictsMarkersPredicate(index)
- .showWhenCollapsed,
+ ['show-when-collapsed']:
+ mergeConflictsMarkersPredicate(index).showWhenCollapsed,
})}"
>
${this.renderMarkers(
@@ -365,8 +364,8 @@
html`<div
class="${classMap({
['relatedChangeLine']: true,
- ['show-when-collapsed']: cherryPicksMarkersPredicate(index)
- .showWhenCollapsed,
+ ['show-when-collapsed']:
+ cherryPicksMarkersPredicate(index).showWhenCollapsed,
})}"
>
${this.renderMarkers(
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
index d0849bf..0d2f68d 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog.ts
@@ -374,16 +374,17 @@
constructor() {
super();
- this.filterReviewerSuggestion = this._filterReviewerSuggestionGenerator(
- false
- );
+ this.filterReviewerSuggestion =
+ this._filterReviewerSuggestionGenerator(false);
this.filterCCSuggestion = this._filterReviewerSuggestionGenerator(true);
}
/** @override */
connectedCallback() {
super.connectedCallback();
- ((IronA11yAnnouncer as unknown) as FixIronA11yAnnouncer).requestAvailability();
+ (
+ IronA11yAnnouncer as unknown as FixIronA11yAnnouncer
+ ).requestAvailability();
this._getAccount().then(account => {
if (account) this._account = account;
});
diff --git a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
index ddad092..d70c7ba 100644
--- a/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-reply-dialog/gr-reply-dialog_test.ts
@@ -102,10 +102,11 @@
let setDraftCommentStub: sinon.SinonStub;
let eraseDraftCommentStub: sinon.SinonStub;
- const emptyAccountInfoInputChanges = ([] as unknown) as PolymerDeepPropertyChange<
- AccountInfoInput[],
- AccountInfoInput[]
- >;
+ const emptyAccountInfoInputChanges =
+ [] as unknown as PolymerDeepPropertyChange<
+ AccountInfoInput[],
+ AccountInfoInput[]
+ >;
let lastId = 1;
const makeAccount = function () {
@@ -129,7 +130,7 @@
...createChange(),
_number: changeNum,
owner: {
- _account_id: (999 as AccountId) as AccountId,
+ _account_id: 999 as AccountId as AccountId,
display_name: 'Kermit',
},
labels: {
@@ -1067,10 +1068,9 @@
const value = '+1';
element.setLabelValue(label, value);
- const labels = (queryAndAssert(
- element,
- '#labelScores'
- ) as GrLabelScores).getLabelValues();
+ const labels = (
+ queryAndAssert(element, '#labelScores') as GrLabelScores
+ ).getLabelValues();
assert.deepEqual(labels, {
'Code-Review': 0,
Verified: 1,
@@ -1173,10 +1173,9 @@
observer = overlayObserver('closed');
const expected = 'Group name has 10 members';
assert.notEqual(
- (queryAndAssert(
- element,
- 'reviewerConfirmationOverlay'
- ) as GrOverlay).innerText.indexOf(expected),
+ (
+ queryAndAssert(element, 'reviewerConfirmationOverlay') as GrOverlay
+ ).innerText.indexOf(expected),
-1
);
tap(noButton); // close the overlay
diff --git a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
index d1c401b..f250b76 100644
--- a/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
+++ b/polygerrit-ui/app/elements/core/gr-error-manager/gr-error-manager.ts
@@ -171,7 +171,9 @@
}
);
- ((IronA11yAnnouncer as unknown) as FixIronA11yAnnouncer).requestAvailability();
+ (
+ IronA11yAnnouncer as unknown as FixIronA11yAnnouncer
+ ).requestAvailability();
}
/** @override */
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
index ad1b02d..ac4ac64 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.ts
@@ -216,7 +216,8 @@
// Matches diff routes using @\d+ to specify a file name (whether or not
// the project name is included).
// eslint-disable-next-line max-len
- DIFF_LEGACY_LINENUM: /^\/c\/((.+)\/\+\/)?(\d+)(\/?((-?\d+|edit)(\.\.(\d+|edit))?\/(.+))?)@[ab]?\d+$/,
+ DIFF_LEGACY_LINENUM:
+ /^\/c\/((.+)\/\+\/)?(\d+)(\/?((-?\d+|edit)(\.\.(\d+|edit))?\/(.+))?)@[ab]?\d+$/,
SETTINGS: /^\/settings\/?/,
SETTINGS_LEGACY: /^\/settings\/VE\/(\S+)/,
@@ -1752,7 +1753,7 @@
_handleNewAgreementsRoute(data: PageContextWithQueryMap) {
data.params['view'] = GerritView.AGREEMENTS;
// TODO(TS): create valid object
- this._setParams((data.params as unknown) as AppElementAgreementParam);
+ this._setParams(data.params as unknown as AppElementAgreementParam);
}
_handleSettingsLegacyRoute(data: PageContextWithQueryMap) {
diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
index 71d378e..3b22d1d 100644
--- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
+++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.ts
@@ -241,7 +241,8 @@
...createServerInfo(),
change: {
...createChangeConfig(),
- mergeability_computation_behavior: mergeability as MergeabilityComputationBehavior,
+ mergeability_computation_behavior:
+ mergeability as MergeabilityComputationBehavior,
},
})
);
diff --git a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
index 315fbfb..b99a17b 100644
--- a/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
+++ b/polygerrit-ui/app/elements/diff/gr-comment-api/gr-comment-api.ts
@@ -552,8 +552,9 @@
)
);
}
- const commentThreadCount = threads.filter(thread => !isDraftThread(thread))
- .length;
+ const commentThreadCount = threads.filter(
+ thread => !isDraftThread(thread)
+ ).length;
const unresolvedCount = threads.reduce((cnt, thread) => {
if (isUnresolved(thread)) cnt += 1;
return cnt;
@@ -627,10 +628,8 @@
this.restApiService.getPortedDrafts(changeNum, patchNum),
]).then(res => {
if (!this._changeComments) return;
- this._changeComments = this._changeComments.cloneWithUpdatedPortedComments(
- res[0],
- res[1]
- );
+ this._changeComments =
+ this._changeComments.cloneWithUpdatedPortedComments(res[0], res[1]);
});
}
}
diff --git a/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls.ts b/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls.ts
index 86a60ce..4b32f5e 100644
--- a/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls.ts
+++ b/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls.ts
@@ -515,11 +515,13 @@
private contextRange() {
return {
leftStart: this.contextGroups[0].lineRange.left.start_line,
- leftEnd: this.contextGroups[this.contextGroups.length - 1].lineRange.left
- .end_line,
+ leftEnd:
+ this.contextGroups[this.contextGroups.length - 1].lineRange.left
+ .end_line,
rightStart: this.contextGroups[0].lineRange.right.start_line,
- rightEnd: this.contextGroups[this.contextGroups.length - 1].lineRange
- .right.end_line,
+ rightEnd:
+ this.contextGroups[this.contextGroups.length - 1].lineRange.right
+ .end_line,
};
}
diff --git a/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls_test.ts b/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls_test.ts
index a1fc6d8..cacea42 100644
--- a/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls_test.ts
+++ b/polygerrit-ui/app/elements/diff/gr-context-controls/gr-context-controls_test.ts
@@ -32,7 +32,7 @@
setup(async () => {
element = document.createElement('gr-context-controls');
- element.diff = ({content: []} as any) as DiffInfo;
+ element.diff = {content: []} as any as DiffInfo;
element.renderPreferences = {};
element.section = document.createElement('div');
blankFixture.instantiate().appendChild(element);
@@ -124,9 +124,9 @@
function prepareForBlockExpansion(syntaxTree: SyntaxBlock[]) {
element.renderPreferences!.use_block_expansion = true;
- element.diff!.meta_b = ({
+ element.diff!.meta_b = {
syntax_tree: syntaxTree,
- } as any) as DiffFileMetaInfo;
+ } as any as DiffFileMetaInfo;
}
test('context control with block expansion at the top', async () => {
@@ -360,12 +360,10 @@
const blockExpansionButtons = element.shadowRoot!.querySelectorAll(
'.blockExpansion paper-button'
);
- const tooltipAbove = blockExpansionButtons[0].querySelector(
- 'paper-tooltip'
- )!;
- const tooltipBelow = blockExpansionButtons[1].querySelector(
- 'paper-tooltip'
- )!;
+ const tooltipAbove =
+ blockExpansionButtons[0].querySelector('paper-tooltip')!;
+ const tooltipBelow =
+ blockExpansionButtons[1].querySelector('paper-tooltip')!;
assert.equal(
tooltipAbove.querySelector('.breadcrumbTooltip')!.textContent?.trim(),
'20 common lines'
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.ts
index 1243e8f..b42e90a 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder-image.ts
@@ -96,8 +96,8 @@
imageViewer.baseUrl = this._getImageSrc(this._baseImage);
imageViewer.revisionUrl = this._getImageSrc(this._revisionImage);
- imageViewer.automaticBlink = !!this._renderPrefs?.image_diff_prefs
- ?.automatic_blink;
+ imageViewer.automaticBlink =
+ !!this._renderPrefs?.image_diff_prefs?.automatic_blink;
td.appendChild(imageViewer);
tr.appendChild(td);
@@ -222,8 +222,8 @@
'gr-image-viewer'
) as GrImageViewer;
if (this._useNewImageDiffUi && imageViewer) {
- imageViewer.automaticBlink = !!renderPrefs?.image_diff_prefs
- ?.automatic_blink;
+ imageViewer.automaticBlink =
+ !!renderPrefs?.image_diff_prefs?.automatic_blink;
}
}
}
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
index 864fd79..987f808 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
@@ -760,11 +760,8 @@
_buildMoveControls(group: GrDiffGroup) {
const movedIn = group.adds.length > 0;
- const {
- numberOfCells,
- movedOutIndex,
- movedInIndex,
- } = this._getMoveControlsConfig();
+ const {numberOfCells, movedOutIndex, movedInIndex} =
+ this._getMoveControlsConfig();
let controlsClass;
let descriptionIndex;
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts
index 18696f2..8a87791 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/token-highlight-layer.ts
@@ -191,9 +191,7 @@
this.notifyForToken(newHighlight, newLineNumber ?? 0);
}
- findTokenAncestor(
- el?: EventTarget | Element | null
- ): {
+ findTokenAncestor(el?: EventTarget | Element | null): {
token?: string;
line: number;
} {
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-mode-selector/gr-diff-mode-selector.ts b/polygerrit-ui/app/elements/diff/gr-diff-mode-selector/gr-diff-mode-selector.ts
index 6fe9d27..4eb33c7 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-mode-selector/gr-diff-mode-selector.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-mode-selector/gr-diff-mode-selector.ts
@@ -51,7 +51,9 @@
/** @override */
connectedCallback() {
super.connectedCallback();
- ((IronA11yAnnouncer as unknown) as FixIronA11yAnnouncer).requestAvailability();
+ (
+ IronA11yAnnouncer as unknown as FixIronA11yAnnouncer
+ ).requestAvailability();
}
/**
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
index 90ffa4d..61718ba 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts
@@ -884,9 +884,9 @@
);
this._setLoading(false);
this._unobserveIncrementalNodes();
- this._incrementalNodeObserver = (dom(
- this
- ) as PolymerDomWrapper).observeNodes(info => {
+ this._incrementalNodeObserver = (
+ dom(this) as PolymerDomWrapper
+ ).observeNodes(info => {
const addedThreadEls = info.addedNodes.filter(isThreadEl);
// Removed nodes do not need to be handled because all this code does is
// adding a slot for the added thread elements, and the extra slots do
diff --git a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
index a0b5392..18e6e75 100644
--- a/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
+++ b/polygerrit-ui/app/elements/edit/gr-edit-controls/gr-edit-controls_test.ts
@@ -64,9 +64,8 @@
setup(() => {
editDiffStub = sinon.stub(GerritNav, 'getEditUrlForDiff');
navStub = sinon.stub(GerritNav, 'navigateToRelativeUrl');
- openAutoComplete = element.$.openDialog!.querySelector(
- 'gr-autocomplete'
- )!;
+ openAutoComplete =
+ element.$.openDialog!.querySelector('gr-autocomplete')!;
});
test('_isValidPath', () => {
@@ -130,9 +129,8 @@
setup(() => {
navStub = sinon.stub(GerritNav, 'navigateToChange');
deleteStub = stubRestApi('deleteFileInChangeEdit');
- deleteAutocomplete = element.$.deleteDialog!.querySelector(
- 'gr-autocomplete'
- )!;
+ deleteAutocomplete =
+ element.$.deleteDialog!.querySelector('gr-autocomplete')!;
});
test('delete', () => {
@@ -215,9 +213,8 @@
setup(() => {
navStub = sinon.stub(GerritNav, 'navigateToChange');
renameStub = stubRestApi('renameFileInChangeEdit');
- renameAutocomplete = element.$.renameDialog!.querySelector(
- 'gr-autocomplete'
- )!;
+ renameAutocomplete =
+ element.$.renameDialog!.querySelector('gr-autocomplete')!;
});
test('rename', () => {
diff --git a/polygerrit-ui/app/elements/gr-app-element.ts b/polygerrit-ui/app/elements/gr-app-element.ts
index ebd143c..38c80fc 100644
--- a/polygerrit-ui/app/elements/gr-app-element.ts
+++ b/polygerrit-ui/app/elements/gr-app-element.ts
@@ -673,9 +673,9 @@
}
_handleKeyboardShortcutDialogClose() {
- (this.shadowRoot!.querySelector(
- '#keyboardShortcuts'
- ) as GrOverlay).cancel();
+ (
+ this.shadowRoot!.querySelector('#keyboardShortcuts') as GrOverlay
+ ).cancel();
}
onOverlayCanceled() {
@@ -686,9 +686,9 @@
_handleAccountDetailUpdate() {
this.$.mainHeader.reload();
if (this.params?.view === GerritView.SETTINGS) {
- (this.shadowRoot!.querySelector(
- 'gr-settings-view'
- ) as GrSettingsView).reloadAccountDetail();
+ (
+ this.shadowRoot!.querySelector('gr-settings-view') as GrSettingsView
+ ).reloadAccountDetail();
}
}
@@ -696,9 +696,9 @@
// The registration dialog is visible only if this.params is
// instanceof AppElementJustRegisteredParams
(this.params as AppElementJustRegisteredParams).justRegistered = false;
- (this.shadowRoot!.querySelector(
- '#registrationOverlay'
- ) as GrOverlay).close();
+ (
+ this.shadowRoot!.querySelector('#registrationOverlay') as GrOverlay
+ ).close();
}
_goToOpenedChanges() {
diff --git a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
index 3613f4c..6b8c4f0 100644
--- a/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-dom-hooks/gr-dom-hooks.ts
@@ -47,12 +47,12 @@
): HookApi<T> {
const hookName = this._getHookName(endpointName, moduleName);
if (!this.hooks[hookName]) {
- this.hooks[hookName] = (new GrDomHook<T>(
+ this.hooks[hookName] = new GrDomHook<T>(
hookName,
moduleName
- ) as unknown) as GrDomHook<PluginElement>;
+ ) as unknown as GrDomHook<PluginElement>;
}
- return (this.hooks[hookName] as unknown) as GrDomHook<T>;
+ return this.hooks[hookName] as unknown as GrDomHook<T>;
}
}
diff --git a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
index 13d18b5..8ed6611 100644
--- a/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
+++ b/polygerrit-ui/app/elements/plugins/gr-popup-interface/gr-popup-interface.ts
@@ -48,7 +48,7 @@
_getElement() {
// TODO(TS): maybe consider removing this if no one is using
// anything other than native methods on the return
- return (dom(this.popup) as unknown) as HTMLElement;
+ return dom(this.popup) as unknown as HTMLElement;
}
/**
diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
index 8b8a923..6c942b0 100644
--- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
+++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
@@ -65,9 +65,13 @@
*/
_getDisplayedColumns() {
if (this.root === null) return [];
- return (Array.from(
- this.root.querySelectorAll('.checkboxContainer input:not([name=number])')
- ) as HTMLInputElement[])
+ return (
+ Array.from(
+ this.root.querySelectorAll(
+ '.checkboxContainer input:not([name=number])'
+ )
+ ) as HTMLInputElement[]
+ )
.filter(checkbox => checkbox.checked)
.map(checkbox => checkbox.name);
}
@@ -90,8 +94,9 @@
* accordingly.
*/
_handleNumberCheckboxClick(e: MouseEvent) {
- this.showNumber = ((dom(e) as EventApi)
- .rootTarget as HTMLInputElement).checked;
+ this.showNumber = (
+ (dom(e) as EventApi).rootTarget as HTMLInputElement
+ ).checked;
}
/**
diff --git a/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts b/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
index 2f50c78..19aeccb 100644
--- a/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
+++ b/polygerrit-ui/app/elements/settings/gr-settings-view/gr-settings-view_test.ts
@@ -168,14 +168,18 @@
// Rendered with the expected preferences selected.
assert.equal(
Number(
- (valueOf('Changes per page', 'preferences')!
- .firstElementChild as GrSelect).bindValue
+ (
+ valueOf('Changes per page', 'preferences')!
+ .firstElementChild as GrSelect
+ ).bindValue
),
preferences.changes_per_page
);
assert.equal(
- (valueOf('Date/time format', 'preferences')!
- .firstElementChild as GrSelect).bindValue,
+ (
+ valueOf('Date/time format', 'preferences')!
+ .firstElementChild as GrSelect
+ ).bindValue,
preferences.date_format
);
assert.equal(
@@ -184,8 +188,10 @@
preferences.time_format
);
assert.equal(
- (valueOf('Email notifications', 'preferences')!
- .firstElementChild as GrSelect).bindValue,
+ (
+ valueOf('Email notifications', 'preferences')!
+ .firstElementChild as GrSelect
+ ).bindValue,
preferences.email_strategy
);
assert.equal(
@@ -194,13 +200,17 @@
preferences.email_format
);
assert.equal(
- (valueOf('Default Base For Merges', 'preferences')!
- .firstElementChild as GrSelect).bindValue,
+ (
+ valueOf('Default Base For Merges', 'preferences')!
+ .firstElementChild as GrSelect
+ ).bindValue,
preferences.default_base_for_merges
);
assert.equal(
- (valueOf('Show Relative Dates In Changes Table', 'preferences')!
- .firstElementChild as HTMLInputElement).checked,
+ (
+ valueOf('Show Relative Dates In Changes Table', 'preferences')!
+ .firstElementChild as HTMLInputElement
+ ).checked,
false
);
assert.equal(
@@ -209,27 +219,35 @@
preferences.diff_view
);
assert.equal(
- (valueOf('Show size bars in file list', 'preferences')!
- .firstElementChild as HTMLInputElement).checked,
+ (
+ valueOf('Show size bars in file list', 'preferences')!
+ .firstElementChild as HTMLInputElement
+ ).checked,
true
);
assert.equal(
- (valueOf('Publish comments on push', 'preferences')!
- .firstElementChild as HTMLInputElement).checked,
+ (
+ valueOf('Publish comments on push', 'preferences')!
+ .firstElementChild as HTMLInputElement
+ ).checked,
false
);
assert.equal(
- (valueOf(
- 'Set new changes to "work in progress" by default',
- 'preferences'
- )!.firstElementChild as HTMLInputElement).checked,
+ (
+ valueOf(
+ 'Set new changes to "work in progress" by default',
+ 'preferences'
+ )!.firstElementChild as HTMLInputElement
+ ).checked,
false
);
assert.equal(
- (valueOf(
- 'Insert Signed-off-by Footer For Inline Edit Changes',
- 'preferences'
- )!.firstElementChild as HTMLInputElement).checked,
+ (
+ valueOf(
+ 'Insert Signed-off-by Footer For Inline Edit Changes',
+ 'preferences'
+ )!.firstElementChild as HTMLInputElement
+ ).checked,
false
);
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.ts b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.ts
index 9f6afe6..ba3c26d 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.ts
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete.ts
@@ -61,7 +61,8 @@
value: string;
}
-export type AutocompleteCommitEvent = CustomEvent<AutocompleteCommitEventDetail>;
+export type AutocompleteCommitEvent =
+ CustomEvent<AutocompleteCommitEventDetail>;
@customElement('gr-autocomplete')
export class GrAutocomplete extends KeyboardShortcutMixin(PolymerElement) {
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
index 6fe5e15..7da7ed5 100644
--- a/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-autocomplete/gr-autocomplete_test.ts
@@ -372,8 +372,10 @@
test('_focused flag properly triggered', () => {
flush();
assert.isFalse(element._focused);
- const input = queryAndAssert<PaperInputElement>(element, 'paper-input')
- .inputElement;
+ const input = queryAndAssert<PaperInputElement>(
+ element,
+ 'paper-input'
+ ).inputElement;
MockInteractions.focus(input);
assert.isTrue(element._focused);
});
diff --git a/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts b/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts
index a25a3dc..76938e9 100644
--- a/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts
+++ b/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts
@@ -88,10 +88,10 @@
this._initialTabindex = this.getAttribute('tabindex') || '0';
// TODO(TS): try avoid using unknown
this.addEventListener('click', e =>
- this._handleAction((e as unknown) as PolymerEvent)
+ this._handleAction(e as unknown as PolymerEvent)
);
this.addEventListener('keydown', e =>
- this._handleKeydown((e as unknown) as CustomKeyboardEvent)
+ this._handleKeydown(e as unknown as CustomKeyboardEvent)
);
}
diff --git a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
index b55be89..0bf122a 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment-thread/gr-comment-thread_test.ts
@@ -318,7 +318,7 @@
setup(() => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
stubRestApi('saveDiffDraft').returns(
- Promise.resolve(({
+ Promise.resolve({
headers: {} as Headers,
redirected: false,
status: 200,
@@ -339,10 +339,10 @@
})
);
},
- } as unknown) as Response)
+ } as unknown as Response)
);
stubRestApi('deleteDiffDraft').returns(
- Promise.resolve(({ok: true} as unknown) as Response)
+ Promise.resolve({ok: true} as unknown as Response)
);
element = withCommentFixture.instantiate();
element.patchNum = 1 as PatchSetNum;
@@ -351,7 +351,7 @@
{
author: {
name: 'Mr. Peanutbutter',
- email: ('tenn1sballchaser@aol.com' as EmailAddress) as EmailAddress,
+ email: 'tenn1sballchaser@aol.com' as EmailAddress as EmailAddress,
},
id: 'baf0414d_60047215' as UrlEncodedCommentId,
line: 5,
@@ -379,7 +379,7 @@
assert.notOk(drafts[0].message, 'message should be empty');
assert.equal(
drafts[0].in_reply_to,
- ('baf0414d_60047215' as UrlEncodedCommentId) as UrlEncodedCommentId
+ 'baf0414d_60047215' as UrlEncodedCommentId as UrlEncodedCommentId
);
assert.isTrue(reportStub.calledOnce);
});
@@ -398,7 +398,7 @@
assert.equal(drafts[0].message, '> is this a crossover episode!?\n\n');
assert.equal(
drafts[0].in_reply_to,
- ('baf0414d_60047215' as UrlEncodedCommentId) as UrlEncodedCommentId
+ 'baf0414d_60047215' as UrlEncodedCommentId as UrlEncodedCommentId
);
assert.isTrue(reportStub.calledOnce);
});
@@ -409,7 +409,7 @@
{
author: {
name: 'Mr. Peanutbutter',
- email: ('tenn1sballchaser@aol.com' as EmailAddress) as EmailAddress,
+ email: 'tenn1sballchaser@aol.com' as EmailAddress as EmailAddress,
},
id: 'baf0414d_60047215' as UrlEncodedCommentId,
path: 'test',
@@ -832,7 +832,7 @@
setup(() => {
stubRestApi('getLoggedIn').returns(Promise.resolve(false));
stubRestApi('saveDiffDraft').returns(
- Promise.resolve(({
+ Promise.resolve({
ok: true,
text() {
return Promise.resolve(
@@ -847,10 +847,10 @@
})
);
},
- } as unknown) as Response)
+ } as unknown as Response)
);
stubRestApi('deleteDiffDraft').returns(
- Promise.resolve(({ok: true} as unknown) as Response)
+ Promise.resolve({ok: true} as unknown as Response)
);
element = withCommentFixture.instantiate();
element.patchNum = 1 as PatchSetNum;
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
index 6518154..97f36de 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -346,7 +346,8 @@
if (!editing) return;
// visibility based on cache this will make sure we only and always show
// a tip once every Math.max(a day, period between creating comments)
- const cachedVisibilityOfRespectfulTip = this.storage.getRespectfulTipVisibility();
+ const cachedVisibilityOfRespectfulTip =
+ this.storage.getRespectfulTipVisibility();
if (!cachedVisibilityOfRespectfulTip) {
// we still want to show the tip with a probability of 30%
if (this.getRandomNum(0, 3) >= 1) return;
@@ -484,7 +485,7 @@
this._eraseDraftCommentFromStorage();
return this.restApiService.getResponseObject(response).then(obj => {
- const resComment = (obj as unknown) as UIDraft;
+ const resComment = obj as unknown as UIDraft;
if (!isDraft(this.comment)) throw new Error('Can only save drafts.');
resComment.__draft = true;
// Maintain the ephemeral draft ID for identification by other
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
index 91fe673..cb09125 100644
--- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment_test.ts
@@ -386,7 +386,7 @@
test('update', () => {
element.comment = {
...createComment(),
- id: ('abc_123' as UrlEncodedCommentId) as UrlEncodedCommentId,
+ id: 'abc_123' as UrlEncodedCommentId as UrlEncodedCommentId,
};
sinon.stub(element, '_discardDraft').returns(Promise.resolve({}));
return element._handleSave(mockEvent)!.then(() => {
@@ -399,7 +399,7 @@
test('discard', () => {
element.comment = {
...createComment(),
- id: ('abc_123' as UrlEncodedCommentId) as UrlEncodedCommentId,
+ id: 'abc_123' as UrlEncodedCommentId as UrlEncodedCommentId,
};
element.comment = createDraft();
sinon.stub(element, '_fireDiscard');
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
index 9a56f2a..466e8e4 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-actions-js-api.ts
@@ -94,9 +94,9 @@
if (!this.el) {
const sharedApiElement = appContext.jsApiService;
this.setEl(
- (sharedApiElement.getElement(
+ sharedApiElement.getElement(
TargetElement.CHANGE_ACTIONS
- ) as unknown) as GrChangeActionsElement
+ ) as unknown as GrChangeActionsElement
);
}
return this.el!;
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.ts
index b8f5aff..3eff401 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-change-reply-js-api.ts
@@ -42,9 +42,9 @@
}
get _el(): GrReplyDialog {
- return (this.sharedApiElement.getElement(
+ return this.sharedApiElement.getElement(
TargetElement.REPLY_DIALOG
- ) as unknown) as GrReplyDialog;
+ ) as unknown as GrReplyDialog;
}
getLabelValue(label: string): string {
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts
index 95d2e7f..4bb5fd4 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-js-api-interface-element.ts
@@ -250,7 +250,7 @@
getDiffLayers(path: string) {
const layers: DiffLayer[] = [];
for (const cb of this._getEventCallbacks(EventType.ANNOTATE_DIFF)) {
- const annotationApi = (cb as unknown) as GrAnnotationActionsInterface;
+ const annotationApi = cb as unknown as GrAnnotationActionsInterface;
try {
const layer = annotationApi.createLayer(path);
if (layer) layers.push(layer);
@@ -264,7 +264,7 @@
disposeDiffLayers(path: string) {
for (const cb of this._getEventCallbacks(EventType.ANNOTATE_DIFF)) {
try {
- const annotationApi = (cb as unknown) as GrAnnotationActionsInterface;
+ const annotationApi = cb as unknown as GrAnnotationActionsInterface;
annotationApi.disposeLayer(path);
} catch (err) {
this.reporting.error(err);
@@ -285,7 +285,7 @@
.then(() => {
const providers: GrAnnotationActionsInterface[] = [];
this._getEventCallbacks(EventType.ANNOTATE_DIFF).forEach(cb => {
- const annotationApi = (cb as unknown) as GrAnnotationActionsInterface;
+ const annotationApi = cb as unknown as GrAnnotationActionsInterface;
const provider = annotationApi.getCoverageProvider();
if (provider) providers.push(annotationApi);
});
@@ -296,7 +296,7 @@
getAdminMenuLinks(): MenuLink[] {
const links: MenuLink[] = [];
for (const cb of this._getEventCallbacks(EventType.ADMIN_MENU_LINKS)) {
- const adminApi = (cb as unknown) as GrAdminApi;
+ const adminApi = cb as unknown as GrAdminApi;
links.push(...adminApi.getMenuLinks());
}
return links;
diff --git a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
index 7d3911a..18737a9 100644
--- a/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
+++ b/polygerrit-ui/app/elements/shared/gr-js-api-interface/gr-public-js-api.ts
@@ -222,9 +222,9 @@
changeActions(): ChangeActionsPluginApi {
return new GrChangeActionsInterface(
this,
- (this.jsApi.getElement(
+ this.jsApi.getElement(
TargetElement.CHANGE_ACTIONS
- ) as unknown) as GrChangeActions
+ ) as unknown as GrChangeActions
);
}
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
index ee9163b..ae2bda0 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.ts
@@ -278,7 +278,8 @@
@customElement('gr-rest-api-interface')
export class GrRestApiInterface
extends PolymerElement
- implements RestApiService {
+ implements RestApiService
+{
readonly _cache = siteBasedCache; // Shared across instances.
readonly _sharedFetchPromises = fetchPromisesCache; // Shared across instances.
@@ -512,10 +513,10 @@
getGroupMembers(groupName: GroupId | GroupName): Promise<AccountInfo[]> {
const encodeName = encodeURIComponent(groupName);
- return (this._restApiHelper.fetchJSON({
+ return this._restApiHelper.fetchJSON({
url: `/groups/${encodeName}/members/`,
anonymizedUrl: '/groups/*/members',
- }) as unknown) as Promise<AccountInfo[]>;
+ }) as unknown as Promise<AccountInfo[]>;
}
getIncludedGroup(
@@ -593,12 +594,12 @@
): Promise<AccountInfo> {
const encodeName = encodeURIComponent(groupName);
const encodeMember = encodeURIComponent(`${groupMember}`);
- return (this._restApiHelper.send({
+ return this._restApiHelper.send({
method: HttpMethod.PUT,
url: `/groups/${encodeName}/members/${encodeMember}`,
parseResponse: true,
anonymizedUrl: '/groups/*/members/*',
- }) as unknown) as Promise<AccountInfo>;
+ }) as unknown as Promise<AccountInfo>;
}
saveIncludedGroup(
@@ -616,9 +617,9 @@
};
return this._restApiHelper.send(req).then(response => {
if (response?.ok) {
- return (this.getResponseObject(
+ return this.getResponseObject(
response
- ) as unknown) as Promise<GroupInfo>;
+ ) as unknown as Promise<GroupInfo>;
}
return undefined;
});
@@ -836,7 +837,7 @@
return this._restApiHelper
.send(req)
.then(newName =>
- this._updateCachedAccount({name: (newName as unknown) as string})
+ this._updateCachedAccount({name: newName as unknown as string})
);
}
@@ -852,7 +853,7 @@
return this._restApiHelper
.send(req)
.then(newName =>
- this._updateCachedAccount({username: (newName as unknown) as string})
+ this._updateCachedAccount({username: newName as unknown as string})
);
}
@@ -867,7 +868,7 @@
};
return this._restApiHelper.send(req).then(newName =>
this._updateCachedAccount({
- display_name: (newName as unknown) as string,
+ display_name: newName as unknown as string,
})
);
}
@@ -884,7 +885,7 @@
return this._restApiHelper
.send(req)
.then(newStatus =>
- this._updateCachedAccount({status: (newStatus as unknown) as string})
+ this._updateCachedAccount({status: newStatus as unknown as string})
);
}
@@ -967,7 +968,7 @@
if (!res) {
return res;
}
- const prefInfo = (res as unknown) as PreferencesInfo;
+ const prefInfo = res as unknown as PreferencesInfo;
if (this._isNarrowScreen()) {
// Note that this can be problematic, because the diff will stay
// unified even after increasing the window width.
@@ -983,22 +984,22 @@
}
getWatchedProjects() {
- return (this._fetchSharedCacheURL({
+ return this._fetchSharedCacheURL({
url: '/accounts/self/watched.projects',
reportUrlAsIs: true,
- }) as unknown) as Promise<ProjectWatchInfo[] | undefined>;
+ }) as unknown as Promise<ProjectWatchInfo[] | undefined>;
}
saveWatchedProjects(
projects: ProjectWatchInfo[]
): Promise<ProjectWatchInfo[]> {
- return (this._restApiHelper.send({
+ return this._restApiHelper.send({
method: HttpMethod.POST,
url: '/accounts/self/watched.projects',
body: projects,
parseResponse: true,
reportUrlAsIs: true,
- }) as unknown) as Promise<ProjectWatchInfo[]>;
+ }) as unknown as Promise<ProjectWatchInfo[]>;
}
deleteWatchedProjects(projects: ProjectWatchInfo[]): Promise<Response> {
@@ -1217,10 +1218,10 @@
};
return this._restApiHelper.fetchRawJSON(req).then(response => {
if (response?.status === 304) {
- return (parsePrefixedJSON(
+ return parsePrefixedJSON(
// urlWithParams already cached
this._etags.getCachedPayload(urlWithParams)!
- ) as unknown) as ChangeInfo;
+ ) as unknown as ChangeInfo;
}
if (response && !response.ok) {
@@ -1242,11 +1243,9 @@
}
this._etags.collect(urlWithParams, response, payload.raw);
// TODO(TS): Why it is always change info?
- this._maybeInsertInLookup(
- (payload.parsed as unknown) as ChangeInfo
- );
+ this._maybeInsertInLookup(payload.parsed as unknown as ChangeInfo);
- return (payload.parsed as unknown) as ChangeInfo;
+ return payload.parsed as unknown as ChangeInfo;
});
});
}
@@ -1526,11 +1525,11 @@
`/projects/${encodedRepo}/tags` + `?n=${n}&S=${offset}` + encodedFilter;
// TODO(kaspern): Rename rest api from /projects/ to /repos/ once backend
// supports it.
- return (this._restApiHelper.fetchJSON({
+ return this._restApiHelper.fetchJSON({
url,
errFn,
anonymizedUrl: '/projects/*/tags',
- }) as unknown) as Promise<TagInfo[]>;
+ }) as unknown as Promise<TagInfo[]>;
}
getPlugins(
@@ -1581,13 +1580,13 @@
projectName: RepoName,
projectInfo: ProjectAccessInput
): Promise<ChangeInfo> {
- return (this._restApiHelper.send({
+ return this._restApiHelper.send({
method: HttpMethod.PUT,
url: `/projects/${encodeURIComponent(projectName)}/access:review`,
body: projectInfo,
parseResponse: true,
anonymizedUrl: '/projects/*/access:review',
- }) as unknown) as Promise<ChangeInfo>;
+ }) as unknown as Promise<ChangeInfo>;
}
getSuggestedGroups(
@@ -1880,7 +1879,7 @@
baseChange?: ChangeId,
baseCommit?: string
) {
- return (this._restApiHelper.send({
+ return this._restApiHelper.send({
method: HttpMethod.POST,
url: '/changes/',
body: {
@@ -1895,7 +1894,7 @@
},
parseResponse: true,
reportUrlAsIs: true,
- }) as unknown) as Promise<ChangeInfo | undefined>;
+ }) as unknown as Promise<ChangeInfo | undefined>;
}
getFileContent(
@@ -1925,7 +1924,7 @@
// X-FYI-Content-Type header of the response.
const type = res.headers.get('X-FYI-Content-Type');
return this.getResponseObject(res).then(content => {
- const strContent = (content as unknown) as string | null;
+ const strContent = content as unknown as string | null;
return {content: strContent, type, ok: true};
});
});
@@ -2762,28 +2761,28 @@
}
setChangeTopic(changeNum: NumericChangeId, topic?: string): Promise<string> {
- return (this._getChangeURLAndSend({
+ return this._getChangeURLAndSend({
changeNum,
method: HttpMethod.PUT,
endpoint: '/topic',
body: {topic},
parseResponse: true,
reportUrlAsIs: true,
- }) as unknown) as Promise<string>;
+ }) as unknown as Promise<string>;
}
setChangeHashtag(
changeNum: NumericChangeId,
hashtag: HashtagsInput
): Promise<Hashtag[]> {
- return (this._getChangeURLAndSend({
+ return this._getChangeURLAndSend({
changeNum,
method: HttpMethod.POST,
endpoint: '/hashtags',
body: hashtag,
parseResponse: true,
reportUrlAsIs: true,
- }) as unknown) as Promise<Hashtag[]>;
+ }) as unknown as Promise<Hashtag[]>;
}
deleteAccountHttpPassword() {
@@ -2795,20 +2794,20 @@
}
generateAccountHttpPassword(): Promise<Password> {
- return (this._restApiHelper.send({
+ return this._restApiHelper.send({
method: HttpMethod.PUT,
url: '/accounts/self/password.http',
body: {generate: true},
parseResponse: true,
reportUrlAsIs: true,
- }) as Promise<unknown>) as Promise<Password>;
+ }) as Promise<unknown> as Promise<Password>;
}
getAccountSSHKeys() {
- return (this._fetchSharedCacheURL({
+ return this._fetchSharedCacheURL({
url: '/accounts/self/sshkeys',
reportUrlAsIs: true,
- }) as Promise<unknown>) as Promise<SshKeyInfo[] | undefined>;
+ }) as Promise<unknown> as Promise<SshKeyInfo[] | undefined>;
}
addAccountSSHKey(key: string): Promise<SshKeyInfo> {
@@ -2825,9 +2824,9 @@
if (!response || (response.status < 200 && response.status >= 300)) {
return Promise.reject(new Error('error'));
}
- return (this.getResponseObject(
+ return this.getResponseObject(
response
- ) as unknown) as Promise<SshKeyInfo>;
+ ) as unknown as Promise<SshKeyInfo>;
})
.then(obj => {
if (!obj || !obj.valid) {
@@ -2846,10 +2845,10 @@
}
getAccountGPGKeys() {
- return (this._restApiHelper.fetchJSON({
+ return this._restApiHelper.fetchJSON({
url: '/accounts/self/gpgkeys',
reportUrlAsIs: true,
- }) as Promise<unknown>) as Promise<Record<string, GpgKeyInfo>>;
+ }) as Promise<unknown> as Promise<Record<string, GpgKeyInfo>>;
}
addAccountGPGKey(key: GpgKeysInput) {
@@ -2994,7 +2993,7 @@
commentID: UrlEncodedCommentId,
reason: string
) {
- return (this._getChangeURLAndSend({
+ return this._getChangeURLAndSend({
changeNum,
method: HttpMethod.POST,
patchNum,
@@ -3002,7 +3001,7 @@
body: {reason},
parseResponse: true,
anonymizedEndpoint: '/comments/*/delete',
- }) as unknown) as Promise<CommentInfo>;
+ }) as unknown as Promise<CommentInfo>;
}
/**
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
index 89abd57..8db6606 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-apis/gr-rest-api-helper.ts
@@ -86,7 +86,7 @@
// so that we spare more round trips to the server when the app loads
// initially.
Object.entries(window.INITIAL_DATA).forEach(e =>
- this._cache().set(e[0], (e[1] as unknown) as ParsedJSON)
+ this._cache().set(e[0], e[1] as unknown as ParsedJSON)
);
}
}
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
index 95e06c0..a603ec6 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-reviewer-updates-parser.ts
@@ -180,8 +180,8 @@
if (isParserBatchWithNonEmptyUpdates(batch)) {
newUpdates.push(batch);
}
- ((this.result
- .reviewer_updates as unknown) as ParserBatchWithNonEmptyUpdates[]) = newUpdates;
+ (this.result
+ .reviewer_updates as unknown as ParserBatchWithNonEmptyUpdates[]) = newUpdates;
return newUpdates;
}
@@ -227,15 +227,15 @@
* @see https://gerrit-review.googlesource.com/c/94490/
*/
_formatUpdates() {
- const reviewerUpdates = (this.result
- .reviewer_updates as unknown) as ParserBatchWithNonEmptyUpdates[];
+ const reviewerUpdates = this.result
+ .reviewer_updates as unknown as ParserBatchWithNonEmptyUpdates[];
for (const update of reviewerUpdates) {
const groupedReviewers = this._groupUpdatesByMessage(update.updates);
const newUpdates: {message: string; reviewers: AccountInfo[]}[] = [];
for (const [message, reviewers] of Object.entries(groupedReviewers)) {
newUpdates.push({message, reviewers});
}
- ((update as unknown) as FormattedReviewerUpdateInfo).updates = newUpdates;
+ (update as unknown as FormattedReviewerUpdateInfo).updates = newUpdates;
}
}
@@ -245,8 +245,8 @@
* TODO(viktard): Remove when server-side serves reviewer updates like so.
*/
_advanceUpdates() {
- const updates = (this.result
- .reviewer_updates as unknown) as FormattedReviewerUpdateInfo[];
+ const updates = this.result
+ .reviewer_updates as unknown as FormattedReviewerUpdateInfo[];
const messages = this.result.messages;
messages.forEach((message, index) => {
const messageDate = parseDate(message.date).getTime();
diff --git a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
index 506c348..7790c73 100644
--- a/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
+++ b/polygerrit-ui/app/elements/shared/gr-textarea/gr-textarea_test.ts
@@ -215,7 +215,7 @@
element.$.textarea.selectionEnd = 16;
element.text = 'test test :tears';
element._colonIndex = 10;
- const selectedItem = ({dataset: {value: '😂'}} as unknown) as HTMLElement;
+ const selectedItem = {dataset: {value: '😂'}} as unknown as HTMLElement;
const event = new CustomEvent<ItemSelectedEvent>('item-selected', {
detail: {trigger: 'click', selected: selectedItem},
});
diff --git a/polygerrit-ui/app/mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin.ts b/polygerrit-ui/app/mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin.ts
index 5f53819..4d2bbf2 100644
--- a/polygerrit-ui/app/mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin.ts
+++ b/polygerrit-ui/app/mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin.ts
@@ -831,7 +831,7 @@
}
// eg: {key: "k:keydown", ..., from: "gr-diff-view"}
- let key = `${((e as unknown) as KeyboardEvent).key}:${e.type}`;
+ let key = `${(e as unknown as KeyboardEvent).key}:${e.type}`;
if (this._inGoKeyMode()) key = 'g+' + key;
if (this.inVKeyMode()) key = 'v+' + key;
if (e.shiftKey) key = 'shift+' + key;
diff --git a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
index dae8e2e..a74adf6 100644
--- a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
+++ b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.ts
@@ -56,7 +56,8 @@
}
export class GrReviewerSuggestionsProvider
- implements ReviewerSuggestionsProvider {
+ implements ReviewerSuggestionsProvider
+{
static create(
restApi: RestApiService,
changeNumber: NumericChangeId,
diff --git a/polygerrit-ui/app/services/change/change-model.ts b/polygerrit-ui/app/services/change/change-model.ts
index 312e78d..962ef4d 100644
--- a/polygerrit-ui/app/services/change/change-model.ts
+++ b/polygerrit-ui/app/services/change/change-model.ts
@@ -110,12 +110,11 @@
* Note that this selector can emit a patchNum without the change being
* available!
*/
-export const currentPatchNum$: Observable<
- PatchSetNum | undefined
-> = changeAndRouterConsistent$.pipe(
- withLatestFrom(routerPatchNum$, latestPatchNum$),
- map(
- ([_, routerPatchNum, latestPatchNum]) => routerPatchNum || latestPatchNum
- ),
- distinctUntilChanged()
-);
+export const currentPatchNum$: Observable<PatchSetNum | undefined> =
+ changeAndRouterConsistent$.pipe(
+ withLatestFrom(routerPatchNum$, latestPatchNum$),
+ map(
+ ([_, routerPatchNum, latestPatchNum]) => routerPatchNum || latestPatchNum
+ ),
+ distinctUntilChanged()
+ );
diff --git a/polygerrit-ui/app/services/comments/comments-service.ts b/polygerrit-ui/app/services/comments/comments-service.ts
index 1aea7ad..9aa297a 100644
--- a/polygerrit-ui/app/services/comments/comments-service.ts
+++ b/polygerrit-ui/app/services/comments/comments-service.ts
@@ -84,7 +84,7 @@
return;
}
this.restApiService.getResponseObject(result).then(obj => {
- const resComment = (obj as unknown) as DraftInfo;
+ const resComment = obj as unknown as DraftInfo;
resComment.patch_set = draft.patch_set;
updateStateAddDraft(resComment);
updateStateUndoDiscardedDraft(draftID);
diff --git a/polygerrit-ui/app/test/common-test-setup-karma.ts b/polygerrit-ui/app/test/common-test-setup-karma.ts
index e67b1ec..3463d3b 100644
--- a/polygerrit-ui/app/test/common-test-setup-karma.ts
+++ b/polygerrit-ui/app/test/common-test-setup-karma.ts
@@ -102,7 +102,8 @@
self.flush = flushImpl;
class TestFixtureIdProvider {
- public static readonly instance: TestFixtureIdProvider = new TestFixtureIdProvider();
+ public static readonly instance: TestFixtureIdProvider =
+ new TestFixtureIdProvider();
private fixturesCount = 1;
@@ -198,7 +199,7 @@
): TagTestFixture<HTMLElementTagNameMap[T]> {
const template = document.createElement('template');
template.innerHTML = `<${tagName}></${tagName}>`;
- return (fixtureFromTemplate(template) as unknown) as TagTestFixture<
+ return fixtureFromTemplate(template) as unknown as TagTestFixture<
HTMLElementTagNameMap[T]
>;
}
diff --git a/polygerrit-ui/app/test/mocks/gr-rest-api_mock.ts b/polygerrit-ui/app/test/mocks/gr-rest-api_mock.ts
index 30989d6..4be19fd 100644
--- a/polygerrit-ui/app/test/mocks/gr-rest-api_mock.ts
+++ b/polygerrit-ui/app/test/mocks/gr-rest-api_mock.ts
@@ -356,7 +356,7 @@
},
getRepo(repo: RepoName): Promise<ProjectInfo | undefined> {
return Promise.resolve({
- id: (repo as string) as UrlEncodedRepoName,
+ id: repo as string as UrlEncodedRepoName,
name: repo,
});
},
diff --git a/polygerrit-ui/app/test/test-data-generators.ts b/polygerrit-ui/app/test/test-data-generators.ts
index 6e989e1..c82c15b 100644
--- a/polygerrit-ui/app/test/test-data-generators.ts
+++ b/polygerrit-ui/app/test/test-data-generators.ts
@@ -191,7 +191,8 @@
export const TEST_PROJECT_NAME: RepoName = 'test-project' as RepoName;
export const TEST_BRANCH_ID: BranchName = 'test-branch' as BranchName;
export const TEST_CHANGE_ID: ChangeId = 'TestChangeId' as ChangeId;
-export const TEST_CHANGE_INFO_ID: ChangeInfoId = `${TEST_PROJECT_NAME}~${TEST_BRANCH_ID}~${TEST_CHANGE_ID}` as ChangeInfoId;
+export const TEST_CHANGE_INFO_ID: ChangeInfoId =
+ `${TEST_PROJECT_NAME}~${TEST_BRANCH_ID}~${TEST_CHANGE_ID}` as ChangeInfoId;
export const TEST_SUBJECT = 'Test subject';
export const TEST_NUMERIC_CHANGE_ID = 42 as NumericChangeId;
@@ -262,9 +263,9 @@
};
}
-export function createRevisions(
- count: number
-): {[revisionId: string]: RevisionInfo} {
+export function createRevisions(count: number): {
+ [revisionId: string]: RevisionInfo;
+} {
const revisions: {[revisionId: string]: RevisionInfo} = {};
const revisionDate = TEST_CHANGE_CREATED;
const revisionIdStart = 1; // The same as getCurrentRevision
diff --git a/polygerrit-ui/app/test/test-utils.ts b/polygerrit-ui/app/test/test-utils.ts
index f11eef4..03a9525 100644
--- a/polygerrit-ui/app/test/test-utils.ts
+++ b/polygerrit-ui/app/test/test-utils.ts
@@ -108,7 +108,8 @@
}
_restoreShortcuts() {
- const bindings = _testOnly_getShortcutManagerInstance()._testOnly_getBindings();
+ const bindings =
+ _testOnly_getShortcutManagerInstance()._testOnly_getBindings();
bindings.clear();
this.originalBinding.forEach((value, key) => {
bindings.set(key, value);
diff --git a/polygerrit-ui/app/types/events.ts b/polygerrit-ui/app/types/events.ts
index 67d4786..0069321 100644
--- a/polygerrit-ui/app/types/events.ts
+++ b/polygerrit-ui/app/types/events.ts
@@ -114,7 +114,8 @@
export interface ChangeMessageDeletedEventDetail {
message: ChangeMessage;
}
-export type ChangeMessageDeletedEvent = CustomEvent<ChangeMessageDeletedEventDetail>;
+export type ChangeMessageDeletedEvent =
+ CustomEvent<ChangeMessageDeletedEventDetail>;
export type CommitEvent = CustomEvent;
@@ -131,7 +132,8 @@
export interface EditableContentSaveEventDetail {
content: string;
}
-export type EditableContentSaveEvent = CustomEvent<EditableContentSaveEventDetail>;
+export type EditableContentSaveEvent =
+ CustomEvent<EditableContentSaveEventDetail>;
export interface RpcLogEventDetail {
status: number | null;
diff --git a/polygerrit-ui/app/utils/comment-util.ts b/polygerrit-ui/app/utils/comment-util.ts
index a9f969b..48d6947 100644
--- a/polygerrit-ui/app/utils/comment-util.ts
+++ b/polygerrit-ui/app/utils/comment-util.ts
@@ -367,9 +367,9 @@
* TODO(taoalpha): should consider changing BE to send path
* back within CommentInfo
*/
-export function addPath<T>(
- comments: {[path: string]: T[]} = {}
-): {[path: string]: Array<T & {path: string}>} {
+export function addPath<T>(comments: {[path: string]: T[]} = {}): {
+ [path: string]: Array<T & {path: string}>;
+} {
const updatedComments: {[path: string]: Array<T & {path: string}>} = {};
for (const filePath of Object.keys(comments)) {
const allCommentsForPath = comments[filePath] || [];
diff --git a/polygerrit-ui/app/utils/event-util.ts b/polygerrit-ui/app/utils/event-util.ts
index c356893..2018eeb 100644
--- a/polygerrit-ui/app/utils/event-util.ts
+++ b/polygerrit-ui/app/utils/event-util.ts
@@ -32,21 +32,19 @@
);
}
-type HTMLElementEventDetailType<
- K extends keyof HTMLElementEventMap
-> = HTMLElementEventMap[K] extends CustomEvent<infer DT>
- ? unknown extends DT
- ? never
- : DT
- : never;
+type HTMLElementEventDetailType<K extends keyof HTMLElementEventMap> =
+ HTMLElementEventMap[K] extends CustomEvent<infer DT>
+ ? unknown extends DT
+ ? never
+ : DT
+ : never;
-type DocumentEventDetailType<
- K extends keyof DocumentEventMap
-> = DocumentEventMap[K] extends CustomEvent<infer DT>
- ? unknown extends DT
- ? never
- : DT
- : never;
+type DocumentEventDetailType<K extends keyof DocumentEventMap> =
+ DocumentEventMap[K] extends CustomEvent<infer DT>
+ ? unknown extends DT
+ ? never
+ : DT
+ : never;
export function fire<K extends keyof DocumentEventMap>(
target: Document,