Upgrade eslint (#1014)

It's apparently forced now to use the eslint.config.js instead of
.eslintrc

It got more strict with requiring the underscore on unused vars like
`catch(_err)` , but that was all

Closes #1012
Closes #995
Closes #992

## Launch Checklist

<!-- Thanks for the PR! Feel free to add or remove items from the
checklist. -->


 - [ ] Briefly describe the changes in this PR.
 - [ ] Link to related issues.
- [ ] Include before/after visuals or gifs if this PR includes visual
changes.
 - [ ] Write tests for all new functionality.
 - [ ] Add an entry to `CHANGELOG.md` under the `## main` section.
This commit is contained in:
Birk Skyum
2025-01-21 16:21:30 +01:00
committed by GitHub
parent b429bb16d7
commit cd7d607f13
20 changed files with 467 additions and 598 deletions

View File

@@ -1,7 +1,7 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("accessibility", () => {
let { beforeAndAfter, get, when, then } = new MaputnikDriver();
const { beforeAndAfter, get, when, then } = new MaputnikDriver();
beforeAndAfter();
describe("skip links", () => {

View File

@@ -1,7 +1,7 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("history", () => {
let { beforeAndAfter, when, get, then } = new MaputnikDriver();
const { beforeAndAfter, when, get, then } = new MaputnikDriver();
beforeAndAfter();
let undoKeyCombo: string;

View File

@@ -1,7 +1,7 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("i18n", () => {
let { beforeAndAfter, get, when, then } = new MaputnikDriver();
const { beforeAndAfter, get, when, then } = new MaputnikDriver();
beforeAndAfter();
describe("language detector", () => {

View File

@@ -1,7 +1,7 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("keyboard", () => {
let { beforeAndAfter, given, when, get, then } = new MaputnikDriver();
const { beforeAndAfter, given, when, get, then } = new MaputnikDriver();
beforeAndAfter();
describe("shortcuts", () => {
beforeEach(() => {

View File

@@ -2,7 +2,7 @@ import { v1 as uuid } from "uuid";
import { MaputnikDriver } from "./maputnik-driver";
describe("layers", () => {
let { beforeAndAfter, get, when, then } = new MaputnikDriver();
const { beforeAndAfter, get, when, then } = new MaputnikDriver();
beforeAndAfter();
beforeEach(() => {
when.setStyle("both");
@@ -101,7 +101,7 @@ describe("layers", () => {
});
describe("background", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "background",
});
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
@@ -117,7 +117,7 @@ describe("layers", () => {
describe("modify", () => {
function createBackground() {
// Setup
let id = uuid();
const id = uuid();
when.selectWithin("add-layer.layer-type", "background");
when.setValue("add-layer.layer-id.input", "background:" + id);
@@ -139,11 +139,11 @@ describe("layers", () => {
describe("layer", () => {
it("expand/collapse");
it("id", () => {
let bgId = createBackground();
const bgId = createBackground();
when.click("layer-list-item:background:" + bgId);
let id = uuid();
const id = uuid();
when.setValue("layer-editor.layer-id.input", "foobar:" + id);
when.click("min-zoom");
@@ -219,7 +219,7 @@ describe("layers", () => {
describe("comments", () => {
let bgId: string;
let comment = "42";
const comment = "42";
beforeEach(() => {
bgId = createBackground();
@@ -320,11 +320,11 @@ describe("layers", () => {
// TODO
it.skip("parse error", () => {
let bgId = createBackground();
const bgId = createBackground();
when.click("layer-list-item:background:" + bgId);
let errorSelector = ".CodeMirror-lint-marker-error";
const errorSelector = ".CodeMirror-lint-marker-error";
then(get.elementByTestId(errorSelector)).shouldNotExist();
when.click(".CodeMirror");
@@ -339,7 +339,7 @@ describe("layers", () => {
describe("fill", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "fill",
layer: "example",
});
@@ -361,7 +361,7 @@ describe("layers", () => {
describe("line", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "line",
layer: "example",
});
@@ -385,7 +385,7 @@ describe("layers", () => {
describe("symbol", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "symbol",
layer: "example",
});
@@ -404,7 +404,7 @@ describe("layers", () => {
describe("raster", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "raster",
layer: "raster",
});
@@ -423,7 +423,7 @@ describe("layers", () => {
describe("circle", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "circle",
layer: "example",
});
@@ -442,7 +442,7 @@ describe("layers", () => {
describe("fill extrusion", () => {
it("add", () => {
let id = when.modal.fillLayers({
const id = when.modal.fillLayers({
type: "fill-extrusion",
layer: "example",
});

View File

@@ -1,11 +1,11 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("map", () => {
let { beforeAndAfter, get, when, then } = new MaputnikDriver();
const { beforeAndAfter, get, when, then } = new MaputnikDriver();
beforeAndAfter();
describe("zoom level", () => {
it("via url", () => {
let zoomLevel = 12.37;
const zoomLevel = 12.37;
when.setStyle("geojson", zoomLevel);
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldBeVisible();
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldContainText(
@@ -14,7 +14,7 @@ describe("map", () => {
});
it("via map controls", () => {
let zoomLevel = 12.37;
const zoomLevel = 12.37;
when.setStyle("geojson", zoomLevel);
then(get.elementByTestId("maplibre:ctrl-zoom")).shouldBeVisible();
when.clickZoomIn();

View File

@@ -8,8 +8,8 @@ export default class ModalDriver {
fillLayers: (opts: { type: string; layer?: string; id?: string }) => {
// Having logic in test code is an anti pattern.
// This should be splitted to multiple single responsibility functions
let type = opts.type;
let layer = opts.layer;
const type = opts.type;
const layer = opts.layer;
let id;
if (opts.id) {
id = opts.id;

View File

@@ -1,7 +1,7 @@
import { MaputnikDriver } from "./maputnik-driver";
describe("modals", () => {
let { beforeAndAfter, when, get, then } = new MaputnikDriver();
const { beforeAndAfter, when, get, then } = new MaputnikDriver();
beforeAndAfter();
beforeEach(() => {
@@ -25,7 +25,7 @@ describe("modals", () => {
describe("when click open url", () => {
beforeEach(() => {
let styleFileUrl = get.exampleFileUrl();
const styleFileUrl = get.exampleFileUrl();
when.setValue("modal:open.url.input", styleFileUrl);
when.click("modal:open.url.button");
@@ -70,7 +70,7 @@ describe("modals", () => {
it("public source");
it("add new source", () => {
let sourceId = "n1z2v3r";
const sourceId = "n1z2v3r";
when.setValue("modal:sources.add.source_id", sourceId);
when.select("modal:sources.add.source_type", "tile_vector");
when.select("modal:sources.add.scheme_type", "tms");
@@ -84,7 +84,7 @@ describe("modals", () => {
});
it("add new raster source", () => {
let sourceId = "rastertest";
const sourceId = "rastertest";
when.setValue("modal:sources.add.source_id", sourceId);
when.select("modal:sources.add.source_type", "tile_raster");
when.select("modal:sources.add.scheme_type", "xyz");
@@ -159,7 +159,7 @@ describe("modals", () => {
});
});
it("glyphs url", () => {
let glyphsUrl = "http://example.com/{fontstack}/{range}.pbf";
const glyphsUrl = "http://example.com/{fontstack}/{range}.pbf";
when.setValue("modal:settings.glyphs", glyphsUrl);
when.click("modal:settings.name");
then(get.styleFromLocalStorage()).shouldDeepNestedInclude({
@@ -168,7 +168,7 @@ describe("modals", () => {
});
it("maptiler access token", () => {
let apiKey = "testing123";
const apiKey = "testing123";
when.setValue(
"modal:settings.maputnik:openmaptiles_access_token",
apiKey
@@ -182,7 +182,7 @@ describe("modals", () => {
});
it("thunderforest access token", () => {
let apiKey = "testing123";
const apiKey = "testing123";
when.setValue(
"modal:settings.maputnik:thunderforest_access_token",
apiKey
@@ -194,7 +194,7 @@ describe("modals", () => {
});
it("stadia access token", () => {
let apiKey = "testing123";
const apiKey = "testing123";
when.setValue(
"modal:settings.maputnik:stadia_access_token",
apiKey