chore: add biome for linting/formatting + CI action for linting in SRC folder#1284
Merged
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Added HeightmapGenerator class for generating heightmaps with various tools (Hill, Pit, Range, Trough, Strait, etc.). - Introduced Voronoi class for creating Voronoi diagrams using Delaunator. - Updated index.html to include new modules. - Created index.ts to manage module imports. - Enhanced arrayUtils and graphUtils with type definitions and improved functionality. - Added utility functions for generating grids and calculating Voronoi cells.
chore: add npm + vite for progressive enhancement
…ve unused launch.json
…utils-to-ts Refactor: migrate utils to typescript
Co-authored-by: Azgaar <26469650+Azgaar@users.noreply.github.com>
Update copilot guidelines for NPM/Vite/TypeScript architecture
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/Fantasy-Map-Generator into refactor/migrate-modules
…modules feat: Implement HeightmapGenerator and Voronoi module
…r generation logic to river-generator.ts
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Collaborator
Author
|
this should be a good one early on in our refactor. To keep consistent styling. I chose biome for speed reasons. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces Biome as the formatter/linter for the TypeScript sources and wires it into both local tooling and CI, while applying Biome-driven formatting and a few small safety/consistency tweaks across the src tree. It also adds an initial unit test for stringUtils.round.
Changes:
- Added Biome configuration (
biome.json), npm scripts (lint,format), and a GitHub Actions workflow to enforce linting on pushes and PRs. - Reformatted and lightly refactored multiple utilities and modules in
src/to satisfy Biome rules (e.g., parseInt radix,Number.isNaN, stronger typing, safer optional handling). - Introduced a Vitest unit test for
roundinstringUtils, exercising behavior withundefinedinput.
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils/unitUtils.ts | Refactored temperature and SI helpers to use template strings and explicit parseInt radix for Biome compliance. |
| src/utils/stringUtils.ts | Reformatted helpers, adjusted regex style, and suppressed unused error variables in JSON helpers; core behavior otherwise unchanged. |
| src/utils/stringUtils.test.ts | Added a Vitest test asserting round(undefined) returns an empty string (currently not satisfied by implementation; see inline comment). |
| src/utils/probabilityUtils.ts | Reordered imports, reformatted functions, used Number.isNaN and exponent operator, and expanded gauss for clarity. |
| src/utils/polyfills.ts | Reflowed polyfill implementations and typings for replaceAll, flat, and async iterator on ReadableStream without altering behavior. |
| src/utils/pathUtils.ts | Reformatted path/isolines utilities, improved typed options, and made internal closures more explicit while preserving existing logic. |
| src/utils/numberUtils.ts | Switched Math.pow to exponent operator and added semicolons; numeric behavior remains the same. |
| src/utils/nodeUtils.ts | Converted helper functions to arrow functions and tightened parent typing without changing semantics. |
| src/utils/languageUtils.ts | Replaced new RegExp with regex literals, made heavy use of template strings, and slightly clarified getAdjective implementation. |
| src/utils/index.ts | Reordered imports and window augmentations for consistency, and wrapped several window-exposed bindings for clarity while keeping the global API stable. |
| src/utils/graphUtils.ts | Reorganized imports, strengthened typings (Cells, Vertices, Point), and refactored several helpers (Voronoi grid, quadtree search, height drawing) for readability and safer numeric handling. |
| src/utils/functionUtils.ts | Reformatted rollups and distanceSquared and clarified internal nest helper signature. |
| src/utils/debugUtils.ts | Reordered imports, expanded drawing helpers (drawPoint, drawPath) and ensured window typings reflect debug helpers. |
| src/utils/commonUtils.ts | Reformatted utility helpers, added safer setTimeout usage, enforced parseInt radix, and slightly clarified prompt initialization logic. |
| src/utils/colorUtils.ts | Split d3 imports, added type annotations, and refactored color helpers to use template strings and explicit HEX formatting. |
| src/utils/arrayUtils.ts | Clarified deep-copy helper internals, made cf map typing more generic, and improved typed-array factory assertion messaging. |
| src/types/global.ts | Normalized imports to double quotes and converted PackedGraph import to a type-only import. |
| src/types/PackedGraph.ts | Reformatted TypedArray union across multiple lines and kept PackedGraph layout intact. |
| src/modules/voronoi.ts | Switched Delaunator import to type-only, restructured Voronoi fields and methods formatting, and slightly clarified some math operations. |
| src/modules/river-generator.ts | Reorganized imports, reformatted class methods, improved naming/spacing in river generation logic, and made some numeric expressions clearer. |
| src/modules/ocean-layers.ts | Simplified imports, reordered parameters, and made vertex connection logic and path generation more readable. |
| src/modules/lakes.ts | Reordered imports, converted PackedGraphFeature to a type import, and clarified lake climate calculations and cleanup logic. |
| src/modules/index.ts | Ensured module side-effect imports include ./biomes with a trailing semicolon to keep module initialization order consistent. |
| src/modules/heightmap-generator.ts | Renamed class to HeightmapModule, updated the global type, and significantly reformatted heightmap generation while preserving algorithmic behavior. |
| src/modules/features.ts | Reorganized imports from ../utils, refactored feature-markup helpers for clarity, and made use of clipPoly and connectVertices more explicit. |
| src/modules/biomes.ts | Reformatted biome configuration data, clarified arrays (names, colors, costs), and expanded define and getId signatures. |
| package.json | Added @biomejs/biome devDependency and lint/format scripts invoking Biome. |
| package-lock.json | Locked @biomejs/biome and its platform-specific binary packages, and updated dependency metadata accordingly. |
| biome.json | New Biome configuration enabling formatter and linter for src/**/*.ts, with customized rules (including useParseIntRadix and noUnusedVariables). |
| .github/workflows/lint.yml | New GitHub Actions workflow running biome ci . on push and PR to enforce linting/formatting in CI. |
… simplifying function calls
Collaborator
Author
|
ready for merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of change
Versioning