diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs index 2a1f597ac1..66e0437703 100644 --- a/frontend/.eslintrc.cjs +++ b/frontend/.eslintrc.cjs @@ -14,6 +14,7 @@ module.exports = { }, rules: { curly: ['error', 'all'], + 'func-names': ['error', 'always'], 'newline-before-return': 'error', 'no-console': ['error', { allow: ['info', 'warn', 'error'] }], @@ -167,6 +168,7 @@ module.exports = { files: ['cypress/**/*.js', 'cypress/**/*.ts', 'cypress.config.ts'], plugins: ['cypress', 'mocha'], rules: { + 'func-names': ['off'], // TODO Check why either Prettier or ESLint auto-formatting does that and why this rule is not enabled. // 'max-len': ['warn', { code: 120 }], diff --git a/frontend/cypress/e2e/sidebars/custom_zones.spec.ts b/frontend/cypress/e2e/sidebars/custom_zones.spec.ts index 5ccb4d710c..c2e2e6dfcd 100644 --- a/frontend/cypress/e2e/sidebars/custom_zones.spec.ts +++ b/frontend/cypress/e2e/sidebars/custom_zones.spec.ts @@ -26,7 +26,7 @@ context('Sidebars > Custom Zones', () => { cy.get('*[data-cy="custom-zone-display-button"]') .click() .then(() => { - const customZonesItem = JSON.parse(localStorage.getItem(CUSTOM_ZONES_LOCALSTORAGE_KEY) || '') + const customZonesItem = JSON.parse(localStorage.getItem(CUSTOM_ZONES_LOCALSTORAGE_KEY) ?? '') const zones = JSON.parse(customZonesItem.zones) expect(zones['b2f8aea3-7814-4247-98fa-ddc58c922d09'].isShown).equal(false) }) diff --git a/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts b/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts index c2594cbc9c..f0e3c94b4b 100644 --- a/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts +++ b/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts @@ -373,7 +373,7 @@ context('Sidebars > Regulatory Layers', () => { cy.cleanScreenshots(1) cy.getAllLocalStorage().then(localStorage => { - expect(localStorage.homepagelayersShowedOnMap || '').to.be.empty + expect(localStorage.homepagelayersShowedOnMap ?? '').to.be.empty }) // When @@ -383,7 +383,7 @@ context('Sidebars > Regulatory Layers', () => { .eq(0) .click({ force: true, timeout: 10000 }) .then(() => { - const showedLayers = JSON.parse(localStorage.getItem('homepagelayersShowedOnMap') || '') + const showedLayers = JSON.parse(localStorage.getItem('homepagelayersShowedOnMap') ?? '') expect(showedLayers).length(1) expect(showedLayers[0].type).equal('eez_areas') }) @@ -409,7 +409,7 @@ context('Sidebars > Regulatory Layers', () => { cy.get('*[data-cy="administrative-zones-open"]') .click({ force: true, timeout: 10000 }) .then(() => { - const showedLayers = JSON.parse(localStorage.getItem('homepagelayersShowedOnMap') || '') + const showedLayers = JSON.parse(localStorage.getItem('homepagelayersShowedOnMap') ?? '') expect(showedLayers).length(1) expect(showedLayers[0].type).equal('eez_areas') }) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 67942c815c..dfabdacce6 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -63,11 +63,11 @@ }, "devDependencies": { "@faker-js/faker": "8.4.1", - "@import-meta-env/cli": "0.6.9", - "@import-meta-env/prepare": "0.1.14", - "@import-meta-env/unplugin": "0.5.2", + "@import-meta-env/cli": "0.7.0", + "@import-meta-env/prepare": "0.2.0", + "@import-meta-env/unplugin": "0.6.0", "@jest/globals": "29.7.0", - "@swc/core": "1.7.22", + "@swc/core": "1.7.23", "@swc/jest": "0.2.36", "@testing-library/react": "15.0.7", "@tsconfig/vite-react": "2.0.1", @@ -93,13 +93,13 @@ "eslint-config-airbnb-typescript": "17.1.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-cypress": "3.5.0", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-jest": "28.8.1", + "eslint-plugin-import": "2.30.0", + "eslint-plugin-jest": "28.8.2", "eslint-plugin-jsx-a11y": "6.9.0", "eslint-plugin-mocha": "10.5.0", "eslint-plugin-no-null": "1.0.2", "eslint-plugin-prettier": "5.2.1", - "eslint-plugin-react": "7.35.0", + "eslint-plugin-react": "7.35.2", "eslint-plugin-react-hooks": "4.6.2", "eslint-plugin-sort-destructure-keys": "1.5.0", "eslint-plugin-sort-keys-fix": "1.1.2", @@ -1653,13 +1653,13 @@ } }, "node_modules/@import-meta-env/cli": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/@import-meta-env/cli/-/cli-0.6.9.tgz", - "integrity": "sha512-qLwk6PrS26Ni15paHSEgsz8NZODtrrxhIUms5I5jjXBVVP/DmIP4oFBH8thWCCyHRYeirWeWyjSUfzuk4tHE2A==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@import-meta-env/cli/-/cli-0.7.0.tgz", + "integrity": "sha512-2ARV8ZSqdB3Oh9MYyh2JlGVV16IjqlXfmyRbp2Fng8geONWh5SGPZwXLFjsqj4z1LN5KYfdDgL6dSz9PV+CxWQ==", "dev": true, - "license": "MIT", "dependencies": { "commander": "12.1.0", + "dotenv": "^16.0.0", "glob": "11.0.0", "picocolors": "1.0.1", "serialize-javascript": "6.0.2" @@ -1671,10 +1671,9 @@ "node": ">= 14" }, "peerDependencies": { - "@import-meta-env/babel": "^0.4.3", + "@import-meta-env/babel": "^0.5.0", "@import-meta-env/swc": "^0.4.5", - "@import-meta-env/unplugin": "^0.4.8 || ^0.5.0", - "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" + "@import-meta-env/unplugin": "0.6.0" }, "peerDependenciesMeta": { "@import-meta-env/babel": { @@ -1689,13 +1688,13 @@ } }, "node_modules/@import-meta-env/prepare": { - "version": "0.1.14", - "resolved": "https://registry.npmjs.org/@import-meta-env/prepare/-/prepare-0.1.14.tgz", - "integrity": "sha512-bkf1U5mEyEd4S4qT0vjIm9IPhxlBWnRjCfVLQW+GCajosh92gjO4bxsenasLeRTwiGi1cKo7LRDBdbugN6EpdA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@import-meta-env/prepare/-/prepare-0.2.0.tgz", + "integrity": "sha512-n5/0PUS1swCgsen8dUx3JCy6EW4dZv1izXjuJF8pe2y9F5VMtfHso3Ov8+2lqKNOZOsm60KMewN9XUCubYFI6g==", "dev": true, - "license": "MIT", "dependencies": { "commander": "12.1.0", + "dotenv": "^16.0.0", "glob": "11.0.0", "picocolors": "1.0.1", "serialize-javascript": "6.0.2" @@ -1705,19 +1704,16 @@ }, "engines": { "node": ">= 14" - }, - "peerDependencies": { - "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" } }, "node_modules/@import-meta-env/unplugin": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@import-meta-env/unplugin/-/unplugin-0.5.2.tgz", - "integrity": "sha512-v4/BBoq9GseABxpBuxmuNsLFkHGr9rhCg5T+t00cGf2q67o8xjn3LrxVa8OiYqN49c5J2OLHj4udL5wzIxrtCQ==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@import-meta-env/unplugin/-/unplugin-0.6.0.tgz", + "integrity": "sha512-oKttBqTQpAK0D6iWSR952L58+86GW7EMhfHD1ueF7xwJxfbIikvNa+oNIvdinr46m9g0aaHA0XywpZTGCCwm+g==", "dev": true, "hasInstallScript": true, - "license": "MIT", "dependencies": { + "dotenv": "^16.0.0", "magic-string": "^0.30.0", "object-hash": "^3.0.0", "picocolors": "^1.0.0", @@ -1727,8 +1723,7 @@ "node": ">= 14" }, "peerDependencies": { - "@import-meta-env/cli": "^0.5.1 || ^0.6.0", - "dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0" + "@import-meta-env/cli": "^0.7.0" }, "peerDependenciesMeta": { "@import-meta-env/cli": { @@ -3093,6 +3088,12 @@ "react-dom": ">=16.8.0" } }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, "node_modules/@sentry-internal/feedback": { "version": "7.117.0", "resolved": "https://registry.npmjs.org/@sentry-internal/feedback/-/feedback-7.117.0.tgz", @@ -3571,9 +3572,9 @@ } }, "node_modules/@swc/core": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.7.22.tgz", - "integrity": "sha512-Asn79WKqyjEuO2VEeSnVjn2YiRMToRhFJwOsQeqftBvwWMn1FGUuzVcXtkQFBk37si8Gh2Vkk/+p0u4K5NxDig==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.7.23.tgz", + "integrity": "sha512-VDNkpDvDlreGh2E3tlDj8B3piiuLhhQA/7rIVZpiLUvG1YpucAa6N7iDXA7Gc/+Hah8spaCg/qvEaBkCmcIYCQ==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -3588,16 +3589,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.7.22", - "@swc/core-darwin-x64": "1.7.22", - "@swc/core-linux-arm-gnueabihf": "1.7.22", - "@swc/core-linux-arm64-gnu": "1.7.22", - "@swc/core-linux-arm64-musl": "1.7.22", - "@swc/core-linux-x64-gnu": "1.7.22", - "@swc/core-linux-x64-musl": "1.7.22", - "@swc/core-win32-arm64-msvc": "1.7.22", - "@swc/core-win32-ia32-msvc": "1.7.22", - "@swc/core-win32-x64-msvc": "1.7.22" + "@swc/core-darwin-arm64": "1.7.23", + "@swc/core-darwin-x64": "1.7.23", + "@swc/core-linux-arm-gnueabihf": "1.7.23", + "@swc/core-linux-arm64-gnu": "1.7.23", + "@swc/core-linux-arm64-musl": "1.7.23", + "@swc/core-linux-x64-gnu": "1.7.23", + "@swc/core-linux-x64-musl": "1.7.23", + "@swc/core-win32-arm64-msvc": "1.7.23", + "@swc/core-win32-ia32-msvc": "1.7.23", + "@swc/core-win32-x64-msvc": "1.7.23" }, "peerDependencies": { "@swc/helpers": "*" @@ -3609,9 +3610,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.22.tgz", - "integrity": "sha512-B2Bh2W+C7ALdGwDxRWAJ+UtNExfozvwyayGiNkbR3wmDKXXeQfhGM5MK+QYUWKu7UQ6ATq69OyZrxofDobKUug==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.7.23.tgz", + "integrity": "sha512-yyOHPfti6yKlQulfVWMt7BVKst+SyEZYCWuQSGMn1KgmNCH/bYufRWfQXIhkGSj44ZkEepJmsJ8tDyIb4k5WyA==", "cpu": [ "arm64" ], @@ -3625,9 +3626,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.7.22.tgz", - "integrity": "sha512-s34UQntnQ6tL9hS9aX3xG7OfGhpmy05FEEndbHaooGO8O+L5k8uWxhE5KhYCOC0N803sGdZg6YZmKtYrWN/YxA==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.7.23.tgz", + "integrity": "sha512-GzqHwQ0Y1VyjdI/bBKFX2GKm5HD3PIB6OhuAQtWZMTtEr2yIrlT0YK2T+XKh7oIg31JwxGBeQdBk3KTI7DARmQ==", "cpu": [ "x64" ], @@ -3641,9 +3642,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.22.tgz", - "integrity": "sha512-SE69+oos1jLOXx5YdMH//Qc5zQc2xYukajB+0BWmkcFd/S/cCanGWYtdSzYausm8af2Fw1hPJMNIfndJLnBDFw==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.7.23.tgz", + "integrity": "sha512-qwX4gB41OS6/OZkHcpTqLFGsdmvoZyffnJIlgB/kZKwH3lfeJWzv6vx57zXtNpM/t7GoQEe0VZUVdmNjxSxBZw==", "cpu": [ "arm" ], @@ -3657,9 +3658,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.22.tgz", - "integrity": "sha512-59FzDW/ojgiTj4dlnv3Z3ESuVlzhSAq9X12CNYh4/WTCNA8BoJqOnWMRQKspWtoNlnVviFLMvpek0pGXHndEBA==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.7.23.tgz", + "integrity": "sha512-TsrbUZdMaUwzI7+g/8rHPLWbntMKYSu5Bn5IBSqVKPeyqaXxNnlIUnWXgXcUcRAc+T+Y8ADfr7EiFz9iz5DuSA==", "cpu": [ "arm64" ], @@ -3673,9 +3674,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.22.tgz", - "integrity": "sha512-cMQMI8YRO/XR3OrYuiUlWksNsJOZSkA6gSLNyH6eHTw+FOAzv05oJ4SFYe6s1WesrOqRwhpez6y5H6OIP/EKzg==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.7.23.tgz", + "integrity": "sha512-JEdtwdthazKq4PBz53KSubwwK8MvqODAihGSAzc8u3Unq4ojcvaS8b0CwLBeD+kTQ78HpxOXTt3DsFIxpgaCAA==", "cpu": [ "arm64" ], @@ -3689,9 +3690,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.22.tgz", - "integrity": "sha512-639kA7MXrWqWYfwuSJ+XTg21VYb/5o99R1zJrndoEjEX6m7Wza/sXssQKU5jbbkPoSEKVKNP3n/gazLWiUKgiQ==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.7.23.tgz", + "integrity": "sha512-V51gFPWaVAHbI1yg9ahsoya3aB4uawye3SZ5uQWgcP7wdCdiv60dw4F5nuPJf5Z1oXD3U/BslXuamv8Oh9vXqQ==", "cpu": [ "x64" ], @@ -3705,9 +3706,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.22.tgz", - "integrity": "sha512-f3zfGgY8EJQUOk3ve25ZTkNkhB/kHo9QlN2r+0exaE1g9W7X8IS6J8pWzF3hJrV2P9dBi6ofMOt+opVA89JKHA==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.7.23.tgz", + "integrity": "sha512-BBqQi4+UdeRqag3yM4IJjaHG4yc1o3l9ksENHToE0o/u2DT0FY5+K/DiYGZLC1JHbSFzNqRCYsa7DIzRtZ0A1A==", "cpu": [ "x64" ], @@ -3721,9 +3722,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.22.tgz", - "integrity": "sha512-p/Fav5U+LtTJD/tbbS0dKK8SVVAhXo5Jdm1TDeBPJ4BEIVguYBZEXgD3CW9wY4K34g1hscpiz2Q2rktfhFj1+A==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.7.23.tgz", + "integrity": "sha512-JPk6pvCKncL6bXG7p+NLZf8PWx4FakVvKNdwGeMrYunb+yk1IZf7qf9LJk8+GDGF5QviDXPs8opZrTrfsW80fA==", "cpu": [ "arm64" ], @@ -3737,9 +3738,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.22.tgz", - "integrity": "sha512-HbmfasaCNTqeCTvDjleYj+jJZQ6MlraiVOdhW55KtbA9mAVQdPBq6DDAvR7VOero3wUNYUM/e36otFKgEJI5Rg==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.7.23.tgz", + "integrity": "sha512-2Whxi8d+bLQBzJcQ5qYPHlk02YYVGsMVav0fWk+FnX2z1QRREIu1L1xvrpi7gBpjXp6BIU40ya8GiKeekNT2bg==", "cpu": [ "ia32" ], @@ -3753,9 +3754,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.7.22", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.22.tgz", - "integrity": "sha512-lppIveE+hpe7WXny/9cUT+T6sBM/ND0E+dviKWJ5jFBISj2KWomlSJGUjYEsRGJVPnTEc8uOlKK7etmXBhQx9A==", + "version": "1.7.23", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.7.23.tgz", + "integrity": "sha512-82fARk4/yJ40kwWKY/gdKDisPdtgJE9jgpl/vkNG3alyJxrCzuNM7+CtiKoYbXLeqM8GQTS3wlvCaJu9oQ8dag==", "cpu": [ "x64" ], @@ -8058,11 +8059,10 @@ } }, "node_modules/eslint-module-utils": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.2.tgz", - "integrity": "sha512-3XnC5fDyc8M4J2E8pt8pmSVRX2M+5yWMCfI/kDZwauQeFgzQOuhcRBFKjTeJagqgk4sFKxe1mvNVnaWwImx/Tg==", + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.9.0.tgz", + "integrity": "sha512-McVbYmwA3NEKwRQY5g4aWMdcZE5xZxV8i8l7CqJSrameuGSQJtSWaL/LxTEzSKKaCcOhlpDR8XEfYXWPrdo/ZQ==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^3.2.7" }, @@ -8080,7 +8080,6 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.1" } @@ -8127,27 +8126,27 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "version": "2.30.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz", + "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==", "dev": true, - "license": "MIT", "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.8", + "array.prototype.findlastindex": "^1.2.5", "array.prototype.flat": "^1.3.2", "array.prototype.flatmap": "^1.3.2", "debug": "^3.2.7", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", + "eslint-module-utils": "^2.9.0", + "hasown": "^2.0.2", + "is-core-module": "^2.15.1", "is-glob": "^4.0.3", "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.0", "semver": "^6.3.1", "tsconfig-paths": "^3.15.0" }, @@ -8192,9 +8191,9 @@ } }, "node_modules/eslint-plugin-jest": { - "version": "28.8.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.1.tgz", - "integrity": "sha512-G46XMyYu6PtSNJUkQ0hsPjzXYpzq/O4vpCciMizTKRJG8kNsRreGoMRDG6H9FIB/xVgfFuclVnuX4XRvFUzrZQ==", + "version": "28.8.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.8.2.tgz", + "integrity": "sha512-mC3OyklHmS5i7wYU1rGId9EnxRI8TVlnFG56AE+8U9iRy6zwaNygZR+DsdZuCL0gRG0wVeyzq+uWcPt6yJrrMA==", "dev": true, "dependencies": { "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -8349,11 +8348,10 @@ } }, "node_modules/eslint-plugin-react": { - "version": "7.35.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.35.0.tgz", - "integrity": "sha512-v501SSMOWv8gerHkk+IIQBkcGRGrO2nfybfj5pLxuJNFTPxxA3PSryhXTK+9pNbtkggheDdsC0E9Q8CuPk6JKA==", + "version": "7.35.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.35.2.tgz", + "integrity": "sha512-Rbj2R9zwP2GYNcIak4xoAMV57hrBh3hTaR0k7hVjwCQgryE/pw5px4b13EYjduOI0hfXyZhwBxaGpOTbWSGzKQ==", "dev": true, - "license": "MIT", "dependencies": { "array-includes": "^3.1.8", "array.prototype.findlast": "^1.2.5", diff --git a/frontend/package.json b/frontend/package.json index b5eda4c670..cc5dc1b4a7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -89,11 +89,11 @@ }, "devDependencies": { "@faker-js/faker": "8.4.1", - "@import-meta-env/cli": "0.6.9", - "@import-meta-env/prepare": "0.1.14", - "@import-meta-env/unplugin": "0.5.2", + "@import-meta-env/cli": "0.7.0", + "@import-meta-env/prepare": "0.2.0", + "@import-meta-env/unplugin": "0.6.0", "@jest/globals": "29.7.0", - "@swc/core": "1.7.22", + "@swc/core": "1.7.23", "@swc/jest": "0.2.36", "@testing-library/react": "15.0.7", "@tsconfig/vite-react": "2.0.1", @@ -119,13 +119,13 @@ "eslint-config-airbnb-typescript": "17.1.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-cypress": "3.5.0", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-jest": "28.8.1", + "eslint-plugin-import": "2.30.0", + "eslint-plugin-jest": "28.8.2", "eslint-plugin-jsx-a11y": "6.9.0", "eslint-plugin-mocha": "10.5.0", "eslint-plugin-no-null": "1.0.2", "eslint-plugin-prettier": "5.2.1", - "eslint-plugin-react": "7.35.0", + "eslint-plugin-react": "7.35.2", "eslint-plugin-react-hooks": "4.6.2", "eslint-plugin-sort-destructure-keys": "1.5.0", "eslint-plugin-sort-keys-fix": "1.1.2", diff --git a/frontend/src/api/alert.ts b/frontend/src/api/alert.ts index 1b8acf892e..8b4ccde27a 100644 --- a/frontend/src/api/alert.ts +++ b/frontend/src/api/alert.ts @@ -84,8 +84,8 @@ async function silenceAlertFromAPI( silencedAlertPeriodRequest: SilencedAlertPeriodRequest ): Promise { // TODO Normalize this data before calling the api service rather than here. - const silencedAlertPeriod = silencedAlertPeriodRequest.silencedAlertPeriod || '' - const beforeDateTime = silencedAlertPeriodRequest.beforeDateTime?.toISOString() || '' + const silencedAlertPeriod = silencedAlertPeriodRequest.silencedAlertPeriod ?? '' + const beforeDateTime = silencedAlertPeriodRequest.beforeDateTime?.toISOString() ?? '' try { return await monitorfishApiKy diff --git a/frontend/src/domain/entities/beaconMalfunction/index.ts b/frontend/src/domain/entities/beaconMalfunction/index.ts index 006c0c2377..a58025bcfd 100644 --- a/frontend/src/domain/entities/beaconMalfunction/index.ts +++ b/frontend/src/domain/entities/beaconMalfunction/index.ts @@ -26,7 +26,7 @@ function getYearsToBeaconMalfunctions( if (beaconMalfunction.beaconMalfunction?.malfunctionStartDateTime) { const year = new Date(beaconMalfunction.beaconMalfunction?.malfunctionStartDateTime).getUTCFullYear() - nextYearsToBeaconMalfunctions[year] = nextYearsToBeaconMalfunctions[year]?.concat(beaconMalfunction) || [ + nextYearsToBeaconMalfunctions[year] = nextYearsToBeaconMalfunctions[year]?.concat(beaconMalfunction) ?? [ beaconMalfunction ] } @@ -118,12 +118,12 @@ const getMalfunctionStartDateText = (beaconMalfunction: BeaconMalfunction) => { switch (beaconMalfunction.endOfBeaconMalfunctionReason) { case END_OF_MALFUNCTION_REASON_RECORD.RESUMED_TRANSMISSION.value: return `Reprise des émissions ${ - (beaconMalfunction.malfunctionEndDateTime && getReducedTimeAgo(beaconMalfunction.malfunctionEndDateTime)) || + (beaconMalfunction.malfunctionEndDateTime && getReducedTimeAgo(beaconMalfunction.malfunctionEndDateTime)) ?? '' }`.trim() case END_OF_MALFUNCTION_REASON_RECORD.BEACON_DEACTIVATED_OR_UNEQUIPPED.value: return `Balise désactivée ${ - (beaconMalfunction.malfunctionEndDateTime && getReducedTimeAgo(beaconMalfunction.malfunctionEndDateTime)) || + (beaconMalfunction.malfunctionEndDateTime && getReducedTimeAgo(beaconMalfunction.malfunctionEndDateTime)) ?? '' }`.trim() default: diff --git a/frontend/src/domain/entities/controlUnits/__tests__/utils.test.ts b/frontend/src/domain/entities/controlUnits/__tests__/utils.test.ts index ac837c7ed3..fa926183d5 100644 --- a/frontend/src/domain/entities/controlUnits/__tests__/utils.test.ts +++ b/frontend/src/domain/entities/controlUnits/__tests__/utils.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from '@jest/globals' -import { dummyControlUnits } from './__mock__/controlUnits' import { getControlUnitsOptionsFromControlUnits } from '../utils' +import { dummyControlUnits } from './__mock__/controlUnits' describe('controlUnits/utils', () => { it('getControlUnitsOptionsFromControlUnits Should return active control units', async () => { diff --git a/frontend/src/domain/entities/controls.ts b/frontend/src/domain/entities/controls.ts index e7241e6e72..e8b1d18ccd 100644 --- a/frontend/src/domain/entities/controls.ts +++ b/frontend/src/domain/entities/controls.ts @@ -81,10 +81,10 @@ export const getNumberOfInfractions = ( } return ( - (control.gearInfractions?.length || 0) + - (control.logbookInfractions?.length || 0) + - (control.speciesInfractions?.length || 0) + - (control.otherInfractions?.length || 0) + (control.gearInfractions?.length ?? 0) + + (control.logbookInfractions?.length ?? 0) + + (control.speciesInfractions?.length ?? 0) + + (control.otherInfractions?.length ?? 0) ) } @@ -101,10 +101,10 @@ export const getNumberOfInfractionsWithRecord = ( const infractionWithRecordFilter = infraction => infraction.infractionType === InfractionType.WITH_RECORD return ( - (control.gearInfractions?.filter(infractionWithRecordFilter).length || 0) + - (control.logbookInfractions?.filter(infractionWithRecordFilter).length || 0) + - (control.speciesInfractions?.filter(infractionWithRecordFilter).length || 0) + - (control.otherInfractions?.filter(infractionWithRecordFilter).length || 0) + (control.gearInfractions?.filter(infractionWithRecordFilter).length ?? 0) + + (control.logbookInfractions?.filter(infractionWithRecordFilter).length ?? 0) + + (control.speciesInfractions?.filter(infractionWithRecordFilter).length ?? 0) + + (control.otherInfractions?.filter(infractionWithRecordFilter).length ?? 0) ) } diff --git a/frontend/src/features/ActivityReport/components/ExportActivityReportsDialog/csvMap.ts b/frontend/src/features/ActivityReport/components/ExportActivityReportsDialog/csvMap.ts index 25750dc6db..fb1f7fc93a 100644 --- a/frontend/src/features/ActivityReport/components/ExportActivityReportsDialog/csvMap.ts +++ b/frontend/src/features/ActivityReport/components/ExportActivityReportsDialog/csvMap.ts @@ -71,7 +71,7 @@ export const JDP_CSV_MAP_BASE: DownloadAsCsvMap = { }, objectState: { label: 'OBJECT_STATE', - transform: activity => toAlpha3(activity.vessel.flagState) || 'UNK' + transform: activity => toAlpha3(activity.vessel.flagState) ?? 'UNK' }, vesselNationalIdentifier: 'OBJECT_NATIONAL_ID', 'vessel.ircs': 'RC', @@ -80,12 +80,12 @@ export const JDP_CSV_MAP_BASE: DownloadAsCsvMap = { activityCode: 'ACTIVITY_CODE', gearCode: { label: 'GEAR_CODE', - transform: activity => activity.action.gearOnboard[0]?.gearCode || '' + transform: activity => activity.action.gearOnboard[0]?.gearCode ?? '' }, meshSize: { label: 'MESH_SIZE', transform: activity => - activity.action.gearOnboard[0]?.controlledMesh ?? (activity.action.gearOnboard[0]?.declaredMesh || '') + activity.action.gearOnboard[0]?.controlledMesh ?? activity.action.gearOnboard[0]?.declaredMesh ?? '' }, faoArea: { label: 'FAO_AREA_CODE', diff --git a/frontend/src/features/BackOffice/edit_regulation/regulatory_text/RegulatoryText.tsx b/frontend/src/features/BackOffice/edit_regulation/regulatory_text/RegulatoryText.tsx index 50c4a12c7f..9cc5fed458 100644 --- a/frontend/src/features/BackOffice/edit_regulation/regulatory_text/RegulatoryText.tsx +++ b/frontend/src/features/BackOffice/edit_regulation/regulatory_text/RegulatoryText.tsx @@ -173,7 +173,7 @@ export function RegulatoryText({  ou { set('endDate', isChecked ? INFINITE : '') diff --git a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/index.tsx b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/index.tsx index a17e2d06d8..18571c69d1 100644 --- a/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/index.tsx +++ b/frontend/src/features/FleetSegment/components/FleetSegmentsBackoffice/index.tsx @@ -45,7 +45,7 @@ export function FleetSegmentsBackoffice() { async (_year?: number) => { const { data: nextFleetSegments } = await dispatch(fleetSegmentApi.endpoints.getFleetSegments.initiate(_year)) - setFleetSegments(nextFleetSegments || []) + setFleetSegments(nextFleetSegments ?? []) if (_year) { setYear(_year) } @@ -95,7 +95,7 @@ export function FleetSegmentsBackoffice() { async newFleetSegmentData => { const nextFleetSegments = await dispatch(createFleetSegment(newFleetSegmentData, fleetSegments)) - setFleetSegments(nextFleetSegments || []) + setFleetSegments(nextFleetSegments ?? []) closeCreateOrEditFleetSegmentModal() }, [dispatch, fleetSegments, closeCreateOrEditFleetSegmentModal] @@ -145,11 +145,11 @@ export function FleetSegmentsBackoffice() {