Commit e9d2a2e1 authored by lauraMon's avatar lauraMon

Replaces underscore with lodash

And vanilla JS when possible
parent 8d17d7c3
......@@ -6,7 +6,7 @@ import {
GlModal,
GlModalDirective,
} from '@gitlab/ui';
import _ from 'underscore';
import { escape as esc } from 'lodash';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import ToggleButton from '~/vue_shared/components/toggle_button.vue';
import axios from '~/lib/utils/axios_utils';
......@@ -65,7 +65,7 @@ export default {
'AlertService|%{linkStart}Learn more%{linkEnd} about configuring this endpoint to receive alerts.',
),
{
linkStart: `<a href="${_.escape(
linkStart: `<a href="${esc(
this.learnMoreUrl,
)}" target="_blank" rel="noopener noreferrer">`,
linkEnd: '</a>',
......
import _ from 'underscore';
import { escape as esc } from 'lodash';
import '~/gl_dropdown';
export default class CreateItemDropdown {
......@@ -37,14 +37,14 @@ export default class CreateItemDropdown {
},
selectable: true,
toggleLabel(selected) {
return selected && 'id' in selected ? _.escape(selected.title) : this.defaultToggleLabel;
return selected && 'id' in selected ? esc(selected.title) : this.defaultToggleLabel;
},
fieldName: this.fieldName,
text(item) {
return _.escape(item.text);
return esc(item.text);
},
id(item) {
return _.escape(item.id);
return esc(item.id);
},
onFilter: this.toggleCreateNewButton.bind(this),
clicked: options => {
......
......@@ -9,7 +9,7 @@ import {
GlEmptyState,
GlTable,
} from '@gitlab/ui';
import _ from 'underscore';
import { escape as esc } from 'lodash';
import Tracking from '~/tracking';
import PackageActivity from './activity.vue';
import PackageInformation from './information.vue';
......@@ -83,8 +83,8 @@ export default {
`PackageRegistry|You are about to delete version %{boldStart}%{version}%{boldEnd} of %{boldStart}%{name}%{boldEnd}. Are you sure?`,
),
{
version: _.escape(this.packageEntity.version),
name: _.escape(this.packageEntity.name),
version: esc(this.packageEntity.version),
name: esc(this.packageEntity.name),
boldStart: '<b>',
boldEnd: '</b>',
},
......
......@@ -8,7 +8,7 @@ import {
GlSearchBoxByType,
GlLoadingIcon,
} from '@gitlab/ui';
import { debounce } from 'underscore';
import { debounce } from 'lodash';
import { __ } from '~/locale';
import ProjectAvatar from '~/vue_shared/components/project_avatar/default.vue';
......
......@@ -8,7 +8,7 @@ import {
GlDeprecatedButton,
GlTooltip,
} from '@gitlab/ui';
import _ from 'underscore';
import { isEmpty } from 'lodash';
import ItemWeight from 'ee/boards/components/issue_card_weight.vue';
import { __ } from '~/locale';
......@@ -71,7 +71,7 @@ export default {
return this.item.state === ChildState.Closed;
},
hasMilestone() {
return !_.isEmpty(this.item.milestone);
return !isEmpty(this.item.milestone);
},
hasAssignees() {
return this.item.assignees && this.item.assignees.length > 0;
......
<script>
import { mapState, mapActions } from 'vuex';
import _ from 'underscore';
import { escape as esc } from 'lodash';
import { GlModal } from '@gitlab/ui';
......@@ -30,13 +30,13 @@ export default {
if (this.removeItemType === ChildType.Epic) {
Object.assign(sprintfParams, {
targetEpicTitle: _.escape(this.removeItemModalProps.item.title),
parentEpicTitle: _.escape(this.parentItem.title),
targetEpicTitle: esc(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title),
});
} else {
Object.assign(sprintfParams, {
targetIssueTitle: _.escape(this.removeItemModalProps.item.title),
parentEpicTitle: _.escape(this.parentItem.title),
targetIssueTitle: esc(this.removeItemModalProps.item.title),
parentEpicTitle: esc(this.parentItem.title),
});
}
......
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