From 4a6aed30b807a6caab2552bf8a60bb6e9a4cd4b5 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Fri, 18 Sep 2026 08:21:33 +0200 Subject: [PATCH 1/6] Update to Biome 2.x. --- .pre-commit-config.yaml | 3 +- biome.json | 89 +++++++++-------------------------------- package-lock.json | 73 +++++++++++++++++---------------- package.json | 18 +++++++-- 4 files changed, 71 insertions(+), 112 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce5749ff56..67c8f3ac35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -72,10 +72,9 @@ repos: types_or: [html, css] - repo: https://github.com/biomejs/pre-commit - rev: "v2.4.12" + rev: "v2.5.13" hooks: - id: biome-check - additional_dependencies: ["@biomejs/biome@1.9.4"] - repo: https://github.com/awebdeveloper/pre-commit-stylelint rev: "0.0.2" diff --git a/biome.json b/biome.json index d97dd7c7d5..0e90c52a0c 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "$schema": "https://biomejs.dev/schemas/2.5.13/schema.json", "vcs": { "enabled": true, "clientKind": "git", @@ -8,13 +8,16 @@ }, "files": { "ignoreUnknown": true, - "ignore": [ - "**/*.min.js", - "**/javascript/esm/**", - "**/javascript/vendor/**", - "public/**", - "site.webmanifest", - "**/settings.local.json" + "includes": [ + "**", + "!**/*.min.js", + "!**/*.html", + "!**/static_src/tailwind", + "!**/javascript/esm", + "!**/javascript/vendor", + "!**/public", + "!**/site.webmanifest", + "!**/settings.local.json" ] }, "formatter": { @@ -22,77 +25,25 @@ "useEditorconfig": true, "indentStyle": "space" }, - "organizeImports": { "enabled": true }, + "assist": { "actions": { "source": { "organizeImports": "on" } } }, "linter": { "enabled": true, "rules": { - "recommended": false, + "preset": "recommended", "complexity": { - "noExtraBooleanCast": "error", - "noMultipleSpacesInRegularExpressionLiterals": "error", - "noUselessCatch": "error", - "noUselessLoneBlockStatements": "error", - "noUselessUndefinedInitialization": "error", - "noWith": "error" + "noImportantStyles": "off", + "useArrowFunction": "off", + "useOptionalChain": "off" }, "correctness": { - "noConstAssign": "error", - "noConstantCondition": "error", - "noEmptyCharacterClassInRegex": "error", - "noEmptyPattern": "error", - "noGlobalObjectCalls": "error", - "noInvalidBuiltinInstantiation": "error", - "noInvalidConstructorSuper": "error", - "noNonoctalDecimalEscape": "error", - "noPrecisionLoss": "error", - "noSelfAssign": "error", - "noSetterReturn": "error", - "noSwitchDeclarations": "error", - "noUndeclaredVariables": "error", - "noUnreachable": "error", - "noUnreachableSuper": "error", - "noUnsafeFinally": "error", - "noUnsafeOptionalChaining": "error", - "noUnusedLabels": "error", - "noUnusedPrivateClassMembers": "error", - "useArrayLiterals": "error", - "useIsNan": "error", - "useValidForDirection": "error", - "useYield": "error" + "noInnerDeclarations": "off" }, - "security": { "noGlobalEval": "error" }, "style": { - "noCommaOperator": "error", - "noYodaExpression": "error", - "useBlockStatements": "off", - "useConsistentBuiltinInstantiation": "error", - "useSingleVarDeclarator": "error" + "useTemplate": "off", + "useConst": "off" }, "suspicious": { - "noAsyncPromiseExecutor": "error", - "noCatchAssign": "error", - "noClassAssign": "error", - "noCompareNegZero": "error", - "noControlCharactersInRegex": "error", - "noDebugger": "error", - "noDuplicateCase": "error", - "noDuplicateClassMembers": "error", - "noDuplicateObjectKeys": "error", - "noDuplicateParameters": "error", - "noEmptyBlockStatements": "error", - "noFallthroughSwitchClause": "error", - "noFunctionAssign": "error", - "noGlobalAssign": "error", - "noImportAssign": "error", - "noLabelVar": "error", - "noMisleadingCharacterClass": "error", - "noPrototypeBuiltins": "error", - "noRedeclare": "error", - "noShadowRestrictedNames": "error", - "noSparseArray": "error", - "noUnsafeNegation": "error", - "useGetterReturn": "error", - "useValidTypeof": "error" + "useIterableCallbackReturn": "off" } } }, diff --git a/package-lock.json b/package-lock.json index 36547fbe7c..8ed5fbbbd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@babel/cli": "^8.0.4", "@babel/core": "^8.0.1", "@babel/preset-env": "^8.0.2", - "@biomejs/biome": "^1.9.4", + "@biomejs/biome": "^2.5.13", "@tailwindcss/cli": "^4.3.3", "@tailwindcss/typography": "^0.5.20", "alpinejs": "^3.15.12", @@ -1530,11 +1530,10 @@ } }, "node_modules/@biomejs/biome": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.9.4.tgz", - "integrity": "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.5.13.tgz", + "integrity": "sha512-+SEC/mFk1a+5mvUANZgbZTaiZXs1nj4iMhL/PHiqDT5TPUEPFIlliEtkKKZB4N862yylHC3UI+/Sj2I0HJEqhA==", "dev": true, - "hasInstallScript": true, "license": "MIT OR Apache-2.0", "bin": { "biome": "bin/biome" @@ -1547,20 +1546,20 @@ "url": "https://opencollective.com/biome" }, "optionalDependencies": { - "@biomejs/cli-darwin-arm64": "1.9.4", - "@biomejs/cli-darwin-x64": "1.9.4", - "@biomejs/cli-linux-arm64": "1.9.4", - "@biomejs/cli-linux-arm64-musl": "1.9.4", - "@biomejs/cli-linux-x64": "1.9.4", - "@biomejs/cli-linux-x64-musl": "1.9.4", - "@biomejs/cli-win32-arm64": "1.9.4", - "@biomejs/cli-win32-x64": "1.9.4" + "@biomejs/cli-darwin-arm64": "2.5.13", + "@biomejs/cli-darwin-x64": "2.5.13", + "@biomejs/cli-linux-arm64": "2.5.13", + "@biomejs/cli-linux-arm64-musl": "2.5.13", + "@biomejs/cli-linux-x64": "2.5.13", + "@biomejs/cli-linux-x64-musl": "2.5.13", + "@biomejs/cli-win32-arm64": "2.5.13", + "@biomejs/cli-win32-x64": "2.5.13" } }, "node_modules/@biomejs/cli-darwin-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.4.tgz", - "integrity": "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.5.13.tgz", + "integrity": "sha512-nYSuDJ6zgVqZUkAkJkvhXxsF2PYIrUk/g638K4voCXz7foI9f7b6C2/7+oAihsHQlivZNMUrm/y8ywlcHQtZOw==", "cpu": [ "arm64" ], @@ -1575,9 +1574,9 @@ } }, "node_modules/@biomejs/cli-darwin-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.4.tgz", - "integrity": "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.5.13.tgz", + "integrity": "sha512-KVy1ceEDuJ3AzFxjT9kkxbVy+UANw1pjEMUS6lvKfxjJ+fmkRvc7sQn1Xo6ETgseEI7wUQoV03KSga3XfE8YRQ==", "cpu": [ "x64" ], @@ -1592,9 +1591,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.4.tgz", - "integrity": "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.5.13.tgz", + "integrity": "sha512-VlNMtoxOqs0dUR6drxxHr18SNUvI7xxAuHZlH4s/dstYSf3g6RaqVgo8JRnhcOhKz9afWrvtJTboNG1JuYlIDQ==", "cpu": [ "arm64" ], @@ -1612,9 +1611,9 @@ } }, "node_modules/@biomejs/cli-linux-arm64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.4.tgz", - "integrity": "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.5.13.tgz", + "integrity": "sha512-CH32xpep3dNS5EVJpAHlYchkBYznxyVZQrx0b6YYYlPL9u9ZeD2NtqiK/6s64+HFS2a7hGnryLlqqZAOh8ax5g==", "cpu": [ "arm64" ], @@ -1632,9 +1631,9 @@ } }, "node_modules/@biomejs/cli-linux-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.4.tgz", - "integrity": "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.5.13.tgz", + "integrity": "sha512-Fi6gIxbUaJ3ZCIXeG3ggIBPF76O2DjDN67WrPX/ODRv54GeXPm2gbEPC96Yb0yrJoiH0Eax1JLx1Pi0XbsNFZQ==", "cpu": [ "x64" ], @@ -1652,9 +1651,9 @@ } }, "node_modules/@biomejs/cli-linux-x64-musl": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.4.tgz", - "integrity": "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.5.13.tgz", + "integrity": "sha512-F3pmwl+VHoUuVJN/tbNLKeLt0SVK3EIyN1jXlMcNyQGYRQQTVqXF+GgkP0/CjGXFN87e/mv0sBfUnWqWza5PKQ==", "cpu": [ "x64" ], @@ -1672,9 +1671,9 @@ } }, "node_modules/@biomejs/cli-win32-arm64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.4.tgz", - "integrity": "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.5.13.tgz", + "integrity": "sha512-+WD13qshXrr0Icv4BfsAdzm8Fs3TL+nZ59zEQxsYNd8lcgZJ0A5+OrlwsL1PipVCmWeRpxgIPD6DAcEd7smkCQ==", "cpu": [ "arm64" ], @@ -1689,9 +1688,9 @@ } }, "node_modules/@biomejs/cli-win32-x64": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.4.tgz", - "integrity": "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.5.13.tgz", + "integrity": "sha512-VOofU/nW761XWzUeUNE8zzYNyPrxuMuNFMizL0qz7J75yeV8N7WFheUlk1/K6dOkaFpH9wJ+lDKlwjAbw0346w==", "cpu": [ "x64" ], diff --git a/package.json b/package.json index 43bdbc50cf..401ff844ba 100644 --- a/package.json +++ b/package.json @@ -8,16 +8,26 @@ "trailingComma": "es5" }, "babel": { - "exclude": ["**/*.min.js", "**/esm/*.js"], - "presets": ["@babel/preset-env"] + "exclude": [ + "**/*.min.js", + "**/esm/*.js" + ], + "presets": [ + "@babel/preset-env" + ] }, - "browserslist": ["> 0.5%", "last 2 versions", "Firefox ESR", "not dead"], + "browserslist": [ + "> 0.5%", + "last 2 versions", + "Firefox ESR", + "not dead" + ], "devDependencies": { "@alpinejs/focus": "^3.15.12", "@babel/cli": "^8.0.4", "@babel/core": "^8.0.1", "@babel/preset-env": "^8.0.2", - "@biomejs/biome": "^1.9.4", + "@biomejs/biome": "^2.5.13", "@tailwindcss/cli": "^4.3.3", "@tailwindcss/typography": "^0.5.20", "alpinejs": "^3.15.12", From 86f2e58c3e54ec0327d87be8827234b380de74e6 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Fri, 18 Sep 2026 08:22:47 +0200 Subject: [PATCH 2/6] Remove obsolete use strict and add tilte to some svg. --- hypha/addressfield/static/addressfield.js | 2 -- hypha/static_src/images/favicons/safari-pinned-tab.svg | 2 +- hypha/static_src/images/quote-outline.svg | 2 +- hypha/static_src/javascript/batch-actions.js | 2 -- hypha/static_src/javascript/form-group-toggle.js | 2 -- hypha/static_src/javascript/submission-form-copy.js | 2 -- hypha/templates/includes/_toast-placeholder.html | 1 - 7 files changed, 2 insertions(+), 11 deletions(-) diff --git a/hypha/addressfield/static/addressfield.js b/hypha/addressfield/static/addressfield.js index ec674770f4..2310720a2d 100644 --- a/hypha/addressfield/static/addressfield.js +++ b/hypha/addressfield/static/addressfield.js @@ -5,8 +5,6 @@ * Licensed under the MIT license. */ (() => { - "use strict"; - // WeakMap for per-element value storage during select↔input conversion. const savedValues = new WeakMap(); diff --git a/hypha/static_src/images/favicons/safari-pinned-tab.svg b/hypha/static_src/images/favicons/safari-pinned-tab.svg index 3effb09a16..55b8110d00 100644 --- a/hypha/static_src/images/favicons/safari-pinned-tab.svg +++ b/hypha/static_src/images/favicons/safari-pinned-tab.svg @@ -1 +1 @@ - \ No newline at end of file + diff --git a/hypha/static_src/images/quote-outline.svg b/hypha/static_src/images/quote-outline.svg index 170ef07de5..af419e961d 100644 --- a/hypha/static_src/images/quote-outline.svg +++ b/hypha/static_src/images/quote-outline.svg @@ -1,3 +1,3 @@ - + diff --git a/hypha/static_src/javascript/batch-actions.js b/hypha/static_src/javascript/batch-actions.js index 3c04da5bbe..5038d28204 100644 --- a/hypha/static_src/javascript/batch-actions.js +++ b/hypha/static_src/javascript/batch-actions.js @@ -1,6 +1,4 @@ (function () { - "use strict"; - const checkboxes = document.querySelectorAll(".js-batch-select"); const allCheckboxInputs = document.querySelectorAll(".js-batch-select-all"); const batchButtons = document.querySelectorAll("[data-js-batch-actions]"); diff --git a/hypha/static_src/javascript/form-group-toggle.js b/hypha/static_src/javascript/form-group-toggle.js index bc9edd6c84..f5a1201eca 100644 --- a/hypha/static_src/javascript/form-group-toggle.js +++ b/hypha/static_src/javascript/form-group-toggle.js @@ -1,6 +1,4 @@ (function () { - "use strict"; - /** * Wrap all elements matching a selector into a single wrapper div. * Similar to jQuery's wrapAll. diff --git a/hypha/static_src/javascript/submission-form-copy.js b/hypha/static_src/javascript/submission-form-copy.js index 5ba159f85f..75df993bf2 100644 --- a/hypha/static_src/javascript/submission-form-copy.js +++ b/hypha/static_src/javascript/submission-form-copy.js @@ -1,6 +1,4 @@ (function () { - "use strict"; - /** * Strip HTML tags from a string and return plain text. * @param {string} html diff --git a/hypha/templates/includes/_toast-placeholder.html b/hypha/templates/includes/_toast-placeholder.html index 2ef83a2f59..6f5a9366bb 100644 --- a/hypha/templates/includes/_toast-placeholder.html +++ b/hypha/templates/includes/_toast-placeholder.html @@ -11,7 +11,6 @@