fix: don't use openfga/sdk for assertNever#539
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughRemoves external runtime dependency by replacing an imported Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR removes a runtime import of assertNever from @openfga/sdk to avoid unintentionally introducing a runtime/peer dependency for @openfga/syntax-transformer.
Changes:
- Replaced
@openfga/sdk/dist/utilsassertNeverimport with a locally definedassertNeverhelper in the schema version utilities.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/js/util/schema_version.ts (1)
21-48:⚠️ Potential issue | 🟡 MinorEnsure code passes ESLint and Prettier linting before merge.
The exhaustiveness checks are correct—all three
SchemaVersionmembers (V1_0, V1_1, V1_2) are explicitly handled, anddefault: assertNever(version)properly enforces TypeScript's exhaustiveness guarantees.assertNeveris correctly defined locally and not exported or re-exported through barrel files.However, per the coding guidelines, files in
pkg/js/**/*.tsmust use ESLint and Prettier. Verify the code passes both:
npm run lint(ESLint rules: double quotes, semicolons, 120-char max line length)npm run format:check(Prettier formatting rules)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/js/util/schema_version.ts` around lines 21 - 48, Run the project linters and formatters and fix any issues in this file: ensure pkg/js/util/schema_version.ts conforms to ESLint (double quotes, semicolons, 120-char max) and Prettier rules by running npm run lint and npm run format:check and applying fixes (or npm run format) as needed; specifically open the functions isSchemaVersionSupported and checkSchemaVersionSupportsModules and adjust quoting/semicolon/whitespace/line breaks to satisfy the rules, then re-run the checks until both pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@pkg/js/util/schema_version.ts`:
- Around line 21-48: Run the project linters and formatters and fix any issues
in this file: ensure pkg/js/util/schema_version.ts conforms to ESLint (double
quotes, semicolons, 120-char max) and Prettier rules by running npm run lint and
npm run format:check and applying fixes (or npm run format) as needed;
specifically open the functions isSchemaVersionSupported and
checkSchemaVersionSupportsModules and adjust quoting/semicolon/whitespace/line
breaks to satisfy the rules, then re-run the checks until both pass.
Description
What problem is being solved?
#534 introduced a peer dependency on
@openfga/sdkby importingassertNeverfrom@openfga/sdkinschema_version.ts, which is then exported fromindex.tsObserved failure using
@openfga/syntax-transformer: https://github.com/openfga/vscode-ext/actions/runs/22102322207/job/63875359435?pr=453#logsHow is it being solved?
just define
assertNeverinlineWhat changes are made to solve it?
just define
assertNeverinlineReferences
Review Checklist
mainSummary by CodeRabbit