Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Nov 19, 2025

| undefined in optional function params (e.g. param?: string | undefined) is pointless. Remove them.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 19, 2025
Copy link
Member Author

overlookmotel commented Nov 19, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app graphite-app bot changed the base branch from 11-19-docs_linter_plugins_fix_jsdoc_comment to graphite-base/15885 November 19, 2025 20:23
@overlookmotel overlookmotel marked this pull request as ready for review November 19, 2025 20:24
@overlookmotel overlookmotel self-assigned this Nov 19, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Nov 19, 2025
Copy link
Member Author

overlookmotel commented Nov 19, 2025

Merge activity

@graphite-app graphite-app bot changed the base branch from graphite-base/15885 to main November 19, 2025 20:29
… params types (#15885)

`| undefined` in optional function params (e.g. `param?: string | undefined`) is pointless. Remove them.
@graphite-app graphite-app bot force-pushed the 11-19-refactor_linter_plugins_remove_undefined_from_optional_function_params_types branch from f870a1a to b2de90b Compare November 19, 2025 20:30
@graphite-app graphite-app bot merged commit b2de90b into main Nov 19, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 11-19-refactor_linter_plugins_remove_undefined_from_optional_function_params_types branch November 19, 2025 20:35
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Nov 19, 2025
beforeCount?: number | null | undefined,
afterCount?: number | null | undefined,
): string {
getText(node?: Ranged | null, beforeCount?: number | null, afterCount?: number | null): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should copy eslint's API and remove | null here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm. If ESLint doesn't accept null, then yes I guess we shouldn't either, so that plugins written and tested in Oxlint remain compatible with ESLint. But in a lot of cases, ESLint uses !option to check for defined/undefined, so is very liberal indeed. I think ideally we don't want to do that as truthiness checks are somewhat expensive compared to == null (I believe).

Copy link
Contributor

@camc314 camc314 Nov 20, 2025

Choose a reason for hiding this comment

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

I think ===undefined is probably faster than ==null i would guess?

Copy link
Member Author

@overlookmotel overlookmotel Nov 20, 2025

Choose a reason for hiding this comment

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

Yes. We only use == null where we want to catch either. Wherever possible, we use === undefined or === null.

But if it was me designing a lib, I'd accept either null or undefined to mean "nothing" in all external APIs, and conform the input so we only use null internally.

Copilot AI pushed a commit that referenced this pull request Nov 21, 2025
… params types (#15885)

`| undefined` in optional function params (e.g. `param?: string | undefined`) is pointless. Remove them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants