Skip to content

noUnusedParameters: add note about underscore prefix exception - #3178

Merged
Jake Bailey (jakebailey) merged 3 commits into
microsoft:v2from
jamonholmgren:patch-1
Jul 24, 2025
Merged

noUnusedParameters: add note about underscore prefix exception#3178
Jake Bailey (jakebailey) merged 3 commits into
microsoft:v2from
jamonholmgren:patch-1

Conversation

@jamonholmgren

Copy link
Copy Markdown
Contributor

In the release notes for noUnusedParameters, there's a note about prefixing the parameter name with an underscore to bypass this error.

This PR adds that same note and example to the noUnusedParameters documentation.

(thanks to Lizzi Lindboe (@lindboe) for noticing this and pointing me to the release docs!)

@jakebailey Jake Bailey (jakebailey) added the deploy-preview Enables automatic deployments to preview environments on a PR label Aug 8, 2024
Parameters declaration with names starting with an underscore _ are exempt from the unused parameter checking. e.g.:

```ts twoslash
function returnNull(_a) {

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.

@jakebailey Jake Bailey (jakebailey) Aug 8, 2024

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.

Also, set // @noUnusedParameters here. Best to copy the above example and just rename the parameter, actually (but without the @errors)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will do!

Copy first example, modify for the example
@jamonholmgren

Copy link
Copy Markdown
Contributor Author

Finally got back to this. Jake Bailey (@jakebailey) thanks for the feedback, should be ready to go...hopefully!

@github-actions

github-actions Bot commented May 2, 2025

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://victorious-plant-05c166c10-3178.centralus.5.azurestaticapps.net

@jakebailey Jake Bailey (jakebailey) left a comment

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.

Minor nit, given _ is special in markdown.

Comment thread packages/tsconfig-reference/copy/en/options/noUnusedParameters.md Outdated
@jakebailey Jake Bailey (jakebailey) removed the deploy-preview Enables automatic deployments to preview environments on a PR label May 17, 2025
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
@jamonholmgren

Copy link
Copy Markdown
Contributor Author

Just remembered this issue and committed that change, Jake Bailey (@jakebailey). Anything else?

@jakebailey
Jake Bailey (jakebailey) enabled auto-merge (squash) July 24, 2025 18:30
@jakebailey
Jake Bailey (jakebailey) merged commit 0640deb into microsoft:v2 Jul 24, 2025
8 checks passed
@jamonholmgren

Copy link
Copy Markdown
Contributor Author

Thank you!!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants