Commit 6fc8bc3e authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'lm-replace-underscore-random-places' into 'master'

Replaces underscore with lodash

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