[No QA] Fix ESLint seatbelt failure in createDocsRoutes.ts (unsafe type assertions) - #95782
[No QA] Fix ESLint seatbelt failure in createDocsRoutes.ts (unsafe type assertions)#95782MelvinBot wants to merge 1 commit into
Conversation
Co-authored-by: Stephanie Elliott <stephanieelliott@users.noreply.github.com>
|
🤖 I analyzed the checks. No code fix is needed — the check this PR exists to fix is already green, and the only failing check is the human-only PR Author Checklist. Failing check: Everything relevant passes:
Why no other failure is expectedThe Jest Bottom line: tick the PR Author Checklist boxes to clear the only failing check; there's nothing for me to push. |
|
@Eskalifer1 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
🤖 Re-checked — nothing has changed since my earlier analysis, and there's still no code fix for me to push.
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
@codex review |
|
@MelvinBot we have branch conflict with main, let's fix that |
|
I can't resolve the conflict here because I can only make code changes (including merging To have me do it, an assignee or co-author (e.g. gh pr checkout 95782
git merge main
# resolve conflicts, then:
git add -A && git commit && git pushThe conflict is almost certainly in |
|
@MelvinBot merge main and resolve conflicts |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
Still can't do this, Two ways forward:
The conflict is most likely in |
|
@MelvinBot I am assigned to this issue as C+, you can check it |
|
I checked, and I don't see
I can only make code changes (including merging Alternatively, the conflict can be resolved manually: gh pr checkout 95782
git merge main
# resolve conflicts (most likely in config/eslint/eslint.seatbelt.tsv), then:
git add -A && git commit && git push |
|
Oop this isn't needed anymore! We ended up reverting the offending PR. |
Explanation of Change
The
lint / ESLint checkjob started failing onmainafter PR #95101, which added new@typescript-eslint/no-unsafe-type-assertionviolations to.github/scripts/createDocsRoutes.ts. The file'seslint-seatbeltbaseline allowed only 3 such assertions, but the newgetOrderFromArticleFrontMatter/getSectionMetahelpers pushed it to 6, breaking the build.This removes the 5 unsafe
asassertions on theyaml.load(...)results (which returnunknown) and replaces them with:isRecord()type guard that narrows anunknownvalue toRecord<string, unknown>.typeofchecks when readingorder/title, so the returned values are correctly typed without asserting.This is behavior-preserving and actually slightly safer: the old code blind-cast
frontmatterObject.ordertonumber | undefinedandmeta.titletostring | undefinedeven if the parsed YAML held a different type; the new code validates the runtime type before using it. Only the originalas DocsRoutesassertion remains (grandfathered), so the seatbelt baseline for this file is tightened from3to1inconfig/eslint/eslint.seatbelt.tsv.Fixed Issues
$ #95779
PROPOSAL: #95779 (comment)
Tests
// TODO: The human co-author must fill out the tests they ran before marking this PR as "ready for review".
This is a CI/build-script change with no runtime (app) impact. It can be validated with:
npm run lint(or./scripts/lint.sh .github/scripts/createDocsRoutes.ts) and verify it passes with 0 errors.npm run createDocsRoutesand verifydocs/_data/routes.ymlis generated identically to before (article order and section titles unchanged).Offline tests
N/A — build/CI-only change.
QA Steps
// TODO: The issue title includes "[No QA]" — this change only affects a repo build script (
.github/scripts/createDocsRoutes.ts) and the lint baseline, not the app.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Screenshots/Videos
N/A — no UI changes.