Skip to content

Commit d380516

Browse files
authored
Migrate to biome and add lint, typecheck to CI (#25)
Closes #24 This pull request migrates the project from ESLint and Prettier to Biome for linting and formatting, updates the continuous integration workflow to use Biome and TypeScript type checking, and standardizes TypeScript types and dependencies across packages. It also improves import ordering and code style consistency in several files. Migration to Biome (Linting & Formatting): * Added `biome.json` configuration file and Biome as a dev dependency in `package.json`, specifying formatting, linting, and ignore rules. * Replaced ESLint and Prettier scripts with Biome equivalents in `package.json` and `.lintstagedrc.json`, removing related config and ignore files (`.eslintrc.js`, `.eslintignore`, `.prettierrc.json`, `.prettierignore`). * Updated import ordering and code style in multiple files for consistency with Biome formatting. Continuous Integration Workflow Updates: * Updated `.github/workflows/ci.yml` to run Biome linting and TypeScript type checking before tests and build. * Revised `.github/CI.md` to document the new CI steps and local development commands, replacing ESLint/Prettier references with Biome and typecheck steps. TypeScript and Dependency Standardization: * Standardized `@types/react` and `@types/react-dom` to version `^18.2.0` in both root and `experience-editor` package dependencies. These changes modernize the project's code quality tooling, improve developer experience, and ensure consistent formatting and type safety across the codebase.
1 parent 3cc95c3 commit d380516

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+507
-481
lines changed

.eslintignore

Lines changed: 0 additions & 20 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/CI.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ This project uses GitHub Actions for continuous integration. The CI workflow run
77
The CI workflow (`.github/workflows/ci.yml`) runs the following checks in sequence:
88

99
1. **Install dependencies** - `yarn install --frozen-lockfile`
10-
2. **Test** - `yarn test` - Runs all unit tests (currently 39 tests)
11-
3. **Build** - `yarn build` - Verifies all packages build successfully
10+
2. **Lint** - `yarn lint` - Runs Biome linter on all source files
11+
3. **Type check** - `yarn typecheck` - Runs TypeScript type checking across all packages
12+
4. **Test** - `yarn test` - Runs all unit tests (currently 39 tests)
13+
5. **Build** - `yarn build` - Verifies all packages build successfully
1214

1315
All checks must pass before code can be merged to `main`.
1416

15-
> **Note:** Linting and type checking will be added after resolving existing type errors and migrating to Biome.
16-
1717
## Environment
1818
- **Node version:** 22.20.0
1919
- **Yarn version:** 1.22.18
@@ -23,12 +23,19 @@ All checks must pass before code can be merged to `main`.
2323
Before pushing your changes, you can run the same checks locally:
2424

2525
```bash
26-
# Run all checks
26+
# Run all checks in sequence
2727
yarn install --frozen-lockfile
28+
yarn lint
29+
yarn typecheck
2830
yarn test
2931
yarn build
3032

3133
# Or run them individually as needed
34+
yarn lint # Check code quality with Biome
35+
yarn lint:fix # Fix auto-fixable linting issues
36+
yarn typecheck # Check TypeScript types
37+
yarn test # Run unit tests
38+
yarn build # Build all packages
3239
```
3340

3441
## Troubleshooting

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
restore-keys: |
3535
${{ runner.os }}-nx-
3636
37+
- name: Lint
38+
run: yarn lint
39+
40+
- name: Type check
41+
run: yarn typecheck
42+
3743
- name: Test
3844
run: yarn test
3945

.lintstagedrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"{packages,entrypoints,web-components,viz-service}/**/*.{js,jsx,ts,tsx,json,css,scss,md}": "prettier --write",
3-
"{packages,entrypoints,web-components,viz-service}/**/*.+(js,jsx,ts,tsx,json,css,scss,md)": "eslint"
2+
"{packages}/**/*.{js,jsx,ts,tsx,json,css,md}": [
3+
"biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
4+
]
45
}

.prettierignore

Lines changed: 0 additions & 17 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

.storybook/preview.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import React from "react";
2-
31
const defaultDecorator = (Story: any, context: any) => {
4-
return (
5-
<>
6-
<Story {...context} />
7-
</>
8-
);
2+
return <Story {...context} />;
93
};
104

115
export const decorators = [defaultDecorator];

.storybook/storyshots.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/// <reference types="vite/client"/>
22
/// <reference types="vitest/globals"/>
3-
import { describe, expect, test } from "vitest";
3+
4+
import { composeStories, Meta, StoryFn } from "@storybook/react";
45
import { render, waitForElementToBeRemoved } from "@testing-library/react";
5-
import { Meta, StoryFn, composeStories } from "@storybook/react";
66
import { parseISO } from "date-fns";
7+
import { describe, expect, test } from "vitest";
78
import * as globalConfig from "./preview";
89

910
vi?.useFakeTimers().setSystemTime(parseISO("2020-01-01"));
@@ -23,13 +24,13 @@ describe("Storybook Snapshots", async () => {
2324
modules
2425
.filter((module) => !/skip-storyshots/.test(module.default.title!))
2526
.map((module) => [module.default.title!, module]),
26-
)("%s", (moduleName, module) => {
27+
)("%s", (_moduleName, module) => {
2728
test.each(
2829
Object.values(composeStories(module, globalConfig)).map((Story) => [
2930
Story.storyName!,
3031
Story,
3132
]),
32-
)("%s", async (storyName, Story) => {
33+
)("%s", async (_storyName, Story) => {
3334
const { container } = await render(Story({}));
3435
if (container.querySelector(".MuiCircularProgress-indeterminate")) {
3536
await waitForElementToBeRemoved(() =>

.storybook/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { mergeConfig } from "vite";
22

33
import { default as base } from "../config/entrypoint/vite.config";
44

5-
65
export default mergeConfig(base, {
76
test: {
87
environment: "happy-dom",

0 commit comments

Comments
 (0)