Linting and Formatting
Relevant source files
The following files were used as context for generating this wiki page:
Linting and formatting ensure code consistency and quality across the Acode documentation project and the editor itself. The project uses Biome as its primary toolchain for maintaining code standards, while the Acode editor provides user-configurable settings to handle various programming languages through built-in and plugin-based formatters.
Project-Level Toolchain
The repository utilizes Biome for unified linting, formatting, and code organization. This toolchain automates the enforcement of style guides and detects potential errors in the codebase.
Biome Configuration
The biome.json file defines the rules for the project's static analysis and automated styling.
The diagram shows the hierarchy of configuration blocks within the Biome toolchain.
- Linter: Enables recommended rules to identify code smells and errors.
- Formatter: Enforces a consistent
tabindentation style across files. - Assist: Automatically organizes imports during the development process.
- VCS Integration: Specifically configured to use Git as the client but remains disabled by default in the provided configuration.
Sources: biome.json:1-36
Script Automation
Task automation is handled through npm scripts defined in package.json.
| Script | Command | Action |
|---|---|---|
lint | biome lint --write | Checks for code issues and applies safe fixes. |
format | biome format --write | Rewrites files to match the defined style. |
check | biome check --write | Combines linting, formatting, and import organization. |
Sources: package.json:7-9
Editor-Level Formatting
Acode allows users to configure formatting behavior for various programming languages through the Formatter Settings.
Formatter Types
Users can select between different sources for code formatting:
- Built-in: Core formatters provided natively by Acode.
- Plugin-based: External formatters, such as Prettier, installed via the Plugin Registry.
Sources: user-guide/settings/formatter.md:5-13
Automation Settings
The editor integrates formatting into the file lifecycle through specific options in the Editor Settings.
| Setting | Function | Default |
|---|---|---|
| Format on Save | Automatically runs the selected formatter when a file is saved. | Off |
| Lint Gutter | Displays diagnostic markers from language servers (LSP) in the editor gutter. | On |
Sources: user-guide/settings/editor-settings.md:15-16, user-guide/settings/editor-settings.md:32
Typography and Spellchecking
The project maintains a _typos.toml configuration to manage spellchecking exclusions and specific word mappings. This ensures technical terms like "formate" are not flagged as errors during documentation building or automated checks.
Sources: _typos.toml:1-12
Workflow Integration
The following sequence illustrates how code is processed when a developer runs the automated check script.
This diagram represents the data flow when executing the project's primary maintenance script.
Sources: package.json:9, biome.json:8-25
Linting and formatting in this project provide a dual-layered approach: Biome maintains the repository's integrity, while the Acode application settings empower users to customize their coding environment. Proper configuration of these tools reduces technical debt and maintains high documentation standards.