Skip to content

chore: lint with oxlint - #1359

Merged
dangreen merged 66 commits into
masterfrom
chore/oxlint
Nov 30, 2026
Merged

dangreen merged 66 commits into
masterfrom
chore/oxlint

Conversation

@dangreen

@dangreen dangreen commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part 6 of the tooling stack. Based on master (#1354–#1358 are merged).

What

  • oxlint instead of ESLint + Prettier (the eslint-to-oxlint skill). oxlint.config.ts wraps @trigen/oxlint-config in defineConfig from @trigen/oxlint and extends the base, module, React, type-checked TypeScript, test and Storybook configs, with typeAware and typeCheck on (oxlint-tsgolint). oxlint --fix also formats, so Prettier and its config are gone.
  • Scripts: lint → oxlint, format → oxlint --fix; .nano-staged.json runs oxlint --fix on staged files.
  • Sample data in sandboxes and stories may use plain numbers and log to the console (one override).
  • The code is reformatted to the Trigen style (separate commit, mechanical). Lint fixes on top of formatting: props order in specs, helpers that capture nothing moved to module scope in the events sandbox, function declarations in story data, type imports first.
  • One library change, fix:: ForwardedRef uses RefObject<T | null> instead of MutableRefObject<T | null>, which is deprecated in React 19 types. It accepts the same refs from every @types/react version in the peer range.
  • One intentional oxlint-disable-next-line typescript/no-misused-spread in chart.tsx, where options is shallow-copied so Chart.js does not mutate the user's object (the rule mistakes the options type for a class instance).

Left as is

Four react-hooks/exhaustive-deps warnings in chart.tsx that ESLint reported too: adding the dependencies would change when the chart is re-created.

Checked locally

pnpm test (lint, unit, types), pnpm build (sizes unchanged: 857 / 538 / 590 B), pnpm storybook:build, pnpm sandboxes:build; no eslint/prettier config or dependency left (only the two /* eslint-disable */ in Docusaurus files, which the website PR deletes).

Merging

GitHub could not rebase this branch after the lower PRs were squash-merged, so master is merged into it instead (the trees were identical, so the merge changes nothing). Its commit list therefore also shows the commits of #1354–#1358. When squash-merging, keep only this PR's own commits in the message: chore: lint with oxlint, fix: type ref objects with RefObject and style: format the code with oxlint.

Stack

  1. chore: agent skills and notes (chore: add agent skills lock and agent notes #1354)
  2. ci: Node.js 26, pnpm 12 and workflows (ci: update Node.js, pnpm and workflows #1355)
  3. build: Vite and Vitest (build: build and test with Vite #1356)
  4. chore: Storybook 10 (chore: update Storybook to 10 #1357)
  5. chore: sandboxes in the root workspace (chore: install the sandboxes from the root workspace #1358)
  6. chore: lint with oxlint ← this PR
  7. chore(deps): update dependencies
  8. docs: move the website to Starlight
  9. build!: drop the CommonJS build (build!: drop the CommonJS build #1362)

🤖 Generated with Claude Code

Agent skills are installed from skills-lock.json, while the installed copies in .agents and .claude stay out of git, as in the other Trigen repositories. AGENTS.md describes what matters in this repository; CLAUDE.md points to it.
pnpm 12 reads build script approvals from allowBuilds instead of onlyBuiltDependencies.
Every job takes Node.js from .tool-versions and pnpm 12, actions are pinned to release commits, which renovate keeps current, and the token of a run only reads unless a job needs more. Tests run as separate types, lint and unit jobs; checks add package.json linting; commitlint runs from the repository; the release job is ready for npm trusted publishing.
The big-lib preset runs the bundle in headless Chrome, which no longer works; the small-lib preset measures what a consumer ships, for the whole package and for single components, with limits pinned on a 50 B step.
The description ends with a period and the homepage, now the documentation website, follows the license.
The react-chartjs-2 tag on Stack Overflow gets no new questions since 2025. The bug report now points to the StackBlitz sandbox.
Vite builds the same ESM and CommonJS entries that rollup with swc did, unminified and for modern targets, so the pure annotations reach the bundlers of consumers. Declarations are emitted from tsconfig.build.json, and the scripts follow the Trigen baseline.
Specs live beside the code they test, and tsd type tests become @ts-expect-error cases in them, checked by tsc and by Vitest typecheck.
Addons that moved into the core are dropped, the config is ESM TypeScript, and the scripts are named as in the other Trigen repositories: storybook and storybook:build. chartjs-plugin-zoom 3 ships ESM types that the stories need.
Stories are type-checked with the rest of the code now, so a change of the component types that breaks a usage shows up in test:types.
Claude Code reads AGENTS.md by itself.
The sandboxes were a separate pnpm workspace with their own lockfile, so they got another copy of Chart.js and ran on the package from npm. In the root workspace they share one install and run on the sources of the package; StackBlitz still installs each one with its own package.json from npm.
The sandboxes resolve the package to its sources through the workspace now.
ESLint with the standard config and Prettier are replaced by oxlint with @trigen/oxlint-config: base, module, React, type-checked TypeScript, test and Storybook configs, with type-aware rules and type checking on. oxlint --fix also formats, so Prettier is gone. Sample data in sandboxes and stories may use plain numbers and log to the console.
MutableRefObject is deprecated in React 19 types. RefObject<T | null> accepts the same refs: useRef(null) results with any @types/react version from the peer range.
The code follows the Trigen style now. Besides formatting: props of elements are ordered, helpers that capture nothing move to the module scope, and stories import types first.
@codecov

codecov Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.97%. Comparing base (cfc7317) to head (22560b3).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1359      +/-   ##
==========================================
+ Coverage   93.75%   93.97%   +0.22%     
==========================================
  Files           3        3              
  Lines          80       83       +3     
  Branches       20       20              
==========================================
+ Hits           75       78       +3     
  Misses          3        3              
  Partials        2        2              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Stories import the sandboxes, which import react-chartjs-2 by name: without an install of the sandboxes, as in CI, tsc maps the name to the sources.
The sandboxes resolve the package to its sources through the workspace now.
The sandboxes resolve the package to its sources through the workspace now.
Questions go to the Q&A category of Discussions instead of issues, so they stay apart from bug reports and an answer can be marked.
Questions go to the Q&A category of Discussions instead of issues, so they stay apart from bug reports and an answer can be marked.
The specs checked only the props types, so the render function of the typed components was never run.
# Conflicts:
#	src/typedCharts.spec.tsx
With empty datasets Chart.js never looks up the controller, so the tests passed even without the controller registration. Each test now checks one behavior.
# Conflicts:
#	src/typedCharts.spec.tsx
Base automatically changed from chore/sandboxes-workspace to master November 30, 2026 15:45
@dangreen
dangreen marked this pull request as ready for review November 30, 2026 15:48
@dangreen
dangreen merged commit fe7d82c into master Nov 30, 2026
11 checks passed
@dangreen
dangreen deleted the chore/oxlint branch November 30, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant