Lint examples (#7827)

* lint examples

* examples lint fixes

* more lint fixes

* fixes

* final fixes
This commit is contained in:
Vladimir Agafonkin
2021-11-29 16:31:54 +02:00
committed by GitHub
parent 31259a9d25
commit 80279dd98b
25 changed files with 153 additions and 157 deletions

View File

@ -16,6 +16,7 @@ title: Choropleth Tutorial
zoomOffset: -1
}).addTo(map);
/* global statesData */
var geojson = L.geoJson(statesData).addTo(map);
</script>

View File

@ -20,13 +20,12 @@ title: Choropleth Tutorial
// get color depending on population density value
function getColor(d) {
return d > 1000 ? '#800026' :
d > 500 ? '#BD0026' :
d > 200 ? '#E31A1C' :
d > 100 ? '#FC4E2A' :
d > 50 ? '#FD8D3C' :
d > 20 ? '#FEB24C' :
d > 10 ? '#FED976' :
'#FFEDA0';
d > 500 ? '#BD0026' :
d > 200 ? '#E31A1C' :
d > 100 ? '#FC4E2A' :
d > 50 ? '#FD8D3C' :
d > 20 ? '#FEB24C' :
d > 10 ? '#FED976' : '#FFEDA0';
}
function style(feature) {
@ -40,6 +39,7 @@ title: Choropleth Tutorial
};
}
/* global statesData */
var geojson = L.geoJson(statesData, {
style: style,
}).addTo(map);

View File

@ -59,8 +59,7 @@ css: "#map {
info.update = function (props) {
this._div.innerHTML = '<h4>US Population Density</h4>' + (props ?
'<b>' + props.name + '</b><br />' + props.density + ' people / mi<sup>2</sup>'
: 'Hover over a state');
'<b>' + props.name + '</b><br />' + props.density + ' people / mi<sup>2</sup>' : 'Hover over a state');
};
info.addTo(map);
@ -69,13 +68,12 @@ css: "#map {
// get color depending on population density value
function getColor(d) {
return d > 1000 ? '#800026' :
d > 500 ? '#BD0026' :
d > 200 ? '#E31A1C' :
d > 100 ? '#FC4E2A' :
d > 50 ? '#FD8D3C' :
d > 20 ? '#FEB24C' :
d > 10 ? '#FED976' :
'#FFEDA0';
d > 500 ? '#BD0026' :
d > 200 ? '#E31A1C' :
d > 100 ? '#FC4E2A' :
d > 50 ? '#FD8D3C' :
d > 20 ? '#FEB24C' :
d > 10 ? '#FED976' : '#FFEDA0';
}
function style(feature) {
@ -125,6 +123,7 @@ css: "#map {
});
}
/* global statesData */
geojson = L.geoJson(statesData, {
style: style,
onEachFeature: onEachFeature
@ -137,10 +136,10 @@ css: "#map {
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'),
grades = [0, 10, 20, 50, 100, 200, 500, 1000],
labels = [],
from, to;
var div = L.DomUtil.create('div', 'info legend');
var grades = [0, 10, 20, 50, 100, 200, 500, 1000];
var labels = [];
var from, to;
for (var i = 0; i < grades.length; i++) {
from = grades[i];