From 84033f37cf0f4ac4388676a158d743a003e22094 Mon Sep 17 00:00:00 2001 From: imperosol Date: Fri, 13 Feb 2026 14:07:46 +0100 Subject: [PATCH] update BiomeJS --- .pre-commit-config.yaml | 2 +- biome.json | 24 +++++++++++++++---- .../club/components/ajax-select-index.ts | 4 ++-- .../com/components/ics-calendar-index.ts | 5 ++-- .../bundled/com/moderation-alert-index.ts | 2 +- core/static/bundled/alpine-index.js | 4 ++-- core/static/bundled/alpine/limited-choices.ts | 2 +- .../core/components/ajax-select-base.ts | 8 +++---- .../core/components/ajax-select-index.ts | 21 ++++++++-------- .../bundled/core/components/easymde-index.ts | 4 ++-- .../bundled/core/components/include-index.ts | 2 +- .../core/components/nfc-input-index.ts | 2 +- .../bundled/core/components/tabs-index.ts | 2 +- core/static/bundled/core/navbar-index.ts | 2 +- core/static/bundled/core/read-more-index.ts | 2 +- core/static/bundled/core/tooltips-index.ts | 2 +- core/static/bundled/sentry-popup-index.ts | 4 ++-- .../static/bundled/user/family-graph-index.ts | 6 ++--- core/static/bundled/utils/api.ts | 2 +- core/static/bundled/utils/csv.ts | 2 +- core/static/bundled/utils/web-components.ts | 1 - counter/static/bundled/counter/basket.ts | 2 +- .../counter/components/ajax-select-index.ts | 8 +++---- .../counter-product-select-index.ts | 10 ++++---- .../bundled/counter/counter-click-index.ts | 6 ++--- .../bundled/counter/product-list-index.ts | 12 ++++++---- .../bundled/counter/product-type-index.ts | 4 ++-- .../static/bundled/eboutic/eboutic-index.ts | 2 +- eboutic/static/eboutic/css/eboutic.css | 4 +++- galaxy/static/bundled/galaxy/galaxy-index.js | 2 +- package.json | 4 +++- .../static/bundled/pedagogy/guide-index.js | 10 +++++--- sas/static/bundled/sas/album-index.ts | 13 ++++++---- .../sas/components/ajax-select-index.ts | 4 ++-- .../bundled/sas/pictures-download-index.ts | 2 +- sas/static/bundled/sas/user/pictures-index.ts | 4 ++-- sas/static/bundled/sas/viewer-index.ts | 15 ++++++------ .../creation-form-existing-user-index.ts | 4 ++-- .../bundled/subscription/stats-index.ts | 3 +-- .../bundled/timetable/generator-index.ts | 5 ++-- vite.config.mts | 2 +- 41 files changed, 124 insertions(+), 95 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5282e1da..51b4f75d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: rev: v0.6.1 hooks: - id: biome-check - additional_dependencies: ["@biomejs/biome@1.9.4"] + additional_dependencies: ["@biomejs/biome@2.3.14"] - repo: https://github.com/rtts/djhtml rev: 3.0.10 hooks: diff --git a/biome.json b/biome.json index cf528680..de2077a9 100644 --- a/biome.json +++ b/biome.json @@ -7,20 +7,34 @@ }, "files": { "ignoreUnknown": false, - "ignore": ["*.min.*", "staticfiles/generated"] + "includes": ["**/static/**"] }, "formatter": { "enabled": true, "indentStyle": "space", "lineWidth": 88 }, - "organizeImports": { - "enabled": true - }, "linter": { "enabled": true, "rules": { - "all": true + "recommended": true, + "style": { + "useNamingConvention": "error" + }, + "performance": { + "noNamespaceImport": "error" + }, + "suspicious": { + "noConsole": { + "level": "error", + "options": { "allow": ["error", "warn"] } + } + }, + "correctness": { + "noUnusedVariables": "error", + "noUndeclaredVariables": "error", + "noUndeclaredDependencies": "error" + } } }, "javascript": { diff --git a/club/static/bundled/club/components/ajax-select-index.ts b/club/static/bundled/club/components/ajax-select-index.ts index d58de56c..56c93760 100644 --- a/club/static/bundled/club/components/ajax-select-index.ts +++ b/club/static/bundled/club/components/ajax-select-index.ts @@ -1,7 +1,7 @@ -import { AjaxSelect } from "#core:core/components/ajax-select-base"; -import { registerComponent } from "#core:utils/web-components"; import type { TomOption } from "tom-select/dist/types/types"; import type { escape_html } from "tom-select/dist/types/utils"; +import { AjaxSelect } from "#core:core/components/ajax-select-base.ts"; +import { registerComponent } from "#core:utils/web-components.ts"; import { type ClubSchema, clubSearchClub } from "#openapi"; @registerComponent("club-ajax-select") diff --git a/com/static/bundled/com/components/ics-calendar-index.ts b/com/static/bundled/com/components/ics-calendar-index.ts index f3af0a18..8eb159c1 100644 --- a/com/static/bundled/com/components/ics-calendar-index.ts +++ b/com/static/bundled/com/components/ics-calendar-index.ts @@ -1,5 +1,3 @@ -import { makeUrl } from "#core:utils/api"; -import { inheritHtmlElement, registerComponent } from "#core:utils/web-components"; import { Calendar, type EventClickArg, type EventContentArg } from "@fullcalendar/core"; import type { EventImpl } from "@fullcalendar/core/internal"; import enLocale from "@fullcalendar/core/locales/en-gb"; @@ -8,6 +6,8 @@ import dayGridPlugin from "@fullcalendar/daygrid"; import iCalendarPlugin from "@fullcalendar/icalendar"; import listPlugin from "@fullcalendar/list"; import { type HTMLTemplateResult, html, render } from "lit-html"; +import { makeUrl } from "#core:utils/api.ts"; +import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts"; import { calendarCalendarInternal, calendarCalendarUnpublished, @@ -95,6 +95,7 @@ export class IcsCalendar extends inheritHtmlElement("div") { .split("/") .filter((s) => s) // Remove blank characters .pop(), + 10, ); } diff --git a/com/static/bundled/com/moderation-alert-index.ts b/com/static/bundled/com/moderation-alert-index.ts index f2ff1806..70dc871c 100644 --- a/com/static/bundled/com/moderation-alert-index.ts +++ b/com/static/bundled/com/moderation-alert-index.ts @@ -1,4 +1,4 @@ -import { exportToHtml } from "#core:utils/globals"; +import { exportToHtml } from "#core:utils/globals.ts"; import { newsDeleteNews, newsFetchNewsDates, newsPublishNews } from "#openapi"; // This will be used in jinja templates, diff --git a/core/static/bundled/alpine-index.js b/core/static/bundled/alpine-index.js index ef273300..9a4d7948 100644 --- a/core/static/bundled/alpine-index.js +++ b/core/static/bundled/alpine-index.js @@ -1,7 +1,7 @@ -import { limitedChoices } from "#core:alpine/limited-choices"; -import { alpinePlugin as notificationPlugin } from "#core:utils/notifications"; import sort from "@alpinejs/sort"; import Alpine from "alpinejs"; +import { limitedChoices } from "#core:alpine/limited-choices.ts"; +import { alpinePlugin as notificationPlugin } from "#core:utils/notifications.ts"; Alpine.plugin([sort, limitedChoices]); Alpine.magic("notifications", notificationPlugin); diff --git a/core/static/bundled/alpine/limited-choices.ts b/core/static/bundled/alpine/limited-choices.ts index 211441d0..f4254548 100644 --- a/core/static/bundled/alpine/limited-choices.ts +++ b/core/static/bundled/alpine/limited-choices.ts @@ -56,7 +56,7 @@ export function limitedChoices(Alpine: AlpineType) { effect(() => { getMaxChoices((value: string) => { const previousValue = maxChoices; - maxChoices = Number.parseInt(value); + maxChoices = Number.parseInt(value, 10); if (maxChoices < previousValue) { // The maximum number of selectable items has been lowered. // Some currently selected elements may need to be removed diff --git a/core/static/bundled/core/components/ajax-select-base.ts b/core/static/bundled/core/components/ajax-select-base.ts index 06c3508e..8eedbfc7 100644 --- a/core/static/bundled/core/components/ajax-select-base.ts +++ b/core/static/bundled/core/components/ajax-select-base.ts @@ -1,4 +1,3 @@ -import { inheritHtmlElement } from "#core:utils/web-components"; import TomSelect from "tom-select"; import type { RecursivePartial, @@ -7,6 +6,7 @@ import type { TomSettings, } from "tom-select/dist/types/types"; import type { escape_html } from "tom-select/dist/types/utils"; +import { inheritHtmlElement } from "#core:utils/web-components.ts"; export class AutoCompleteSelectBase extends inheritHtmlElement("select") { static observedAttributes = [ @@ -29,7 +29,7 @@ export class AutoCompleteSelectBase extends inheritHtmlElement("select") { ) { switch (name) { case "delay": { - this.delay = Number.parseInt(newValue) ?? null; + this.delay = Number.parseInt(newValue, 10) ?? null; break; } case "placeholder": { @@ -37,11 +37,11 @@ export class AutoCompleteSelectBase extends inheritHtmlElement("select") { break; } case "max": { - this.max = Number.parseInt(newValue) ?? null; + this.max = Number.parseInt(newValue, 10) ?? null; break; } case "min-characters-for-search": { - this.minCharNumberForSearch = Number.parseInt(newValue) ?? 0; + this.minCharNumberForSearch = Number.parseInt(newValue, 10) ?? 0; break; } default: { diff --git a/core/static/bundled/core/components/ajax-select-index.ts b/core/static/bundled/core/components/ajax-select-index.ts index db9f4f21..6980285f 100644 --- a/core/static/bundled/core/components/ajax-select-index.ts +++ b/core/static/bundled/core/components/ajax-select-index.ts @@ -1,20 +1,19 @@ import "tom-select/dist/css/tom-select.default.css"; -import { registerComponent } from "#core:utils/web-components"; import type { TomOption } from "tom-select/dist/types/types"; import type { escape_html } from "tom-select/dist/types/utils"; -import { - type GroupSchema, - type SithFileSchema, - type UserProfileSchema, - groupSearchGroup, - sithfileSearchFiles, - userSearchUsers, -} from "#openapi"; - import { AjaxSelect, AutoCompleteSelectBase, -} from "#core:core/components/ajax-select-base"; +} from "#core:core/components/ajax-select-base.ts"; +import { registerComponent } from "#core:utils/web-components.ts"; +import { + type GroupSchema, + groupSearchGroup, + type SithFileSchema, + sithfileSearchFiles, + type UserProfileSchema, + userSearchUsers, +} from "#openapi"; @registerComponent("autocomplete-select") export class AutoCompleteSelect extends AutoCompleteSelectBase {} diff --git a/core/static/bundled/core/components/easymde-index.ts b/core/static/bundled/core/components/easymde-index.ts index 09f08626..8e38ca9b 100644 --- a/core/static/bundled/core/components/easymde-index.ts +++ b/core/static/bundled/core/components/easymde-index.ts @@ -1,14 +1,14 @@ // biome-ignore lint/correctness/noUndeclaredDependencies: shipped by easymde import "codemirror/lib/codemirror.css"; import "easymde/src/css/easymde.css"; -import { inheritHtmlElement, registerComponent } from "#core:utils/web-components"; // biome-ignore lint/correctness/noUndeclaredDependencies: Imported by EasyMDE import type CodeMirror from "codemirror"; // biome-ignore lint/style/useNamingConvention: This is how they called their namespace import EasyMDE from "easymde"; +import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts"; import { - type UploadUploadImageErrors, markdownRenderMarkdown, + type UploadUploadImageErrors, uploadUploadImage, } from "#openapi"; diff --git a/core/static/bundled/core/components/include-index.ts b/core/static/bundled/core/components/include-index.ts index ea8dbb6b..c1989f4b 100644 --- a/core/static/bundled/core/components/include-index.ts +++ b/core/static/bundled/core/components/include-index.ts @@ -1,4 +1,4 @@ -import { inheritHtmlElement, registerComponent } from "#core:utils/web-components"; +import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts"; /** * Web component used to import css files only once diff --git a/core/static/bundled/core/components/nfc-input-index.ts b/core/static/bundled/core/components/nfc-input-index.ts index 0b57931b..7a1100ed 100644 --- a/core/static/bundled/core/components/nfc-input-index.ts +++ b/core/static/bundled/core/components/nfc-input-index.ts @@ -1,4 +1,4 @@ -import { inheritHtmlElement, registerComponent } from "#core:utils/web-components"; +import { inheritHtmlElement, registerComponent } from "#core:utils/web-components.ts"; @registerComponent("nfc-input") export class NfcInput extends inheritHtmlElement("input") { diff --git a/core/static/bundled/core/components/tabs-index.ts b/core/static/bundled/core/components/tabs-index.ts index 94dbe544..7bd85998 100644 --- a/core/static/bundled/core/components/tabs-index.ts +++ b/core/static/bundled/core/components/tabs-index.ts @@ -1,6 +1,6 @@ -import { registerComponent } from "#core:utils/web-components"; import { html, render } from "lit-html"; import { unsafeHTML } from "lit-html/directives/unsafe-html.js"; +import { registerComponent } from "#core:utils/web-components.ts"; @registerComponent("ui-tab") export class Tab extends HTMLElement { diff --git a/core/static/bundled/core/navbar-index.ts b/core/static/bundled/core/navbar-index.ts index b5330d42..18f7e3e3 100644 --- a/core/static/bundled/core/navbar-index.ts +++ b/core/static/bundled/core/navbar-index.ts @@ -1,4 +1,4 @@ -import { exportToHtml } from "#core:utils/globals"; +import { exportToHtml } from "#core:utils/globals.ts"; exportToHtml("showMenu", () => { const navbar = document.getElementById("navbar-content"); diff --git a/core/static/bundled/core/read-more-index.ts b/core/static/bundled/core/read-more-index.ts index 52e095a3..150cb0a3 100644 --- a/core/static/bundled/core/read-more-index.ts +++ b/core/static/bundled/core/read-more-index.ts @@ -26,7 +26,7 @@ function showMore(element: HTMLElement) { const fullContent = element.innerHTML; const clippedContent = clip( element.innerHTML, - Number.parseInt(element.getAttribute("show-more") as string), + Number.parseInt(element.getAttribute("show-more") as string, 10), { html: true, }, diff --git a/core/static/bundled/core/tooltips-index.ts b/core/static/bundled/core/tooltips-index.ts index 629c9767..55f115ad 100644 --- a/core/static/bundled/core/tooltips-index.ts +++ b/core/static/bundled/core/tooltips-index.ts @@ -1,9 +1,9 @@ import { - type Placement, autoPlacement, computePosition, flip, offset, + type Placement, size, } from "@floating-ui/dom"; diff --git a/core/static/bundled/sentry-popup-index.ts b/core/static/bundled/sentry-popup-index.ts index 04d7ef29..ea16c092 100644 --- a/core/static/bundled/sentry-popup-index.ts +++ b/core/static/bundled/sentry-popup-index.ts @@ -1,6 +1,6 @@ -import { exportToHtml } from "#core:utils/globals"; -// biome-ignore lint/style/noNamespaceImport: this is the recommended way from the documentation +// biome-ignore lint/performance/noNamespaceImport: this is the recommended way from the documentation import * as Sentry from "@sentry/browser"; +import { exportToHtml } from "#core:utils/globals.ts"; interface LoggedUser { name: string; diff --git a/core/static/bundled/user/family-graph-index.ts b/core/static/bundled/user/family-graph-index.ts index d8179c07..a4683f63 100644 --- a/core/static/bundled/user/family-graph-index.ts +++ b/core/static/bundled/user/family-graph-index.ts @@ -1,4 +1,3 @@ -import { History, initialUrlParams, updateQueryString } from "#core:utils/history"; import cytoscape, { type ElementDefinition, type NodeSingular, @@ -6,7 +5,8 @@ import cytoscape, { } from "cytoscape"; import cxtmenu from "cytoscape-cxtmenu"; import klay, { type KlayLayoutOptions } from "cytoscape-klay"; -import { type UserProfileSchema, familyGetFamilyGraph } from "#openapi"; +import { History, initialUrlParams, updateQueryString } from "#core:utils/history.ts"; +import { familyGetFamilyGraph, type UserProfileSchema } from "#openapi"; cytoscape.use(klay); cytoscape.use(cxtmenu); @@ -200,7 +200,7 @@ document.addEventListener("alpine:init", () => { isZoomEnabled: !isMobile(), getInitialDepth(prop: string) { - const value = Number.parseInt(initialUrlParams.get(prop)); + const value = Number.parseInt(initialUrlParams.get(prop), 10); if (Number.isNaN(value) || value < config.depthMin || value > config.depthMax) { return defaultDepth; } diff --git a/core/static/bundled/utils/api.ts b/core/static/bundled/utils/api.ts index 6ed4a53a..92f89595 100644 --- a/core/static/bundled/utils/api.ts +++ b/core/static/bundled/utils/api.ts @@ -1,5 +1,5 @@ +import { client, type Options } from "#openapi"; import type { Client, RequestResult, TDataShape } from "#openapi:client"; -import { type Options, client } from "#openapi"; export interface PaginatedResponse { count: number; diff --git a/core/static/bundled/utils/csv.ts b/core/static/bundled/utils/csv.ts index df1a5ebf..d7356bfc 100644 --- a/core/static/bundled/utils/csv.ts +++ b/core/static/bundled/utils/csv.ts @@ -1,4 +1,4 @@ -import type { NestedKeyOf } from "#core:utils/types"; +import type { NestedKeyOf } from "#core:utils/types.ts"; interface StringifyOptions { /** The columns to include in the resulting CSV. */ diff --git a/core/static/bundled/utils/web-components.ts b/core/static/bundled/utils/web-components.ts index c2b089c5..8d1dbc47 100644 --- a/core/static/bundled/utils/web-components.ts +++ b/core/static/bundled/utils/web-components.ts @@ -10,7 +10,6 @@ export function registerComponent(name: string, options?: ElementDefinitionOptio window.customElements.define(name, component, options); } catch (e) { if (e instanceof DOMException) { - // biome-ignore lint/suspicious/noConsole: it's handy to troobleshot console.warn(e.message); return; } diff --git a/counter/static/bundled/counter/basket.ts b/counter/static/bundled/counter/basket.ts index 34d244e1..666d0874 100644 --- a/counter/static/bundled/counter/basket.ts +++ b/counter/static/bundled/counter/basket.ts @@ -1,4 +1,4 @@ -import type { Product } from "#counter:counter/types"; +import type { Product } from "#counter:counter/types.ts"; export class BasketItem { quantity: number; diff --git a/counter/static/bundled/counter/components/ajax-select-index.ts b/counter/static/bundled/counter/components/ajax-select-index.ts index 08caa15e..cd9f77db 100644 --- a/counter/static/bundled/counter/components/ajax-select-index.ts +++ b/counter/static/bundled/counter/components/ajax-select-index.ts @@ -1,14 +1,14 @@ -import { AjaxSelect } from "#core:core/components/ajax-select-base"; -import { registerComponent } from "#core:utils/web-components"; import type { TomOption } from "tom-select/dist/types/types"; import type { escape_html } from "tom-select/dist/types/utils"; +import { AjaxSelect } from "#core:core/components/ajax-select-base.ts"; +import { registerComponent } from "#core:utils/web-components.ts"; import { type CounterSchema, - type ProductTypeSchema, - type SimpleProductSchema, counterSearchCounter, + type ProductTypeSchema, productSearchProducts, producttypeFetchAll, + type SimpleProductSchema, } from "#openapi"; @registerComponent("product-ajax-select") diff --git a/counter/static/bundled/counter/components/counter-product-select-index.ts b/counter/static/bundled/counter/components/counter-product-select-index.ts index 6484385e..ec1d2773 100644 --- a/counter/static/bundled/counter/components/counter-product-select-index.ts +++ b/counter/static/bundled/counter/components/counter-product-select-index.ts @@ -1,13 +1,13 @@ -import { AutoCompleteSelectBase } from "#core:core/components/ajax-select-base"; -import { registerComponent } from "#core:utils/web-components"; import type { RecursivePartial, TomSettings } from "tom-select/dist/types/types"; +import { AutoCompleteSelectBase } from "#core:core/components/ajax-select-base.ts"; +import { registerComponent } from "#core:utils/web-components.ts"; const productParsingRegex = /^(\d+x)?(.*)/i; const codeParsingRegex = / \((\w+)\)$/; function parseProduct(query: string): [number, string] { const parsed = productParsingRegex.exec(query); - return [Number.parseInt(parsed[1] || "1"), parsed[2]]; + return [Number.parseInt(parsed[1] || "1", 10), parsed[2]]; } @registerComponent("counter-product-select") @@ -80,9 +80,9 @@ export class CounterProductSelect extends AutoCompleteSelectBase { // We need to manually set weights or it results on an inconsistent // behavior between production and development environment searchField: [ - // @ts-ignore documentation says it's fine, specified type is wrong + // @ts-expect-error documentation says it's fine, specified type is wrong { field: "code", weight: 2 }, - // @ts-ignore documentation says it's fine, specified type is wrong + // @ts-expect-error documentation says it's fine, specified type is wrong { field: "text", weight: 0.5 }, ], }; diff --git a/counter/static/bundled/counter/counter-click-index.ts b/counter/static/bundled/counter/counter-click-index.ts index f594cdd8..6d582b20 100644 --- a/counter/static/bundled/counter/counter-click-index.ts +++ b/counter/static/bundled/counter/counter-click-index.ts @@ -1,6 +1,6 @@ -import { AlertMessage } from "#core:utils/alert-message"; -import { BasketItem } from "#counter:counter/basket"; -import type { CounterConfig, ErrorMessage } from "#counter:counter/types"; +import { AlertMessage } from "#core:utils/alert-message.ts"; +import { BasketItem } from "#counter:counter/basket.ts"; +import type { CounterConfig, ErrorMessage } from "#counter:counter/types.ts"; import type { CounterProductSelect } from "./components/counter-product-select-index.ts"; document.addEventListener("alpine:init", () => { diff --git a/counter/static/bundled/counter/product-list-index.ts b/counter/static/bundled/counter/product-list-index.ts index de0381b9..5c5abec6 100644 --- a/counter/static/bundled/counter/product-list-index.ts +++ b/counter/static/bundled/counter/product-list-index.ts @@ -1,9 +1,13 @@ -import { paginated } from "#core:utils/api"; -import { csv } from "#core:utils/csv"; -import { History, getCurrentUrlParams, updateQueryString } from "#core:utils/history"; -import type { NestedKeyOf } from "#core:utils/types"; import { showSaveFilePicker } from "native-file-system-adapter"; import type TomSelect from "tom-select"; +import { paginated } from "#core:utils/api.ts"; +import { csv } from "#core:utils/csv.ts"; +import { + getCurrentUrlParams, + History, + updateQueryString, +} from "#core:utils/history.ts"; +import type { NestedKeyOf } from "#core:utils/types.ts"; import { type ProductSchema, type ProductSearchProductsDetailedData, diff --git a/counter/static/bundled/counter/product-type-index.ts b/counter/static/bundled/counter/product-type-index.ts index 37de445d..a796a784 100644 --- a/counter/static/bundled/counter/product-type-index.ts +++ b/counter/static/bundled/counter/product-type-index.ts @@ -1,5 +1,5 @@ -import { AlertMessage } from "#core:utils/alert-message"; import Alpine from "alpinejs"; +import { AlertMessage } from "#core:utils/alert-message.ts"; import { producttypeReorder } from "#openapi"; document.addEventListener("alpine:init", () => { @@ -22,7 +22,7 @@ document.addEventListener("alpine:init", () => { const productTypes = this.$refs.productTypes .childNodes as NodeListOf; const getId = (elem: HTMLLIElement) => - Number.parseInt(elem.getAttribute("x-sort:item")); + Number.parseInt(elem.getAttribute("x-sort:item"), 10); const query = newPosition === 0 ? { above: getId(productTypes.item(1)) } diff --git a/eboutic/static/bundled/eboutic/eboutic-index.ts b/eboutic/static/bundled/eboutic/eboutic-index.ts index 93afc81b..0cd689fd 100644 --- a/eboutic/static/bundled/eboutic/eboutic-index.ts +++ b/eboutic/static/bundled/eboutic/eboutic-index.ts @@ -21,7 +21,7 @@ document.addEventListener("alpine:init", () => { if (lastPurchaseTime !== null && localStorage.basketTimestamp !== undefined) { if ( new Date(lastPurchaseTime) >= - new Date(Number.parseInt(localStorage.basketTimestamp)) + new Date(Number.parseInt(localStorage.basketTimestamp, 10)) ) { this.basket = []; } diff --git a/eboutic/static/eboutic/css/eboutic.css b/eboutic/static/eboutic/css/eboutic.css index 57e56c6a..fe4b88aa 100644 --- a/eboutic/static/eboutic/css/eboutic.css +++ b/eboutic/static/eboutic/css/eboutic.css @@ -18,7 +18,9 @@ #basket { min-width: 300px; border-radius: 8px; - box-shadow: rgb(60 64 67 / 30%) 0 1px 3px 0, rgb(60 64 67 / 15%) 0 4px 8px 3px; + box-shadow: + rgb(60 64 67 / 30%) 0 1px 3px 0, + rgb(60 64 67 / 15%) 0 4px 8px 3px; padding: 10px; } diff --git a/galaxy/static/bundled/galaxy/galaxy-index.js b/galaxy/static/bundled/galaxy/galaxy-index.js index bd5f4134..abe73c2a 100644 --- a/galaxy/static/bundled/galaxy/galaxy-index.js +++ b/galaxy/static/bundled/galaxy/galaxy-index.js @@ -1,6 +1,6 @@ import { default as ForceGraph3D } from "3d-force-graph"; import { forceX, forceY, forceZ } from "d3-force-3d"; -// biome-ignore lint/style/noNamespaceImport: This is how it should be imported +// biome-ignore lint/performance/noNamespaceImport: This is how it should be imported import * as Three from "three"; import SpriteText from "three-spritetext"; diff --git a/package.json b/package.json index f66f5f0b..969e6485 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,9 @@ "keywords": [], "author": "", "license": "GPL-3.0-only", - "sideEffects": [".css"], + "sideEffects": [ + ".css" + ], "imports": { "#openapi": "./staticfiles/generated/openapi/client/index.ts", "#core:*": "./core/static/bundled/*", diff --git a/pedagogy/static/bundled/pedagogy/guide-index.js b/pedagogy/static/bundled/pedagogy/guide-index.js index ccbae091..69373576 100644 --- a/pedagogy/static/bundled/pedagogy/guide-index.js +++ b/pedagogy/static/bundled/pedagogy/guide-index.js @@ -1,4 +1,8 @@ -import { History, getCurrentUrlParams, updateQueryString } from "#core:utils/history"; +import { + getCurrentUrlParams, + History, + updateQueryString, +} from "#core:utils/history.ts"; import { ueFetchUeList } from "#openapi"; const pageDefault = 1; @@ -31,8 +35,8 @@ document.addEventListener("alpine:init", () => { const url = getCurrentUrlParams(); this.pushstate = History.Replace; - this.page = Number.parseInt(url.get("page")) || pageDefault; - this.page_size = Number.parseInt(url.get("page_size")) || pageSizeDefault; + this.page = Number.parseInt(url.get("page"), 10) || pageDefault; + this.page_size = Number.parseInt(url.get("page_size"), 10) || pageSizeDefault; this.search = url.get("search") || ""; this.department = url.getAll("department"); this.credit_type = url.getAll("credit_type"); diff --git a/sas/static/bundled/sas/album-index.ts b/sas/static/bundled/sas/album-index.ts index b56b8e02..052c9ba4 100644 --- a/sas/static/bundled/sas/album-index.ts +++ b/sas/static/bundled/sas/album-index.ts @@ -1,12 +1,12 @@ -import { paginated } from "#core:utils/api"; -import { History, initialUrlParams, updateQueryString } from "#core:utils/history"; +import { paginated } from "#core:utils/api.ts"; +import { History, initialUrlParams, updateQueryString } from "#core:utils/history.ts"; import { type AlbumFetchAlbumData, type AlbumSchema, + albumFetchAlbum, type PictureSchema, type PicturesFetchPicturesData, type PicturesUploadPictureErrors, - albumFetchAlbum, picturesFetchPictures, picturesUploadPicture, } from "#openapi"; @@ -23,7 +23,7 @@ interface SubAlbumsConfig { document.addEventListener("alpine:init", () => { Alpine.data("pictures", (config: AlbumPicturesConfig) => ({ pictures: [] as PictureSchema[], - page: Number.parseInt(initialUrlParams.get("page")) || 1, + page: Number.parseInt(initialUrlParams.get("page"), 10) || 1, pushstate: History.Push /* Used to avoid pushing a state on a back action */, loading: false, @@ -38,7 +38,10 @@ document.addEventListener("alpine:init", () => { window.addEventListener("popstate", () => { this.pushstate = History.Replace; this.page = - Number.parseInt(new URLSearchParams(window.location.search).get("page")) || 1; + Number.parseInt( + new URLSearchParams(window.location.search).get("page"), + 10, + ) || 1; }); }, diff --git a/sas/static/bundled/sas/components/ajax-select-index.ts b/sas/static/bundled/sas/components/ajax-select-index.ts index aa640556..e4165169 100644 --- a/sas/static/bundled/sas/components/ajax-select-index.ts +++ b/sas/static/bundled/sas/components/ajax-select-index.ts @@ -1,7 +1,7 @@ -import { AjaxSelect } from "#core:core/components/ajax-select-base"; -import { registerComponent } from "#core:utils/web-components"; import type { TomOption } from "tom-select/dist/types/types"; import type { escape_html } from "tom-select/dist/types/utils"; +import { AjaxSelect } from "#core:core/components/ajax-select-base.ts"; +import { registerComponent } from "#core:utils/web-components.ts"; import { type AlbumAutocompleteSchema, albumAutocompleteAlbum } from "#openapi"; @registerComponent("album-ajax-select") diff --git a/sas/static/bundled/sas/pictures-download-index.ts b/sas/static/bundled/sas/pictures-download-index.ts index ea23b9cc..7aca75d8 100644 --- a/sas/static/bundled/sas/pictures-download-index.ts +++ b/sas/static/bundled/sas/pictures-download-index.ts @@ -31,7 +31,7 @@ document.addEventListener("alpine:init", () => { await Promise.all( this.downloadPictures.map((p: PictureSchema) => { - const imgName = `${p.album.name}/IMG_${p.id}_${p.date.replace(/[:\-]/g, "_")}${p.name.slice(p.name.lastIndexOf("."))}`; + const imgName = `${p.album.name}/IMG_${p.id}_${p.date.replace(/[:-]/g, "_")}${p.name.slice(p.name.lastIndexOf("."))}`; return zipWriter.add(imgName, new HttpReader(p.full_size_url), { level: 9, lastModDate: new Date(p.date), diff --git a/sas/static/bundled/sas/user/pictures-index.ts b/sas/static/bundled/sas/user/pictures-index.ts index 7cc941c8..d4c75f17 100644 --- a/sas/static/bundled/sas/user/pictures-index.ts +++ b/sas/static/bundled/sas/user/pictures-index.ts @@ -1,4 +1,4 @@ -import { paginated } from "#core:utils/api"; +import { paginated } from "#core:utils/api.ts"; import { type PictureSchema, type PicturesFetchPicturesData, @@ -27,7 +27,7 @@ document.addEventListener("alpine:init", () => { const lastCachedNumber = localStorage.getItem(localStorageInvalidationKey); if ( lastCachedNumber !== null && - Number.parseInt(lastCachedNumber) === config.nbPictures + Number.parseInt(lastCachedNumber, 10) === config.nbPictures ) { return JSON.parse(localStorage.getItem(localStorageKey)); } diff --git a/sas/static/bundled/sas/viewer-index.ts b/sas/static/bundled/sas/viewer-index.ts index ba17ee46..8b07b0cf 100644 --- a/sas/static/bundled/sas/viewer-index.ts +++ b/sas/static/bundled/sas/viewer-index.ts @@ -1,21 +1,21 @@ -import type { UserAjaxSelect } from "#core:core/components/ajax-select-index"; -import { paginated } from "#core:utils/api"; -import { exportToHtml } from "#core:utils/globals"; -import { History } from "#core:utils/history"; import type TomSelect from "tom-select"; +import type { UserAjaxSelect } from "#core:core/components/ajax-select-index.ts"; +import { paginated } from "#core:utils/api.ts"; +import { exportToHtml } from "#core:utils/globals.ts"; +import { History } from "#core:utils/history.ts"; import { type IdentifiedUserSchema, type ModerationRequestSchema, type PictureSchema, type PicturesFetchIdentificationsResponse, type PicturesFetchPicturesData, - type UserProfileSchema, picturesDeletePicture, picturesFetchIdentifications, picturesFetchModerationRequests, picturesFetchPictures, picturesIdentifyUsers, picturesModeratePicture, + type UserProfileSchema, usersidentifiedDeleteRelation, } from "#openapi"; @@ -208,7 +208,8 @@ exportToHtml("loadViewer", (config: ViewerConfig) => { } this.pushstate = History.Replace; this.currentPicture = this.pictures.find( - (i: PictureSchema) => i.id === Number.parseInt(event.state.sasPictureId), + (i: PictureSchema) => + i.id === Number.parseInt(event.state.sasPictureId, 10), ); }); this.pushstate = History.Replace; /* Avoid first url push */ @@ -301,7 +302,7 @@ exportToHtml("loadViewer", (config: ViewerConfig) => { // biome-ignore lint/style/useNamingConvention: api is in snake_case picture_id: this.currentPicture.id, }, - body: widget.items.map((i: string) => Number.parseInt(i)), + body: widget.items.map((i: string) => Number.parseInt(i, 10)), }); // refresh the identified users list await this.currentPicture.loadIdentifications({ forceReload: true }); diff --git a/subscription/static/bundled/subscription/creation-form-existing-user-index.ts b/subscription/static/bundled/subscription/creation-form-existing-user-index.ts index 3d258c90..e0b47cca 100644 --- a/subscription/static/bundled/subscription/creation-form-existing-user-index.ts +++ b/subscription/static/bundled/subscription/creation-form-existing-user-index.ts @@ -8,9 +8,9 @@ document.addEventListener("alpine:init", () => { async init() { const userSelect = document.getElementById("id_member") as HTMLSelectElement; userSelect.addEventListener("change", async () => { - await this.loadProfile(Number.parseInt(userSelect.value)); + await this.loadProfile(Number.parseInt(userSelect.value, 10)); }); - await this.loadProfile(Number.parseInt(userSelect.value)); + await this.loadProfile(Number.parseInt(userSelect.value, 10)); }, async loadProfile(userId: number) { diff --git a/subscription/static/bundled/subscription/stats-index.ts b/subscription/static/bundled/subscription/stats-index.ts index b30f30a6..14d23aef 100644 --- a/subscription/static/bundled/subscription/stats-index.ts +++ b/subscription/static/bundled/subscription/stats-index.ts @@ -1,4 +1,5 @@ import { BarController, BarElement, CategoryScale, Chart, LinearScale } from "chart.js"; + Chart.register(BarController, BarElement, CategoryScale, LinearScale); function getRandomColor() { @@ -18,13 +19,11 @@ function getRandomColorUniq(list: string[]) { } function hexToRgb(hex: string) { // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") - // biome-ignore lint/performance/useTopLevelRegex: Performance impact is minimal const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; const hexrgb = hex.replace(shorthandRegex, (_m, r, g, b) => { return r + r + g + g + b + b; }); - // biome-ignore lint/performance/useTopLevelRegex: Performance impact is minimal const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexrgb); return result ? { diff --git a/timetable/static/bundled/timetable/generator-index.ts b/timetable/static/bundled/timetable/generator-index.ts index 826e0400..d5e38c4b 100644 --- a/timetable/static/bundled/timetable/generator-index.ts +++ b/timetable/static/bundled/timetable/generator-index.ts @@ -63,10 +63,10 @@ function parseSlots(s: string): TimetableSlot[] { } const [startHour, startMin] = parsed.groups.startHour .split(":") - .map((i) => Number.parseInt(i)); + .map((i) => Number.parseInt(i, 10)); const [endHour, endMin] = parsed.groups.endHour .split(":") - .map((i) => Number.parseInt(i)); + .map((i) => Number.parseInt(i, 10)); return { ...parsed.groups, startSlot: Math.floor((startHour * 60 + startMin) / MINUTES_PER_SLOT), @@ -157,6 +157,7 @@ document.addEventListener("alpine:init", () => { .map((c: TimetableSlot) => c.startHour) .reduce((res: string, hour: string) => (hour < res ? hour : res), "24:00") .split(":")[0], + 10, ); const res: [string, object][] = []; for (let i = 0; i <= this.endSlot - this.startSlot; i += 60 / MINUTES_PER_SLOT) { diff --git a/vite.config.mts b/vite.config.mts index d191d017..0c9b42a9 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -2,8 +2,8 @@ import { parse, resolve } from "node:path"; import inject from "@rollup/plugin-inject"; import { glob } from "glob"; -import { type AliasOptions, type UserConfig, defineConfig } from "vite"; import type { Rollup } from "vite"; +import { type AliasOptions, defineConfig, type UserConfig } from "vite"; import tsconfig from "./tsconfig.json"; const outDir = resolve(__dirname, "./staticfiles/generated/bundled");