Linting
Linting
Fusion apps use two linters together, each catching different things:
- Biome β general JavaScript/TypeScript formatting and correctness (unused variables, dead code, style)
- Fusion Lint β Fusion Framework-specific conventions (intent comments on control flow, TSDoc on exported APIs, no class components, and more)
Run both, in that order β Biome catches general issues, Fusion Lint catches Fusion-specific ones.
Install Fusion TS Lint in VS Code for inline squiggles as you type β no separate server to configure.
π Fusion Lint
Fusion-specific lint rules for TypeScript β the stuff ESLint and Biome don't know about.
Squiggles in your editor. Failures in CI. Inline comments on pull requests.
All from one tool that understands how Fusion apps are supposed to be written.
β¨ What makes it different
Most linters check what your code does. Fusion Lint checks why.
Every if, for, and RxJS chain must be preceded by a comment explaining the intent. Every exported hook, component, and function must have TSDoc. The rules aren't pedantic β they're the conventions your team already agreed on, just enforced automatically.
π Jump in
| I want to⦠| Go here |
|---|---|
| π₯οΈ Get squiggles in VS Code right now | vscode/ β |
| β¨οΈ Run lint in the terminal or pre-commit | cli/ β |
| βοΈ Wire it up in GitHub Actions | cli/ β CI β |
| π See every rule and what it catches | rules/ β |
| ποΈ Tune severities or turn rules off | config/ β |
| π§ Write your own rule | core/ β |
π See it in action
Intent comments
// β Fusion Lint: require-intent-comment/flow
if (user.role === 'admin') {
redirect('/admin');
}
// β
Why is obvious β lint is happy
// Admins land on a dedicated dashboard with elevated controls
if (user.role === 'admin') {
redirect('/admin');
}TSDoc on public API
// β Fusion Lint: require-hook-tsdoc
export const useContextData = (id: string): ContextData => { ... };
// β
One line is enough
/** Fetches and caches context data for the given context ID. */
export const useContextData = (id: string): ContextData => { ... };Code style
// β Fusion Lint: no-class-components
export class UserCard extends React.Component<Props> { ... }
// β
export const UserCard = ({ user }: Props): JSX.Element => ( ... );π¦ Packages
core β rules β config β cli β lsp β vscode| Package | What it is |
|---|---|
@equinor/fusion-framework-lint-core | Engine, Rule interface, Diagnostic type |
@equinor/fusion-framework-lint-rules | All built-in rules |
@equinor/fusion-framework-lint-config | recommended preset and config loader |
@equinor/fusion-lint | CLI β fusion-lint check and fusion-lint changed |
@equinor/fusion-framework-lint-lsp | LSP server for editor integration |
fusion-ts-lint-vscode | VS Code extension β squiggles, Problems panel, hover messages |
Biome
Biome formats and lints general JS/TS issues. A Fusion app's generated biome.json (via @equinor/fusion-framework-cli) is a good starting point β extend or copy it into your own project.
// biome.json
{
"$schema": "https://biomejs.dev/schemas/2.2.5/schema.json",
"formatter": {
"enabled": true,
"lineWidth": 100,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"semicolons": "always",
"quoteStyle": "single"
}
}
}Install the Biome VS Code extension and set it as your default formatter:
// .vscode/settings.json
{
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true
}Useful commands once Biome is added to your package.json scripts:
| Command | What it does |
|---|---|
biome check | Format + lint check (read-only) |
biome format --write | Format files in place |
biome lint | Lint only |