Commit c0ea77ac authored by Nathan Friend's avatar Nathan Friend

Comply with `no-implicit-coercion` rule (EE)

This commit is the result of running `yarn eslint --fix` after enabling
the `no-implicit-coercion` ESLint rule.  This rule has been added to
our ESLint config here:

https://gitlab.com/gitlab-org/gitlab-eslint-config/merge_requests/14
parent c92076a2
......@@ -15,7 +15,7 @@ export const mapApprovalFallbackRuleRequest = req => ({
export const mapApprovalRuleResponse = res => ({
id: res.id,
hasSource: !!res.source_rule,
hasSource: Boolean(res.source_rule),
name: res.name,
approvalsRequired: res.approvals_required,
minApprovalsRequired: res.source_rule ? res.source_rule.approvals_required : 0,
......
......@@ -29,16 +29,16 @@ export const draftsPerFileHashAndLine = state =>
}, {});
export const shouldRenderDraftRow = (state, getters) => (diffFileSha, line) =>
!!(
Boolean(
diffFileSha in getters.draftsPerFileHashAndLine &&
getters.draftsPerFileHashAndLine[diffFileSha][line.line_code]
getters.draftsPerFileHashAndLine[diffFileSha][line.line_code],
);
export const shouldRenderParallelDraftRow = (state, getters) => (diffFileSha, line) => {
const draftsForFile = getters.draftsPerFileHashAndLine[diffFileSha];
const [lkey, rkey] = [parallelLineKey(line, 'left'), parallelLineKey(line, 'right')];
return draftsForFile ? !!(draftsForFile[lkey] || draftsForFile[rkey]) : false;
return draftsForFile ? Boolean(draftsForFile[lkey] || draftsForFile[rkey]) : false;
};
export const shouldRenderDraftRowInDiscussion = (state, getters) => discussionId =>
......
......@@ -176,7 +176,7 @@ export default class BurndownChart {
this.idealData = [idealStart, idealEnd];
}
this.scheduleLineAnimation = !!animate;
this.scheduleLineAnimation = Boolean(animate);
this.scheduleRender();
}
......
......@@ -55,12 +55,12 @@ export default {
},
computed: {
formIsValid() {
return !!(
return Boolean(
this.queryIsValid &&
this.title.length &&
this.yLabel.length &&
this.unit.length &&
this.group.length
this.group.length,
);
},
validQueryMsg() {
......
......@@ -20,7 +20,7 @@ export default class SidebarContext {
// which requires us to use `display: none;`
// in `labels_select/base.vue` as well.
// see: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4773#note_61844731
const isVisible = !!$selectbox.get(0).offsetParent;
const isVisible = Boolean($selectbox.get(0).offsetParent);
$selectbox.toggle(!isVisible);
$block.find('.js-value').toggle(isVisible);
......
......@@ -6,7 +6,7 @@ import { statusType } from '../constants';
export const isEpicOpen = state => state.state === statusType.open;
export const isUserSignedIn = () => !!gon.current_user_id;
export const isUserSignedIn = () => Boolean(gon.current_user_id);
export const startDateTime = state => (state.startDate ? parsePikadayDate(state.startDate) : null);
......
......@@ -62,10 +62,10 @@ export default {
: s__('PrometheusAlerts|Edit alert');
},
hasAlerts() {
return !!Object.keys(this.alertsToManage).length;
return Boolean(Object.keys(this.alertsToManage).length);
},
formDisabled() {
return !!(this.errorMessage || this.isLoading);
return Boolean(this.errorMessage || this.isLoading);
},
},
watch: {
......
......@@ -50,13 +50,13 @@ export default {
return this.mr.approvals || {};
},
hasFooter() {
return !!this.approvals.has_approval_rules;
return Boolean(this.approvals.has_approval_rules);
},
approvedBy() {
return this.approvals.approved_by ? this.approvals.approved_by.map(x => x.user) : [];
},
isApproved() {
return !!this.approvals.approved;
return Boolean(this.approvals.approved);
},
approvalsRequired() {
return this.approvals.approvals_required || 0;
......@@ -65,10 +65,10 @@ export default {
return !this.approvedBy.length && !this.approvalsRequired;
},
userHasApproved() {
return !!this.approvals.user_has_approved;
return Boolean(this.approvals.user_has_approved);
},
userCanApprove() {
return !!this.approvals.user_can_approve;
return Boolean(this.approvals.user_can_approve);
},
showApprove() {
return !this.userHasApproved && this.userCanApprove && this.mr.isOpen;
......@@ -106,7 +106,7 @@ export default {
return null;
},
hasAction() {
return !!this.action;
return Boolean(this.action);
},
},
watch: {
......
......@@ -51,7 +51,7 @@ export default {
);
},
hasApprovers() {
return !!this.approvers.length;
return Boolean(this.approvers.length);
},
},
APPROVED_MESSAGE,
......
......@@ -67,7 +67,7 @@ export default class MergeRequestStore extends CEMergeRequestStore {
setApprovals(data) {
this.approvals = mapApprovalsResponse(data);
this.approvalsLeft = !!data.approvals_left;
this.approvalsLeft = Boolean(data.approvals_left);
this.isApproved = data.approved || false;
this.preventMerge = !this.isApproved;
}
......
......@@ -36,10 +36,10 @@ export default {
computed: {
// Exactly one of these (triggeredBy and triggered) must be truthy. Never both. Never neither.
isUpstream() {
return !!this.triggeredBy.length && !this.triggered.length;
return Boolean(this.triggeredBy.length) && !this.triggered.length;
},
isDownstream() {
return !this.triggeredBy.length && !!this.triggered.length;
return !this.triggeredBy.length && Boolean(this.triggered.length);
},
linkedPipelines() {
return this.isUpstream ? this.triggeredBy : this.triggered;
......
......@@ -24,7 +24,8 @@ export default {
type: Object,
required: true,
validator: license =>
!!license.name && Object.values(LICENSE_APPROVAL_STATUS).includes(license.approvalStatus),
Boolean(license.name) &&
Object.values(LICENSE_APPROVAL_STATUS).includes(license.approvalStatus),
},
},
LICENSE_APPROVAL_STATUS,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment