Commit f7053458 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'nfriend-no-implicit-coercion-fixes' into 'master'

Fix all EE `no-implicit-coercion` ESLint violations

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