more strict eslinting

This commit is contained in:
Vladimir Agafonkin 2015-09-25 13:40:21 +03:00
parent bcde047f09
commit 301473ad4d
24 changed files with 71 additions and 99 deletions

View File

@ -1,42 +1,18 @@
{
"rules": {
"eqeqeq": 2,
"consistent-return": 2,
"no-loop-func": 2,
"no-use-before-define": [2, "nofunc"],
"no-lonely-if": 2,
"no-else-return": 2,
"no-new": 2,
"no-throw-literal": 2,
"no-self-compare": 2,
"no-void": 2,
"no-eq-null": 2,
"quotes": [2, "single"],
"camelcase": 2,
"comma-style": 2,
"comma-spacing": 2,
"new-cap": 2,
"no-empty": 2,
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"space-in-parens": 2,
"space-before-blocks": 2,
"space-after-keywords": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
"array-bracket-spacing": 2,
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"no-constant-condition": 0
},
"globals": {
"L": true,
"module": false,
"define": false
},
"env": {
"browser": true
"commonjs": true,
"amd": true,
"node": false
},
"extends": "eslint:recommended"
"extends": "mourner",
"rules": {
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"indent": [2, "tab", {"VariableDeclarator": 0}],
"strict": 0,
"wrap-iife": 0,
"key-spacing": 0
}
}

View File

@ -4,7 +4,8 @@
"description": "JavaScript library for mobile-friendly interactive maps",
"devDependencies": {
"copyfiles": "0.2.1",
"eslint": "^1.3.1",
"eslint": "^1.5.1",
"eslint-config-mourner": "^1.0.0",
"happen": "~0.2.0",
"jake": "~8.0.12",
"karma": "~0.13.9",

View File

@ -4,21 +4,15 @@
"quotes": 0,
"no-shadow": 0,
"no-irregular-whitespace": 0,
"no-console": 0
},
"globals": {
"L": true,
"module": false,
"define": false,
"expect": false,
"it": false,
"describe": false,
"sinon": false,
"happen": false,
"beforeEach": false,
"afterEach": false
"no-console": 0,
"indent": 0
},
"env": {
"browser": true
"mocha": true
},
"globals": {
"expect": false,
"sinon": false,
"happen": false
}
}

View File

@ -143,7 +143,10 @@ L.DomUtil = {
var pos = offset || new L.Point(0, 0);
el.style[L.DomUtil.TRANSFORM] =
(L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px' + ')' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px' + ',0)') + (scale ? ' scale(' + scale + ')' : '');
(L.Browser.ie3d ?
'translate(' + pos.x + 'px,' + pos.y + 'px)' :
'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') +
(scale ? ' scale(' + scale + ')' : '');
},
setPosition: function (el, point) { // (HTMLElement, Point[, Boolean])

View File

@ -424,9 +424,8 @@ L.GridLayer = L.Layer.extend({
},
_getTiledPixelBounds: function (center, zoom, tileZoom) {
var map = this._map;
var scale = map.getZoomScale(zoom, tileZoom),
var map = this._map,
scale = map.getZoomScale(zoom, tileZoom),
pixelCenter = map.project(center, tileZoom).floor(),
halfSize = map.getSize().divideBy(scale * 2);
@ -442,9 +441,8 @@ L.GridLayer = L.Layer.extend({
if (center === undefined) { center = map.getCenter(); }
if (this._tileZoom === undefined) { return; } // if out of minzoom/maxzoom
var pixelBounds = this._getTiledPixelBounds(center, zoom, this._tileZoom);
var tileRange = this._pxBoundsToTileRange(pixelBounds),
var pixelBounds = this._getTiledPixelBounds(center, zoom, this._tileZoom),
tileRange = this._pxBoundsToTileRange(pixelBounds),
tileCenter = tileRange.getCenter(),
queue = [];

View File

@ -82,7 +82,7 @@ L.Canvas = L.Renderer.extend({
var padding = (layer.options.weight || 0) + 1;
this._redrawBounds = this._redrawBounds || new L.Bounds();
this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]))
this._redrawBounds.extend(layer._pxBounds.min.subtract([padding, padding]));
this._redrawBounds.extend(layer._pxBounds.max.add([padding, padding]));
this._redrawRequest = this._redrawRequest || L.Util.requestAnimFrame(this._redraw, this);

View File

@ -709,8 +709,8 @@ L.Map = L.Evented.extend({
for (var i = 0; i < targets.length; i++) {
targets[i].fire(type, data, true);
if (data.originalEvent._stopped
|| (targets[i].options.nonBubblingEvents && L.Util.indexOf(targets[i].options.nonBubblingEvents, type) !== -1)) { return; }
if (data.originalEvent._stopped ||
(targets[i].options.nonBubblingEvents && L.Util.indexOf(targets[i].options.nonBubblingEvents, type) !== -1)) { return; }
}
},