feat: add Biome for linting and formatting #11
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
javascript
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
thayen/portfolio-site!11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code Review
This pull request introduces Biome as the project's linter and formatter, transitioning the codebase from spaces to tabs and adding necessary configuration files and scripts. Key feedback includes addressing a potential memory leak in
keyword.astrocaused by redundantresizeevent listeners being registered on every page load. Additionally, the reviewer identified invalid configuration keys and glob syntax inbiome.jsonand an incorrect flag in thepackage.jsonformatting script.@ -0,0 +40,4 @@},"files": {"includes": ["**", "!!**/dist", "!!**/.astro"]}The
includeskey is incorrect; Biome uses the singularincludefor whitelisting files. Additionally, the!!prefix is not standard glob syntax for negation in Biome; a single!should be used. However, for excluding directories likedistand.astro, it is idiomatic to use theignorefield instead of negative patterns ininclude.The
biome formatcommand does not support the--fixflag. To apply formatting changes to files, you should use the--writeflag instead. Note thatbiome check --fix(used in yourlint:fixscript) already handles formatting, so this script might be redundant, but if kept, it should use the correct flag.This
resizeevent listener is added to thewindowevery timeinitKeywordsis executed. SinceinitKeywordsis triggered on everyastro:page-load(and twice on the initial load due to the direct call at line 152 and the event listener at line 154), this will lead to a significant memory leak and multiple redundant executions of the resize logic as the user navigates the site.Furthermore, calling
clampPopupPosition(which modifies styles and triggers layout) in a loop during a resize event can cause layout thrashing and performance issues. Consider moving the window listener outside ofinitKeywordsor implementing a cleanup strategy to remove the previous listener before adding a new one.