Skip to content

Commit c5f445b

Browse files
committed
fix eslint no-unused-vars
1 parent d1fd209 commit c5f445b

File tree

11 files changed

+33
-84
lines changed

11 files changed

+33
-84
lines changed

atlas/static/chart.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function stackedBarChartConfig(element, data) {
143143
});
144144
}
145145

146-
function formatStackedBarChart(values, element) {
146+
function formatStackedBarChart(values) {
147147
const labels = [];
148148
const nb_species = [];
149149
const nb_patrimonial = [];
@@ -333,15 +333,15 @@ function threatenedByTaxoGroupChartConfig(element, values) {
333333

334334
var monthChartElement = document.getElementById("monthChart");
335335
if (monthChartElement) {
336-
const monthChart = genericChart(
336+
genericChart(
337337
monthChartElement,
338338
months_name,
339339
getChartDatas(months_value, "value"),
340340
);
341341
}
342342
var altiChartElement = document.getElementById("altiChart");
343343
if (altiChartElement) {
344-
const altiChart = genericChart(
344+
genericChart(
345345
altiChartElement,
346346
getChartDatas(dataset, "altitude"),
347347
getChartDatas(dataset, "value"),
@@ -350,7 +350,7 @@ if (altiChartElement) {
350350

351351
const dataSourceChartElement = document.getElementById("organismChart");
352352
if (dataSourceChartElement) {
353-
const organismChart = pieChartConfig(
353+
pieChartConfig(
354354
dataSourceChartElement,
355355
formatPieData(organism_stats, dataSourceChartElement),
356356
);
@@ -375,7 +375,7 @@ if (typeof areaInfos !== "undefined") {
375375
const biodiversityChartElement =
376376
document.getElementById("biodiversityChart");
377377
if (biodiversityChartElement) {
378-
const organismChart = stackedBarChartConfig(
378+
stackedBarChartConfig(
379379
biodiversityChartElement,
380380
formatStackedBarChart(
381381
species_by_taxonomic_group,
@@ -387,7 +387,7 @@ if (typeof areaInfos !== "undefined") {
387387
const observationsChartElement =
388388
document.getElementById("observationsChart");
389389
if (observationsChartElement) {
390-
const organismChart = pieChartConfig(
390+
pieChartConfig(
391391
observationsChartElement,
392392
formatPieData(
393393
observations_by_taxonomic_group,
@@ -423,7 +423,7 @@ if (typeof areaInfos !== "undefined") {
423423
"biodiversity_by_territoryChart",
424424
);
425425
if (biodiversityByTerritoryChartElement) {
426-
const organismChart = barChartConfig(
426+
barChartConfig(
427427
biodiversityByTerritoryChartElement,
428428
formatBarChart(
429429
nb_species_by_organism,
@@ -437,7 +437,7 @@ if (typeof areaInfos !== "undefined") {
437437
"observations_by_territoryChart",
438438
);
439439
if (observationsByTerritoryChartElement) {
440-
const organismChart = barChartConfig(
440+
barChartConfig(
441441
observationsByTerritoryChartElement,
442442
formatBarChart(
443443
observations_by_organism,

atlas/static/chart_organism.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// ChartJS Graphs
2-
const chartMainColor = getComputedStyle(
3-
document.documentElement,
4-
).getPropertyValue("--main-color");
5-
const chartHoverMainColor = getComputedStyle(
6-
document.documentElement,
7-
).getPropertyValue("--second-color");
2+
getComputedStyle(document.documentElement).getPropertyValue("--main-color");
3+
getComputedStyle(document.documentElement).getPropertyValue("--second-color");
84

95
const getChartDatas = function (data, key) {
106
const values = [];
@@ -65,7 +61,7 @@ var color_tab = [
6561
];
6662

6763
var groupChartElement = document.getElementById("groupChart");
68-
const groupChart = circleChart(
64+
circleChart(
6965
groupChartElement,
7066
getChartDatas(dataset, "group2_inpn"),
7167
getChartDatas(dataset, "nb_obs_group"),

atlas/static/eslint.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import js from "@eslint/js";
2-
import globals from "globals";
32
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
43
import { defineConfig } from "eslint/config";
54

atlas/static/ficheEspece.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $("#btn-more-audio").click(function () {
1515

1616
var myBooleanVideo = true;
1717
$("#btn-more-video").click(function () {
18-
if (myBoolean) {
18+
if (myBooleanVideo) {
1919
$(this).attr("title", "Masquer les vidéos");
2020
myBooleanVideo = false;
2121
} else {

atlas/static/listeEspeces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ document
342342
// event on taxon search
343343
document.getElementById("taxonInput").addEventListener(
344344
"keyup",
345-
debounce((el) => {
345+
debounce(() => {
346346
inputSearchTaxons = document
347347
.getElementById("taxonInput")
348348
.value.toLowerCase();

atlas/static/main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ autocompleteSearch = function (inputID, urlDestination, nbProposal) {
7171
},
7272
);
7373
},
74-
focus: function (event, ui) {
74+
focus: function () {
7575
return false;
7676
},
7777
select: function (event, ui) {
@@ -100,7 +100,7 @@ autocompleteSearch = function (inputID, urlDestination, nbProposal) {
100100

101101
return false;
102102
},
103-
create: function (event, ui) {
103+
create: function () {
104104
$(this).data("ui-autocomplete")._renderItem = function (ul, item) {
105105
if (item && item.type) {
106106
return $("<div class='type_name'>")
@@ -130,8 +130,6 @@ $("#searchAreasStat").focus(function () {
130130
autocompleteSearch("#searchAreasStat", "area", 10);
131131
});
132132

133-
// child list display
134-
var childList = $("#childList");
135133
$("#buttonChild").click(function () {
136134
$("#buttonChild")
137135
.find("span")

atlas/static/mapAreas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ var zoomHomeButton = false;
22

33
var map = generateMap(zoomHomeButton);
44

5-
var legend = L.control({ position: "bottomright" });
65
// Current observation Layer: leaflet layer type
76
var currentLayer;
87

98
// Current observation geoJson: type object
9+
// eslint-disable-next-line no-unused-vars
1010
var myGeoJson;
1111

1212
const id_area = areaInfos.areaID;

atlas/static/mapGenerator.js

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
1-
const mailleBorderColor = String(
2-
getComputedStyle(document.documentElement).getPropertyValue(
3-
"--map-maille-border-color",
4-
),
5-
);
6-
const mailleLastObsBorderColor = String(
7-
getComputedStyle(document.documentElement).getPropertyValue(
8-
"--map-maille-lastobs-border-color",
9-
),
10-
);
111
const territoryBorderColor = String(
122
getComputedStyle(document.documentElement).getPropertyValue(
133
"--map-territory-border-color",
144
),
155
);
16-
const areaBorderColor = String(
17-
getComputedStyle(document.documentElement).getPropertyValue(
18-
"--map-area-border-color",
19-
),
20-
);
216

227
// Feature group de chaque élément de floutage (M1, M5 etc...)
238
const overlays = {};
24-
const mailleSelectorrGenerated = false;
259
let current_type_code = [];
2610
const control = L.control.layers(null, null, {
2711
collapsed: false,
@@ -96,7 +80,7 @@ function addExternalOverlays() {
9680
document.getElementById("legend-other-info").appendChild(div);
9781
});
9882

99-
overlays[elem.name].addEventListener("remove", (event) => {
83+
overlays[elem.name].addEventListener("remove", () => {
10084
// Remove legend item
10185
const item = document.querySelector(
10286
`.legend-item[data-name='${elem.name}']`,
@@ -116,7 +100,7 @@ function addExternalOverlays() {
116100
.then((response) => response.json())
117101
.then((data) => {
118102
overlays[elem.name] = L.geoJSON(data, {
119-
style: function (feature) {
103+
style: function () {
120104
return elem.style || {};
121105
},
122106
});
@@ -264,6 +248,7 @@ function createLayersSelector(selectedAllLayer = false) {
264248
});
265249
}
266250

251+
// eslint-disable-next-line no-unused-vars
267252
function generateMap(zoomHomeButton) {
268253
// Map initialization
269254
firstMapTile = L.tileLayer(configuration.MAP.FIRST_MAP.url, {
@@ -291,7 +276,7 @@ function generateMap(zoomHomeButton) {
291276
// Keep Layers in the same order as specified by the
292277
// overlays variable so Departement under Commune
293278
// under 10km2 under 1km2
294-
map.on("overlayadd", function (e) {
279+
map.on("overlayadd", function () {
295280
Object.values(overlays).forEach((e) => e.bringToFront());
296281
});
297282

@@ -454,7 +439,7 @@ function onEachFeatureMaille(feature, layer) {
454439
}
455440

456441
function zoomMaille(layer) {
457-
layer.on("click", function (e) {
442+
layer.on("click", function () {
458443
map.fitBounds(layer.getBounds());
459444
});
460445
}
@@ -478,15 +463,6 @@ function getColor(d) {
478463
: "#FFEDA0";
479464
}
480465

481-
function styleMaille(feature) {
482-
return {
483-
fillColor: getColor(feature.properties.nb_observations),
484-
weight: 1,
485-
color: mailleBorderColor,
486-
fillOpacity: 0.8,
487-
};
488-
}
489-
490466
function generateLegend(isMaille = false) {
491467
if (!configuration.AFFICHAGE_MAILLE && !isMaille) {
492468
return generalLegendPoint();
@@ -535,6 +511,7 @@ function generalLegendPoint() {
535511

536512
// Display Maille layer
537513

514+
// eslint-disable-next-line no-unused-vars
538515
function displayMailleLayerFicheEspece(observationsMaille) {
539516
myGeoJson = observationsMaille;
540517
// Get all different type code
@@ -593,6 +570,7 @@ function generateGeojsonPointFicheEspece(
593570
}
594571

595572
// Display marker Layer (cluster or not)
573+
// eslint-disable-next-line no-unused-vars
596574
function displayMarkerLayerFicheEspece(
597575
observationsPoint,
598576
yearMin,
@@ -612,7 +590,7 @@ function displayMarkerLayerFicheEspece(
612590
);
613591

614592
if (typeof customizeMarkerStyle === "undefined") {
615-
customizeMarkerStyle = function (feature) {
593+
customizeMarkerStyle = function () {
616594
return {};
617595
};
618596
}
@@ -674,21 +652,17 @@ function onEachFeaturePoint(feature, layer) {
674652
layer.bindPopup(popupContent);
675653
}
676654

677-
function onEachFeaturePointArea(feature, layer) {
678-
popupContent = generateObservationPopup(feature, true);
679-
layer.bindPopup(popupContent);
680-
}
681-
682655
function getCustomizeMarkerStyle() {
683656
if (typeof customizeMarkerStyle === "undefined") {
684-
customizeMarkerStyle = function (feature) {
657+
customizeMarkerStyle = function () {
685658
return {};
686659
};
687660
} else {
688661
return customizeMarkerStyle;
689662
}
690663
}
691664

665+
// eslint-disable-next-line no-unused-vars
692666
function displayGeoJsonPoint(geojson) {
693667
currentLayer = L.geoJson(geojson, {
694668
onEachFeature: onEachFeaturePoint,
@@ -705,6 +679,7 @@ function displayGeoJsonPoint(geojson) {
705679
createTabControl(control);
706680
}
707681

682+
// eslint-disable-next-line no-unused-vars
708683
function refreshStyle(layers) {
709684
// fonction to refresh style of a list of layers from the customizeMarkerStyle (set green for sensibility and blue for non sensible obs)
710685
layers.forEach((layer) => {
@@ -714,12 +689,6 @@ function refreshStyle(layers) {
714689

715690
// ** MAILLE ***
716691

717-
function compare(a, b) {
718-
if (a.id_maille < b.id_maille) return -1;
719-
if (a.id_maille > b.id_maille) return 1;
720-
return 0;
721-
}
722-
723692
function buildSpeciesEntries(taxons) {
724693
rows = [];
725694
taxons.forEach((taxon) => {
@@ -894,6 +863,7 @@ function addInFeatureGroup(feature, layer) {
894863
}
895864
}
896865

866+
// eslint-disable-next-line no-unused-vars
897867
function displayGeojsonMailles(observationsMaille) {
898868
// Get all different type code
899869
observationsMaille.features.forEach((elem) => {
@@ -910,16 +880,18 @@ function displayGeojsonMailles(observationsMaille) {
910880
// Legend
911881

912882
var div;
883+
// eslint-disable-next-line no-unused-vars
913884
var mySlider;
914885

886+
// eslint-disable-next-line no-unused-vars
915887
function generateSliderOnMap() {
916888
var SliderControl = L.Control.extend({
917889
options: {
918890
position: "bottomleft",
919891
//control position - allowed: 'topleft', 'topright', 'bottomleft', 'bottomright'
920892
},
921893

922-
onAdd: function (map) {
894+
onAdd: function () {
923895
var sliderContainer = L.DomUtil.create(
924896
"div",
925897
"leaflet-bar leaflet-control leaflet-slider-control",
@@ -956,11 +928,3 @@ function generateSliderOnMap() {
956928
$("#yearMax").html("&nbsp;&nbsp;&nbsp;&nbsp;" + YEARMAX);
957929
$("#yearMin").html(taxonYearMin + "&nbsp;&nbsp;&nbsp;&nbsp");
958930
}
959-
960-
function find_id_observation_in_array(tab_id, id_observation) {
961-
i = 0;
962-
while (i < tab_id.length && tab_id[i] !== id_observation) {
963-
i = i + 1;
964-
}
965-
return i !== tab_id.length;
966-
}

atlas/static/mapHome.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ var zoomHomeButton = true;
22

33
var map = generateMap(zoomHomeButton);
44

5-
var legend = L.control({ position: "bottomright" });
6-
75
map.scrollWheelZoom.disable();
86
$("#map").click(function () {
97
map.scrollWheelZoom.enable();

atlas/static/mapMailles.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ var map = generateMap(zoomHomeButton);
44
if (configuration.MAP.ENABLE_SLIDER) {
55
generateSliderOnMap();
66
}
7-
var legend = L.control({ position: "bottomright" });
8-
97
// Legende
108

119
htmlLegend =
@@ -20,10 +18,9 @@ htmlLegend =
2018
var currentLayer;
2119

2220
// Current observation geoJson: type object
21+
// eslint-disable-next-line no-unused-vars
2322
var myGeoJson;
2423

25-
var compteurLegend = 0; // compteur pour ne pas rajouter la légende à chaque fois
26-
2724
$.ajax({
2825
url:
2926
configuration.URL_APPLICATION +

0 commit comments

Comments
 (0)