Commit b261fb7b authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'adopt-es-module-syntax' into 'master'

Adopt ES module syntax

See merge request !9567
parents 53f18d83 97724e62
......@@ -27,6 +27,7 @@
},
"rules": {
"filenames/match-regex": [2, "^[a-z0-9_]+$"],
"import/no-commonjs": "error",
"no-multiple-empty-lines": ["error", { "max": 1 }],
"promise/catch-or-return": "error"
}
......
......@@ -6,23 +6,22 @@ import Vue from 'vue';
import VueResource from 'vue-resource';
import FilteredSearchBoards from './filtered_search_boards';
import eventHub from './eventhub';
require('./models/issue');
require('./models/label');
require('./models/list');
require('./models/milestone');
require('./models/assignee');
require('./stores/boards_store');
require('./stores/modal_store');
require('./services/board_service');
require('./mixins/modal_mixins');
require('./mixins/sortable_default_options');
require('./filters/due_date_filters');
require('./components/board');
require('./components/board_sidebar');
require('./components/new_list_dropdown');
require('./components/modal/index');
require('../vue_shared/vue_resource_interceptor');
import './models/issue';
import './models/label';
import './models/list';
import './models/milestone';
import './models/assignee';
import './stores/boards_store';
import './stores/modal_store';
import './services/board_service';
import './mixins/modal_mixins';
import './mixins/sortable_default_options';
import './filters/due_date_filters';
import './components/board';
import './components/board_sidebar';
import './components/new_list_dropdown';
import './components/modal/index';
import '../vue_shared/vue_resource_interceptor';
Vue.use(VueResource);
......
......@@ -3,9 +3,7 @@
import Vue from 'vue';
import boardList from './board_list';
import boardBlankState from './board_blank_state';
require('./board_delete');
require('./board_list');
import './board_delete';
const Store = gl.issueBoards.BoardsStore;
......
require('./issue_card_inner');
import './issue_card_inner';
const Store = gl.issueBoards.BoardsStore;
......
......@@ -7,11 +7,9 @@
import Vue from 'vue';
import eventHub from '../../sidebar/event_hub';
import AssigneeTitle from '../../sidebar/components/assignees/assignee_title';
import Assignees from '../../sidebar/components/assignees/assignees';
require('./sidebar/remove_issue');
import './sidebar/remove_issue';
const Store = gl.issueBoards.BoardsStore;
......
......@@ -2,8 +2,7 @@
/* global Flash */
import Vue from 'vue';
require('./lists_dropdown');
import './lists_dropdown';
const ModalStore = gl.issueBoards.ModalStore;
......
import Vue from 'vue';
import modalFilters from './filters';
require('./tabs');
import './tabs';
const ModalStore = gl.issueBoards.ModalStore;
......
......@@ -3,11 +3,10 @@
import Vue from 'vue';
import queryData from '../../utils/query_data';
import loadingIcon from '../../../vue_shared/components/loading_icon.vue';
require('./header');
require('./list');
require('./footer');
require('./empty_state');
import './header';
import './list';
import './footer';
import './empty_state';
const ModalStore = gl.issueBoards.ModalStore;
......
/* eslint-disable class-methods-use-this, object-shorthand, no-unused-vars, no-use-before-define, no-new, max-len, no-restricted-syntax, guard-for-in, no-continue */
require('./lib/utils/common_utils');
import './lib/utils/common_utils';
const gfmRules = {
// The filters referenced in lib/banzai/pipeline/gfm_pipeline.rb convert
......
......@@ -4,18 +4,16 @@ import Vue from 'vue';
import Cookies from 'js-cookie';
import Translate from '../vue_shared/translate';
import LimitWarningComponent from './components/limit_warning_component';
require('./components/stage_code_component');
require('./components/stage_issue_component');
require('./components/stage_plan_component');
require('./components/stage_production_component');
require('./components/stage_review_component');
require('./components/stage_staging_component');
require('./components/stage_test_component');
require('./components/total_time_component');
require('./cycle_analytics_service');
require('./cycle_analytics_store');
require('./default_event_objects');
import './components/stage_code_component';
import './components/stage_issue_component';
import './components/stage_plan_component';
import './components/stage_production_component';
import './components/stage_review_component';
import './components/stage_staging_component';
import './components/stage_test_component';
import './components/total_time_component';
import './cycle_analytics_service';
import './cycle_analytics_store';
Vue.use(Translate);
......
/* eslint-disable no-param-reassign */
import { __ } from '../locale';
require('../lib/utils/text_utility');
const DEFAULT_EVENT_OBJECTS = require('./default_event_objects');
import { __ } from '../locale';
import '../lib/utils/text_utility';
import DEFAULT_EVENT_OBJECTS from './default_event_objects';
const global = window.gl || (window.gl = {});
global.cycleAnalytics = global.cycleAnalytics || {};
......
module.exports = {
export default {
issue: {
created_at: '',
url: '',
......
/* eslint-disable class-methods-use-this */
require('./lib/utils/url_utility');
import './lib/utils/url_utility';
const UNFOLD_COUNT = 20;
let isBound = false;
......
......@@ -2,19 +2,18 @@
/* global ResolveCount */
import Vue from 'vue';
require('./models/discussion');
require('./models/note');
require('./stores/comments');
require('./services/resolve');
require('./mixins/discussion');
require('./components/comment_resolve_btn');
require('./components/jump_to_discussion');
require('./components/resolve_btn');
require('./components/resolve_count');
require('./components/resolve_discussion_btn');
require('./components/diff_note_avatars');
require('./components/new_issue_for_discussion');
import './models/discussion';
import './models/note';
import './stores/comments';
import './services/resolve';
import './mixins/discussion';
import './components/comment_resolve_btn';
import './components/jump_to_discussion';
import './components/resolve_btn';
import './components/resolve_count';
import './components/resolve_discussion_btn';
import './components/diff_note_avatars';
import './components/new_issue_for_discussion';
$(() => {
const projectPath = document.querySelector('.merge-request').dataset.projectPath;
......
......@@ -3,11 +3,7 @@
/* global CommentsStore */
import Vue from 'vue';
import VueResource from 'vue-resource';
require('../../vue_shared/vue_resource_interceptor');
Vue.use(VueResource);
import '../../vue_shared/vue_resource_interceptor';
window.gl = window.gl || {};
......
......@@ -34,7 +34,6 @@
/* global ShortcutsWiki */
import Issue from './issue';
import BindInOut from './behaviors/bind_in_out';
import DeleteModal from './branches/branches_delete_modal';
import Group from './group';
......@@ -54,8 +53,7 @@ import AutoWidthDropdownSelect from './issuable/auto_width_dropdown_select';
import UsersSelect from './users_select';
import RefSelectDropdown from './ref_select_dropdown';
import GfmAutoComplete from './gfm_auto_complete';
const ShortcutsBlob = require('./shortcuts_blob');
import ShortcutsBlob from './shortcuts_blob';
(function() {
var Dispatcher;
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, one-var, no-var, one-var-declaration-per-line, no-unused-vars, camelcase, quotes, no-useless-concat, prefer-template, quote-props, comma-dangle, object-shorthand, consistent-return, prefer-arrow-callback */
/* global Dropzone */
require('./preview_markdown');
import './preview_markdown';
window.DropzoneInput = (function() {
function DropzoneInput(form) {
......
import Filter from '~/droplab/plugins/filter';
require('./filtered_search_dropdown');
import './filtered_search_dropdown';
class DropdownHint extends gl.FilteredSearchDropdown {
constructor(droplab, dropdown, input, filter) {
......
......@@ -2,8 +2,7 @@
import Ajax from '~/droplab/plugins/ajax';
import Filter from '~/droplab/plugins/filter';
require('./filtered_search_dropdown');
import './filtered_search_dropdown';
class DropdownNonUser extends gl.FilteredSearchDropdown {
constructor(droplab, dropdown, input, filter, endpoint, symbol) {
......
/* global Flash */
import AjaxFilter from '~/droplab/plugins/ajax_filter';
require('./filtered_search_dropdown');
import './filtered_search_dropdown';
class DropdownUser extends gl.FilteredSearchDropdown {
constructor(droplab, dropdown, input, filter) {
......
require('./dropdown_hint');
require('./dropdown_non_user');
require('./dropdown_user');
require('./dropdown_utils');
require('./filtered_search_dropdown_manager');
require('./filtered_search_dropdown');
require('./filtered_search_manager');
require('./filtered_search_token_keys');
require('./filtered_search_tokenizer');
require('./filtered_search_visual_tokens');
import './dropdown_hint';
import './dropdown_non_user';
import './dropdown_user';
import './dropdown_utils';
import './filtered_search_dropdown_manager';
import './filtered_search_dropdown';
import './filtered_search_manager';
import './filtered_search_token_keys';
import './filtered_search_tokenizer';
import './filtered_search_visual_tokens';
require('./filtered_search_token_keys');
import './filtered_search_token_keys';
class FilteredSearchTokenizer {
static processTokens(input) {
......
/* eslint-disable comma-dangle, class-methods-use-this, max-len, space-before-function-paren, arrow-parens, no-param-reassign */
require('./gl_field_error');
import './gl_field_error';
const customValidationFlag = 'gl-field-error-ignore';
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, one-var, no-underscore-dangle, one-var-declaration-per-line, object-shorthand, no-unused-vars, no-new, comma-dangle, consistent-return, quotes, dot-notation, quote-props, prefer-arrow-callback, max-len */
/* global Flash */
import CreateMergeRequestDropdown from './create_merge_request_dropdown';
/* global Flash */
require('./flash');
require('~/lib/utils/text_utility');
require('vendor/jquery.waitforimages');
require('./task_list');
import 'vendor/jquery.waitforimages';
import '~/lib/utils/text_utility';
import './flash';
import './task_list';
import CreateMergeRequestDropdown from './create_merge_request_dropdown';
class Issue {
constructor() {
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, comma-dangle, no-unused-expressions, prefer-template, max-len */
/* global timeago */
/* global dateFormat */
window.timeago = require('timeago.js');
window.dateFormat = require('vendor/date.format');
import timeago from 'timeago.js';
import dateFormat from 'vendor/date.format';
window.timeago = timeago;
window.dateFormat = dateFormat;
(function() {
(function(w) {
......@@ -101,8 +102,7 @@ window.dateFormat = require('vendor/date.format');
};
w.gl.utils.updateTimeagoText = function(el) {
const timeago = gl.utils.getTimeago();
const formattedDate = timeago.format(el.getAttribute('datetime'), 'gl_en');
const formattedDate = gl.utils.getTimeago().format(el.getAttribute('datetime'), 'gl_en');
if (el.textContent !== formattedDate) {
el.textContent = formattedDate;
......
......@@ -2,9 +2,7 @@
* exports HTTP status codes
*/
const statusCodes = {
export default {
NO_CONTENT: 204,
OK: 200,
};
module.exports = statusCodes;
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, no-param-reassign, no-cond-assign, quotes, one-var, one-var-declaration-per-line, operator-assignment, no-else-return, prefer-template, prefer-arrow-callback, no-empty, max-len, consistent-return, no-unused-vars, no-return-assign, max-len, vars-on-top */
require('vendor/latinise');
import 'vendor/latinise';
var base;
var w = window;
......
......@@ -4,8 +4,6 @@
//
// Handles single- and multi-line selection and highlight for blob views.
//
require('vendor/jquery.scrollTo');
//
// ### Example Markup
//
......
......@@ -170,7 +170,7 @@ import './visibility_select';
import './wikis';
import './zen_mode';
// eslint-disable-next-line global-require
// eslint-disable-next-line global-require, import/no-commonjs
if (process.env.NODE_ENV !== 'production') require('./test_utils/');
document.addEventListener('beforeunload', function () {
......
......@@ -2,14 +2,13 @@
/* global Flash */
import Vue from 'vue';
require('./merge_conflict_store');
require('./merge_conflict_service');
require('./mixins/line_conflict_utils');
require('./mixins/line_conflict_actions');
require('./components/diff_file_editor');
require('./components/inline_conflict_lines');
require('./components/parallel_conflict_lines');
import './merge_conflict_store';
import './merge_conflict_service';
import './mixins/line_conflict_utils';
import './mixins/line_conflict_actions';
import './components/diff_file_editor';
import './components/inline_conflict_lines';
import './components/parallel_conflict_lines';
$(() => {
const INTERACTIVE_RESOLVE_MODE = 'interactive';
......
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */
/* global MergeRequestTabs */
require('vendor/jquery.waitforimages');
require('./task_list');
require('./merge_request_tabs');
import 'vendor/jquery.waitforimages';
import './task_list';
import './merge_request_tabs';
(function() {
this.MergeRequest = (function() {
......
......@@ -6,15 +6,17 @@
import $ from 'jquery';
import Cookies from 'js-cookie';
import autosize from 'vendor/autosize';
import Dropzone from 'dropzone';
import 'vendor/jquery.caret'; // required by jquery.atwho
import 'vendor/jquery.atwho';
import CommentTypeToggle from './comment_type_toggle';
import './autosave';
import './dropzone_input';
import './task_list';
require('./autosave');
window.autosize = require('vendor/autosize');
window.Dropzone = require('dropzone');
require('./dropzone_input');
require('vendor/jquery.caret'); // required by jquery.atwho
require('vendor/jquery.atwho');
require('./task_list');
window.autosize = autosize;
window.Dropzone = Dropzone;
const normalizeNewlines = function(str) {
return str.replace(/\r\n/g, '\n');
......
require('~/lib/utils/common_utils');
require('~/lib/utils/url_utility');
import '~/lib/utils/common_utils';
import '~/lib/utils/url_utility';
(() => {
const ENDLESS_SCROLL_BOTTOM_PX = 400;
......
require('./gl_crop');
require('./profile');
import './gl_crop';
import './profile';
require('./protected_branch_access_dropdown');
require('./protected_branch_create');
require('./protected_branch_dropdown');
require('./protected_branch_edit');
require('./protected_branch_edit_list');
import './protected_branch_access_dropdown';
import './protected_branch_create';
import './protected_branch_dropdown';
import './protected_branch_edit';
import './protected_branch_edit_list';
/* global Mousetrap */
/* global Shortcuts */
require('./shortcuts');
import './shortcuts';
const defaults = {
skipResetBindings: false,
fileBlobPermalinkUrl: null,
};
class ShortcutsBlob extends Shortcuts {
export default class ShortcutsBlob extends Shortcuts {
constructor(opts) {
const options = Object.assign({}, defaults, opts);
super(options.skipResetBindings);
......@@ -25,5 +25,3 @@ class ShortcutsBlob extends Shortcuts {
}
}
}
module.exports = ShortcutsBlob;
......@@ -2,7 +2,7 @@
/* global Mousetrap */
/* global ShortcutsNavigation */
require('./shortcuts_navigation');
import './shortcuts_navigation';
(function() {
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......
......@@ -3,8 +3,8 @@
/* global ShortcutsNavigation */
/* global sidebar */
require('mousetrap');
require('./shortcuts_navigation');
import 'mousetrap';
import './shortcuts_navigation';
(function() {
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......
/* eslint-disable func-names, space-before-function-paren, max-len, no-var, one-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-arrow-callback, consistent-return, no-return-assign */
/* global Mousetrap */
/* global Shortcuts */
import findAndFollowLink from './shortcuts_dashboard_navigation';
require('./shortcuts');
import findAndFollowLink from './shortcuts_dashboard_navigation';
import './shortcuts';
(function() {
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......
......@@ -2,7 +2,7 @@
/* global Mousetrap */
/* global ShortcutsNavigation */
require('./shortcuts_navigation');
import './shortcuts_navigation';
(function() {
var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
......
/* global Flash */
require('vendor/task_list');
import 'vendor/task_list';
class TaskList {
constructor(options = {}) {
......
require('vendor/xterm/encoding-indexes.js');
require('vendor/xterm/encoding.js');
window.Terminal = require('vendor/xterm/xterm.js');
require('vendor/xterm/fit.js');
require('./terminal.js');
import 'vendor/xterm/encoding-indexes';
import 'vendor/xterm/encoding';
import Terminal from 'vendor/xterm/xterm';
import 'vendor/xterm/fit';
import './terminal';
window.Terminal = Terminal;
$(() => new gl.Terminal({ selector: '#terminal' }));
class VersionCheckImage {
export default class VersionCheckImage {
static bindErrorEvent(imageElement) {
imageElement.off('error').on('error', () => imageElement.hide());
}
......@@ -6,5 +6,3 @@ class VersionCheckImage {
window.gl = window.gl || {};
gl.VersionCheckImage = VersionCheckImage;
module.exports = VersionCheckImage;
require('../../lib/utils/text_utility');
import '../../lib/utils/text_utility';
export default {
name: 'MRWidgetHeader',
......
/* eslint-disable no-param-reassign */
/* global Breakpoints */
require('./breakpoints');
require('vendor/jquery.nicescroll');
import 'vendor/jquery.nicescroll';
import './breakpoints';
((global) => {
class Wikis {
......
/* eslint-disable func-names, space-before-function-paren, wrap-iife, prefer-arrow-callback, no-unused-vars, consistent-return, camelcase, comma-dangle, max-len */
/* global Dropzone */
/* global Mousetrap */
// Zen Mode (full screen) textarea
......@@ -7,10 +6,12 @@
/*= provides zen_mode:enter */
/*= provides zen_mode:leave */
require('vendor/jquery.scrollTo');
window.Dropzone = require('dropzone');
require('mousetrap');
require('mousetrap/plugins/pause/mousetrap-pause');
import 'vendor/jquery.scrollTo';
import Dropzone from 'dropzone';
import 'mousetrap';
import 'mousetrap/plugins/pause/mousetrap-pause';
window.Dropzone = Dropzone;
//
// ### Events
......
require('~/lib/utils/text_utility');
require('~/abuse_reports');
import '~/lib/utils/text_utility';
import '~/abuse_reports';
((global) => {
describe('Abuse Reports', () => {
......
/* eslint-disable no-unused-expressions, no-prototype-builtins, no-new, no-shadow, max-len */
require('vendor/jquery.endless-scroll.js');
require('~/pager');
require('~/activities');
import 'vendor/jquery.endless-scroll';
import '~/pager';
import '~/activities';
(() => {
window.gon || (window.gon = {});
......
require('~/extensions/array');
require('jquery');
require('jquery-ujs');
require('~/ajax_loading_spinner');
import '~/extensions/array';
import 'jquery';
import 'jquery-ujs';
import '~/ajax_loading_spinner';
describe('Ajax Loading Spinner', () => {
const fixtureTemplate = 'static/ajax_loading_spinner.html.raw';
......
......@@ -3,7 +3,7 @@
import Cookies from 'js-cookie';
import AwardsHandler from '~/awards_handler';
require('~/lib/utils/common_utils');
import '~/lib/utils/common_utils';
(function() {
var awardsHandler, lazyAssert, urlRoot, openAndWaitForEmojiMenu;
......
/* eslint-disable space-before-function-paren, no-var, comma-dangle, no-return-assign, max-len */
require('~/behaviors/autosize');
import '~/behaviors/autosize';
(function() {
describe('Autosize behavior', function() {
......
/* eslint-disable space-before-function-paren, no-var, no-return-assign, comma-dangle, jasmine/no-spec-dupes, new-cap, max-len */
require('~/behaviors/quick_submit');
import '~/behaviors/quick_submit';
(function() {
describe('Quick Submit behavior', function() {
......
/* eslint-disable space-before-function-paren, no-var */
require('~/behaviors/requires_input');
import '~/behaviors/requires_input';
(function() {
describe('requiresInput', function() {
......
require('~/gl_dropdown');
require('~/blob/create_branch_dropdown');
require('~/blob/target_branch_dropdown');
import '~/gl_dropdown';
import '~/blob/create_branch_dropdown';
import '~/blob/target_branch_dropdown';
describe('CreateBranchDropdown', () => {
const fixtureTemplate = 'static/target_branch_dropdown.html.raw';
......
require('~/gl_dropdown');
require('~/blob/create_branch_dropdown');
require('~/blob/target_branch_dropdown');
import '~/gl_dropdown';
import '~/blob/create_branch_dropdown';
import '~/blob/target_branch_dropdown';
describe('TargetBranchDropdown', () => {
const fixtureTemplate = 'static/target_branch_dropdown.html.raw';
......
......@@ -8,11 +8,11 @@
import Vue from 'vue';
import '~/boards/models/assignee';
require('~/boards/models/list');
require('~/boards/models/label');
require('~/boards/stores/boards_store');
const boardCard = require('~/boards/components/board_card').default;
require('./mock_data');
import '~/boards/models/list';
import '~/boards/models/label';
import '~/boards/stores/boards_store';
import boardCard from '~/boards/components/board_card';
import './mock_data';
describe('Issue card', () => {
let vm;
......
......@@ -6,8 +6,8 @@
import Vue from 'vue';
import boardNewIssue from '~/boards/components/board_new_issue';
require('~/boards/models/list');
require('./mock_data');
import '~/boards/models/list';
import './mock_data';
describe('Issue boards new issue form', () => {
let vm;
......
/* global CommitsList */
require('vendor/jquery.endless-scroll');
require('~/pager');
require('~/commits');
import 'vendor/jquery.endless-scroll';
import '~/pager';
import '~/commits';
(() => {
// TODO: remove this hack!
......
require('~/lib/utils/datetime_utility');
import '~/lib/utils/datetime_utility';
(() => {
describe('Date time utils', () => {
......
/* eslint-disable jasmine/no-global-setup, dot-notation, jasmine/no-expect-in-setup-teardown, max-len */
/* global CommentsStore */
require('~/diff_notes/models/discussion');
require('~/diff_notes/models/note');
require('~/diff_notes/stores/comments');
import '~/diff_notes/models/discussion';
import '~/diff_notes/models/note';
import '~/diff_notes/stores/comments';
function createDiscussion(noteId = 1, resolved = true) {
CommentsStore.create({
......
/* eslint-disable space-before-function-paren, no-var */
require('~/extensions/array');
import '~/extensions/array';
(function() {
describe('Array extensions', function() {
......
require('~/filtered_search/dropdown_utils');
require('~/filtered_search/filtered_search_tokenizer');
require('~/filtered_search/filtered_search_dropdown');
require('~/filtered_search/dropdown_user');
import '~/filtered_search/dropdown_utils';
import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown';
import '~/filtered_search/dropdown_user';
describe('Dropdown User', () => {
describe('getSearchInput', () => {
......
require('~/extensions/array');
require('~/filtered_search/dropdown_utils');
require('~/filtered_search/filtered_search_tokenizer');
require('~/filtered_search/filtered_search_dropdown_manager');
import '~/extensions/array';
import '~/filtered_search/dropdown_utils';
import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager';
describe('Dropdown Utils', () => {
describe('getEscapedText', () => {
......
require('~/extensions/array');
require('~/filtered_search/filtered_search_visual_tokens');
require('~/filtered_search/filtered_search_tokenizer');
require('~/filtered_search/filtered_search_dropdown_manager');
import '~/extensions/array';
import '~/filtered_search/filtered_search_visual_tokens';
import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager';
describe('Filtered Search Dropdown Manager', () => {
describe('addWordToInput', () => {
......
import * as recentSearchesStoreSrc from '~/filtered_search/stores/recent_searches_store';
import RecentSearchesService from '~/filtered_search/services/recent_searches_service';
import RecentSearchesServiceError from '~/filtered_search/services/recent_searches_service_error';
require('~/lib/utils/url_utility');
require('~/lib/utils/common_utils');
require('~/filtered_search/filtered_search_token_keys');
require('~/filtered_search/filtered_search_tokenizer');
require('~/filtered_search/filtered_search_dropdown_manager');
require('~/filtered_search/filtered_search_manager');
const FilteredSearchSpecHelper = require('../helpers/filtered_search_spec_helper');
import '~/lib/utils/url_utility';
import '~/lib/utils/common_utils';
import '~/filtered_search/filtered_search_token_keys';
import '~/filtered_search/filtered_search_tokenizer';
import '~/filtered_search/filtered_search_dropdown_manager';
import '~/filtered_search/filtered_search_manager';
import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper';
describe('Filtered Search Manager', () => {
let input;
......
require('~/extensions/array');
require('~/filtered_search/filtered_search_token_keys');
import '~/extensions/array';
import '~/filtered_search/filtered_search_token_keys';
describe('Filtered Search Token Keys', () => {
describe('get', () => {
......
require('~/extensions/array');
require('~/filtered_search/filtered_search_token_keys');
require('~/filtered_search/filtered_search_tokenizer');
import '~/extensions/array';
import '~/filtered_search/filtered_search_token_keys';
import '~/filtered_search/filtered_search_tokenizer';
describe('Filtered Search Tokenizer', () => {
describe('processTokens', () => {
......
import AjaxCache from '~/lib/utils/ajax_cache';
require('~/filtered_search/filtered_search_visual_tokens');
const FilteredSearchSpecHelper = require('../helpers/filtered_search_spec_helper');
import '~/filtered_search/filtered_search_visual_tokens';
import FilteredSearchSpecHelper from '../helpers/filtered_search_spec_helper';
describe('Filtered Search Visual Tokens', () => {
let tokensContainer;
......
......@@ -2,8 +2,8 @@
import GfmAutoComplete from '~/gfm_auto_complete';
require('vendor/jquery.caret');
require('vendor/jquery.atwho');
import 'vendor/jquery.caret';
import 'vendor/jquery.atwho';
describe('GfmAutoComplete', function () {
const gfmAutoCompleteCallbacks = GfmAutoComplete.prototype.getDefaultCallbacks.call({
......
/* eslint-disable comma-dangle, no-param-reassign, no-unused-expressions, max-len */
require('~/gl_dropdown');
require('~/lib/utils/common_utils');
require('~/lib/utils/url_utility');
import '~/gl_dropdown';
import '~/lib/utils/common_utils';
import '~/lib/utils/url_utility';
(() => {
const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link';
......
/* eslint-disable space-before-function-paren, arrow-body-style */
require('~/gl_field_errors');
import '~/gl_field_errors';
((global) => {
preloadFixtures('static/gl_field_errors.html.raw');
......
/* global autosize */
import autosize from 'vendor/autosize';
import '~/gl_form';
import '~/lib/utils/text_utility';
import '~/lib/utils/common_utils';
window.autosize = require('vendor/autosize');
require('~/gl_form');
require('~/lib/utils/text_utility');
require('~/lib/utils/common_utils');
window.autosize = autosize;
describe('GLForm', () => {
const global = window.gl || (window.gl = {});
......@@ -27,7 +27,7 @@ describe('GLForm', () => {
$.prototype.off.calls.reset();
$.prototype.on.calls.reset();
$.prototype.css.calls.reset();
autosize.calls.reset();
window.autosize.calls.reset();
done();
});
});
......@@ -51,7 +51,7 @@ describe('GLForm', () => {
});
it('should autosize the textarea', () => {
expect(autosize).toHaveBeenCalledWith(jasmine.any(Object));
expect(window.autosize).toHaveBeenCalledWith(jasmine.any(Object));
});
it('should set the resize css property to vertical', () => {
......@@ -81,7 +81,7 @@ describe('GLForm', () => {
spyOn($.prototype, 'data');
spyOn($.prototype, 'outerHeight').and.returnValue(200);
spyOn(window, 'outerHeight').and.returnValue(400);
spyOn(autosize, 'destroy');
spyOn(window.autosize, 'destroy');
this.glForm.destroyAutosize();
});
......@@ -95,7 +95,7 @@ describe('GLForm', () => {
});
it('should call autosize destroy', () => {
expect(autosize.destroy).toHaveBeenCalledWith(this.textarea);
expect(window.autosize.destroy).toHaveBeenCalledWith(this.textarea);
});
it('should set the data-height attribute', () => {
......@@ -114,9 +114,9 @@ describe('GLForm', () => {
it('should return undefined if the data-height equals the outerHeight', () => {
spyOn($.prototype, 'outerHeight').and.returnValue(200);
spyOn($.prototype, 'data').and.returnValue(200);
spyOn(autosize, 'destroy');
spyOn(window.autosize, 'destroy');
expect(this.glForm.destroyAutosize()).toBeUndefined();
expect(autosize.destroy).not.toHaveBeenCalled();
expect(window.autosize.destroy).not.toHaveBeenCalled();
});
});
});
......
/* eslint-disable space-before-function-paren, no-var */
require('~/header');
require('~/lib/utils/text_utility');
import '~/header';
import '~/lib/utils/text_utility';
(function() {
describe('Header', function() {
......
class ClassSpecHelper {
export default class ClassSpecHelper {
static itShouldBeAStaticMethod(base, method) {
return it('should be a static method', () => {
expect(Object.prototype.hasOwnProperty.call(base, method)).toBeTruthy();
......@@ -7,5 +7,3 @@ class ClassSpecHelper {
}
window.ClassSpecHelper = ClassSpecHelper;
module.exports = ClassSpecHelper;
/* global ClassSpecHelper */
require('./class_spec_helper');
import './class_spec_helper';
describe('ClassSpecHelper', () => {
describe('itShouldBeAStaticMethod', function () {
......
class FilteredSearchSpecHelper {
export default class FilteredSearchSpecHelper {
static createFilterVisualTokenHTML(name, value, isSelected) {
return FilteredSearchSpecHelper.createFilterVisualToken(name, value, isSelected).outerHTML;
}
......@@ -53,5 +53,3 @@ class FilteredSearchSpecHelper {
`;
}
}
module.exports = FilteredSearchSpecHelper;
/* global Issuable */
require('~/lib/utils/url_utility');
require('~/issuable');
import '~/lib/utils/url_utility';
import '~/issuable';
(() => {
const BASE_URL = '/user/project/issues?scope=all&state=closed';
......
/* eslint-disable space-before-function-paren, one-var, one-var-declaration-per-line, no-use-before-define, comma-dangle, max-len */
import Issue from '~/issue';
require('~/lib/utils/text_utility');
import '~/lib/utils/text_utility';
describe('Issue', function() {
let $boxClosed, $boxOpen, $btnClose, $btnReopen;
......
......@@ -2,14 +2,14 @@
/* global IssuableContext */
/* global LabelsSelect */
require('~/gl_dropdown');
require('select2');
require('vendor/jquery.nicescroll');
require('~/api');
require('~/create_label');
require('~/issuable_context');
require('~/users_select');
require('~/labels_select');
import '~/gl_dropdown';
import 'select2';
import 'vendor/jquery.nicescroll';
import '~/api';
import '~/create_label';
import '~/issuable_context';
import '~/users_select';
import '~/labels_select';
(() => {
let saveLabelCount = 0;
......
/* eslint-disable promise/catch-or-return */
require('~/lib/utils/common_utils');
import '~/lib/utils/common_utils';
(() => {
describe('common_utils', () => {
......
require('~/lib/utils/text_utility');
import '~/lib/utils/text_utility';
describe('text_utility', () => {
describe('gl.text.getTextWidth', () => {
......
/* eslint-disable space-before-function-paren, no-var, no-param-reassign, quotes, prefer-template, no-else-return, new-cap, dot-notation, no-return-assign, comma-dangle, no-new, one-var, one-var-declaration-per-line, jasmine/no-spec-dupes, no-underscore-dangle, max-len */
/* global LineHighlighter */
require('~/line_highlighter');
import '~/line_highlighter';
(function() {
describe('LineHighlighter', function() {
......
/* eslint-disable space-before-function-paren, no-return-assign */
/* global MergeRequest */
require('~/merge_request');
import '~/merge_request';
(function() {
describe('MergeRequest', function() {
......
/* eslint-disable no-var, comma-dangle, object-shorthand */
require('~/merge_request_tabs');
require('~/commit/pipelines/pipelines_bundle.js');
require('~/breakpoints');
require('~/lib/utils/common_utils');
require('~/diff');
require('~/single_file_diff');
require('~/files_comment_button');
require('vendor/jquery.scrollTo');
import '~/merge_request_tabs';
import '~/commit/pipelines/pipelines_bundle';
import '~/breakpoints';
import '~/lib/utils/common_utils';
import '~/diff';
import '~/single_file_diff';
import '~/files_comment_button';
import 'vendor/jquery.scrollTo';
(function () {
// TODO: remove this hack!
......
/* eslint-disable space-before-function-paren, one-var, no-var, one-var-declaration-per-line, no-return-assign, quotes, max-len */
/* global NewBranchForm */
require('~/new_branch_form');
import '~/new_branch_form';
(function() {
describe('Branch', function() {
......
/* global fixture */
require('~/pager');
import '~/pager';
describe('pager', () => {
const Pager = window.Pager;
......
require('~/lib/utils/pretty_time');
import '~/lib/utils/pretty_time';
(() => {
const prettyTime = gl.utils.prettyTime;
......
/* eslint-disable space-before-function-paren, no-unused-expressions, no-return-assign, no-param-reassign, no-var, new-cap, wrap-iife, no-unused-vars, quotes, jasmine/no-expect-in-setup-teardown, max-len */
/* global Project */
require('select2/select2.js');
require('~/gl_dropdown');
require('~/api');
require('~/project_select');
require('~/project');
import 'select2/select2';
import '~/gl_dropdown';
import '~/api';
import '~/project_select';
import '~/project';
(function() {
describe('Project Title', function() {
......
/* eslint-disable space-before-function-paren, max-len, no-var, one-var, one-var-declaration-per-line, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, comma-dangle, object-shorthand, prefer-template, quotes, new-parens, vars-on-top, new-cap, max-len */
require('~/gl_dropdown');
require('~/search_autocomplete');
require('~/lib/utils/common_utils');
require('vendor/fuzzaldrin-plus');
import '~/gl_dropdown';
import '~/search_autocomplete';
import '~/lib/utils/common_utils';
import 'vendor/fuzzaldrin-plus';
(function() {
var addBodyAttributes, assertLinks, dashboardIssuesPath, dashboardMRsPath, groupIssuesPath, groupMRsPath, groupName, mockDashboardOptions, mockGroupOptions, mockProjectOptions, projectIssuesPath, projectMRsPath, projectName, userId, widget;
......
/* eslint-disable space-before-function-paren, no-return-assign, no-var, quotes */
/* global ShortcutsIssuable */
require('~/copy_as_gfm');
require('~/shortcuts_issuable');
import '~/copy_as_gfm';
import '~/shortcuts_issuable';
(function() {
describe('ShortcutsIssuable', function() {
......
import AccessorUtilities from '~/lib/utils/accessor';
require('~/signin_tabs_memoizer');
import '~/signin_tabs_memoizer';
((global) => {
describe('SigninTabsMemoizer', () => {
......
require('~/smart_interval');
import '~/smart_interval';
(() => {
const DEFAULT_MAX_INTERVAL = 100;
......
/* eslint-disable space-before-function-paren, no-var, no-return-assign, quotes */
require('~/syntax_highlight');
import '~/syntax_highlight';
(function() {
describe('Syntax Highlighter', function() {
......
// enable test fixtures
require('jasmine-jquery');
import $ from 'jquery';
import _ from 'underscore';
import 'jasmine-jquery';
import '~/commons';
// enable test fixtures
jasmine.getFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
jasmine.getJSONFixtures().fixturesPath = '/base/spec/javascripts/fixtures';
// include common libraries
require('~/commons/index.js');
window.$ = window.jQuery = require('jquery');
window._ = require('underscore');
// globalize common libraries
window.$ = window.jQuery = $;
window._ = _;
// stub expected globals
window.gl = window.gl || {};
......
require('~/todos');
require('~/lib/utils/common_utils');
import '~/todos';
import '~/lib/utils/common_utils';
describe('Todos', () => {
preloadFixtures('todos/todos.html.raw');
......
......@@ -2,11 +2,11 @@
/* global MockU2FDevice */
/* global U2FAuthenticate */
require('~/u2f/authenticate');
require('~/u2f/util');
require('~/u2f/error');
require('vendor/u2f');
require('./mock_u2f_device');
import '~/u2f/authenticate';
import '~/u2f/util';
import '~/u2f/error';
import 'vendor/u2f';
import './mock_u2f_device';
(function() {
describe('U2FAuthenticate', function() {
......
......@@ -2,11 +2,11 @@
/* global MockU2FDevice */
/* global U2FRegister */
require('~/u2f/register');
require('~/u2f/util');
require('~/u2f/error');
require('vendor/u2f');
require('./mock_u2f_device');
import '~/u2f/register';
import '~/u2f/util';
import '~/u2f/error';
import 'vendor/u2f';
import './mock_u2f_device';
(function() {
describe('U2FRegister', function() {
......
const ClassSpecHelper = require('./helpers/class_spec_helper');
const VersionCheckImage = require('~/version_check_image');
require('jquery');
import VersionCheckImage from '~/version_check_image';
import ClassSpecHelper from './helpers/class_spec_helper';
describe('VersionCheckImage', function () {
describe('bindErrorEvent', function () {
......
require('~/visibility_select');
import '~/visibility_select';
(() => {
const VisibilitySelect = gl.VisibilitySelect;
......
This diff is collapsed.
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