Fix eslint problems
Change-Id: Ibaea5efb31d3455467a009d910969e221d65fedb
diff --git a/.eslintrc.json b/.eslintrc.json
index b9a6517..b38415b 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -90,7 +90,8 @@
2,
{
"ignoreComments": true,
- "ignorePattern": "^import .*;$"
+ "ignorePattern": "^import .*;$",
+ "ignoreTemplateLiterals": true
}
],
"new-cap": [
@@ -235,4 +236,4 @@
}
}
]
-}
\ No newline at end of file
+}
diff --git a/ui/code-owners-service.js b/ui/code-owners-service.js
index 416b3ec..25cbec4 100644
--- a/ui/code-owners-service.js
+++ b/ui/code-owners-service.js
@@ -226,19 +226,21 @@
return UserRole.REVIEWER;
} else if (this._accountInReviewers(change.reviewers.CC, account)) {
return UserRole.CC;
- } else if (this._accountInReviewers(change.reviewers.REMOVED, account)) {
+ } else if (this._accountInReviewers(change.reviewers.REMOVED,
+ account)) {
return UserRole.REMOVED_REVIEWER;
}
}
return UserRole.OTHER;
- })
+ });
}
_accountInReviewers(reviewers, account) {
if (!reviewers) {
return false;
}
- return reviewers.some(reviewer => reviewer._account_id === account._account_id);
+ return reviewers.some(reviewer =>
+ reviewer._account_id === account._account_id);
}
getStatus() {
@@ -301,7 +303,8 @@
status: this._fetchStatus,
progress: this._totalFetchCount === 0 ?
`Loading suggested owners ...` :
- `${this._fetchedOwners.size} out of ${this._totalFetchCount} files have returned suggested owners.`,
+ `${this._fetchedOwners.size} out of ${this._totalFetchCount} ` +
+ `files have returned suggested owners.`,
suggestions: this._groupFilesByOwners(codeOwnerStatusMap),
};
});
@@ -329,7 +332,8 @@
}
, {pending: [], missing: []});
// always fetch INSUFFICIENT_REVIEWERS first and then pending
- const filesToFetch = filesGroupByStatus.missing.concat(filesGroupByStatus.pending);
+ const filesToFetch = filesGroupByStatus.missing
+ .concat(filesGroupByStatus.pending);
this._totalFetchCount = filesToFetch.length;
return this._batchFetchCodeOwners(filesToFetch);
});
@@ -415,7 +419,8 @@
groupedItems.push({
groupName: this.getGroupName(failedFiles),
files: failedFiles,
- error: new Error('Failed to fetch code owner info. Try to refresh the page.'),
+ error: new Error(
+ 'Failed to fetch code owner info. Try to refresh the page.'),
});
}
diff --git a/ui/code-owners-service_test.html b/ui/code-owners-service_test.html
index 6986ea9..884b97f 100644
--- a/ui/code-owners-service_test.html
+++ b/ui/code-owners-service_test.html
@@ -98,12 +98,14 @@
suite('basic api request tests', () => {
setup(done => {
- getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`).returns(Promise.resolve(fakeStatus));
- codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi, {...fakeChange});
+ getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`)
+ .returns(Promise.resolve(fakeStatus));
+ codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi,
+ {...fakeChange});
flush(done);
});
- test('same change should return the same instance through getOwnerService', () => {
+ test('getOwnerService - same change returns the same instance', () => {
assert.equal(
CodeOwnerService.getOwnerService(fakeRestApi, fakeChange),
CodeOwnerService.getOwnerService(fakeRestApi, fakeChange)
@@ -119,7 +121,8 @@
test('should fetch status after init', () => {
assert.isTrue(getApiStub.calledOnce);
- assert.equal(getApiStub.lastCall.args[0], `/changes/${fakeChange._number}/code_owners.status`);
+ assert.equal(getApiStub.lastCall.args[0],
+ `/changes/${fakeChange._number}/code_owners.status`);
});
test('getSuggestion should kickoff the fetch', done => {
@@ -144,33 +147,35 @@
suite('all approved case', () => {
setup(done => {
- getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`).returns(Promise.resolve({
- // fake data with fake files
- patch_set_number: 1,
- file_code_owner_statuses: [
- {
- new_path_status: {
- path: 'a.js',
- status: 'APPROVED',
- },
- },
- {
- new_path_status: {
- path: 'b.js',
- status: 'APPROVED',
- },
- },
- {
- old_path_status: {
- path: 'd.js',
- status: 'APPROVED',
- },
- change_type: 'DELETED',
- },
- ],
- }));
+ getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`)
+ .returns(Promise.resolve({
+ // fake data with fake files
+ patch_set_number: 1,
+ file_code_owner_statuses: [
+ {
+ new_path_status: {
+ path: 'a.js',
+ status: 'APPROVED',
+ },
+ },
+ {
+ new_path_status: {
+ path: 'b.js',
+ status: 'APPROVED',
+ },
+ },
+ {
+ old_path_status: {
+ path: 'd.js',
+ status: 'APPROVED',
+ },
+ change_type: 'DELETED',
+ },
+ ],
+ }));
- codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi, {...fakeChange});
+ codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi,
+ {...fakeChange});
flush(done);
});
@@ -196,11 +201,12 @@
});
suite('abort', () => {
- let resolver;
setup(done => {
- getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`).returns(Promise.resolve(fakeStatus));
+ getApiStub.withArgs(`/changes/${fakeChange._number}/code_owners.status`)
+ .returns(Promise.resolve(fakeStatus));
- codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi, {...fakeChange});
+ codeOwnersService = CodeOwnerService.getOwnerService(fakeRestApi,
+ {...fakeChange});
flush(done);
});
diff --git a/ui/owner-requirement.js b/ui/owner-requirement.js
index 7bd74ee..44d14ca 100644
--- a/ui/owner-requirement.js
+++ b/ui/owner-requirement.js
@@ -63,8 +63,10 @@
<template is="dom-if" if="[[!_isLoading]]">
<span>[[_computeStatusText(_statusCount, _isOverriden)]]</span>
<template is="dom-if" if="[[_overrideInfoUrl]]">
- <a on-click="_reportDocClick" href="[[_overrideInfoUrl]]" target="_blank">
- <iron-icon icon="gr-icons:help-outline" title="Documentation for overriding code owners"></iron-icon>
+ <a on-click="_reportDocClick" href="[[_overrideInfoUrl]]"
+ target="_blank">
+ <iron-icon icon="gr-icons:help-outline"
+ title="Documentation for overriding code owners"></iron-icon>
</a>
</template>
<template is="dom-if" if="[[!_allApproved]]">
diff --git a/ui/owner-status-column.js b/ui/owner-status-column.js
index 3fdcd50..a63ef8b 100644
--- a/ui/owner-status-column.js
+++ b/ui/owner-status-column.js
@@ -38,8 +38,10 @@
const STATUS_TOOLTIP = {
[STATUS_CODE.PENDING]: 'Pending code owner approval',
[STATUS_CODE.MISSING]: 'Missing code owner approval',
- [STATUS_CODE.PENDING_OLD_PATH]: 'Pending code owner approval on pre-renamed file',
- [STATUS_CODE.MISSING_OLD_PATH]: 'Missing code owner approval on pre-renamed file',
+ [STATUS_CODE.PENDING_OLD_PATH]:
+ 'Pending code owner approval on pre-renamed file',
+ [STATUS_CODE.MISSING_OLD_PATH]:
+ 'Missing code owner approval on pre-renamed file',
[STATUS_CODE.APPROVED]: 'Approved by code owner',
[STATUS_CODE.ERROR]: 'Failed to fetch code owner status',
};
@@ -248,4 +250,4 @@
}
}
-customElements.define(OwnerStatusColumnContent.is, OwnerStatusColumnContent);
\ No newline at end of file
+customElements.define(OwnerStatusColumnContent.is, OwnerStatusColumnContent);
diff --git a/ui/suggest-owners-trigger.js b/ui/suggest-owners-trigger.js
index 2c0ccc0..8e799f4 100644
--- a/ui/suggest-owners-trigger.js
+++ b/ui/suggest-owners-trigger.js
@@ -107,7 +107,7 @@
Promise.all([
this.ownerService.isCodeOwnerEnabled(),
this.ownerService.areAllFilesApproved(),
- this.ownerService.getLoggedInUserInitialRole()
+ this.ownerService.getLoggedInUserInitialRole(),
])
.then(([enabled, approved, userRole]) => {
if (enabled) {
diff --git a/ui/suggest-owners.js b/ui/suggest-owners.js
index 2e1a487..29e989a 100644
--- a/ui/suggest-owners.js
+++ b/ui/suggest-owners.js
@@ -398,10 +398,12 @@
this._suggestionsTimer = null;
const reportDetails = res.suggestions.reduce((details, cur) => {
details.totalGroups++;
- details.stats.push([cur.files.length, cur.owners ? cur.owners.length : 0]);
+ details.stats.push([cur.files.length,
+ cur.owners ? cur.owners.length : 0]);
return details;
}, {totalGroups: 0, stats: []});
- this.reporting.reportLifeCycle('owners-suggestions-fetching-finished', reportDetails);
+ this.reporting.reportLifeCycle(
+ 'owners-suggestions-fetching-finished', reportDetails);
}
this.progressText = res.progress;
this.isLoading = !res.finished;
@@ -517,7 +519,8 @@
}
_reportDocClick() {
- this.reporting.reportInteraction('code-owners-doc-click', {section: 'no owners found'});
+ this.reporting.reportInteraction('code-owners-doc-click',
+ {section: 'no owners found'});
}
}