Merge branch 'eslint' into 'master'

Add ESLint

## What does this MR do?

- create `package.json`
- add ESLint dependencies to `package.json`
- add JavaScript linting to CI
- add Rake task `lint:javascript`as alias for `eslint` (which itself is an alias for `npm run eslint`)

## Are there points in the code the reviewer needs to double check?

Probably not.

## Why was this MR needed?

My hovercraft was full of eels.

## What are the relevant issue numbers?

- https://gitlab.com/gitlab-org/gitlab-ce/issues/13224#note_12537431
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5006#note_13255658


See merge request !5445
This commit is contained in:
Fatih Acet 2016-10-26 16:31:08 +00:00
commit dd5e46ab69
238 changed files with 297 additions and 0 deletions

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
/public/
/tmp/
/vendor/

23
.eslintrc Normal file
View File

@ -0,0 +1,23 @@
{
"extends": "airbnb",
"globals": {
"$": false,
"_": false,
"beforeEach": false,
"d3": false,
"define": false,
"describe": false,
"document": false,
"expect": false,
"fixture": false,
"gl": false,
"it": false,
"jQuery": false,
"Mousetrap": false,
"spyOn": false,
"spyOnEvent": false,
"Turbolinks": false,
"window": false
}
}

1
.gitignore vendored
View File

@ -37,6 +37,7 @@
/doc/code/*
/dump.rdb
/log/*.log*
/node_modules/
/nohup.out
/public/assets/
/public/uploads.*

View File

@ -311,6 +311,14 @@ coverage:
- coverage/index.html
- coverage/assets/
lint-javascript:
stage: test
image: "node:latest"
before_script:
- npm install
script:
- npm run eslint
# Trigger docs build
# https://gitlab.com/gitlab-com/doc-gitlab-com/blob/master/README.md#deployment-process
trigger_docs:

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
const MAX_MESSAGE_LENGTH = 500;
const MESSAGE_CELL_SELECTOR = '.abuse-reports .message';

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Activities = (function() {
function Activities() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Admin = (function() {
function Admin() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Api = {
groupsPath: "/api/:version/groups.json",

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee 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

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Aside = (function() {
function Aside() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Autosave = (function() {
function Autosave(field, key) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.AwardsHandler = (function() {
const FROM_SENTENCE_REGEX = /(?:, and | and |, )/; //For separating lists produced by ruby's Array#toSentence

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require jquery.ba-resize */
/*= require autosize */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
$(function() {
$("body").on("click", ".js-details-target", function() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// Quick Submit behavior
//
// When a child field of a form with a `js-quick-submit` class receives a

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// Requires Input behavior
//
// When called on a form with input fields with the `required` attribute, the

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function(w) {
$(function() {
// Toggle button. Show/hide content inside parent container.

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require blob/template_selector */
((global) => {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.BlobFileDropzone = (function() {
function BlobFileDropzone(form, method) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require blob/template_selector */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.BlobGitignoreSelectors = (function() {
function BlobGitignoreSelectors(opts) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require blob/template_selector */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
class BlobLicenseSelectors {
constructor({ $dropdowns, editor }) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
class TemplateSelector {
constructor({ dropdown, data, pattern, wrapper, editor, fileEndpoint, $input } = {}) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require_tree . */
(function() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -1,3 +1,4 @@
/* eslint-disable */
//= require vue
//= require vue-resource
//= require Sortable

View File

@ -1,3 +1,4 @@
/* eslint-disable */
//= require ./board_blank_state
//= require ./board_delete
//= require ./board_list

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
const Store = gl.issueBoards.BoardsStore;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
const Store = gl.issueBoards.BoardsStore;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};

View File

@ -1,3 +1,4 @@
/* eslint-disable */
//= require ./board_card
//= require ./board_new_issue

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
const Store = gl.issueBoards.BoardsStore;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
$(() => {
const Store = gl.issueBoards.BoardsStore;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class ListIssue {
constructor (obj) {
this.id = obj.iid;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class ListLabel {
constructor (obj) {
this.id = obj.id;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class List {
constructor (obj) {
this.id = obj.id;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class ListUser {
constructor (user) {
this.id = user.id;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class BoardService {
constructor (root, boardId) {
this.lists = Vue.resource(`${root}/${boardId}/lists{/id}`, {}, {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function () {
'use strict';

View File

@ -1,3 +1,4 @@
/* eslint-disable */
Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Breakpoints = (function() {
var BreakpointInstance, instance;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
$(function() {
var previewPath;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.BuildArtifacts = (function() {
function BuildArtifacts() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
$(function(){
$('.reveal-variables').off('click').on('click',function(){
$('.js-build').toggle().niceScroll();

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Commit = (function() {
function Commit() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.CommitFile = (function() {
function CommitFile(file) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.ImageFile = (function() {
var prepareFrames;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.CommitsList = (function() {
function CommitsList() {}

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Compare = (function() {
function Compare(opts) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.CompareAutocomplete = (function() {
function CompareAutocomplete() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.ConfirmDangerModal = (function() {
function ConfirmDangerModal(form, text) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require clipboard */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function (w) {
class CreateLabelDropdown {
constructor ($el, namespacePath, projectPath) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
//= require vue
((global) => {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Diff = (function() {
var UNFOLD_COUNT;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.CommentAndResolveBtn = Vue.extend({
props: {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(() => {
JumpToDiscussion = Vue.extend({
mixins: [DiscussionMixins],

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.ResolveBtn = Vue.extend({
props: {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.ResolveCount = Vue.extend({
mixins: [DiscussionMixins],

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.ResolveDiscussionBtn = Vue.extend({
props: {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
//= require vue
//= require vue-resource
//= require_directory ./models

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.DiscussionMixins = {
computed: {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class DiscussionModel {
constructor (discussionId) {
this.id = discussionId;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
class NoteModel {
constructor (discussionId, noteId, canResolve, resolved, resolved_by) {
this.discussionId = discussionId;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
class ResolveServiceClass {
constructor() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((w) => {
w.CommentsStore = {
state: {},

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var Dispatcher;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require preview_markdown */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function(global) {
class DueDateSelect {
constructor({ $dropdown, $loading } = {}) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
Array.prototype.first = function() {
return this[0];
}

View File

@ -1,3 +1,4 @@
/* eslint-disable */
Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatches;
Element.prototype.closest = function closest(selector, selectedElement = this) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// Disable an element and add the 'disabled' Bootstrap class
(function() {
$.fn.extend({

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.Flash = (function() {
var hideFlash;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// Creates the variables for setting up GFM auto-completion
(function() {
if (window.GitLab == null) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
/*
* This class overrides the browser's validation error bubbles, displaying custom

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.GLForm = (function() {
function GLForm(form) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee 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

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.StatGraph = (function() {
function StatGraph() {}

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require d3 */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require d3 */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
window.ContributorsStatGraphUtil = {
parse_log: function(log) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.GroupAvatar = (function() {
function GroupAvatar() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var slice = [].slice;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.ImporterStatus = (function() {
function ImporterStatus(jobs_url, import_url) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var issuable_created;

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.IssuableContext = (function() {
function IssuableContext(currentUser) {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*= require flash */
/*= require jquery.waitforimages */

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.IssueStatusSelect = (function() {
function IssueStatusSelect() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
class IssuableBulkActions {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
((global) => {
class LabelManager {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
this.LabelsSelect = (function() {
function LabelsSelect() {

View File

@ -1,3 +1,4 @@
/* eslint-disable */
(function() {
var hideEndFade;

Some files were not shown because too many files have changed in this diff Show More