{"id":39674243,"url":"https://github.com/doist/react-compiler-tracker","last_synced_at":"2026-02-06T12:43:23.050Z","repository":{"id":333187808,"uuid":"1131348052","full_name":"Doist/react-compiler-tracker","owner":"Doist","description":"A React Compiler violation tracker to help gradual adoption and prevent regressions","archived":false,"fork":false,"pushed_at":"2026-01-18T07:09:45.000Z","size":113,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-18T16:45:55.125Z","etag":null,"topics":["react-compiler"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Doist.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-09T21:24:53.000Z","updated_at":"2026-01-18T07:54:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Doist/react-compiler-tracker","commit_stats":null,"previous_names":["doist/react-compiler-tracker"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Doist/react-compiler-tracker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doist%2Freact-compiler-tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doist%2Freact-compiler-tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doist%2Freact-compiler-tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doist%2Freact-compiler-tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Doist","download_url":"https://codeload.github.com/Doist/react-compiler-tracker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Doist%2Freact-compiler-tracker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28659874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-compiler"],"created_at":"2026-01-18T09:43:35.412Z","updated_at":"2026-01-30T09:59:48.294Z","avatar_url":"https://github.com/Doist.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Compiler Tracker\n\n[![npm version](https://img.shields.io/npm/v/@doist/react-compiler-tracker)](https://www.npmjs.com/package/@doist/react-compiler-tracker)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js](https://img.shields.io/node/v/@doist/react-compiler-tracker)](https://nodejs.org/)\n\nThe [React Compiler](https://react.dev/learn/react-compiler) automatically memoizes your components, eliminating the need for `useCallback` and `useMemo`. However, certain code patterns cause the compiler to bail out. When this happens, your components lose automatic optimization, potentially causing performance regressions.\n\nInspired by [esplint](https://github.com/hjylewis/esplint) and [react-compiler-marker](https://github.com/blazejkustra/react-compiler-marker), this tool tracks compiler errors in a `.react-compiler.rec.json` file and integrates with Git hooks and CI to prevent new violations from being introduced.\n\n## Prerequisites\n\nThis tool requires `babel-plugin-react-compiler` to be installed in your project:\n\n```bash\nnpm install --save-dev babel-plugin-react-compiler\n```\n\n## Installation\n\n```bash\nnpm install --save-dev @doist/react-compiler-tracker\n```\n\n## Configuration\n\nCreate a `.react-compiler-tracker.config.json` file in your project root to customize the tool's behavior:\n\n```json\n{\n    \"recordsFile\": \".react-compiler.rec.json\",\n    \"sourceGlob\": \"src/**/*.{js,jsx,ts,tsx}\"\n}\n```\n\nAll fields are optional. Default values are shown above.\n\n| Option | Description | Default |\n|--------|-------------|---------|\n| `recordsFile` | Path to the records file | `.react-compiler.rec.json` |\n| `sourceGlob` | Glob pattern for source files | `src/**/*.{js,jsx,ts,tsx}` |\n\n### Monorepo Usage\n\nIn a monorepo, run the tool from your package directory. The config file and all paths are relative to where you run the command. The defaults typically work out of the box:\n\n```\nmy-monorepo/\n├── packages/\n│   └── frontend/\n│       ├── .react-compiler-tracker.config.json  # Optional config\n│       ├── .react-compiler.rec.json             # Records file\n│       └── src/\n│           └── ...\n```\n\nIf your source files are in a different location (e.g., `app/` instead of `src/`), customize the config:\n\n```json\n{\n    \"sourceGlob\": \"app/**/*.{ts,tsx}\"\n}\n```\n\n## Usage\n\n### `--overwrite`\n\nRegenerates the entire records file by scanning all source files matching `sourceGlob`. Useful for initialization or picking up changes from skipped Git hooks.\n\n```bash\nnpx @doist/react-compiler-tracker --overwrite\n```\n\n### `--stage-record-file \u003cfile1\u003e \u003cfile2\u003e ...`\n\nChecks the provided files and updates the records. Exits with code 1 if errors increase (preventing the commit), otherwise updates the records file for the checked files. Reports when errors decrease, celebrating your progress. Deleted files are automatically removed from the records (no need to pass their paths).\n\n```bash\nnpx @doist/react-compiler-tracker --stage-record-file src/components/Button.tsx src/hooks/useData.ts\n```\n\nIf no files are provided, exits cleanly with a success message.\n\n### `--check-files \u003cfile1\u003e \u003cfile2\u003e ...`\n\nChecks specific files without updating records. Exits with code 1 if checked files show increased error counts (or new errors), or if any provided file does not exist. Reports when errors decrease, celebrating your progress. Primarily for CI to ensure PRs don't introduce new compiler errors.\n\n```bash\nnpx @doist/react-compiler-tracker --check-files src/components/Button.tsx src/hooks/useData.ts\n```\n\n### No flags\n\nChecks all source files matching `sourceGlob` and reports the total error count. The records file is **not** updated in this mode.\n\n```bash\nnpx @doist/react-compiler-tracker\n```\n\n### `--show-errors`\n\nShows error information from the compiler including file path, line number, and error reason. Can be combined with any command. Errors are displayed for all checked files regardless of whether they increased.\n\n```bash\nnpx @doist/react-compiler-tracker --check-files --show-errors src/components/Button.tsx\n```\n\nExample output when errors have increased:\n```\nErrors:\n    - src/components/Button.tsx: Line 15: Cannot access refs during render (x2)\n    - src/components/Button.tsx: Line 28: Invalid hook usage\n❌ React Compiler errors have increased in:\n  • src/components/Button.tsx: +3\n\nPlease fix the errors and run the command again.\n```\n\nWhen no new errors are introduced, you still see the existing errors:\n```\nErrors:\n    - src/components/Button.tsx: Line 15: Cannot access refs during render (x2)\n✅ No new React Compiler errors in checked files\n```\n\n## Integration Examples\n\n### lint-staged\n\nIn `package.json`:\n\n```json\n{\n  \"lint-staged\": {\n    \"*.{js,jsx,ts,tsx}\": \"npx @doist/react-compiler-tracker --stage-record-file\"\n  }\n}\n```\n\nWith lint-staged, the matched files are automatically passed as arguments to the command.\n\n### GitHub Actions CI\n\n```yaml\n- name: Check React Compiler violations\n  run: |\n    # Get changed files in the PR\n    FILES=$(git diff --name-only origin/main...HEAD -- '*.tsx' '*.ts' '*.jsx' '*.js' | tr '\\n' ' ')\n    if [ -n \"$FILES\" ]; then\n      npx @doist/react-compiler-tracker --check-files $FILES\n    fi\n```\n\n### Pre-commit hook (manual)\n\n```bash\n#!/bin/sh\n# Get staged files and pass them to the tracker\n# (deleted files are auto-detected from records, no need to pass them)\nFILES=$(git diff --diff-filter=ACMR --cached --name-only -- '*.tsx' '*.ts' '*.jsx' '*.js' | tr '\\n' ' ')\nif [ -n \"$FILES\" ]; then\n  npx @doist/react-compiler-tracker --stage-record-file $FILES\nfi\n```\n\n## License\n\nReleased under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoist%2Freact-compiler-tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoist%2Freact-compiler-tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoist%2Freact-compiler-tracker/lists"}