Commit 0c9885e6 authored by Mike Greiling's avatar Mike Greiling

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

CE Backport of !13803: "Fix all `no-implicit-coercion` ESLint violations

See merge request gitlab-org/gitlab-ce!29007
parents deebe0bf bee3c7e8
...@@ -37,7 +37,7 @@ export default class ShortcutsIssuable extends Shortcuts { ...@@ -37,7 +37,7 @@ export default class ShortcutsIssuable extends Shortcuts {
} }
// Sanity check: Make sure the selected text comes from a discussion : it can either contain a message... // Sanity check: Make sure the selected text comes from a discussion : it can either contain a message...
let foundMessage = !!documentFragment.querySelector('.md'); let foundMessage = Boolean(documentFragment.querySelector('.md'));
// ... Or come from a message // ... Or come from a message
if (!foundMessage) { if (!foundMessage) {
......
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
data.issues.forEach(issueObj => { data.issues.forEach(issueObj => {
const issue = new ListIssue(issueObj); const issue = new ListIssue(issueObj);
const foundSelectedIssue = ModalStore.findSelectedIssue(issue); const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
issue.selected = !!foundSelectedIssue; issue.selected = Boolean(foundSelectedIssue);
this.issues.push(issue); this.issues.push(issue);
}); });
......
...@@ -37,8 +37,8 @@ class List { ...@@ -37,8 +37,8 @@ class List {
this.type = obj.list_type; this.type = obj.list_type;
const typeInfo = this.getTypeInfo(this.type); const typeInfo = this.getTypeInfo(this.type);
this.preset = !!typeInfo.isPreset; this.preset = Boolean(typeInfo.isPreset);
this.isExpandable = !!typeInfo.isExpandable; this.isExpandable = Boolean(typeInfo.isExpandable);
this.isExpanded = true; this.isExpanded = true;
this.page = 1; this.page = 1;
this.loading = true; this.loading = true;
......
...@@ -23,7 +23,7 @@ class DeleteModal { ...@@ -23,7 +23,7 @@ class DeleteModal {
const branchData = e.currentTarget.dataset; const branchData = e.currentTarget.dataset;
this.branchName = branchData.branchName || ''; this.branchName = branchData.branchName || '';
this.deletePath = branchData.deletePath || ''; this.deletePath = branchData.deletePath || '';
this.isMerged = !!branchData.isMerged; this.isMerged = Boolean(branchData.isMerged);
this.updateModal(); this.updateModal();
} }
......
...@@ -142,7 +142,7 @@ export default { ...@@ -142,7 +142,7 @@ export default {
); );
}, },
hasLogo() { hasLogo() {
return !!this.logoUrl; return Boolean(this.logoUrl);
}, },
identiconId() { identiconId() {
// generate a deterministic integer id for the identicon background // generate a deterministic integer id for the identicon background
......
...@@ -40,7 +40,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = ( ...@@ -40,7 +40,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
}, },
selectable: true, selectable: true,
filterable: true, filterable: true,
filterRemote: !!$dropdown.data('refsUrl'), filterRemote: Boolean($dropdown.data('refsUrl')),
fieldName: $dropdown.data('fieldName'), fieldName: $dropdown.data('fieldName'),
filterInput: 'input[type="search"]', filterInput: 'input[type="search"]',
renderRow: function(ref) { renderRow: function(ref) {
......
...@@ -12,7 +12,7 @@ export default class CreateItemDropdown { ...@@ -12,7 +12,7 @@ export default class CreateItemDropdown {
this.fieldName = options.fieldName; this.fieldName = options.fieldName;
this.onSelect = options.onSelect || (() => {}); this.onSelect = options.onSelect || (() => {});
this.getDataOption = options.getData; this.getDataOption = options.getData;
this.getDataRemote = !!options.filterRemote; this.getDataRemote = Boolean(options.filterRemote);
this.createNewItemFromValueOption = options.createNewItemFromValue; this.createNewItemFromValueOption = options.createNewItemFromValue;
this.$dropdown = options.$dropdown; this.$dropdown = options.$dropdown;
this.$dropdownContainer = this.$dropdown.parent(); this.$dropdownContainer = this.$dropdown.parent();
......
...@@ -2,10 +2,10 @@ import _ from 'underscore'; ...@@ -2,10 +2,10 @@ import _ from 'underscore';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import { getDisplayName } from '../utils'; import { getDisplayName } from '../utils';
export const hasProjects = state => !!state.projects && state.projects.length > 0; export const hasProjects = state => Boolean(state.projects) && state.projects.length > 0;
export const isProjectInvalid = (state, getters) => export const isProjectInvalid = (state, getters) =>
!!state.selectedProject && Boolean(state.selectedProject) &&
getters.hasProjects && getters.hasProjects &&
!state.projects.some(project => _.isMatch(state.selectedProject, project)); !state.projects.some(project => _.isMatch(state.selectedProject, project));
......
...@@ -51,7 +51,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => { ...@@ -51,7 +51,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => {
const params = { const params = {
simple: true, simple: true,
per_page: 20, per_page: 20,
membership: !!gon.current_user_id, membership: Boolean(gon.current_user_id),
}; };
if (state.namespace === 'projects') { if (state.namespace === 'projects') {
......
...@@ -307,8 +307,8 @@ GitLabDropdown = (function() { ...@@ -307,8 +307,8 @@ GitLabDropdown = (function() {
// Set Defaults // Set Defaults
this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT); this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT);
this.noFilterInput = this.options.noFilterInput || this.getElement(NO_FILTER_INPUT); this.noFilterInput = this.options.noFilterInput || this.getElement(NO_FILTER_INPUT);
this.highlight = !!this.options.highlight; this.highlight = Boolean(this.options.highlight);
this.icon = !!this.options.icon; this.icon = Boolean(this.options.icon);
this.filterInputBlur = this.filterInputBlur =
this.options.filterInputBlur != null ? this.options.filterInputBlur : true; this.options.filterInputBlur != null ? this.options.filterInputBlur : true;
// If no input is passed create a default one // If no input is passed create a default one
......
...@@ -13,7 +13,7 @@ export default class GLForm { ...@@ -13,7 +13,7 @@ export default class GLForm {
const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {}; const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {};
Object.keys(this.enableGFM).forEach(item => { Object.keys(this.enableGFM).forEach(item => {
if (item !== 'emojis') { if (item !== 'emojis') {
this.enableGFM[item] = !!dataSources[item]; this.enableGFM[item] = Boolean(dataSources[item]);
} }
}); });
// Before we start, we should clean up any previous data for this form // Before we start, we should clean up any previous data for this form
......
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
.then(() => { .then(() => {
this.initManager('#ide-preview', this.sandboxOpts, { this.initManager('#ide-preview', this.sandboxOpts, {
fileResolver: { fileResolver: {
isFile: p => Promise.resolve(!!this.entries[createPathWithExt(p)]), isFile: p => Promise.resolve(Boolean(this.entries[createPathWithExt(p)])),
readFile: p => this.loadFileContent(createPathWithExt(p)).then(content => content), readFile: p => this.loadFileContent(createPathWithExt(p)).then(content => content),
}, },
}); });
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommittedChanges', 'activeFile']), ...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommittedChanges', 'activeFile']),
...mapGetters('commit', ['discardDraftButtonDisabled']), ...mapGetters('commit', ['discardDraftButtonDisabled']),
showStageUnstageArea() { showStageUnstageArea() {
return !!(this.someUncommittedChanges || this.lastCommitMsg || !this.unusedSeal); return Boolean(this.someUncommittedChanges || this.lastCommitMsg || !this.unusedSeal);
}, },
activeFileKey() { activeFileKey() {
return this.activeFile ? this.activeFile.key : null; return this.activeFile ? this.activeFile.key : null;
......
...@@ -11,7 +11,7 @@ export const defaultEditorOptions = { ...@@ -11,7 +11,7 @@ export const defaultEditorOptions = {
export default [ export default [
{ {
readOnly: model => !!model.file.file_lock, readOnly: model => Boolean(model.file.file_lock),
quickSuggestions: model => !(model.language === 'markdown'), quickSuggestions: model => !(model.language === 'markdown'),
}, },
]; ];
...@@ -42,9 +42,10 @@ export const emptyRepo = state => ...@@ -42,9 +42,10 @@ export const emptyRepo = state =>
export const currentTree = state => export const currentTree = state =>
state.trees[`${state.currentProjectId}/${state.currentBranchId}`]; state.trees[`${state.currentProjectId}/${state.currentBranchId}`];
export const hasChanges = state => !!state.changedFiles.length || !!state.stagedFiles.length; export const hasChanges = state =>
Boolean(state.changedFiles.length) || Boolean(state.stagedFiles.length);
export const hasMergeRequest = state => !!state.currentMergeRequestId; export const hasMergeRequest = state => Boolean(state.currentMergeRequestId);
export const allBlobs = state => export const allBlobs = state =>
Object.keys(state.entries) Object.keys(state.entries)
...@@ -70,7 +71,7 @@ export const isCommitModeActive = state => state.currentActivityView === activit ...@@ -70,7 +71,7 @@ export const isCommitModeActive = state => state.currentActivityView === activit
export const isReviewModeActive = state => state.currentActivityView === activityBarViews.review; export const isReviewModeActive = state => state.currentActivityView === activityBarViews.review;
export const someUncommittedChanges = state => export const someUncommittedChanges = state =>
!!(state.changedFiles.length || state.stagedFiles.length); Boolean(state.changedFiles.length || state.stagedFiles.length);
export const getChangesInFolder = state => path => { export const getChangesInFolder = state => path => {
const changedFilesCount = state.changedFiles.filter(f => filePathMatches(f.path, path)).length; const changedFilesCount = state.changedFiles.filter(f => filePathMatches(f.path, path)).length;
......
...@@ -102,7 +102,7 @@ export const updateFilesAfterCommit = ({ commit, dispatch, rootState, rootGetter ...@@ -102,7 +102,7 @@ export const updateFilesAfterCommit = ({ commit, dispatch, rootState, rootGetter
eventHub.$emit(`editor.update.model.content.${file.key}`, { eventHub.$emit(`editor.update.model.content.${file.key}`, {
content: file.content, content: file.content,
changed: !!changedFile, changed: Boolean(changedFile),
}); });
}); });
}; };
......
import { states } from './constants'; import { states } from './constants';
export const hasLatestPipeline = state => !state.isLoadingPipeline && !!state.latestPipeline; export const hasLatestPipeline = state => !state.isLoadingPipeline && Boolean(state.latestPipeline);
export const pipelineFailed = state => export const pipelineFailed = state =>
state.latestPipeline && state.latestPipeline.details.status.text === states.failed; state.latestPipeline && state.latestPipeline.details.status.text === states.failed;
......
...@@ -142,7 +142,7 @@ export default { ...@@ -142,7 +142,7 @@ export default {
Object.assign(state.entries[file.path], { Object.assign(state.entries[file.path], {
raw: file.content, raw: file.content,
changed: !!changedFile, changed: Boolean(changedFile),
staged: false, staged: false,
prevPath: '', prevPath: '',
moved: false, moved: false,
......
...@@ -14,7 +14,7 @@ export function addCommentIndicator(containerEl, { x, y }) { ...@@ -14,7 +14,7 @@ export function addCommentIndicator(containerEl, { x, y }) {
export function removeCommentIndicator(imageFrameEl) { export function removeCommentIndicator(imageFrameEl) {
const commentIndicatorEl = imageFrameEl.querySelector('.comment-indicator'); const commentIndicatorEl = imageFrameEl.querySelector('.comment-indicator');
const imageEl = imageFrameEl.querySelector('img'); const imageEl = imageFrameEl.querySelector('img');
const willRemove = !!commentIndicatorEl; const willRemove = Boolean(commentIndicatorEl);
let meta = {}; let meta = {};
if (willRemove) { if (willRemove) {
......
...@@ -6,8 +6,8 @@ import { isImageLoaded } from '../lib/utils/image_utility'; ...@@ -6,8 +6,8 @@ import { isImageLoaded } from '../lib/utils/image_utility';
export default class ImageDiff { export default class ImageDiff {
constructor(el, options) { constructor(el, options) {
this.el = el; this.el = el;
this.canCreateNote = !!(options && options.canCreateNote); this.canCreateNote = Boolean(options && options.canCreateNote);
this.renderCommentBadge = !!(options && options.renderCommentBadge); this.renderCommentBadge = Boolean(options && options.renderCommentBadge);
this.$noteContainer = $('.note-container', this.el); this.$noteContainer = $('.note-container', this.el);
this.imageBadges = []; this.imageBadges = [];
} }
......
...@@ -5,5 +5,5 @@ export const viewTypes = { ...@@ -5,5 +5,5 @@ export const viewTypes = {
}; };
export function isValidViewType(validate) { export function isValidViewType(validate) {
return !!Object.getOwnPropertyNames(viewTypes).find(viewType => viewType === validate); return Boolean(Object.getOwnPropertyNames(viewTypes).find(viewType => viewType === validate));
} }
...@@ -12,7 +12,7 @@ export default class IssuableIndex { ...@@ -12,7 +12,7 @@ export default class IssuableIndex {
} }
initBulkUpdate(pagePrefix) { initBulkUpdate(pagePrefix) {
const userCanBulkUpdate = $('.issues-bulk-update').length > 0; const userCanBulkUpdate = $('.issues-bulk-update').length > 0;
const alreadyInitialized = !!this.bulkUpdateSidebar; const alreadyInitialized = Boolean(this.bulkUpdateSidebar);
if (userCanBulkUpdate && !alreadyInitialized) { if (userCanBulkUpdate && !alreadyInitialized) {
IssuableBulkUpdateActions.init({ IssuableBulkUpdateActions.init({
......
...@@ -156,7 +156,7 @@ export default { ...@@ -156,7 +156,7 @@ export default {
return this.store.formState; return this.store.formState;
}, },
hasUpdated() { hasUpdated() {
return !!this.state.updatedAt; return Boolean(this.state.updatedAt);
}, },
issueChanged() { issueChanged() {
const { const {
......
...@@ -53,7 +53,7 @@ export default class LabelManager { ...@@ -53,7 +53,7 @@ export default class LabelManager {
toggleEmptyState($label, $btn, action) { toggleEmptyState($label, $btn, action) {
this.emptyState.classList.toggle( this.emptyState.classList.toggle(
'hidden', 'hidden',
!!this.prioritizedLabels[0].querySelector(':scope > li'), Boolean(this.prioritizedLabels[0].querySelector(':scope > li')),
); );
} }
......
...@@ -2,7 +2,7 @@ function isPropertyAccessSafe(base, property) { ...@@ -2,7 +2,7 @@ function isPropertyAccessSafe(base, property) {
let safe; let safe;
try { try {
safe = !!base[property]; safe = Boolean(base[property]);
} catch (error) { } catch (error) {
safe = false; safe = false;
} }
......
...@@ -513,7 +513,7 @@ export const stringifyTime = (timeObject, fullNameFormat = false) => { ...@@ -513,7 +513,7 @@ export const stringifyTime = (timeObject, fullNameFormat = false) => {
const reducedTime = _.reduce( const reducedTime = _.reduce(
timeObject, timeObject,
(memo, unitValue, unitName) => { (memo, unitValue, unitName) => {
const isNonZero = !!unitValue; const isNonZero = Boolean(unitValue);
if (fullNameFormat && isNonZero) { if (fullNameFormat && isNonZero) {
// Remove traling 's' if unit value is singular // Remove traling 's' if unit value is singular
......
...@@ -223,9 +223,9 @@ export function insertMarkdownText({ ...@@ -223,9 +223,9 @@ export function insertMarkdownText({
return tag.replace(textPlaceholder, val); return tag.replace(textPlaceholder, val);
} }
if (val.indexOf(tag) === 0) { if (val.indexOf(tag) === 0) {
return '' + val.replace(tag, ''); return String(val.replace(tag, ''));
} else { } else {
return '' + tag + val; return String(tag) + val;
} }
}) })
.join('\n'); .join('\n');
...@@ -233,7 +233,7 @@ export function insertMarkdownText({ ...@@ -233,7 +233,7 @@ export function insertMarkdownText({
} else if (tag.indexOf(textPlaceholder) > -1) { } else if (tag.indexOf(textPlaceholder) > -1) {
textToInsert = tag.replace(textPlaceholder, selected); textToInsert = tag.replace(textPlaceholder, selected);
} else { } else {
textToInsert = '' + startChar + tag + selected + (wrap ? tag : ' '); textToInsert = String(startChar) + tag + selected + (wrap ? tag : ' ');
} }
if (removedFirstNewLine) { if (removedFirstNewLine) {
......
export default { export default {
isLoggedIn(state, getters) { isLoggedIn(state, getters) {
return !!getters.getUserData.id; return Boolean(getters.getUserData.id);
}, },
}; };
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
computed: { computed: {
...mapGetters(['userCanReply']), ...mapGetters(['userCanReply']),
hasReplies() { hasReplies() {
return !!this.replies.length; return Boolean(this.replies.length);
}, },
replies() { replies() {
return this.discussion.notes.slice(1); return this.discussion.notes.slice(1);
......
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
}; };
}, },
canReportAsAbuse() { canReportAsAbuse() {
return !!this.note.report_abuse_path && this.author.id !== this.getUserData.id; return Boolean(this.note.report_abuse_path) && this.author.id !== this.getUserData.id;
}, },
noteAnchorId() { noteAnchorId() {
return `note_${this.note.id}`; return `note_${this.note.id}`;
......
export default { export default {
methods: { methods: {
isConfidential(issue) { isConfidential(issue) {
return !!issue.confidential; return Boolean(issue.confidential);
}, },
isLocked(issue) { isLocked(issue) {
return !!issue.discussion_locked; return Boolean(issue.discussion_locked);
}, },
hasWarning(issue) { hasWarning(issue) {
......
...@@ -20,7 +20,7 @@ export const getNoteableData = state => state.noteableData; ...@@ -20,7 +20,7 @@ export const getNoteableData = state => state.noteableData;
export const getNoteableDataByProp = state => prop => state.noteableData[prop]; export const getNoteableDataByProp = state => prop => state.noteableData[prop];
export const userCanReply = state => !!state.noteableData.current_user.can_create_note; export const userCanReply = state => Boolean(state.noteableData.current_user.can_create_note);
export const openState = state => state.noteableData.state; export const openState = state => state.noteableData.state;
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
// The text input is editable when there's a custom interval, or when it's // The text input is editable when there's a custom interval, or when it's
// a preset interval and the user clicks the 'custom' radio button // a preset interval and the user clicks the 'custom' radio button
isEditable() { isEditable() {
return !!(this.customInputEnabled || !this.intervalIsPreset); return Boolean(this.customInputEnabled || !this.intervalIsPreset);
}, },
}, },
watch: { watch: {
......
...@@ -35,7 +35,7 @@ export default () => { ...@@ -35,7 +35,7 @@ export default () => {
return createElement('delete-account-modal', { return createElement('delete-account-modal', {
props: { props: {
actionUrl: deleteAccountModalEl.dataset.actionUrl, actionUrl: deleteAccountModalEl.dataset.actionUrl,
confirmWithPassword: !!deleteAccountModalEl.dataset.confirmWithPassword, confirmWithPassword: Boolean(deleteAccountModalEl.dataset.confirmWithPassword),
username: deleteAccountModalEl.dataset.username, username: deleteAccountModalEl.dataset.username,
}, },
}); });
......
...@@ -57,7 +57,7 @@ export const validateProjectBilling = ({ dispatch, commit, state }) => ...@@ -57,7 +57,7 @@ export const validateProjectBilling = ({ dispatch, commit, state }) =>
resp => { resp => {
const { billingEnabled } = resp.result; const { billingEnabled } = resp.result;
commit(types.SET_PROJECT_BILLING_STATUS, !!billingEnabled); commit(types.SET_PROJECT_BILLING_STATUS, Boolean(billingEnabled));
dispatch('setIsValidatingProjectBilling', false); dispatch('setIsValidatingProjectBilling', false);
resolve(); resolve();
}, },
......
export const hasProject = state => !!state.selectedProject.projectId; export const hasProject = state => Boolean(state.selectedProject.projectId);
export const hasZone = state => !!state.selectedZone; export const hasZone = state => Boolean(state.selectedZone);
export const hasMachineType = state => !!state.selectedMachineType; export const hasMachineType = state => Boolean(state.selectedMachineType);
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
[types.SET_REPOS_LIST](state, list) { [types.SET_REPOS_LIST](state, list) {
Object.assign(state, { Object.assign(state, {
repos: list.map(el => ({ repos: list.map(el => ({
canDelete: !!el.destroy_path, canDelete: Boolean(el.destroy_path),
destroyPath: el.destroy_path, destroyPath: el.destroy_path,
id: el.id, id: el.id,
isLoading: false, isLoading: false,
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
location: element.location, location: element.location,
createdAt: element.created_at, createdAt: element.created_at,
destroyPath: element.destroy_path, destroyPath: element.destroy_path,
canDelete: !!element.destroy_path, canDelete: Boolean(element.destroy_path),
})); }));
}, },
......
...@@ -82,9 +82,9 @@ Sidebar.prototype.toggleTodo = function(e) { ...@@ -82,9 +82,9 @@ Sidebar.prototype.toggleTodo = function(e) {
ajaxType = $this.data('deletePath') ? 'delete' : 'post'; ajaxType = $this.data('deletePath') ? 'delete' : 'post';
if ($this.data('deletePath')) { if ($this.data('deletePath')) {
url = '' + $this.data('deletePath'); url = String($this.data('deletePath'));
} else { } else {
url = '' + $this.data('createPath'); url = String($this.data('createPath'));
} }
$this.tooltip('hide'); $this.tooltip('hide');
......
...@@ -379,7 +379,7 @@ export class SearchAutocomplete { ...@@ -379,7 +379,7 @@ export class SearchAutocomplete {
} }
} }
} }
this.wrap.toggleClass('has-value', !!e.target.value); this.wrap.toggleClass('has-value', Boolean(e.target.value));
} }
onSearchInputFocus() { onSearchInputFocus() {
...@@ -396,7 +396,7 @@ export class SearchAutocomplete { ...@@ -396,7 +396,7 @@ export class SearchAutocomplete {
onClearInputClick(e) { onClearInputClick(e) {
e.preventDefault(); e.preventDefault();
this.wrap.toggleClass('has-value', !!e.target.value); this.wrap.toggleClass('has-value', Boolean(e.target.value));
return this.searchInput.val('').focus(); return this.searchInput.val('').focus();
} }
......
...@@ -49,10 +49,10 @@ export default { ...@@ -49,10 +49,10 @@ export default {
}, },
computed: { computed: {
hasTimeSpent() { hasTimeSpent() {
return !!this.timeSpent; return Boolean(this.timeSpent);
}, },
hasTimeEstimate() { hasTimeEstimate() {
return !!this.timeEstimate; return Boolean(this.timeEstimate);
}, },
showComparisonState() { showComparisonState() {
return this.hasTimeEstimate && this.hasTimeSpent; return this.hasTimeEstimate && this.hasTimeSpent;
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
return !this.hasTimeEstimate && !this.hasTimeSpent; return !this.hasTimeEstimate && !this.hasTimeSpent;
}, },
showHelpState() { showHelpState() {
return !!this.showHelp; return Boolean(this.showHelp);
}, },
}, },
created() { created() {
......
...@@ -77,16 +77,16 @@ export default { ...@@ -77,16 +77,16 @@ export default {
return this.deployment.external_url; return this.deployment.external_url;
}, },
hasExternalUrls() { hasExternalUrls() {
return !!(this.deployment.external_url && this.deployment.external_url_formatted); return Boolean(this.deployment.external_url && this.deployment.external_url_formatted);
}, },
hasDeploymentTime() { hasDeploymentTime() {
return !!(this.deployment.deployed_at && this.deployment.deployed_at_formatted); return Boolean(this.deployment.deployed_at && this.deployment.deployed_at_formatted);
}, },
hasDeploymentMeta() { hasDeploymentMeta() {
return !!(this.deployment.url && this.deployment.name); return Boolean(this.deployment.url && this.deployment.name);
}, },
hasMetrics() { hasMetrics() {
return !!this.deployment.metrics_url; return Boolean(this.deployment.metrics_url);
}, },
deployedText() { deployedText() {
return this.$options.deployedTextMap[this.deployment.status]; return this.$options.deployedTextMap[this.deployment.status];
......
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
return this.isPostMerge ? this.mr.mergePipeline : this.mr.pipeline; return this.isPostMerge ? this.mr.mergePipeline : this.mr.pipeline;
}, },
showVisualReviewAppLink() { showVisualReviewAppLink() {
return !!(this.mr.visualReviewFF && this.mr.visualReviewAppAvailable); return Boolean(this.mr.visualReviewFF && this.mr.visualReviewAppAvailable);
}, },
}, },
}; };
......
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
return this.mr.hasCI; return this.mr.hasCI;
}, },
shouldRenderRelatedLinks() { shouldRenderRelatedLinks() {
return !!this.mr.relatedLinks && !this.mr.isNothingToMergeState; return Boolean(this.mr.relatedLinks) && !this.mr.isNothingToMergeState;
}, },
shouldRenderSourceBranchRemovalStatus() { shouldRenderSourceBranchRemovalStatus() {
return ( return (
......
...@@ -79,7 +79,7 @@ export default class MergeRequestStore { ...@@ -79,7 +79,7 @@ export default class MergeRequestStore {
this.autoMergeStrategy = data.auto_merge_strategy; this.autoMergeStrategy = data.auto_merge_strategy;
this.mergePath = data.merge_path; this.mergePath = data.merge_path;
this.ffOnlyEnabled = data.ff_only_enabled; this.ffOnlyEnabled = data.ff_only_enabled;
this.shouldBeRebased = !!data.should_be_rebased; this.shouldBeRebased = Boolean(data.should_be_rebased);
this.statusPath = data.status_path; this.statusPath = data.status_path;
this.emailPatchesPath = data.email_patches_path; this.emailPatchesPath = data.email_patches_path;
this.plainDiffPath = data.plain_diff_path; this.plainDiffPath = data.plain_diff_path;
...@@ -92,9 +92,9 @@ export default class MergeRequestStore { ...@@ -92,9 +92,9 @@ export default class MergeRequestStore {
this.isOpen = data.state === 'opened'; this.isOpen = data.state === 'opened';
this.hasMergeableDiscussionsState = data.mergeable_discussions_state === false; this.hasMergeableDiscussionsState = data.mergeable_discussions_state === false;
this.canRemoveSourceBranch = currentUser.can_remove_source_branch || false; this.canRemoveSourceBranch = currentUser.can_remove_source_branch || false;
this.canMerge = !!data.merge_path; this.canMerge = Boolean(data.merge_path);
this.canCreateIssue = currentUser.can_create_issue || false; this.canCreateIssue = currentUser.can_create_issue || false;
this.canCancelAutomaticMerge = !!data.cancel_auto_merge_path; this.canCancelAutomaticMerge = Boolean(data.cancel_auto_merge_path);
this.isSHAMismatch = this.sha !== data.diff_head_sha; this.isSHAMismatch = this.sha !== data.diff_head_sha;
this.canBeMerged = data.can_be_merged || false; this.canBeMerged = data.can_be_merged || false;
this.isMergeAllowed = data.mergeable || false; this.isMergeAllowed = data.mergeable || false;
......
...@@ -34,7 +34,7 @@ export default { ...@@ -34,7 +34,7 @@ export default {
format: 'yyyy-mm-dd', format: 'yyyy-mm-dd',
container: this.$el, container: this.$el,
defaultDate: this.selectedDate, defaultDate: this.selectedDate,
setDefaultDate: !!this.selectedDate, setDefaultDate: Boolean(this.selectedDate),
minDate: this.minDate, minDate: this.minDate,
maxDate: this.maxDate, maxDate: this.maxDate,
parse: dateString => parsePikadayDate(dateString), parse: dateString => parsePikadayDate(dateString),
......
...@@ -121,7 +121,7 @@ export default { ...@@ -121,7 +121,7 @@ export default {
this.change(1); this.change(1);
break; break;
default: default:
this.change(+text); this.change(Number(text));
break; break;
} }
}, },
......
...@@ -39,7 +39,7 @@ if (BABEL_ENV === 'karma' || BABEL_ENV === 'coverage') { ...@@ -39,7 +39,7 @@ if (BABEL_ENV === 'karma' || BABEL_ENV === 'coverage') {
} }
// Jest is running in node environment, so we need additional plugins // Jest is running in node environment, so we need additional plugins
const isJest = !!process.env.JEST_WORKER_ID; const isJest = Boolean(process.env.JEST_WORKER_ID);
if (isJest) { if (isJest) {
plugins.push('@babel/plugin-transform-modules-commonjs'); plugins.push('@babel/plugin-transform-modules-commonjs');
/* /*
......
...@@ -16,4 +16,6 @@ const vNodeContainsText = (vnode, text) => ...@@ -16,4 +16,6 @@ const vNodeContainsText = (vnode, text) =>
* @param {String} text * @param {String} text
*/ */
export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) => export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) =>
!!shallowWrapper.vm.$slots[slotName].filter(vnode => vNodeContainsText(vnode, text)).length; Boolean(
shallowWrapper.vm.$slots[slotName].filter(vnode => vNodeContainsText(vnode, text)).length,
);
...@@ -16,4 +16,6 @@ const vNodeContainsText = (vnode, text) => ...@@ -16,4 +16,6 @@ const vNodeContainsText = (vnode, text) =>
* @param {String} text * @param {String} text
*/ */
export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) => export const shallowWrapperContainsSlotText = (shallowWrapper, slotName, text) =>
!!shallowWrapper.vm.$slots[slotName].filter(vnode => vNodeContainsText(vnode, text)).length; Boolean(
shallowWrapper.vm.$slots[slotName].filter(vnode => vNodeContainsText(vnode, text)).length,
);
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
reference.getAttribute('xlink:href').endsWith(`#${iconName}`), reference.getAttribute('xlink:href').endsWith(`#${iconName}`),
); );
const result = { const result = {
pass: !!matchingIcon, pass: Boolean(matchingIcon),
}; };
if (result.pass) { if (result.pass) {
......
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