Skip to content

Systematically reduce @typescript-eslint/no-unsafe-type-assertion violations #94739

Open
7 of 8 issues completed
Open

Description

@blimpich

If you run npm run eslint-report from App you can see our repo's eslint violations. The vast majority of these violations come from @typescript-eslint/no-unsafe-type-assertion.

Image Image

About half the violations are in test suites vs production files:

┌────────────┬───────┬────────────┐
│            │ Files │ Violations │
├────────────┼───────┼────────────┤
│ Test files │ 485   │ 3,380      │
├────────────┼───────┼────────────┤
│ Prod files │ 861   │ 2,212      │
├────────────┼───────┼────────────┤
│ Total      │ 1,346 │  5,592     │
└────────────┴───────┴────────────┘

The ease of fixing these violations varies. Some are extremely simple and others are complex. We fixed some of the worst offending test suites in these two PRs (1, 2) by beginning to use a PartialDeep helper method for creating mock objects, but this is only for test files – and many violations still remain. The job of this issue is to get these number of violations down 📉

Changing one type can have cascading effects on the rest of the codebase. Careful use of Type Narrowing will be needed, and business logic will have to be preserved.

However, we can get good bang-for-our-buck here. A small number of files account for a disproportionate % of violations:

┌─────────┬───────┬────────────┬────────────┬────────────┐
│  Scope  │ Files │ % of files │ Violations │ % of total │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 5   │ 5     │ 0.4%       │ 547        │ 10%        │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 10  │ 10    │ 0.7%       │ 872        │ 16%        │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 20  │ 20    │ 1.5%       │ 1,344      │ 24%        │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 50  │ 50    │ 3.7%       │ 2,040      │ 36%        │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 107 │ 107   │ 8%         │ 2,803      │ 50%        │
├─────────┼───────┼────────────┼────────────┼────────────┤
│ Top 372 │ 372   │ 28%        │ 4,194      │ 75%        │
└─────────┴───────┴────────────┴────────────┴────────────┘

So a full 3rd of these violations can be fixed by only touching 3.7% of the files with violations, and 75% of the violations can be fixed by only fixing 28% of the files. Good Pareto Principle example. Because of the nature of this issue, we've structured the payout in a unique way: you'll be paid by getting the total number of @typescript-eslint/no-unsafe-type-assertion to go down. This structure assumes (and incentivizes) the contributors working on it will knock out the easiest violations first, and the reward per violation goes up ⬆️ as you progress. Of course, removing the violations will also likely get harder as the low-hanging fruit all gets knocked out 😢.

┌───────────┬──────────────────────┬────────┐
│ Milestone │ Violations remaining │ Payout │
├───────────┼──────────────────────┼────────┤
│ Start     │ 5,592                │ —      │
├───────────┼──────────────────────┼────────┤
│ 1         │ ≤ 4,500              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 2         │ ≤ 3,800              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 3         │ ≤ 3,200              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 4         │ ≤ 2,700              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 5         │ ≤ 2,300              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 6         │ ≤ 1,950              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 7         │ ≤ 1,650              │ $250   │
├───────────┼──────────────────────┼────────┤
│ 8         │ ≤ 1,398 (75%)        │ $250   │
├───────────┼──────────────────────┼────────┤
│ Total     │                      │ $2,000 │
└───────────┴──────────────────────┴────────┘

Guidelines:

  • To minimize merge conflicts (and ease review load) PRs should be kept small. Ideally no more than 200 changed lines per PR. This will also make it easier to revert in case of regressions.
  • Violation count will be calculated by checking npm run eslint-report on the latest version of main.
  • Once a count has been reached the contributor can notify the author of this issue (@blimpich) and I'll create a payout issue for the specific milestone you've reached. This way you're paid as you accomplish work rather than all at the end.
Issue OwnerCurrent Issue Owner: @situchan

Activity

  1. self-assigned this
    on Jun 26, 2026
  2. blimpich commented on Jun 29, 2026

    @blimpich
    ContributorAuthor

    @KJ21-ENG and I talked in DM about them working on this issue. They are going to take over and start chipping away at it 👍

  3. added theissue type on Jun 29, 2026
  4. KJ21-ENG commented on Jun 29, 2026

    @KJ21-ENG
    Contributor

    @blimpich Heyy 👋🏻

  5. KJ21-ENG commented on Jul 2, 2026

    @KJ21-ENG
    Contributor

    @blimpich I will start working on this today and will keep you updated on progress. Thanks!

  6. blimpich commented on Jul 2, 2026

    @blimpich
    ContributorAuthor

    Lovely thank you @KJ21-ENG!

  7. blimpich commented on Jul 2, 2026

    @blimpich
    ContributorAuthor

    As a heads up I'll be OOO tomorrow, but will be back Monday 👍

  8. KJ21-ENG commented on Jul 2, 2026

    @KJ21-ENG
    Contributor

    NP! I will try to get some work ready for review by the time you're back. 😄

  9. 356 remaining items

  10. KJ21-ENG commented on Oct 28, 2026

    @KJ21-ENG
    Contributor

    Hi @blimpich @ikevin127 👋

    Milestone 7 is reached on main 🎉

    Current @typescript-eslint/no-unsafe-type-assertion count on latest main: 1,623

    Milestone Target Status
    7 ≤ 1,650 ✅ Reached (27 below target)
    8 ≤ 1,398 ⏳ 225 violations to go

    Source: config/eslint/eslint.seatbelt.tsv at main commit 8af186d.

    As agreed here, @ikevin127 took milestone 7, and milestone 8 goes to a new C+. Thanks a lot, Kevin, for all the reviews on this one 🙌

    @blimpich could you please assign a new C+ for milestone 8?

  11. ikevin127 commented on Oct 28, 2026

    @ikevin127
    Contributor

    ✅ Confirmed, milestone 7 is reached on main. I posted stats on Milestone 7 issue to ready it for payment.

    Thanks @KJ21-ENG for pushing this over the line 🙌

  12. melvin-bot commented on Oct 29, 2026

    @melvin-bot

    @ikevin127

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.24-8 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

  13. melvin-bot commented on Oct 29, 2026

    @melvin-bot

    @ikevin127

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.25-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

  14. blimpich commented on Oct 29, 2026

    @blimpich
    ContributorAuthor

    @ikevin127 can you ask in the C+ channel to see if anyone is interested in taking over the milestone 8?

  15. ikevin127 commented on Oct 29, 2026

    @ikevin127
    Contributor
  16. blimpich commented on Oct 29, 2026

    @blimpich
    ContributorAuthor

    @situchan is taking over for the final milestone, which will be paid out at $500. @situchan please review previous conversations in this issue about payment to make sure you're okay with $500 being the amount paid out for reviewing the final PRs necessary to reach milestone 8. I will not be increasing the amount paid out above $500 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

DailyKSv2Skip PaymentSkips all the payment process steps for an issue. Use it for fixed-price projects.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions