Update eslint version and eslint rules
Legacy indent rules doesn't handle all cases. As a result there are
different indents in .js files. This commit update eslint rules and add
autofix for incorrect indents. It is expected that fix should be run
after converting to class-based elements.
Change-Id: I9d37a3d4319e2af71ddb93100a6791b8ddb7de79
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js
index b6f1b74..afe3955 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section.js
@@ -224,8 +224,8 @@
editRefInput() {
return Polymer.dom(this.root).querySelector(Polymer.Element ?
- 'iron-input.editRefInput' :
- 'input[is=iron-input].editRefInput');
+ 'iron-input.editRefInput' :
+ 'input[is=iron-input].editRefInput');
},
editReference() {
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
index 5110dc1..c5fa827 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
@@ -206,8 +206,9 @@
id: 'administrateServer',
value: {},
};
- assert.equal(element._computePermissionName(name, permission,
- element.permissionValues, element.capabilities),
+ assert.equal(
+ element._computePermissionName(name, permission,
+ element.permissionValues, element.capabilities),
element.capabilities[permission.id].name);
name = 'refs/for/*';
@@ -216,8 +217,9 @@
value: {},
};
- assert.equal(element._computePermissionName(
- name, permission, element.permissionValues, element.capabilities),
+ assert.equal(
+ element._computePermissionName(
+ name, permission, element.permissionValues, element.capabilities),
element.permissionValues[permission.id].name);
name = 'refs/for/*';
@@ -228,8 +230,9 @@
},
};
- assert.equal(element._computePermissionName(name, permission,
- element.permissionValues, element.capabilities),
+ assert.equal(
+ element._computePermissionName(name, permission,
+ element.permissionValues, element.capabilities),
'Label Code-Review');
permission = {
@@ -239,8 +242,9 @@
},
};
- assert.equal(element._computePermissionName(name, permission,
- element.permissionValues, element.capabilities),
+ assert.equal(
+ element._computePermissionName(name, permission,
+ element.permissionValues, element.capabilities),
'Label Code-Review(On Behalf Of)');
});
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js
index 4c099d6..74dcb87 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js
+++ b/polygerrit-ui/app/elements/admin/gr-admin-group-list/gr-admin-group-list.js
@@ -120,11 +120,11 @@
return;
}
this._groups = Object.keys(groups)
- .map(key => {
- const group = groups[key];
- group.name = key;
- return group;
- });
+ .map(key => {
+ const group = groups[key];
+ group.name = key;
+ return group;
+ });
this._loading = false;
});
},
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js
index d3f020d..72cca9e 100644
--- a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js
@@ -105,23 +105,23 @@
.then(res => {
this._filteredLinks = res.links;
this._breadcrumbParentName = res.expandedSection ?
- res.expandedSection.name : '';
+ res.expandedSection.name : '';
if (!res.expandedSection) {
this._subsectionLinks = [];
return;
}
this._subsectionLinks = [res.expandedSection]
- .concat(res.expandedSection.children).map(section => {
- return {
- text: !section.detailType ? 'Home' : section.name,
- value: section.view + (section.detailType || ''),
- view: section.view,
- url: section.url,
- detailType: section.detailType,
- parent: this._groupId || this._repoName || '',
- };
- });
+ .concat(res.expandedSection.children).map(section => {
+ return {
+ text: !section.detailType ? 'Home' : section.name,
+ value: section.view + (section.detailType || ''),
+ view: section.view,
+ url: section.url,
+ detailType: section.detailType,
+ parent: this._groupId || this._repoName || '',
+ };
+ });
});
});
},
diff --git a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js
index 5e4d102..e29e5f8 100644
--- a/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js
+++ b/polygerrit-ui/app/elements/admin/gr-create-change-dialog/gr-create-change-dialog.js
@@ -107,21 +107,21 @@
}
return this.$.restAPI.getRepoBranches(
input, this.repoName, SUGGESTIONS_LIMIT).then(response => {
- const branches = [];
- let branch;
- for (const key in response) {
- if (!response.hasOwnProperty(key)) { continue; }
- if (response[key].ref.startsWith('refs/heads/')) {
- branch = response[key].ref.substring('refs/heads/'.length);
- } else {
- branch = response[key].ref;
- }
- branches.push({
- name: branch,
- });
- }
- return branches;
+ const branches = [];
+ let branch;
+ for (const key in response) {
+ if (!response.hasOwnProperty(key)) { continue; }
+ if (response[key].ref.startsWith('refs/heads/')) {
+ branch = response[key].ref.substring('refs/heads/'.length);
+ } else {
+ branch = response[key].ref;
+ }
+ branches.push({
+ name: branch,
});
+ }
+ return branches;
+ });
},
_formatBooleanString(config) {
diff --git a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js
index 958c0ac..7f8e9ac 100644
--- a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js
+++ b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members.js
@@ -141,15 +141,15 @@
_handleSavingGroupMember() {
return this.$.restAPI.saveGroupMembers(this._groupName,
this._groupMemberSearchId).then(config => {
- if (!config) {
- return;
- }
- this.$.restAPI.getGroupMembers(this._groupName).then(members => {
- this._groupMembers = members;
- });
- this._groupMemberSearchName = '';
- this._groupMemberSearchId = '';
- });
+ if (!config) {
+ return;
+ }
+ this.$.restAPI.getGroupMembers(this._groupName).then(members => {
+ this._groupMembers = members;
+ });
+ this._groupMemberSearchName = '';
+ this._groupMemberSearchId = '';
+ });
},
_handleDeleteConfirm() {
@@ -239,24 +239,24 @@
if (input.length === 0) { return Promise.resolve([]); }
return this.$.restAPI.getSuggestedAccounts(
input, SUGGESTIONS_LIMIT).then(accounts => {
- const accountSuggestions = [];
- let nameAndEmail;
- if (!accounts) { return []; }
- for (const key in accounts) {
- if (!accounts.hasOwnProperty(key)) { continue; }
- if (accounts[key].email !== undefined) {
- nameAndEmail = accounts[key].name +
+ const accountSuggestions = [];
+ let nameAndEmail;
+ if (!accounts) { return []; }
+ for (const key in accounts) {
+ if (!accounts.hasOwnProperty(key)) { continue; }
+ if (accounts[key].email !== undefined) {
+ nameAndEmail = accounts[key].name +
' <' + accounts[key].email + '>';
- } else {
- nameAndEmail = accounts[key].name;
- }
- accountSuggestions.push({
- name: nameAndEmail,
- value: accounts[key]._account_id,
- });
- }
- return accountSuggestions;
+ } else {
+ nameAndEmail = accounts[key].name;
+ }
+ accountSuggestions.push({
+ name: nameAndEmail,
+ value: accounts[key]._account_id,
});
+ }
+ return accountSuggestions;
+ });
},
_getGroupSuggestions(input) {
diff --git a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html
index 15a59c8..bf9113b 100644
--- a/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-group-members/gr-group-members_test.html
@@ -169,10 +169,10 @@
.querySelectorAll('.nameColumn a')[0].href, includedGroups[0].url);
assert.equal(Polymer.dom(element.root)
.querySelectorAll('.nameColumn a')[1].href,
- 'https://test/site/group/url');
+ 'https://test/site/group/url');
assert.equal(Polymer.dom(element.root)
.querySelectorAll('.nameColumn a')[2].href,
- 'https://test/site/group/url');
+ 'https://test/site/group/url');
});
test('save members correctly', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
index 68228b4..19cb45c 100644
--- a/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
+++ b/polygerrit-ui/app/elements/admin/gr-group/gr-group.js
@@ -172,15 +172,15 @@
}
return this.$.restAPI.saveGroupOwner(this.groupId,
owner).then(config => {
- this._owner = false;
- });
+ this._owner = false;
+ });
},
_handleSaveDescription() {
return this.$.restAPI.saveGroupDescription(this.groupId,
this._groupConfig.description).then(config => {
- this._description = false;
- });
+ this._description = false;
+ });
},
_handleSaveOptions() {
@@ -190,8 +190,8 @@
return this.$.restAPI.saveGroupOptions(this.groupId,
options).then(config => {
- this._options = false;
- });
+ this._options = false;
+ });
},
_handleConfigName() {
diff --git a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js
index b31aee6..c485b15 100644
--- a/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js
+++ b/polygerrit-ui/app/elements/admin/gr-permission/gr-permission.js
@@ -228,7 +228,7 @@
_computeGroupName(groups, groupId) {
return groups && groups[groupId] && groups[groupId].name ?
- groups[groupId].name : groupId;
+ groups[groupId].name : groupId;
},
_getGroupSuggestions() {
diff --git a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js
index b77f078..1dbfdc8 100644
--- a/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js
+++ b/polygerrit-ui/app/elements/admin/gr-plugin-list/gr-plugin-list.js
@@ -92,11 +92,11 @@
return;
}
this._plugins = Object.keys(plugins)
- .map(key => {
- const plugin = plugins[key];
- plugin.name = key;
- return plugin;
- });
+ .map(key => {
+ const plugin = plugins[key];
+ plugin.name = key;
+ return plugin;
+ });
this._loading = false;
});
},
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js
index 94bef54..18cd790 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access.js
@@ -167,7 +167,7 @@
// current value appears. If there is no parent repo, it is
// initialized as an empty string.
this._inheritFromFilter = res.inherits_from ?
- this._inheritsFrom.name : '';
+ this._inheritsFrom.name : '';
this._local = res.local;
this._groups = res.groups;
this._weblinks = res.config_web_links || [];
@@ -370,11 +370,11 @@
};
const originalInheritsFromId = this._originalInheritsFrom ?
- this.singleDecodeURL(this._originalInheritsFrom.id) :
- null;
+ this.singleDecodeURL(this._originalInheritsFrom.id) :
+ null;
const inheritsFromId = this._inheritsFrom ?
- this.singleDecodeURL(this._inheritsFrom.id) :
- null;
+ this.singleDecodeURL(this._inheritsFrom.id) :
+ null;
const inheritFromChanged =
// Inherit from changed
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html
index 8b1de6e..1660088 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-repo-access/gr-repo-access_test.html
@@ -676,7 +676,7 @@
Polymer.dom(element.$$('gr-access-section').root).querySelectorAll(
'gr-permission')[2];
newPermission._handleAddRuleItem(
- {detail: {value: {id: 'Maintainers'}}});
+ {detail: {value: {id: 'Maintainers'}}});
assert.deepEqual(element._computeAddAndRemove(), expectedInput);
// Modify a section reference.
@@ -909,7 +909,7 @@
Polymer.dom(element.$$('gr-access-section').root).querySelectorAll(
'gr-permission')[1];
readPermission._handleAddRuleItem(
- {detail: {value: {id: 'Maintainers'}}});
+ {detail: {value: {id: 'Maintainers'}}});
expectedInput = {
add: {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
index 92f15b0..95faaf8 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
@@ -101,17 +101,17 @@
_handleEditRepoConfig() {
return this.$.restAPI.createChange(this.repo, CONFIG_BRANCH,
EDIT_CONFIG_SUBJECT, undefined, false, true).then(change => {
- const message = change ?
- CREATE_CHANGE_SUCCEEDED_MESSAGE :
- CREATE_CHANGE_FAILED_MESSAGE;
- this.dispatchEvent(new CustomEvent(
- 'show-alert',
- {detail: {message}, bubbles: true, composed: true}));
- if (!change) { return; }
+ const message = change ?
+ CREATE_CHANGE_SUCCEEDED_MESSAGE :
+ CREATE_CHANGE_FAILED_MESSAGE;
+ this.dispatchEvent(new CustomEvent(
+ 'show-alert',
+ {detail: {message}, bubbles: true, composed: true}));
+ if (!change) { return; }
- Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff(
- change, CONFIG_PATH, INITIAL_PATCHSET));
- });
+ Gerrit.Nav.navigateToRelativeUrl(Gerrit.Nav.getEditUrlForDiff(
+ change, CONFIG_PATH, INITIAL_PATCHSET));
+ });
},
});
})();
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js
index 6e38566..71cc571 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-dashboards/gr-repo-dashboards.js
@@ -49,7 +49,7 @@
// Group by ref and sort by id.
const dashboards = res.concat.apply([], res).sort((a, b) =>
- a.id < b.id ? -1 : 1);
+ a.id < b.id ? -1 : 1);
const dashboardsByRef = {};
dashboards.forEach(d => {
if (!dashboardsByRef[d.ref]) {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js
index da8ef52..9052322 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list.js
@@ -91,7 +91,7 @@
_determineIfOwner(repo) {
return this.$.restAPI.getRepoAccess(repo)
.then(access =>
- this._isOwner = access && !!access[repo].is_owner);
+ this._isOwner = access && !!access[repo].is_owner);
},
_paramsChanged(params) {
@@ -125,17 +125,17 @@
if (detailType === DETAIL_TYPES.BRANCHES) {
return this.$.restAPI.getRepoBranches(
filter, repo, itemsPerPage, offset, errFn).then(items => {
- if (!items) { return; }
- this._items = items;
- this._loading = false;
- });
+ if (!items) { return; }
+ this._items = items;
+ this._loading = false;
+ });
} else if (detailType === DETAIL_TYPES.TAGS) {
return this.$.restAPI.getRepoTags(
filter, repo, itemsPerPage, offset, errFn).then(items => {
- if (!items) { return; }
- this._items = items;
- this._loading = false;
- });
+ if (!items) { return; }
+ this._items = items;
+ this._loading = false;
+ });
}
},
@@ -174,7 +174,7 @@
_computeCanEditClass(ref, detailType, isOwner) {
return isOwner && this._stripRefs(ref, detailType) === 'HEAD' ?
- 'canEdit' : '';
+ 'canEdit' : '';
},
_handleEditRevision(e) {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html
index d8d4f7c..44d9b27 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-repo-detail-list/gr-repo-detail-list_test.html
@@ -155,9 +155,9 @@
const cancelBtn = Polymer.dom(element.root).querySelector('.cancelBtn');
const editBtn = Polymer.dom(element.root).querySelector('.editBtn');
const revisionNoEditing = Polymer.dom(element.root)
- .querySelector('.revisionNoEditing');
+ .querySelector('.revisionNoEditing');
const revisionWithEditing = Polymer.dom(element.root)
- .querySelector('.revisionWithEditing');
+ .querySelector('.revisionWithEditing');
sandbox.stub(element, '_getLoggedIn').returns(Promise.resolve(true));
sandbox.stub(element.$.restAPI, 'getRepoAccess').returns(
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.html b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.html
index 07da7c7..0a6846f 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-repo-plugin-config/gr-repo-plugin-config_test.html
@@ -54,7 +54,7 @@
{base: {config: {}}}), []);
assert.deepEqual(element._computePluginConfigOptions(
{base: {config: {testKey: 'testInfo'}}}),
- [{_key: 'testKey', info: 'testInfo'}]);
+ [{_key: 'testKey', info: 'testInfo'}]);
});
test('_computeDisabled', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js
index 918efba..153a137 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo.js
@@ -283,8 +283,8 @@
_handleSaveRepoConfig() {
return this.$.restAPI.saveRepoConfig(this.repo,
this._formatRepoConfigForSave(this._repoConfig)).then(() => {
- this._configChanged = false;
- });
+ this._configChanged = false;
+ });
},
_handleConfigChanged() {
@@ -327,7 +327,7 @@
command: commandObj[title]
.replace(/\$\{project\}/gi, encodeURI(repo))
.replace(/\$\{project-base-name\}/gi,
- encodeURI(repo.substring(repo.lastIndexOf('/') + 1))),
+ encodeURI(repo.substring(repo.lastIndexOf('/') + 1))),
});
}
return commands;
diff --git a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html
index f22c5a5..4e81565 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-repo/gr-repo_test.html
@@ -367,7 +367,7 @@
element.$.matchAuthoredDateWithCommitterDateSelect.bindValue =
configInputObj.match_author_to_committer_date;
const inputElement = Polymer.Element ?
- element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput;
+ element.$.maxGitObjSizeIronInput : element.$.maxGitObjSizeInput;
inputElement.bindValue = configInputObj.max_object_size_limit;
element.$.contributorAgreementSelect.bindValue =
configInputObj.use_contributor_agreements;
diff --git a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html
index 4ea3817..6d533af 100644
--- a/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-rule-editor/gr-rule-editor_test.html
@@ -125,7 +125,7 @@
let permission = 'priority';
let label;
assert.deepEqual(element._getDefaultRuleValues(permission, label),
- {action: 'BATCH'});
+ {action: 'BATCH'});
permission = 'label-Code-Review';
label = {values: [
{value: -2, text: 'This shall not be merged'},
@@ -139,7 +139,7 @@
permission = 'push';
label = undefined;
assert.deepEqual(element._getDefaultRuleValues(permission, label),
- {action: 'ALLOW', force: false});
+ {action: 'ALLOW', force: false});
permission = 'submit';
assert.deepEqual(element._getDefaultRuleValues(permission, label),
{action: 'ALLOW'});