Enable a few linting rules
This commit is contained in:
parent
5d8442a473
commit
3fbc8a3d32
7 changed files with 28 additions and 22 deletions
|
@ -113,13 +113,13 @@ $(document).ready(function () {
|
||||||
*/
|
*/
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$("header").children(":visible").each(function (i, e) {
|
$("header").children(":visible").each(function (i, e) {
|
||||||
headerWidth = headerWidth + $(e).outerWidth();
|
headerWidth += $(e).outerWidth();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").addClass("compact-nav");
|
$("body").addClass("compact-nav");
|
||||||
|
|
||||||
$("header").children(":visible").each(function (i, e) {
|
$("header").children(":visible").each(function (i, e) {
|
||||||
compactWidth = compactWidth + $(e).outerWidth();
|
compactWidth += $(e).outerWidth();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("body").removeClass("compact-nav");
|
$("body").removeClass("compact-nav");
|
||||||
|
|
|
@ -65,9 +65,8 @@ OSM.initializeContextMenu = function (map) {
|
||||||
function getDirectionsEndpointCoordinatesFromInput(input) {
|
function getDirectionsEndpointCoordinatesFromInput(input) {
|
||||||
if (input.attr("data-lat") && input.attr("data-lon")) {
|
if (input.attr("data-lat") && input.attr("data-lon")) {
|
||||||
return input.attr("data-lat") + "," + input.attr("data-lon");
|
return input.attr("data-lat") + "," + input.attr("data-lon");
|
||||||
} else {
|
|
||||||
return $(input).val();
|
|
||||||
}
|
}
|
||||||
|
return $(input).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
var updateMenu = function updateMenu() {
|
var updateMenu = function updateMenu() {
|
||||||
|
|
|
@ -121,7 +121,7 @@ OSM.initializeDataLayer = function (map) {
|
||||||
},
|
},
|
||||||
error: function (XMLHttpRequest, textStatus) {
|
error: function (XMLHttpRequest, textStatus) {
|
||||||
dataLoader = null;
|
dataLoader = null;
|
||||||
if (textStatus === "abort") { return; }
|
if (textStatus === "abort") return;
|
||||||
|
|
||||||
function closeError() {
|
function closeError() {
|
||||||
$("#browse_status").empty();
|
$("#browse_status").empty();
|
||||||
|
|
|
@ -115,17 +115,16 @@ OSM.Query = function (map) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tags.name) {
|
for (const key of ["name", "ref", "addr:housename"]) {
|
||||||
return tags.name;
|
if (tags[key]) {
|
||||||
} else if (tags.ref) {
|
return tags[key];
|
||||||
return tags.ref;
|
}
|
||||||
} else if (tags["addr:housename"]) {
|
|
||||||
return tags["addr:housename"];
|
|
||||||
} else if (tags["addr:housenumber"] && tags["addr:street"]) {
|
|
||||||
return tags["addr:housenumber"] + " " + tags["addr:street"];
|
|
||||||
} else {
|
|
||||||
return "#" + feature.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tags["addr:housenumber"] && tags["addr:street"]) {
|
||||||
|
return tags["addr:housenumber"] + " " + tags["addr:street"];
|
||||||
|
}
|
||||||
|
return "#" + feature.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function featureGeometry(feature) {
|
function featureGeometry(feature) {
|
||||||
|
@ -285,10 +284,11 @@ OSM.Query = function (map) {
|
||||||
.hide();
|
.hide();
|
||||||
|
|
||||||
if (marker) map.removeLayer(marker);
|
if (marker) map.removeLayer(marker);
|
||||||
marker = L.circle(latlng, Object.assign({
|
marker = L.circle(latlng, {
|
||||||
radius: radius,
|
radius: radius,
|
||||||
className: "query-marker"
|
className: "query-marker",
|
||||||
}, featureStyle)).addTo(map);
|
...featureStyle
|
||||||
|
}).addTo(map);
|
||||||
|
|
||||||
runQuery(latlng, radius, nearby, $("#query-nearby"), false);
|
runQuery(latlng, radius, nearby, $("#query-nearby"), false);
|
||||||
runQuery(latlng, radius, isin, $("#query-isin"), true, compareSize);
|
runQuery(latlng, radius, isin, $("#query-isin"), true, compareSize);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
L.OSM.locate = function (options) {
|
L.OSM.locate = function (options) {
|
||||||
var control = L.control.locate(Object.assign({
|
var control = L.control.locate({
|
||||||
icon: "icon geolocate",
|
icon: "icon geolocate",
|
||||||
iconLoading: "icon geolocate",
|
iconLoading: "icon geolocate",
|
||||||
strings: {
|
strings: {
|
||||||
|
@ -7,8 +7,9 @@ L.OSM.locate = function (options) {
|
||||||
popup: function (options) {
|
popup: function (options) {
|
||||||
return I18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance });
|
return I18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance });
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}, options));
|
...options
|
||||||
|
});
|
||||||
|
|
||||||
control.onAdd = function (map) {
|
control.onAdd = function (map) {
|
||||||
var container = Object.getPrototypeOf(this).onAdd.apply(this, [map]);
|
var container = Object.getPrototypeOf(this).onAdd.apply(this, [map]);
|
||||||
|
|
|
@ -62,7 +62,8 @@ OSM = {
|
||||||
},
|
},
|
||||||
|
|
||||||
mapParams: function (search) {
|
mapParams: function (search) {
|
||||||
var params = OSM.params(search), mapParams = {};
|
var params = OSM.params(search),
|
||||||
|
mapParams = {};
|
||||||
|
|
||||||
if (params.mlon && params.mlat) {
|
if (params.mlon && params.mlat) {
|
||||||
mapParams.marker = true;
|
mapParams.marker = true;
|
||||||
|
|
|
@ -56,6 +56,7 @@ module.exports = [
|
||||||
}],
|
}],
|
||||||
"@stylistic/key-spacing": "error",
|
"@stylistic/key-spacing": "error",
|
||||||
"@stylistic/keyword-spacing": "error",
|
"@stylistic/keyword-spacing": "error",
|
||||||
|
"@stylistic/max-statements-per-line": "error",
|
||||||
"@stylistic/no-floating-decimal": "error",
|
"@stylistic/no-floating-decimal": "error",
|
||||||
"@stylistic/no-mixed-operators": "error",
|
"@stylistic/no-mixed-operators": "error",
|
||||||
"@stylistic/no-multi-spaces": "error",
|
"@stylistic/no-multi-spaces": "error",
|
||||||
|
@ -65,6 +66,7 @@ module.exports = [
|
||||||
"@stylistic/object-curly-newline": ["error", { consistent: true }],
|
"@stylistic/object-curly-newline": ["error", { consistent: true }],
|
||||||
"@stylistic/object-curly-spacing": ["error", "always"],
|
"@stylistic/object-curly-spacing": ["error", "always"],
|
||||||
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
||||||
|
"@stylistic/one-var-declaration-per-line": "error",
|
||||||
"@stylistic/operator-linebreak": ["error", "after"],
|
"@stylistic/operator-linebreak": ["error", "after"],
|
||||||
"@stylistic/padded-blocks": ["error", "never"],
|
"@stylistic/padded-blocks": ["error", "never"],
|
||||||
"@stylistic/quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
|
"@stylistic/quote-props": ["error", "consistent-as-needed", { keywords: true, numbers: true }],
|
||||||
|
@ -92,6 +94,7 @@ module.exports = [
|
||||||
"no-caller": "error",
|
"no-caller": "error",
|
||||||
"no-console": "warn",
|
"no-console": "warn",
|
||||||
"no-div-regex": "error",
|
"no-div-regex": "error",
|
||||||
|
"no-else-return": ["error", { allowElseIf: false }],
|
||||||
"no-eq-null": "error",
|
"no-eq-null": "error",
|
||||||
"no-eval": "error",
|
"no-eval": "error",
|
||||||
"no-extend-native": "error",
|
"no-extend-native": "error",
|
||||||
|
@ -133,6 +136,8 @@ module.exports = [
|
||||||
"no-useless-return": "error",
|
"no-useless-return": "error",
|
||||||
"no-void": "error",
|
"no-void": "error",
|
||||||
"no-warning-comments": "warn",
|
"no-warning-comments": "warn",
|
||||||
|
"operator-assignment": "error",
|
||||||
|
"prefer-object-spread": "error",
|
||||||
"radix": ["error", "always"],
|
"radix": ["error", "always"],
|
||||||
"yoda": "error"
|
"yoda": "error"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue