Skip to content

Commit

Permalink
migrate all javascript asset bundles and require syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegreiling committed Jan 10, 2017
1 parent 55f291e commit fe964cc
Show file tree
Hide file tree
Showing 83 changed files with 261 additions and 564 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"filenames"
],
"rules": {
"filenames/match-regex": [2, "^[a-z0-9_]+(.js)?$"]
"filenames/match-regex": [2, "^[a-z0-9_]+(.js)?$"],
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off"
}
}
111 changes: 54 additions & 57 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,64 @@
/* eslint-disable func-names, space-before-function-paren, no-var, quotes, consistent-return, prefer-arrow-callback, comma-dangle, object-shorthand, no-new, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, quotes, consistent-return, prefer-arrow-callback, comma-dangle, object-shorthand, no-new, max-len, no-multi-spaces, import/newline-after-import */
/* global bp */
/* global Cookies */
/* global Flash */
/* global ConfirmDangerModal */
/* global AwardsHandler */
/* global Aside */

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
/*= require jquery2 */
/*= require jquery-ui/autocomplete */
/*= require jquery-ui/datepicker */
/*= require jquery-ui/draggable */
/*= require jquery-ui/effect-highlight */
/*= require jquery-ui/sortable */
/*= require jquery_ujs */
/*= require jquery.endless-scroll */
/*= require jquery.highlight */
/*= require jquery.waitforimages */
/*= require jquery.caret */
/*= require jquery.atwho */
/*= require jquery.scrollTo */
/*= require jquery.turbolinks */
/*= require js.cookie */
/*= require turbolinks */
/*= require autosave */
/*= require bootstrap/affix */
/*= require bootstrap/alert */
/*= require bootstrap/button */
/*= require bootstrap/collapse */
/*= require bootstrap/dropdown */
/*= require bootstrap/modal */
/*= require bootstrap/scrollspy */
/*= require bootstrap/tab */
/*= require bootstrap/transition */
/*= require bootstrap/tooltip */
/*= require bootstrap/popover */
/*= require select2 */
/*= require underscore */
/*= require dropzone */
/*= require mousetrap */
/*= require mousetrap/pause */
/*= require shortcuts */
/*= require shortcuts_navigation */
/*= require shortcuts_dashboard_navigation */
/*= require shortcuts_issuable */
/*= require shortcuts_network */
/*= require jquery.nicescroll */
/*= require date.format */
/*= require_directory ./behaviors */
/*= require_directory ./blob */
/*= require_directory ./templates */
/*= require_directory ./commit */
/*= require_directory ./extensions */
/*= require_directory ./lib/utils */
/*= require_directory ./u2f */
/*= require_directory . */
/*= require fuzzaldrin-plus */
/*= require es6-promise.auto */
function requireAll(context) { return context.keys().map(context); }

