Fix some typescript checks

* Do not use trailing or leading underscores for private properties
* Expression evaluates to `void`, but it's used as a value
* Prefer using 'new' instead of relying on implicit construction

Change-Id: I290ed8689549e0099df91a62d40cf2b2cce6a105
This commit is contained in:
Dhruv Srivastava
2020-09-30 13:44:57 +02:00
parent 2ce08db469
commit c7e4a3d205
2 changed files with 7 additions and 7 deletions

View File

@@ -79,7 +79,7 @@ export class GrDiffCursor extends GestureEventListeners(
private _preventAutoScrollOnManualScroll = false; private _preventAutoScrollOnManualScroll = false;
private _lastDisplayedNavigateToNextFileToast: number | null = null; private lastDisplayedNavigateToNextFileToast: number | null = null;
@property({type: String}) @property({type: String})
side = Side.RIGHT; side = Side.RIGHT;
@@ -222,12 +222,12 @@ export class GrDiffCursor extends GestureEventListeners(
this.$.cursorManager.isAtEnd() this.$.cursorManager.isAtEnd()
) { ) {
if ( if (
this._lastDisplayedNavigateToNextFileToast && this.lastDisplayedNavigateToNextFileToast &&
Date.now() - this._lastDisplayedNavigateToNextFileToast <= Date.now() - this.lastDisplayedNavigateToNextFileToast <=
NAVIGATE_TO_NEXT_FILE_TIMEOUT_MS NAVIGATE_TO_NEXT_FILE_TIMEOUT_MS
) { ) {
// reset for next file // reset for next file
this._lastDisplayedNavigateToNextFileToast = null; this.lastDisplayedNavigateToNextFileToast = null;
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('navigate-to-next-unreviewed-file', { new CustomEvent('navigate-to-next-unreviewed-file', {
composed: true, composed: true,
@@ -235,7 +235,7 @@ export class GrDiffCursor extends GestureEventListeners(
}) })
); );
} }
this._lastDisplayedNavigateToNextFileToast = Date.now(); this.lastDisplayedNavigateToNextFileToast = Date.now();
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('show-alert', { new CustomEvent('show-alert', {
detail: { detail: {

View File

@@ -554,7 +554,7 @@ export class GrCommentThread extends KeyboardShortcutMixin(
const comment = diffCommentEl.comment; const comment = diffCommentEl.comment;
const idx = this._indexOf(comment, this.comments); const idx = this._indexOf(comment, this.comments);
if (idx === -1) { if (idx === -1) {
throw Error( throw new Error(
'Cannot find comment ' + JSON.stringify(diffCommentEl.comment) 'Cannot find comment ' + JSON.stringify(diffCommentEl.comment)
); );
} }
@@ -574,7 +574,7 @@ export class GrCommentThread extends KeyboardShortcutMixin(
path: changeComment.path, path: changeComment.path,
line: changeComment.line, line: changeComment.line,
}; };
return this.$.storage.setDraftComment( this.$.storage.setDraftComment(
commentLocation, commentLocation,
changeComment.message ?? '' changeComment.message ?? ''
); );