style(web): sort imports in error-toast.ts to unblock the Biome check - #1666
Conversation
The biome-check-web hook is declared with always_run: true and pass_filenames: false, so it checks all of surfsense_web on every run regardless of which files a change touches. One unsorted import in lib/error-toast.ts therefore fails Frontend Quality, and with it the Quality Gate aggregator, on every pull request against dev. Applies Biome's own safe fix and nothing else.
|
@Yigtwxx is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Frontend Quality— and with it theQuality Gateaggregator — currently fails on every pull request opened againstdev, including ones that change no TypeScript at all. This is the one unsorted import causing it.Description
surfsense_web/lib/error-toast.tsimports./errorbefore./env-config, which Biome'sassist/source/organizeImportsreports as an error. The fix is Biome's own suggested safe fix, applied verbatim — two import lines swapped, nothing else in the file touched.Why one import breaks unrelated pull requests. The hook is declared in
.pre-commit-config.yaml:always_run: truemakes pre-commit run the hook whatever the changed-file set is, so thefiles:filter never gets to exclude it, andpass_filenames: falseplus the trailing.means the entry checks the wholesurfsense_webtree rather than the changed files. The--from-ref/--to-refinvocation in.github/workflows/code-quality.ymltherefore narrows nothing for this hook: any pull request, on any path, is measured against every file insurfsense_web.That is why the job is red on PRs that touch only documentation, and why it is red on merged PRs too — #1663 carries the same
Frontend QualityandQuality Gatefailures.dev's own Code Quality runs have been failing since late July.I am reporting the hook behaviour, not changing it. Whether
always_runis intentional (a deliberate "always check the whole app" policy) or an oversight is a maintainer's call, and either way this file has to be sorted first.Motivation and Context
No linked issue. Found while opening #1665, a documentation-only PR that came back red on a TypeScript check.
Screenshots
Not applicable — no UI change. The file's runtime behaviour is unchanged; only the order of two import statements differs.
API Changes
Change Type
Marked as a bug fix because the effect is on CI rather than on the file itself; the edit is pure formatting.
Testing Performed
npx @biomejs/biome@2.4.6 check --diagnostic-level=error lib/error-toast.tsfromsurfsense_web:lib/error-toast.tsFound 1 error—assist/source/organizeImportsChecked 1 file. No fixes applied.The failing run this PR addresses is the
Frontend Qualityjob on #1665, whose log reports exactly one diagnostic across the tree:Checked 1055 files in 1479ms. Found 1 error.— this file. So the tree is clean once this lands, rather than this being the first of many.Runtime behaviour is untested because there is none to test: reordering two side-effect-free ES module imports of local modules cannot change evaluation order in a way this file observes, and no other file changed.
Checklist
High-level PR Summary
This PR fixes a failing CI check by reordering two import statements in
error-toast.tsto comply with Biome's import sorting rules. The file was causing theFrontend Qualitycheck to fail on all pull requests (including unrelated ones) because the pre-commit hook runs Biome against the entiresurfsense_webdirectory regardless of which files were changed. The fix simply swaps the position of two imports so that./env-configcomes before./error, which is Biome's expected alphabetical order.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_web/lib/error-toast.ts