diff --git a/.eslintrc b/.eslintrc index 4d8f385896..df866ee0c9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,7 @@ "camelcase": [1, {"properties": "always"}], "comma-spacing": [1, {"before": false, "after": true}], "dot-notation": [1, {"allowKeywords": true}], - "curly": [1, "all"], + "curly": [2, "all"], "indent": [ 2, 4 @@ -48,4 +48,4 @@ "globals": { "django": false } -} \ No newline at end of file +} diff --git a/django/contrib/admin/static/admin/js/SelectBox.js b/django/contrib/admin/static/admin/js/SelectBox.js index bbd30a2c58..e859b182b8 100644 --- a/django/contrib/admin/static/admin/js/SelectBox.js +++ b/django/contrib/admin/static/admin/js/SelectBox.js @@ -95,8 +95,12 @@ var SelectBox = { a = a.text.toLowerCase(); b = b.text.toLowerCase(); try { - if (a > b) return 1; - if (a < b) return -1; + if (a > b) { + return 1; + } + if (a < b) { + return -1; + } } catch (e) { // silently fail on IE 'unknown' exception diff --git a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js index 987ee9004f..f7d1bd0ec7 100644 --- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js +++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js @@ -56,12 +56,14 @@ var DateTimeShortcuts = { var timezoneOffset = DateTimeShortcuts.timezoneOffset / 3600; // Only warn if there is a time zone mismatch. - if (!timezoneOffset) + if (!timezoneOffset) { return; + } // Check if warning is already there. - if ($(inp).siblings('.' + warningClass).length) + if ($(inp).siblings('.' + warningClass).length) { return; + } var message; if (timezoneOffset > 0) { diff --git a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js index e8b8dd7890..59688260ad 100644 --- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js +++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js @@ -66,7 +66,9 @@ function showRelatedObjectPopup(triggeringLink) { function updateRelatedObjectLinks(triggeringLink) { var $this = django.jQuery(triggeringLink); var siblings = $this.nextAll('.change-related, .delete-related'); - if (!siblings.length) return; + if (!siblings.length) { + return; + } var value = $this.val(); if (value) { siblings.each(function() { diff --git a/django/contrib/admin/static/admin/js/calendar.js b/django/contrib/admin/static/admin/js/calendar.js index deaac8ec20..841256fe0f 100644 --- a/django/contrib/admin/static/admin/js/calendar.js +++ b/django/contrib/admin/static/admin/js/calendar.js @@ -91,7 +91,9 @@ var CalendarNamespace = { // use UTC function; see above for explanation. if (isSelectedMonth && currentDay === selected.getUTCDate()) { - if (todayClass !== '') todayClass += " "; + if (todayClass !== '') { + todayClass += " "; + } todayClass += "selected"; } diff --git a/django/contrib/admin/static/admin/js/core.js b/django/contrib/admin/static/admin/js/core.js index 7702c66194..7e03bf72db 100644 --- a/django/contrib/admin/static/admin/js/core.js +++ b/django/contrib/admin/static/admin/js/core.js @@ -30,9 +30,13 @@ function removeEvent(obj, evType, fn) { } function cancelEventPropagation(e) { - if (!e) e = window.event; + if (!e) { + e = window.event; + } e.cancelBubble = true; - if (e.stopPropagation) e.stopPropagation(); + if (e.stopPropagation) { + e.stopPropagation(); + } } // quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]); @@ -52,7 +56,9 @@ function quickElement() { // "a" is reference to an object function removeChildren(a) { - while (a.hasChildNodes()) a.removeChild(a.lastChild); + while (a.hasChildNodes()) { + a.removeChild(a.lastChild); + } } // ---------------------------------------------------------------------------- diff --git a/django/contrib/gis/static/gis/js/OLMapWidget.js b/django/contrib/gis/static/gis/js/OLMapWidget.js index fde1f3cf23..8de5344446 100644 --- a/django/contrib/gis/static/gis/js/OLMapWidget.js +++ b/django/contrib/gis/static/gis/js/OLMapWidget.js @@ -170,9 +170,13 @@ function MapWidget(options) { this.wkt_f = new OpenLayers.Format.DjangoWKT(); // Mapping from OGRGeomType name to OpenLayers.Geometry name - if (options['geom_name'] === 'Unknown') options['geom_type'] = OpenLayers.Geometry; - else if (options['geom_name'] === 'GeometryCollection') options['geom_type'] = OpenLayers.Geometry.Collection; - else options['geom_type'] = eval('OpenLayers.Geometry.' + options['geom_name']); + if (options['geom_name'] === 'Unknown') { + options['geom_type'] = OpenLayers.Geometry; + } else if (options['geom_name'] === 'GeometryCollection') { + options['geom_type'] = OpenLayers.Geometry.Collection; + } else { + options['geom_type'] = eval('OpenLayers.Geometry.' + options['geom_name']); + } // Default options this.options = { @@ -261,8 +265,11 @@ function MapWidget(options) { MapWidget.prototype.create_map = function() { var map = new OpenLayers.Map(this.options.map_id, this.options.map_options); - if (this.options.base_layer) this.layers.base = this.options.base_layer; - else this.layers.base = new OpenLayers.Layer.WMS('OpenLayers WMS', 'http://vmap0.tiles.osgeo.org/wms/vmap0', {layers: 'basic'}); + if (this.options.base_layer) { + this.layers.base = this.options.base_layer; + } else { + this.layers.base = new OpenLayers.Layer.WMS('OpenLayers WMS', 'http://vmap0.tiles.osgeo.org/wms/vmap0', {layers: 'basic'}); + } map.addLayer(this.layers.base); return map; }; @@ -359,8 +366,9 @@ MapWidget.prototype.enableEditing = function () { MapWidget.prototype.getControls = function(layer) { this.panel = new OpenLayers.Control.Panel({'displayClass': 'olControlEditingToolbar'}); this.controls = [new OpenLayers.Control.Navigation()]; - if (!this.options.modifiable && layer.features.length) + if (!this.options.modifiable && layer.features.length) { return; + } if (this.options.geom_name.indexOf('LineString') >= 0 || this.options.geom_name === 'GeometryCollection' || this.options.geom_name === 'Unknown') { this.controls.push(new OpenLayers.Control.DrawFeature(layer, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'})); }