update remaining uses of CJS syntax to ES module syntax

This commit is contained in:
Mike Greiling 2017-05-16 15:52:40 -05:00
parent f5ad1dcbf8
commit 5bd549187a
20 changed files with 64 additions and 59 deletions

View file

@ -1,6 +1,6 @@
/* 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

View file

@ -1,6 +1,6 @@
/* eslint-disable class-methods-use-this */
require('./lib/utils/url_utility');
import './lib/utils/url_utility';
const UNFOLD_COUNT = 20;
let isBound = false;

View file

@ -1,7 +1,7 @@
/* 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) {

View file

@ -1,6 +1,6 @@
/* 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';

View file

@ -1,11 +1,11 @@
/* 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() {

View file

@ -1,9 +1,10 @@
/* 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) {

View file

@ -1,5 +1,6 @@
/* 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;

View file

@ -4,8 +4,6 @@
//
// Handles single- and multi-line selection and highlight for blob views.
//
require('vendor/jquery.scrollTo');
//
// ### Example Markup
//

View file

@ -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';

View file

@ -1,9 +1,9 @@
/* 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() {

View file

@ -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');

View file

@ -1,5 +1,5 @@
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;

View file

@ -1,2 +1,2 @@
require('./gl_crop');
require('./profile');
import './gl_crop';
import './profile';

View file

@ -1,5 +1,5 @@
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';

View file

@ -1,5 +1,6 @@
/* global Flash */
require('vendor/task_list');
import 'vendor/task_list';
class TaskList {
constructor(options = {}) {

View file

@ -1,7 +1,9 @@
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' }));

View file

@ -1 +1 @@
require('./calendar');
import './calendar';

View file

@ -1,4 +1,4 @@
require('../../lib/utils/text_utility');
import '../../lib/utils/text_utility';
export default {
name: 'MRWidgetHeader',

View file

@ -1,8 +1,8 @@
/* eslint-disable no-param-reassign */
/* global Breakpoints */
require('./breakpoints');
require('vendor/jquery.nicescroll');
import 'vendor/jquery.nicescroll';
import './breakpoints';
((global) => {
class Wikis {

View file

@ -1,5 +1,4 @@
/* 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