feat: add Biome for linting and formatting #11

Merged
N0tAI merged 1 commit from dev into main 2026-04-03 04:20:16 +00:00
N0tAI commented 2026-04-03 04:20:09 +00:00 (Migrated from github.com)
  • Install @biomejs/biome v2.4.10 and configure biome.json
  • Enable experimentalFullSupportEnabled for full Astro file support
  • Add lint, lint:fix, format, format:fix npm scripts
  • Add biomejs.biome VS Code extension recommendation
  • Auto-format all project files to Biome's tab-based style
  • Fix useIterableCallbackReturn error in keyword.astro
- Install @biomejs/biome v2.4.10 and configure biome.json - Enable experimentalFullSupportEnabled for full Astro file support - Add lint, lint:fix, format, format:fix npm scripts - Add biomejs.biome VS Code extension recommendation - Auto-format all project files to Biome's tab-based style - Fix useIterableCallbackReturn error in keyword.astro
gemini-code-assist[bot] (Migrated from github.com) reviewed 2026-04-03 04:22:21 +00:00
gemini-code-assist[bot] (Migrated from github.com) left a comment

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.astro caused by redundant resize event listeners being registered on every page load. Additionally, the reviewer identified invalid configuration keys and glob syntax in biome.json and an incorrect flag in the package.json formatting script.

## 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.astro` caused by redundant `resize` event listeners being registered on every page load. Additionally, the reviewer identified invalid configuration keys and glob syntax in `biome.json` and an incorrect flag in the `package.json` formatting script.
@ -0,0 +40,4 @@
},
"files": {
"includes": ["**", "!!**/dist", "!!**/.astro"]
}
gemini-code-assist[bot] (Migrated from github.com) commented 2026-04-03 04:22:22 +00:00

medium

The includes key is incorrect; Biome uses the singular include for whitelisting files. Additionally, the !! prefix is not standard glob syntax for negation in Biome; a single ! should be used. However, for excluding directories like dist and .astro, it is idiomatic to use the ignore field instead of negative patterns in include.

	"files": {
		"ignore": ["dist", ".astro"]
	}
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) The `includes` key is incorrect; Biome uses the singular `include` for whitelisting files. Additionally, the `!!` prefix is not standard glob syntax for negation in Biome; a single `!` should be used. However, for excluding directories like `dist` and `.astro`, it is idiomatic to use the `ignore` field instead of negative patterns in `include`. ```suggestion "files": { "ignore": ["dist", ".astro"] } ```
gemini-code-assist[bot] (Migrated from github.com) commented 2026-04-03 04:22:22 +00:00

medium

The biome format command does not support the --fix flag. To apply formatting changes to files, you should use the --write flag instead. Note that biome check --fix (used in your lint:fix script) already handles formatting, so this script might be redundant, but if kept, it should use the correct flag.

		"format:fix": "biome format --write .",
![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg) The `biome format` command does not support the `--fix` flag. To apply formatting changes to files, you should use the `--write` flag instead. Note that `biome check --fix` (used in your `lint:fix` script) already handles formatting, so this script might be redundant, but if kept, it should use the correct flag. ```suggestion "format:fix": "biome format --write .", ```
gemini-code-assist[bot] (Migrated from github.com) commented 2026-04-03 04:22:22 +00:00

high

This resize event listener is added to the window every time initKeywords is executed. Since initKeywords is triggered on every astro: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 of initKeywords or implementing a cleanup strategy to remove the previous listener before adding a new one.

![high](https://www.gstatic.com/codereviewagent/high-priority.svg) This `resize` event listener is added to the `window` every time `initKeywords` is executed. Since `initKeywords` is triggered on every `astro: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 of `initKeywords` or implementing a cleanup strategy to remove the previous listener before adding a new one.
Sign in to join this conversation.
No description provided.