Skip to content
Snippets Groups Projects
Commit bee3c7e8 authored by Nathan Friend's avatar Nathan Friend Committed by Mike Greiling
Browse files

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

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 deebe0bf
No related branches found
No related tags found
No related merge requests found
Showing
with 27 additions and 26 deletions
Loading
Loading
@@ -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...
let foundMessage = !!documentFragment.querySelector('.md');
let foundMessage = Boolean(documentFragment.querySelector('.md'));
 
// ... Or come from a message
if (!foundMessage) {
Loading
Loading
Loading
Loading
@@ -124,7 +124,7 @@ export default {
data.issues.forEach(issueObj => {
const issue = new ListIssue(issueObj);
const foundSelectedIssue = ModalStore.findSelectedIssue(issue);
issue.selected = !!foundSelectedIssue;
issue.selected = Boolean(foundSelectedIssue);
 
this.issues.push(issue);
});
Loading
Loading
Loading
Loading
@@ -37,8 +37,8 @@ class List {
this.type = obj.list_type;
 
const typeInfo = this.getTypeInfo(this.type);
this.preset = !!typeInfo.isPreset;
this.isExpandable = !!typeInfo.isExpandable;
this.preset = Boolean(typeInfo.isPreset);
this.isExpandable = Boolean(typeInfo.isExpandable);
this.isExpanded = true;
this.page = 1;
this.loading = true;
Loading
Loading
Loading
Loading
@@ -23,7 +23,7 @@ class DeleteModal {
const branchData = e.currentTarget.dataset;
this.branchName = branchData.branchName || '';
this.deletePath = branchData.deletePath || '';
this.isMerged = !!branchData.isMerged;
this.isMerged = Boolean(branchData.isMerged);
this.updateModal();
}
 
Loading
Loading
Loading
Loading
@@ -142,7 +142,7 @@ export default {
);
},
hasLogo() {
return !!this.logoUrl;
return Boolean(this.logoUrl);
},
identiconId() {
// generate a deterministic integer id for the identicon background
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ export default function initCompareAutocomplete(limitTo = null, clickHandler = (
},
selectable: true,
filterable: true,
filterRemote: !!$dropdown.data('refsUrl'),
filterRemote: Boolean($dropdown.data('refsUrl')),
fieldName: $dropdown.data('fieldName'),
filterInput: 'input[type="search"]',
renderRow: function(ref) {
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ export default class CreateItemDropdown {
this.fieldName = options.fieldName;
this.onSelect = options.onSelect || (() => {});
this.getDataOption = options.getData;
this.getDataRemote = !!options.filterRemote;
this.getDataRemote = Boolean(options.filterRemote);
this.createNewItemFromValueOption = options.createNewItemFromValue;
this.$dropdown = options.$dropdown;
this.$dropdownContainer = this.$dropdown.parent();
Loading
Loading
Loading
Loading
@@ -2,10 +2,10 @@ import _ from 'underscore';
import { __, s__, sprintf } from '~/locale';
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) =>
!!state.selectedProject &&
Boolean(state.selectedProject) &&
getters.hasProjects &&
!state.projects.some(project => _.isMatch(state.selectedProject, project));
 
Loading
Loading
Loading
Loading
@@ -51,7 +51,7 @@ export const fetchSearchedItems = ({ state, dispatch }, searchQuery) => {
const params = {
simple: true,
per_page: 20,
membership: !!gon.current_user_id,
membership: Boolean(gon.current_user_id),
};
 
if (state.namespace === 'projects') {
Loading
Loading
Loading
Loading
@@ -307,8 +307,8 @@ GitLabDropdown = (function() {
// Set Defaults
this.filterInput = this.options.filterInput || this.getElement(FILTER_INPUT);
this.noFilterInput = this.options.noFilterInput || this.getElement(NO_FILTER_INPUT);
this.highlight = !!this.options.highlight;
this.icon = !!this.options.icon;
this.highlight = Boolean(this.options.highlight);
this.icon = Boolean(this.options.icon);
this.filterInputBlur =
this.options.filterInputBlur != null ? this.options.filterInputBlur : true;
// If no input is passed create a default one
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ export default class GLForm {
const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {};
Object.keys(this.enableGFM).forEach(item => {
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
Loading
Loading
Loading
Loading
@@ -105,7 +105,7 @@ export default {
.then(() => {
this.initManager('#ide-preview', this.sandboxOpts, {
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),
},
});
Loading
Loading
Loading
Loading
@@ -30,7 +30,7 @@ export default {
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommittedChanges', 'activeFile']),
...mapGetters('commit', ['discardDraftButtonDisabled']),
showStageUnstageArea() {
return !!(this.someUncommittedChanges || this.lastCommitMsg || !this.unusedSeal);
return Boolean(this.someUncommittedChanges || this.lastCommitMsg || !this.unusedSeal);
},
activeFileKey() {
return this.activeFile ? this.activeFile.key : null;
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@ export const defaultEditorOptions = {
 
export default [
{
readOnly: model => !!model.file.file_lock,
readOnly: model => Boolean(model.file.file_lock),
quickSuggestions: model => !(model.language === 'markdown'),
},
];
Loading
Loading
@@ -42,9 +42,10 @@ export const emptyRepo = state =>
export const currentTree = state =>
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 =>
Object.keys(state.entries)
Loading
Loading
@@ -70,7 +71,7 @@ export const isCommitModeActive = state => state.currentActivityView === activit
export const isReviewModeActive = state => state.currentActivityView === activityBarViews.review;
 
export const someUncommittedChanges = state =>
!!(state.changedFiles.length || state.stagedFiles.length);
Boolean(state.changedFiles.length || state.stagedFiles.length);
 
export const getChangesInFolder = state => path => {
const changedFilesCount = state.changedFiles.filter(f => filePathMatches(f.path, path)).length;
Loading
Loading
Loading
Loading
@@ -102,7 +102,7 @@ export const updateFilesAfterCommit = ({ commit, dispatch, rootState, rootGetter
 
eventHub.$emit(`editor.update.model.content.${file.key}`, {
content: file.content,
changed: !!changedFile,
changed: Boolean(changedFile),
});
});
};
Loading
Loading
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 =>
state.latestPipeline && state.latestPipeline.details.status.text === states.failed;
Loading
Loading
Loading
Loading
@@ -142,7 +142,7 @@ export default {
 
Object.assign(state.entries[file.path], {
raw: file.content,
changed: !!changedFile,
changed: Boolean(changedFile),
staged: false,
prevPath: '',
moved: false,
Loading
Loading
Loading
Loading
@@ -14,7 +14,7 @@ export function addCommentIndicator(containerEl, { x, y }) {
export function removeCommentIndicator(imageFrameEl) {
const commentIndicatorEl = imageFrameEl.querySelector('.comment-indicator');
const imageEl = imageFrameEl.querySelector('img');
const willRemove = !!commentIndicatorEl;
const willRemove = Boolean(commentIndicatorEl);
let meta = {};
 
if (willRemove) {
Loading
Loading
Loading
Loading
@@ -6,8 +6,8 @@ import { isImageLoaded } from '../lib/utils/image_utility';
export default class ImageDiff {
constructor(el, options) {
this.el = el;
this.canCreateNote = !!(options && options.canCreateNote);
this.renderCommentBadge = !!(options && options.renderCommentBadge);
this.canCreateNote = Boolean(options && options.canCreateNote);
this.renderCommentBadge = Boolean(options && options.renderCommentBadge);
this.$noteContainer = $('.note-container', this.el);
this.imageBadges = [];
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment