Skip to content

Commit

Permalink
added lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bansalnitish committed Mar 11, 2018
1 parent e38d16c commit 43ae1a4
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 49 deletions.
8 changes: 4 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"no-shadow": "off",
"no-undef": "warn",
"no-underscore-dangle": "off",
"no-unused-vars": "off",
"no-unused-vars": "warn",
"no-use-before-define": "error",
"object-curly-spacing": "off",
"one-var": "error",
"padded-blocks": "off",
"quote-props": "off",
"quotes": "off",
"semi": "off",
"space-before-function-paren": "off",
"space-unary-ops": "off",
"semi": "error",
"space-before-function-paren": "error",
"space-unary-ops": "error",
"spaced-comment": "off",
"vars-on-top": "off",
}
Expand Down
10 changes: 5 additions & 5 deletions readthedocs/builds/static-src/builds/js/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var ko = require('knockout');
var $ = require('jquery');


function BuildCommand (data) {
function BuildCommand(data) {
var self = this;
self.id = ko.observable(data.id);
self.command = ko.observable(data.command);
Expand All @@ -25,7 +25,7 @@ function BuildCommand (data) {
});
}

function BuildDetailView (instance) {
function BuildDetailView(instance) {
var self = this;
var instance = instance || {};

Expand All @@ -46,7 +46,7 @@ function BuildDetailView (instance) {
var n;
for (n in commands_raw) {
var command = new BuildCommand(commands_raw[n]);
commands_display.push(command)
commands_display.push(command);
}
return commands_display;
});
Expand All @@ -58,7 +58,7 @@ function BuildDetailView (instance) {
self.legacy_output(true);
};

function poll_api () {
function poll_api() {
if (self.finished()) {
return;
}
Expand All @@ -75,7 +75,7 @@ function BuildDetailView (instance) {
var command = data.commands[n];
var match = ko.utils.arrayFirst(
self.commands(),
function(command_cmp) {
function (command_cmp) {
return (command_cmp.id === command.id);
}
);
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/static-src/core/js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = function (selector, url) {
$(selector).autocomplete({
source: url,
minLength: 2,
open: function(event, ui) {
open: function (event, ui) {
var ac_top = $('.ui-autocomplete').css('top');
$('.ui-autocomplete').css({'width': '233px', 'top': ac_top + 10 });
}
});
}
};
4 changes: 2 additions & 2 deletions readthedocs/core/static-src/core/js/doc-embed/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ var exports = {
THEME_RTD: 'sphinx_rtd_theme',
THEME_ALABASTER: 'alabaster',
THEME_CELERY: 'sphinx_celery'
}
};

exports.PROMO_SUPPORTED_THEMES = [
exports.THEME_RTD,
exports.THEME_ALABASTER,
exports.THEME_CELERY
]
];

exports.PROMO_TYPES = {
LEFTNAV: 'doc', // Left navigation on documentation pages
Expand Down
4 changes: 2 additions & 2 deletions readthedocs/core/static-src/core/js/doc-embed/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function injectFooter(data) {
config.theme,
data.promo_data.display_type,
data.promo_data.pixel
)
);
if (promo) {
promo.display();
}
Expand All @@ -45,7 +45,7 @@ function setupBookmarkCSRFToken() {
}

$.ajaxSetup({
beforeSend: function(xhr, settings) {
beforeSend: function (xhr, settings) {
if (!csrfSafeMethod(settings.type)) {
xhr.setRequestHeader("X-CSRFToken", $('a.bookmark[token]').attr('token'));
}
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/core/static-src/core/js/doc-embed/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function attach_elastic_search_query(data) {
xhrFields: {
withCredentials: true,
},
complete: function(resp, status_code) {
if (typeof(resp.responseJSON) === 'undefined' ||
typeof(resp.responseJSON.results) === 'undefined') {
complete: function (resp, status_code) {
if (typeof (resp.responseJSON) === 'undefined' ||
typeof (resp.responseJSON.results) === 'undefined') {
return search_def.reject();
}
return search_def.resolve(resp.responseJSON.results);
Expand Down
6 changes: 3 additions & 3 deletions readthedocs/core/static-src/core/js/doc-embed/sphinx.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function init() {
var rtd = rtddata.get();

/// Click tracking on flyout
$(document).on('click', "[data-toggle='rst-current-version']", function() {
$(document).on('click', "[data-toggle='rst-current-version']", function () {
var flyout_state = $("[data-toggle='rst-versions']").hasClass('shift-up') ? 'was_open' : 'was_closed';

// This needs to handle both old style legacy analytics for previously built docs
Expand All @@ -34,7 +34,7 @@ function init() {
// already enabled. See:
// https://github.com/snide/sphinx_rtd_theme/issues/250
$(document).ready(function () {
setTimeout(function() {
setTimeout(function () {
if (!theme.navBar) {
theme.enable();
}
Expand All @@ -46,7 +46,7 @@ function init() {
// scroll element, gracefully handle failover by adding it
// dynamically.
var navBar = jquery('div.wy-side-scroll:first');
if (! navBar.length) {
if (!navBar.length) {
var navInner = jquery('nav.wy-nav-side:first');
var navScroll = $('<div />')
.addClass('wy-side-scroll');
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/static-src/core/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ module.exports.handle_notification_dismiss = function () {
}
});
});
}
};
10 changes: 5 additions & 5 deletions readthedocs/core/static-src/core/js/sponsorship.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var constants = require('./doc-embed/constants');


function Promo (id, text, link, image, theme, display_type, pixel) {
function Promo(id, text, link, image, theme, display_type, pixel) {
this.id = id; // analytics id
this.text = text;
this.link = link;
Expand Down Expand Up @@ -41,10 +41,10 @@ Promo.prototype.create = function () {
promo_class = this.display_type === constants.PROMO_TYPES.FOOTER ? 'rtd-pro-footer' : 'alabaster';
}

if (typeof(menu) !== 'undefined') {
if (typeof (menu) !== 'undefined') {
this.place_promo(menu, promo_class);
}
}
};

Promo.prototype.place_promo = function (selector, promo_class) {
var self = this;
Expand Down Expand Up @@ -104,7 +104,7 @@ Promo.prototype.place_promo = function (selector, promo_class) {
'<p class="ethical-callout"><small><em><a href="https://docs.readthedocs.io/en/latest/ethical-advertising.html">' +
'Ads served ethically' +
'</a></em></small></p>'
)
);
promo.append(copy_text);


Expand Down Expand Up @@ -164,7 +164,7 @@ Promo.prototype.display = function () {
var promo = this.promo;
var self = this;

if (! promo) {
if (!promo) {
promo = this.promo = this.create();
}

Expand Down
6 changes: 3 additions & 3 deletions readthedocs/core/static-src/core/js/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

var jquery = require('jquery');

function poll_task (data) {
function poll_task(data) {
var defer = jquery.Deferred();
var tries = 5;

function poll_task_loop () {
function poll_task_loop() {
jquery
.getJSON(data.url)
.success(function (task) {
Expand Down Expand Up @@ -40,7 +40,7 @@ function poll_task (data) {
return defer;
}

function trigger_task (config) {
function trigger_task(config) {
var defer = jquery.Deferred();
var url = config.url;
var token = config.token;
Expand Down
Binary file modified readthedocs/core/static/core/font/fontawesome-webfont.eot
Binary file not shown.
4 changes: 2 additions & 2 deletions readthedocs/gold/static-src/gold/js/gold.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var jquery = require('jquery');
var payment = require('readthedocs/payments/static-src/payments/js/base');
var ko = require('knockout');

function GoldView (config) {
function GoldView(config) {
var self = this;
var config = config || {};

Expand All @@ -20,7 +20,7 @@ GoldView.init = function (config, obj) {
var obj = obj || $('#payment-form')[0];
ko.applyBindings(view, obj);
return view;
}
};

GoldView.prototype.submit_form = function (card_digits, token) {
this.form.find('#id_last_4_digits').val(card_digits);
Expand Down
14 changes: 7 additions & 7 deletions readthedocs/projects/static-src/projects/js/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var $ = require('jquery');
var tasks = require('readthedocs/core/static-src/core/js/tasks');


$(function() {
$(function () {
var input = $('#id_repo');
var repo = $('#id_repo_type');

Expand Down Expand Up @@ -37,7 +37,7 @@ $(function() {
});
});

function append_url_params (url, params) {
function append_url_params(url, params) {
var link = $('<a>').attr('href', url).get(0);

Object.keys(params).map(function (key) {
Expand All @@ -49,7 +49,7 @@ function append_url_params (url, params) {
return link.href;
}

function Organization (instance, view) {
function Organization(instance, view) {
var self = this;
self.id = ko.observable(instance.id);
self.name = ko.observable(instance.name);
Expand All @@ -74,7 +74,7 @@ function Organization (instance, view) {
});
}

function Account (instance, view) {
function Account(instance, view) {
var self = this;
self.id = ko.observable(instance.id);
self.username = ko.observable(instance.username);
Expand All @@ -99,7 +99,7 @@ function Account (instance, view) {
});
}

function Project (instance, view) {
function Project(instance, view) {
var self = this;
self.id = ko.observable(instance.id);
self.name = ko.observable(instance.name);
Expand Down Expand Up @@ -167,7 +167,7 @@ function Project (instance, view) {
};
}

function ProjectImportView (instance, config) {
function ProjectImportView(instance, config) {
var self = this;
var instance = instance || {};

Expand Down Expand Up @@ -288,7 +288,7 @@ function ProjectImportView (instance, config) {
})
.always(function () {
self.is_syncing(false);
})
});
};

self.has_projects = ko.computed(function () {
Expand Down
20 changes: 10 additions & 10 deletions readthedocs/projects/static-src/projects/js/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var $ = jquery;


// Modal display
function _show_modal (section) {
function _show_modal(section) {
var embed_container = $('#embed-container');
if (!embed_container.length) {
embed_container = $('<div id="embed-container" class="modal modal-help" />');
Expand All @@ -27,13 +27,13 @@ function _show_modal (section) {
});
}

function EmbedView (config) {
function EmbedView(config) {
var self = this;

// Normalize config
self.config = config || {};
if (typeof(self.config.api_host) === 'undefined') {
self.config.api_host = 'https://readthedocs.org'
if (typeof (self.config.api_host) === 'undefined') {
self.config.api_host = 'https://readthedocs.org';
}

self.help = ko.observable(null);
Expand All @@ -46,7 +46,7 @@ function EmbedView (config) {
ko.computed(function () {
var file = self.file();
self.sections.removeAll();
if (! file) {
if (!file) {
return;
}
self.help('Loading...');
Expand Down Expand Up @@ -149,16 +149,16 @@ function EmbedView (config) {
module.exports.init_embed = function (config) {
var view = new EmbedView(config);
ko.applyBindings(view, $('#tool-embed')[0]);
}
};

// Analytics
function AnalyticsView (config) {
function AnalyticsView(config) {
var self = this;

// Normalize config
self.config = config || {};
if (typeof(self.config.api_host) === 'undefined') {
self.config.api_host = 'https://readthedocs.org'
if (typeof (self.config.api_host) === 'undefined') {
self.config.api_host = 'https://readthedocs.org';
}

self.show_help = function () {
Expand All @@ -173,4 +173,4 @@ function AnalyticsView (config) {
module.exports.init_analytics = function (config) {
var view = new AnalyticsView(config);
ko.applyBindings(view, $('#tool-analytics')[0]);
}
};

0 comments on commit 43ae1a4

Please sign in to comment.