window.$ = window.jQuery = require('jquery');
require('jquery-ui/ui/autocomplete');
require('jquery-ui/ui/datepicker');
require('jquery-ui/ui/draggable');
require('jquery-ui/ui/effect-highlight');
require('jquery-ui/ui/sortable');
require('jquery-ujs');
require('vendor/jquery.endless-scroll');
require('vendor/jquery.highlight');
require('vendor/jquery.waitforimages');
require('vendor/jquery.caret');
require('vendor/jquery.atwho');
require('vendor/jquery.scrollTo');
require('vendor/jquery.turbolinks');
window.Cookies = require('vendor/js.cookie');
require('vendor/turbolinks');
require('./autosave');
require('bootstrap/js/affix');
require('bootstrap/js/alert');
require('bootstrap/js/button');
require('bootstrap/js/collapse');
require('bootstrap/js/dropdown');
require('bootstrap/js/modal');
require('bootstrap/js/scrollspy');
require('bootstrap/js/tab');
require('bootstrap/js/transition');
require('bootstrap/js/tooltip');
require('bootstrap/js/popover');
require('select2/select2.js');
window._ = require('underscore');
window.Dropzone = require('dropzone');
require('mousetrap');
require('mousetrap/plugins/pause/mousetrap-pause');
require('./shortcuts');
require('./shortcuts_navigation');
require('./shortcuts_dashboard_navigation');
require('./shortcuts_issuable');
require('./shortcuts_network');
require('vendor/jquery.nicescroll');
require('vendor/date.format');
requireAll(require.context('./behaviors', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./blob', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./templates', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./commit', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./extensions', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./lib/utils', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./u2f', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('.', false, /^\.\/(?!application).*\.(js|es6)$/));
require('vendor/fuzzaldrin-plus');
window.ES6Promise = require('vendor/es6-promise.auto');
window.ES6Promise.polyfill();

(function () {
document.addEventListener('page:fetch', function () {
Expand Down
4 changes: 3 additions & 1 deletion app/assets/javascripts/awards_handler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* eslint-disable func-names, space-before-function-paren, wrap-iife, max-len, no-var, spaced-comment, prefer-arrow-callback, consistent-return, one-var, one-var-declaration-per-line, no-unused-vars, no-else-return, prefer-template, quotes, comma-dangle, no-param-reassign, no-void, radix, keyword-spacing, space-before-blocks, brace-style, no-underscore-dangle, no-plusplus, no-return-assign, camelcase, padded-blocks */
/* global Cookies */

var emojiAliases = require('emoji-aliases');

(function() {
this.AwardsHandler = (function() {
var FROM_SENTENCE_REGEX = /(?:, and | and |, )/; //For separating lists produced by ruby's Array#toSentence
function AwardsHandler() {
this.aliases = gl.emojiAliases();
this.aliases = emojiAliases;
$(document).off('click', '.js-add-award').on('click', '.js-add-award', (function(_this) {
return function(e) {
e.stopPropagation();
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/behaviors/autosize.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable func-names, space-before-function-paren, prefer-arrow-callback, no-var, consistent-return, padded-blocks, max-len */
/* global autosize */

/*= require jquery.ba-resize */
/*= require autosize */
var autosize = require('vendor/autosize');
require('vendor/jquery.ba-resize');

(function() {
$(function() {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/behaviors/quick_submit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// "Meta+Enter" (Mac) or "Ctrl+Enter" (Linux/Windows) key combination, the form
// is submitted.
//
/*= require extensions/jquery */
require('../extensions/jquery');

//
// ### Example Markup
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/behaviors/requires_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// When called on a form with input fields with the `required` attribute, the
// form's submit button will be disabled until all required fields have values.
//
/*= require extensions/jquery */
require('../extensions/jquery');

//
// ### Example Markup
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/blob/blob_ci_yaml.js.es6
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable padded-blocks, no-param-reassign, comma-dangle */
/* global Api */

/*= require blob/template_selector */
require('./template_selector');

((global) => {

class BlobCiYamlSelector extends gl.TemplateSelector {
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/blob/blob_dockerfile_selector.js.es6
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global Api */
/*= require blob/template_selector */

require('./template_selector');

(() => {
const global = window.gl || (window.gl = {});
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/blob/blob_gitignore_selector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params, padded-blocks */
/* global Api */

/*= require blob/template_selector */
require('./template_selector');

(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; },
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/blob/blob_license_selector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable func-names, space-before-function-paren, max-len, one-var, no-var, no-restricted-syntax, vars-on-top, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, wrap-iife, prefer-rest-params, comma-dangle, padded-blocks */
/* global Api */

/*= require blob/template_selector */
require('./template_selector');

(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; },
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/blob_edit/blob_edit_bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global EditBlob */
/* global NewCommitForm */

/*= require_tree . */
require('./edit_blob');

(function() {
$(function() {
Expand Down
28 changes: 15 additions & 13 deletions app/assets/javascripts/boards/boards_bundle.js.es6
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
/* eslint-disable one-var, indent, quote-props, comma-dangle, space-before-function-paren */
/* eslint-disable one-var, indent, quote-props, comma-dangle, space-before-function-paren, import/newline-after-import, no-multi-spaces, max-len */
/* global Vue */
/* global BoardService */

//= require vue
//= require vue-resource
//= require Sortable
//= require_tree ./models
//= require_tree ./stores
//= require_tree ./services
//= require_tree ./mixins
//= require_tree ./filters
//= require ./components/board
//= require ./components/board_sidebar
//= require ./components/new_list_dropdown
//= require ./vue_resource_interceptor
function requireAll(context) { return context.keys().map(context); }

window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
window.Sortable = require('vendor/Sortable');
requireAll(require.context('./models', true, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./stores', true, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./services', true, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./mixins', true, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./filters', true, /^\.\/.*\.(js|es6)$/));
require('./components/board');
require('./components/board_sidebar');
require('./components/new_list_dropdown');
require('./vue_resource_interceptor');

$(() => {
const $boardApp = document.getElementById('board-app'),
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/boards/components/board.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/* global Vue */
/* global Sortable */

//= require ./board_blank_state
//= require ./board_delete
//= require ./board_list
require('./board_blank_state');
require('./board_delete');
require('./board_list');

(() => {
const Store = gl.issueBoards.BoardsStore;
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/boards/components/board_list.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* global Vue */
/* global Sortable */

//= require ./board_card
//= require ./board_new_issue
require('./board_card');
require('./board_new_issue');

(() => {
const Store = gl.issueBoards.BoardsStore;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/copy_to_clipboard.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable func-names, space-before-function-paren, one-var, no-var, one-var-declaration-per-line, prefer-template, quotes, no-unused-vars, prefer-arrow-callback, padded-blocks, max-len */
/* global Clipboard */

/*= require clipboard */
window.Clipboard = require('vendor/clipboard');

(function() {
var genericError, genericSuccess, showTooltip;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
/* global Cookies */
/* global Flash */

//= require vue
//= require_tree ./svg
//= require_tree .
window.Vue = require('vue');
window.Cookies = require('vendor/js.cookie');

function requireAll(context) { return context.keys().map(context); }
requireAll(require.context('./svg', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('.', false, /^\.\/(?!cycle_analytics_bundle).*\.(js|es6)$/));

$(() => {
const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed';
Expand Down
18 changes: 10 additions & 8 deletions app/assets/javascripts/diff_notes/diff_notes_bundle.js.es6
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/* eslint-disable func-names, comma-dangle, new-cap, no-new */
/* eslint-disable func-names, comma-dangle, new-cap, no-new, import/newline-after-import, no-multi-spaces, max-len */
/* global Vue */
/* global ResolveCount */

//= require vue
//= require vue-resource
//= require_directory ./models
//= require_directory ./stores
//= require_directory ./services
//= require_directory ./mixins
//= require_directory ./components
function requireAll(context) { return context.keys().map(context); }

window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
requireAll(require.context('./models', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./stores', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./services', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./mixins', false, /^\.\/.*\.(js|es6)$/));
requireAll(require.context('./components', false, /^\.\/.*\.(js|es6)$/));

$(() => {
const COMPONENT_SELECTOR = 'resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn';
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/dropzone_input.js
Original file line number Diff line number Diff line change
@@ -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, no-plusplus, prefer-arrow-callback, padded-blocks */
/* global Dropzone */

/*= require preview_markdown */
require('./preview_markdown');

(function() {
this.DropzoneInput = (function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/* global Vue */
/* global EnvironmentsService */

//= require vue
//= require vue-resource
//= require_tree ../services/
//= require ./environment_item
window.Vue = require('vue');
window.Vue.use(require('vue-resource'));
require('../services/environments_service');
require('./environment_item');

(() => {
window.gl = window.gl || {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*= require vue */
/* global Vue */

window.Vue = require('vue');

(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*= require vue */
/* global Vue */

window.Vue = require('vue');

(() => {
window.gl = window.gl || {};
window.gl.environmentsList = window.gl.environmentsList || {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* global Vue */
/* global timeago */

/*= require timeago */
/*= require lib/utils/text_utility */
/*= require vue_common_component/commit */
/*= require ./environment_actions */
/*= require ./environment_external_url */
/*= require ./environment_stop */
/*= require ./environment_rollback */
/*= require ./environment_terminal_button */
window.Vue = require('vue');
window.timeago = require('vendor/timeago');
require('../../lib/utils/text_utility');
require('../../vue_common_component/commit');
require('./environment_actions');
require('./environment_external_url');
require('./environment_stop');
require('./environment_rollback');
require('./environment_terminal_button');

(() => {
/**
Expand Down
Loading

0 comments on commit fe964cc

Please sign in to comment.