Enable some more eslint rules from iD rules

This commit is contained in:
Tom Hughes 2019-04-06 15:48:51 +01:00
parent 07aa5ade67
commit 87127d41e9
8 changed files with 48 additions and 18 deletions

View file

@ -334,7 +334,7 @@ $(document).ready(function () {
}; };
function addObject(type, id, center) { function addObject(type, id, center) {
map.addObject({type: type, id: parseInt(id)}, function(bounds) { map.addObject({type: type, id: parseInt(id, 10)}, function(bounds) {
if (!window.location.hash && bounds.isValid() && if (!window.location.hash && bounds.isValid() &&
(center || !map.getBounds().contains(bounds))) { (center || !map.getBounds().contains(bounds))) {
OSM.router.withoutMoveListener(function () { OSM.router.withoutMoveListener(function () {

View file

@ -17,7 +17,7 @@ OSM.Changeset = function (map) {
}; };
function addChangeset(id, center) { function addChangeset(id, center) {
map.addObject({type: 'changeset', id: parseInt(id)}, function(bounds) { map.addObject({type: 'changeset', id: parseInt(id, 10)}, function(bounds) {
if (!window.location.hash && bounds.isValid() && if (!window.location.hash && bounds.isValid() &&
(center || !map.getBounds().contains(bounds))) { (center || !map.getBounds().contains(bounds))) {
OSM.router.withoutMoveListener(function () { OSM.router.withoutMoveListener(function () {

View file

@ -121,7 +121,7 @@ OSM.NewNote = function(map) {
}); });
newNote = L.marker(markerLatlng, { newNote = L.marker(markerLatlng, {
icon: noteIcons["new"], icon: noteIcons.new,
opacity: 0.9, opacity: 0.9,
draggable: true draggable: true
}); });

View file

@ -87,20 +87,20 @@ L.OSM.Map = L.Map.extend({
getLayersCode: function () { getLayersCode: function () {
var layerConfig = ''; var layerConfig = '';
for (var i in this._layers) { // TODO: map.eachLayer this.eachLayer(function (layer) {
var layer = this._layers[i];
if (layer.options && layer.options.code) { if (layer.options && layer.options.code) {
layerConfig += layer.options.code; layerConfig += layer.options.code;
} }
} });
return layerConfig; return layerConfig;
}, },
getMapBaseLayerId: function () { getMapBaseLayerId: function () {
for (var i in this._layers) { // TODO: map.eachLayer var baseLayer;
var layer = this._layers[i]; this.eachLayer(function (layer) {
if (layer.options && layer.options.keyid) return layer.options.keyid; if (layer.options && layer.options.keyid) baseLayer = layer;
} });
return baseLayer.keyid;
}, },
getUrl: function(marker) { getUrl: function(marker) {

View file

@ -17,14 +17,44 @@
"updateLinks": "readonly" "updateLinks": "readonly"
}, },
"rules": { "rules": {
"dot-notation": "error",
"eqeqeq": ["error", "smart"], "eqeqeq": ["error", "smart"],
"keyword-spacing": "error",
"no-caller": "error", "no-caller": "error",
"no-div-regex": "error",
"no-extend-native": "error", "no-extend-native": "error",
"no-extra-bind": "error",
"no-floating-decimal": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-labels": "error",
"no-label-var": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-str": "error",
"no-new": "error", "no-new": "error",
"no-new-func": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-process-env": "error",
"no-proto": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow-restricted-names": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error", "no-trailing-spaces": "error",
"no-undef": "error", "no-unneeded-ternary": "error",
"no-unused-expressions": "off",
"no-unused-vars": "error", "no-unused-vars": "error",
"no-use-before-define": ["error", {"functions": false}], "no-use-before-define": ["error", {"functions": false}],
"semi": ["error", "always"] "no-void": "error",
"no-warning-comments": "warn",
"no-with": "error",
"radix": ["error", "always"],
"semi": ["error", "always"],
"semi-spacing": "error",
"space-unary-ops": "error",
"wrap-regex": "off"
} }
} }