Skip to content

ref(eslint): enable no-unsafe-arguments in scraps#115877

Merged
TkDodo merged 3 commits into
masterfrom
tkdodo/ref/no-unsafe-arguments-scraps
May 21, 2026
Merged

ref(eslint): enable no-unsafe-arguments in scraps#115877
TkDodo merged 3 commits into
masterfrom
tkdodo/ref/no-unsafe-arguments-scraps

Conversation

@TkDodo
Copy link
Copy Markdown
Collaborator

@TkDodo TkDodo commented May 20, 2026

No description provided.

@TkDodo
Copy link
Copy Markdown
Collaborator Author

TkDodo commented May 20, 2026

bugbot run

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 20, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 66fd55b. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

📊 Type Coverage Diff

Metric Before After Delta
Coverage 93.56% 93.57% 🟢 +0.01%
Typed 135,613 135,625 🟢 +12
Untyped 9,336 9,325 🟢 -11
🔍 6 new type safety issues introduced

Type assertions (as) (6 new)

File Line Detail
static/app/components/core/layout/container.tsx 257 `as keyof ContainerLayoutProps
static/app/components/core/layout/flex.tsx 67 `as keyof FlexLayoutProps
static/app/components/core/layout/grid.tsx 100 `as keyof GridLayoutProps
static/app/components/core/segmentedControl/segmentedControl.tsx 108 as Parameters<typeof useCollection>[0]props as Parameters<typeof useCollection>[0]
static/app/components/core/separator/separator.tsx 24 as keyof SeparatorPropsprop as keyof SeparatorProps
static/app/components/teamSelector.tsx 196 `as unknown[]

This is informational only and does not block the PR.

@TkDodo TkDodo marked this pull request as ready for review May 20, 2026 13:07
@TkDodo TkDodo requested review from a team as code owners May 20, 2026 13:07
Comment on lines +584 to +589
? value.map((val: OptionType['value'] | null | undefined) =>
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
flatOptions.find(option => compare(option.value, val))
)
: // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
flatOptions.find(opt => compare(opt.value, value)) || noMatchFallback;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of adding eslint comments here, what if we update the compare function?

  const compare = (a: unknown, b: unknown) => {
    if (props.isValueEqual && defined(a) && defined(b)) {
      return props.isValueEqual(
        a as OptionType['value'],
        b as OptionType['value'],
      );
    }
    return a === b;
  };

Copy link
Copy Markdown
Collaborator Author

@TkDodo TkDodo May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that opt.value is of type any because of some underlying types in react-select we can’t change :/ The eslint comment surfaces this, I think changing the input types to unkonwn with a type assertion might just lead to wrong things being passed in

Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left 1 suggestion, but it looks good to me

@TkDodo TkDodo merged commit d46b28e into master May 21, 2026
70 checks passed
@TkDodo TkDodo deleted the tkdodo/ref/no-unsafe-arguments-scraps branch May 21, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants