Skip to content

Commit 74bbb3a

Browse files
authored
Merge pull request readthedocs#3768 from bansalnitish/eslint
Added eslint rules
2 parents 4015c03 + f1dc3df commit 74bbb3a

File tree

13 files changed

+47
-47
lines changed

13 files changed

+47
-47
lines changed

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
"no-shadow": "off",
2727
"no-undef": "warn",
2828
"no-underscore-dangle": "off",
29-
"no-unused-vars": "off",
29+
"no-unused-vars": "warn",
3030
"no-use-before-define": "error",
3131
"object-curly-spacing": "off",
3232
"one-var": "error",
3333
"padded-blocks": "off",
3434
"quote-props": "off",
3535
"quotes": "off",
36-
"semi": "off",
37-
"space-before-function-paren": "off",
38-
"space-unary-ops": "off",
36+
"semi": "error",
37+
"space-before-function-paren": "error",
38+
"space-unary-ops": "error",
3939
"spaced-comment": "off",
4040
"vars-on-top": "off",
4141
}

readthedocs/builds/static-src/builds/js/detail.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var ko = require('knockout');
44
var $ = require('jquery');
55

66

7-
function BuildCommand (data) {
7+
function BuildCommand(data) {
88
var self = this;
99
self.id = ko.observable(data.id);
1010
self.command = ko.observable(data.command);
@@ -25,7 +25,7 @@ function BuildCommand (data) {
2525
});
2626
}
2727

