Skip to content

refactor: replace .bind(this, intent) with arrow fn in Settings#56

Merged
mjdavidson merged 1 commit into
masterfrom
mattd/explore-fix-settings-bind
May 7, 2026
Merged

refactor: replace .bind(this, intent) with arrow fn in Settings#56
mjdavidson merged 1 commit into
masterfrom
mattd/explore-fix-settings-bind

Conversation

@mjdavidson
Copy link
Copy Markdown
Contributor

Clears the 4 no-this-in-exported-function oxlint warnings in components/Settings.js.

Settings is a function component; props.onSubmit.bind(this, intent) binds this to undefined. At runtime it works because the parent's onSubmit is itself bound to the parent class instance, so the inner bind's this=undefined is silently ignored. The arrow function form is clearer about what's actually happening — partial application of intent.

No runtime behaviour change. Lint warnings drop from 7 to 3.

Settings is a function component; props.onSubmit.bind(this, intent)
binds `this` to undefined (function components have no `this` in
strict mode). At runtime it works because the parent's onSubmit is
itself bound to the parent class instance, so the inner bind's
this=undefined is silently ignored. But oxlint flags every `this`
in an exported function (no-this-in-exported-function), and the
intent of the code is clearer as a partial-application closure.

4 sites in components/Settings.js:
  props.onSubmit.bind(this, 'sso') → (e) => props.onSubmit('sso', e)
  ... and the same for dsync, audit_logs, domain_verification.

No runtime behaviour change. Lint warnings drop from 7 to 3.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
explore Ready Ready Preview, Comment May 7, 2026 8:54pm

Request Review

@mjdavidson mjdavidson merged commit 2d39048 into master May 7, 2026
9 checks passed
@mjdavidson mjdavidson deleted the mattd/explore-fix-settings-bind branch May 7, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant