Commit dd5e46ab authored by Fatih Acet's avatar Fatih Acet

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
parents 5a4dabd0 02f94cf0
/public/
/tmp/
/vendor/
{
"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
}
}
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
/doc/code/* /doc/code/*
/dump.rdb /dump.rdb
/log/*.log* /log/*.log*
/node_modules/
/nohup.out /nohup.out
/public/assets/ /public/assets/
/public/uploads.* /public/uploads.*
......
...@@ -311,6 +311,14 @@ coverage: ...@@ -311,6 +311,14 @@ coverage:
- coverage/index.html - coverage/index.html
- coverage/assets/ - coverage/assets/
lint-javascript:
stage: test
image: "node:latest"
before_script:
- npm install
script:
- npm run eslint
# Trigger docs build # Trigger docs build
# https://gitlab.com/gitlab-com/doc-gitlab-com/blob/master/README.md#deployment-process # https://gitlab.com/gitlab-com/doc-gitlab-com/blob/master/README.md#deployment-process
trigger_docs: trigger_docs:
......
/* eslint-disable */
((global) => { ((global) => {
const MAX_MESSAGE_LENGTH = 500; const MAX_MESSAGE_LENGTH = 500;
const MESSAGE_CELL_SELECTOR = '.abuse-reports .message'; const MESSAGE_CELL_SELECTOR = '.abuse-reports .message';
......
/* eslint-disable */
(function() { (function() {
this.Activities = (function() { this.Activities = (function() {
function Activities() { function Activities() {
......
/* eslint-disable */
(function() { (function() {
this.Admin = (function() { this.Admin = (function() {
function Admin() { function Admin() {
......
/* eslint-disable */
(function() { (function() {
this.Api = { this.Api = {
groupsPath: "/api/:version/groups.json", groupsPath: "/api/:version/groups.json",
......
/* eslint-disable */
// This is a manifest file that'll be compiled into including all the files listed below. // 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 // 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 // be included in the compiled file accessible from http://example.com/assets/application.js
......
/* eslint-disable */
(function() { (function() {
this.Aside = (function() { this.Aside = (function() {
function Aside() { function Aside() {
......
/* eslint-disable */
(function() { (function() {
this.Autosave = (function() { this.Autosave = (function() {
function Autosave(field, key) { function Autosave(field, key) {
......
/* eslint-disable */
(function() { (function() {
this.AwardsHandler = (function() { this.AwardsHandler = (function() {
const FROM_SENTENCE_REGEX = /(?:, and | and |, )/; //For separating lists produced by ruby's Array#toSentence const FROM_SENTENCE_REGEX = /(?:, and | and |, )/; //For separating lists produced by ruby's Array#toSentence
......
/* eslint-disable */
/*= require jquery.ba-resize */ /*= require jquery.ba-resize */
/*= require autosize */ /*= require autosize */
......
/* eslint-disable */
(function() { (function() {
$(function() { $(function() {
$("body").on("click", ".js-details-target", function() { $("body").on("click", ".js-details-target", function() {
......
/* eslint-disable */
// Quick Submit behavior // Quick Submit behavior
// //
// When a child field of a form with a `js-quick-submit` class receives a // When a child field of a form with a `js-quick-submit` class receives a
......
/* eslint-disable */
// Requires Input behavior // Requires Input behavior
// //
// When called on a form with input fields with the `required` attribute, the // When called on a form with input fields with the `required` attribute, the
......
/* eslint-disable */
(function(w) { (function(w) {
$(function() { $(function() {
// Toggle button. Show/hide content inside parent container. // Toggle button. Show/hide content inside parent container.
......
/* eslint-disable */
/*= require blob/template_selector */ /*= require blob/template_selector */
((global) => { ((global) => {
......
/* eslint-disable */
(function() { (function() {
this.BlobFileDropzone = (function() { this.BlobFileDropzone = (function() {
function BlobFileDropzone(form, method) { function BlobFileDropzone(form, method) {
......
/* eslint-disable */
/*= require blob/template_selector */ /*= require blob/template_selector */
......
/* eslint-disable */
(function() { (function() {
this.BlobGitignoreSelectors = (function() { this.BlobGitignoreSelectors = (function() {
function BlobGitignoreSelectors(opts) { function BlobGitignoreSelectors(opts) {
......
/* eslint-disable */
/*= require blob/template_selector */ /*= require blob/template_selector */
......
/* eslint-disable */
((global) => { ((global) => {
class BlobLicenseSelectors { class BlobLicenseSelectors {
constructor({ $dropdowns, editor }) { constructor({ $dropdowns, editor }) {
......
/* eslint-disable */
((global) => { ((global) => {
class TemplateSelector { class TemplateSelector {
constructor({ dropdown, data, pattern, wrapper, editor, fileEndpoint, $input } = {}) { constructor({ dropdown, data, pattern, wrapper, editor, fileEndpoint, $input } = {}) {
......
/* eslint-disable */
/*= require_tree . */ /*= require_tree . */
(function() { (function() {
......
/* eslint-disable */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
......
/* eslint-disable */
//= require vue //= require vue
//= require vue-resource //= require vue-resource
//= require Sortable //= require Sortable
......
/* eslint-disable */
//= require ./board_blank_state //= require ./board_blank_state
//= require ./board_delete //= require ./board_delete
//= require ./board_list //= require ./board_list
......
/* eslint-disable */
(() => { (() => {
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
......
/* eslint-disable */
(() => { (() => {
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
......
/* eslint-disable */
(() => { (() => {
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
......
/* eslint-disable */
//= require ./board_card //= require ./board_card
//= require ./board_new_issue //= require ./board_new_issue
......
/* eslint-disable */
(() => { (() => {
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
......
/* eslint-disable */
$(() => { $(() => {
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
......
/* eslint-disable */
((w) => { ((w) => {
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
......
/* eslint-disable */
class ListIssue { class ListIssue {
constructor (obj) { constructor (obj) {
this.id = obj.iid; this.id = obj.iid;
......
/* eslint-disable */
class ListLabel { class ListLabel {
constructor (obj) { constructor (obj) {
this.id = obj.id; this.id = obj.id;
......
/* eslint-disable */
class List { class List {
constructor (obj) { constructor (obj) {
this.id = obj.id; this.id = obj.id;
......
/* eslint-disable */
class ListUser { class ListUser {
constructor (user) { constructor (user) {
this.id = user.id; this.id = user.id;
......
/* eslint-disable */
class BoardService { class BoardService {
constructor (root, boardId) { constructor (root, boardId) {
this.lists = Vue.resource(`${root}/${boardId}/lists{/id}`, {}, { this.lists = Vue.resource(`${root}/${boardId}/lists{/id}`, {}, {
......
/* eslint-disable */
(() => { (() => {
window.gl = window.gl || {}; window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {}; window.gl.issueBoards = window.gl.issueBoards || {};
......
/* eslint-disable */
(function () { (function () {
'use strict'; 'use strict';
......
/* eslint-disable */
Vue.http.interceptors.push((request, next) => { Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1; Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
......
/* eslint-disable */
(function() { (function() {
this.Breakpoints = (function() { this.Breakpoints = (function() {
var BreakpointInstance, instance; var BreakpointInstance, instance;
......
/* eslint-disable */
(function() { (function() {
$(function() { $(function() {
var previewPath; var previewPath;
......
/* eslint-disable */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
......
/* eslint-disable */
(function() { (function() {
this.BuildArtifacts = (function() { this.BuildArtifacts = (function() {
function BuildArtifacts() { function BuildArtifacts() {
......
/* eslint-disable */
$(function(){ $(function(){
$('.reveal-variables').off('click').on('click',function(){ $('.reveal-variables').off('click').on('click',function(){
$('.js-build').toggle().niceScroll(); $('.js-build').toggle().niceScroll();
......
/* eslint-disable */
(function() { (function() {
this.Commit = (function() { this.Commit = (function() {
function Commit() { function Commit() {
......
/* eslint-disable */
(function() { (function() {
this.CommitFile = (function() { this.CommitFile = (function() {
function CommitFile(file) { function CommitFile(file) {
......
/* eslint-disable */
(function() { (function() {
this.ImageFile = (function() { this.ImageFile = (function() {
var prepareFrames; var prepareFrames;
......
/* eslint-disable */
(function() { (function() {
this.CommitsList = (function() { this.CommitsList = (function() {
function CommitsList() {} function CommitsList() {}
......
/* eslint-disable */
(function() { (function() {
this.Compare = (function() { this.Compare = (function() {
function Compare(opts) { function Compare(opts) {
......
/* eslint-disable */
(function() { (function() {
this.CompareAutocomplete = (function() { this.CompareAutocomplete = (function() {
function CompareAutocomplete() { function CompareAutocomplete() {
......
/* eslint-disable */
(function() { (function() {
this.ConfirmDangerModal = (function() { this.ConfirmDangerModal = (function() {
function ConfirmDangerModal(form, text) { function ConfirmDangerModal(form, text) {
......
/* eslint-disable */
/*= require clipboard */ /*= require clipboard */
......
/* eslint-disable */
(function (w) { (function (w) {
class CreateLabelDropdown { class CreateLabelDropdown {
constructor ($el, namespacePath, projectPath) { constructor ($el, namespacePath, projectPath) {
......
/* eslint-disable */
//= require vue //= require vue
((global) => { ((global) => {
......
/* eslint-disable */
(function() { (function() {
this.Diff = (function() { this.Diff = (function() {
var UNFOLD_COUNT; var UNFOLD_COUNT;
......
/* eslint-disable */
((w) => { ((w) => {
w.CommentAndResolveBtn = Vue.extend({ w.CommentAndResolveBtn = Vue.extend({
props: { props: {
......
/* eslint-disable */
(() => { (() => {
JumpToDiscussion = Vue.extend({ JumpToDiscussion = Vue.extend({
mixins: [DiscussionMixins], mixins: [DiscussionMixins],
......
/* eslint-disable */
((w) => { ((w) => {
w.ResolveBtn = Vue.extend({ w.ResolveBtn = Vue.extend({
props: { props: {
......
/* eslint-disable */
((w) => { ((w) => {
w.ResolveCount = Vue.extend({ w.ResolveCount = Vue.extend({
mixins: [DiscussionMixins], mixins: [DiscussionMixins],
......
/* eslint-disable */
((w) => { ((w) => {
w.ResolveDiscussionBtn = Vue.extend({ w.ResolveDiscussionBtn = Vue.extend({
props: { props: {
......
/* eslint-disable */
//= require vue //= require vue
//= require vue-resource //= require vue-resource
//= require_directory ./models //= require_directory ./models
......
/* eslint-disable */
((w) => { ((w) => {
w.DiscussionMixins = { w.DiscussionMixins = {
computed: { computed: {
......
/* eslint-disable */
class DiscussionModel { class DiscussionModel {
constructor (discussionId) { constructor (discussionId) {
this.id = discussionId; this.id = discussionId;
......
/* eslint-disable */
class NoteModel { class NoteModel {
constructor (discussionId, noteId, canResolve, resolved, resolved_by) { constructor (discussionId, noteId, canResolve, resolved, resolved_by) {
this.discussionId = discussionId; this.discussionId = discussionId;
......
/* eslint-disable */
((w) => { ((w) => {
class ResolveServiceClass { class ResolveServiceClass {
constructor() { constructor() {
......
/* eslint-disable */
((w) => { ((w) => {
w.CommentsStore = { w.CommentsStore = {
state: {}, state: {},
......
/* eslint-disable */
(function() { (function() {
var Dispatcher; var Dispatcher;
......
/* eslint-disable */
/*= require preview_markdown */ /*= require preview_markdown */
......
/* eslint-disable */
(function(global) { (function(global) {
class DueDateSelect { class DueDateSelect {
constructor({ $dropdown, $loading } = {}) { constructor({ $dropdown, $loading } = {}) {
......
/* eslint-disable */
Array.prototype.first = function() { Array.prototype.first = function() {
return this[0]; return this[0];
} }
......
/* eslint-disable */
Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatches; Element.prototype.matches = Element.prototype.matches || Element.prototype.msMatches;
Element.prototype.closest = function closest(selector, selectedElement = this) { Element.prototype.closest = function closest(selector, selectedElement = this) {
......
/* eslint-disable */
// Disable an element and add the 'disabled' Bootstrap class // Disable an element and add the 'disabled' Bootstrap class
(function() { (function() {
$.fn.extend({ $.fn.extend({
......
/* eslint-disable */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
......
/* eslint-disable */
(function() { (function() {
this.Flash = (function() { this.Flash = (function() {
var hideFlash; var hideFlash;
......
/* eslint-disable */
// Creates the variables for setting up GFM auto-completion // Creates the variables for setting up GFM auto-completion
(function() { (function() {
if (window.GitLab == null) { if (window.GitLab == null) {
......
/* eslint-disable */
(function() { (function() {
var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote, var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
......
/* eslint-disable */
((global) => { ((global) => {
/* /*
* This class overrides the browser's validation error bubbles, displaying custom * This class overrides the browser's validation error bubbles, displaying custom
......
/* eslint-disable */
(function() { (function() {
this.GLForm = (function() { this.GLForm = (function() {
function GLForm(form) { function GLForm(form) {
......
/* eslint-disable */
// This is a manifest file that'll be compiled into including all the files listed below. // 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 // 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 // be included in the compiled file accessible from http://example.com/assets/application.js
......
/* eslint-disable */
(function() { (function() {
this.StatGraph = (function() { this.StatGraph = (function() {
function StatGraph() {} function StatGraph() {}
......
/* eslint-disable */
/*= require d3 */ /*= require d3 */
......
/* eslint-disable */
/*= require d3 */ /*= require d3 */
......
/* eslint-disable */
(function() { (function() {
window.ContributorsStatGraphUtil = { window.ContributorsStatGraphUtil = {
parse_log: function(log) { parse_log: function(log) {
......
/* eslint-disable */
(function() { (function() {
this.GroupAvatar = (function() { this.GroupAvatar = (function() {
function GroupAvatar() { function GroupAvatar() {
......
/* eslint-disable */
(function() { (function() {
var slice = [].slice; var slice = [].slice;
......
/* eslint-disable */
(function() { (function() {
this.ImporterStatus = (function() { this.ImporterStatus = (function() {
function ImporterStatus(jobs_url, import_url) { function ImporterStatus(jobs_url, import_url) {
......
/* eslint-disable */
(function() { (function() {
var issuable_created; var issuable_created;
......
/* eslint-disable */
(function() { (function() {
this.IssuableContext = (function() { this.IssuableContext = (function() {
function IssuableContext(currentUser) { function IssuableContext(currentUser) {
......
/* eslint-disable */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
......
/* eslint-disable */
/*= require flash */ /*= require flash */
/*= require jquery.waitforimages */ /*= require jquery.waitforimages */
......
/* eslint-disable */
(function() { (function() {
this.IssueStatusSelect = (function() { this.IssueStatusSelect = (function() {
function IssueStatusSelect() { function IssueStatusSelect() {
......
/* eslint-disable */
((global) => { ((global) => {
class IssuableBulkActions { class IssuableBulkActions {
......
/* eslint-disable */
((global) => { ((global) => {
class LabelManager { class LabelManager {
......
/* eslint-disable */
(function() { (function() {
var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
......
/* eslint-disable */
(function() { (function() {
this.LabelsSelect = (function() { this.LabelsSelect = (function() {
function LabelsSelect() { function LabelsSelect() {
......
/* eslint-disable */
(function() { (function() {
var hideEndFade; var hideEndFade;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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