28-
function BuildDetailView (instance) {
28+
function BuildDetailView(instance) {
2929
var self = this;
3030
var instance = instance || {};
3131

@@ -46,7 +46,7 @@ function BuildDetailView (instance) {
4646
var n;
4747
for (n in commands_raw) {
4848
var command = new BuildCommand(commands_raw[n]);
49-
commands_display.push(command)
49+
commands_display.push(command);
5050
}
5151
return commands_display;
5252
});
@@ -58,7 +58,7 @@ function BuildDetailView (instance) {
5858
self.legacy_output(true);
5959
};
6060

61-
function poll_api () {
61+
function poll_api() {
6262
if (self.finished()) {
6363
return;
6464
}
@@ -75,7 +75,7 @@ function BuildDetailView (instance) {
7575
var command = data.commands[n];
7676
var match = ko.utils.arrayFirst(
7777
self.commands(),
78-
function(command_cmp) {
78+
function (command_cmp) {
7979
return (command_cmp.id === command.id);
8080
}
8181
);

readthedocs/core/static-src/core/js/autocomplete.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ module.exports = function (selector, url) {
55
$(selector).autocomplete({
66
source: url,
77
minLength: 2,
8-
open: function(event, ui) {
8+
open: function (event, ui) {
99
var ac_top = $('.ui-autocomplete').css('top');
1010
$('.ui-autocomplete').css({'width': '233px', 'top': ac_top + 10 });
1111
}
1212
});
13-
}
13+
};

readthedocs/core/static-src/core/js/doc-embed/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
var exports = {
44
THEME_RTD: 'sphinx_rtd_theme',
55
THEME_ALABASTER: 'alabaster',
6-
THEME_CELERY: 'sphinx_celery',
6+
THEME_CELERY: 'sphinx_celery'
77
};
88

99
exports.PROMO_SUPPORTED_THEMES = [
1010
exports.THEME_RTD,
1111
exports.THEME_ALABASTER,
12-
exports.THEME_CELERY,
12+
exports.THEME_CELERY
1313
];
1414

1515
exports.PROMO_TYPES = {

readthedocs/core/static-src/core/js/doc-embed/footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function setupBookmarkCSRFToken() {
2828
}
2929

3030
$.ajaxSetup({
31-
beforeSend: function(xhr, settings) {
31+
beforeSend: function (xhr, settings) {
3232
if (!csrfSafeMethod(settings.type)) {
3333
xhr.setRequestHeader("X-CSRFToken", $('a.bookmark[token]').attr('token'));
3434
}

readthedocs/core/static-src/core/js/doc-embed/search.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ function attach_elastic_search_query(data) {
9494
xhrFields: {
9595
withCredentials: true,
9696
},
97-
complete: function(resp, status_code) {
98-
if (typeof(resp.responseJSON) === 'undefined' ||
99-
typeof(resp.responseJSON.results) === 'undefined') {
97+
complete: function (resp, status_code) {
98+
if (typeof (resp.responseJSON) === 'undefined' ||
99+
typeof (resp.responseJSON.results) === 'undefined') {
100100
return search_def.reject();
101101
}
102102
return search_def.resolve(resp.responseJSON.results);

readthedocs/core/static-src/core/js/doc-embed/sphinx.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function init() {
1111
var rtd = rtddata.get();
1212

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

1717
// This needs to handle both old style legacy analytics for previously built docs
@@ -34,7 +34,7 @@ function init() {
3434
// already enabled. See:
3535
// https://github.com/snide/sphinx_rtd_theme/issues/250
3636
$(document).ready(function () {
37-
setTimeout(function() {
37+
setTimeout(function () {
3838
if (!theme.navBar) {
3939
theme.enable();
4040
}
@@ -46,7 +46,7 @@ function init() {
4646
// scroll element, gracefully handle failover by adding it
4747
// dynamically.
4848
var navBar = jquery('div.wy-side-scroll:first');
49-
if (! navBar.length) {
49+
if (!navBar.length) {
5050
var navInner = jquery('nav.wy-nav-side:first');
5151
var navScroll = $('<div />')
5252
.addClass('wy-side-scroll');

readthedocs/core/static-src/core/js/doc-embed/sponsorship.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var rtd;
88
/*
99
* Creates a sidebar div where an ad could go
1010
*/
11-
function create_sidebar_placement () {
11+
function create_sidebar_placement() {
1212
var element_id = 'rtd-' + (Math.random() + 1).toString(36).substring(4);
1313
var display_type = constants.PROMO_TYPES.LEFTNAV;
1414
var selector = null;
@@ -36,7 +36,7 @@ function create_sidebar_placement () {
3636
* Creates a sidebar div where an ad could go
3737
* Returns the ID of the div or none if no footer ad is possible
3838
*/
39-
function create_footer_placement () {
39+
function create_footer_placement() {
4040
var element_id = 'rtd-' + (Math.random() + 1).toString(36).substring(4);
4141
var display_type = constants.PROMO_TYPES.FOOTER;
4242
var selector = null;
@@ -63,7 +63,7 @@ function create_footer_placement () {
6363
/*
6464
* Returns an array of possible places where a promo could go
6565
*/
66-
function get_placements () {
66+
function get_placements() {
6767
var placements = [];
6868
var placement_funcs = [create_footer_placement, create_sidebar_placement];
6969
var placement;
@@ -78,7 +78,7 @@ function get_placements () {
7878
return placements;
7979
}
8080

81-
function Promo (data) {
81+
function Promo(data) {
8282
this.id = data.id; // analytics id
8383
this.div_id = data.div_id || '';
8484
this.html = data.html || '';

readthedocs/core/static-src/core/js/site.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ module.exports.handle_notification_dismiss = function () {
1717
}
1818
});
1919
});
20-
}
20+
};

readthedocs/core/static-src/core/js/tasks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
var jquery = require('jquery');
44

5-
function poll_task (data) {
5+
function poll_task(data) {
66
var defer = jquery.Deferred();
77
var tries = 5;
88

9-
function poll_task_loop () {
9+
function poll_task_loop() {
1010
jquery
1111
.getJSON(data.url)
1212
.success(function (task) {
@@ -40,7 +40,7 @@ function poll_task (data) {
4040
return defer;
4141
}
4242

43-
function trigger_task (config) {
43+
function trigger_task(config) {
4444
var defer = jquery.Deferred();
4545
var url = config.url;
4646
var token = config.token;

readthedocs/gold/static-src/gold/js/gold.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var jquery = require('jquery');
44
var payment = require('readthedocs/payments/static-src/payments/js/base');
55
var ko = require('knockout');
66

7-
function GoldView (config) {
7+
function GoldView(config) {
88
var self = this;
99
var config = config || {};
1010

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

2525
GoldView.prototype.submit_form = function (card_digits, token) {
2626
this.form.find('#id_last_4_digits').val(card_digits);

readthedocs/projects/static-src/projects/js/import.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var $ = require('jquery');
33
var tasks = require('readthedocs/core/static-src/core/js/tasks');
44

55

6-
$(function() {
6+
$(function () {
77
var input = $('#id_repo');
88
var repo = $('#id_repo_type');
99

@@ -37,7 +37,7 @@ $(function() {
3737
});
3838
});
3939

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

4343
Object.keys(params).map(function (key) {
@@ -49,7 +49,7 @@ function append_url_params (url, params) {
4949
return link.href;
5050
}
5151

52-
function Organization (instance, view) {
52+
function Organization(instance, view) {
5353
var self = this;
5454
self.id = ko.observable(instance.id);
5555
self.name = ko.observable(instance.name);
@@ -74,7 +74,7 @@ function Organization (instance, view) {
7474
});
7575
}
7676

77-
function Account (instance, view) {
77+
function Account(instance, view) {
7878
var self = this;
7979
self.id = ko.observable(instance.id);
8080
self.username = ko.observable(instance.username);
@@ -99,7 +99,7 @@ function Account (instance, view) {
9999
});
100100
}
101101

102-
function Project (instance, view) {
102+
function Project(instance, view) {
103103
var self = this;
104104
self.id = ko.observable(instance.id);
105105
self.name = ko.observable(instance.name);
@@ -167,7 +167,7 @@ function Project (instance, view) {
167167
};
168168
}
169169

170-
function ProjectImportView (instance, config) {
170+
function ProjectImportView(instance, config) {
171171
var self = this;
172172
var instance = instance || {};
173173

@@ -288,7 +288,7 @@ function ProjectImportView (instance, config) {
288288
})
289289
.always(function () {
290290
self.is_syncing(false);
291-
})
291+
});
292292
};
293293

294294
self.has_projects = ko.computed(function () {

readthedocs/projects/static-src/projects/js/tools.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var $ = jquery;
66

77

88
// Modal display
9-
function _show_modal (section) {
9+
function _show_modal(section) {
1010
var embed_container = $('#embed-container');
1111
if (!embed_container.length) {
1212
embed_container = $('<div id="embed-container" class="modal modal-help" />');
@@ -27,13 +27,13 @@ function _show_modal (section) {
2727
});
2828
}
2929

30-
function EmbedView (config) {
30+
function EmbedView(config) {
3131
var self = this;
3232

3333
// Normalize config
3434
self.config = config || {};
35-
if (typeof(self.config.api_host) === 'undefined') {
36-
self.config.api_host = 'https://readthedocs.org'
35+
if (typeof (self.config.api_host) === 'undefined') {
36+
self.config.api_host = 'https://readthedocs.org';
3737
}
3838

3939
self.help = ko.observable(null);
@@ -46,7 +46,7 @@ function EmbedView (config) {
4646
ko.computed(function () {
4747
var file = self.file();
4848
self.sections.removeAll();
49-
if (! file) {
49+
if (!file) {
5050
return;
5151
}
5252
self.help('Loading...');
@@ -149,16 +149,16 @@ function EmbedView (config) {
149149
module.exports.init_embed = function (config) {
150150
var view = new EmbedView(config);
151151
ko.applyBindings(view, $('#tool-embed')[0]);
152-
}
152+
};
153153

154154
// Analytics
155-
function AnalyticsView (config) {
155+
function AnalyticsView(config) {
156156
var self = this;
157157

158158
// Normalize config
159159
self.config = config || {};
160-
if (typeof(self.config.api_host) === 'undefined') {
161-
self.config.api_host = 'https://readthedocs.org'
160+
if (typeof (self.config.api_host) === 'undefined') {
161+
self.config.api_host = 'https://readthedocs.org';
162162
}
163163

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

0 commit comments

Comments
 (0)