-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix(eslint-plugin): [restrict-plus-operands] report adding bigints to strings when allowNumberAndString
is false
#10737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(eslint-plugin): [restrict-plus-operands] report adding bigints to strings when allowNumberAndString
is false
#10737
Conversation
…s string When `allowNumberAndString: false` is set, adding bigints and strings should not be allowed
Thanks for the PR, @0x31! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
View your CI Pipeline Execution ↗ for commit 40eb372.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM, nice and straightforward. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats on your first PR to typescript-eslint!
| datasource | package | from | to | | ---------- | -------------------------------- | ------ | ------ | | npm | @typescript-eslint/eslint-plugin | 8.23.0 | 8.24.0 | | npm | @typescript-eslint/parser | 8.23.0 | 8.24.0 | ## [v8.24.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8240-2025-02-10) ##### 🚀 Features - **eslint-plugin:** \[no-unnecessary-condition] make `allowConstantLoopConditions` more granular ([#10639](typescript-eslint/typescript-eslint#10639)) ##### 🩹 Fixes - **eslint-plugin:** \[no-misused-spread] correct and elaborate string spread report message ([#10751](typescript-eslint/typescript-eslint#10751)) - **eslint-plugin:** \[restrict-plus-operands] report adding bigints to strings when `allowNumberAndString` is `false` ([#10737](typescript-eslint/typescript-eslint#10737)) ##### ❤️ Thank You - Josh Goldberg ✨ - noah - Ronen Amiel You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
| datasource | package | from | to | | ---------- | -------------------------------- | ------ | ------ | | npm | @typescript-eslint/eslint-plugin | 8.23.0 | 8.24.0 | | npm | @typescript-eslint/parser | 8.23.0 | 8.24.0 | ## [v8.24.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8240-2025-02-10) ##### 🚀 Features - **eslint-plugin:** \[no-unnecessary-condition] make `allowConstantLoopConditions` more granular ([#10639](typescript-eslint/typescript-eslint#10639)) ##### 🩹 Fixes - **eslint-plugin:** \[no-misused-spread] correct and elaborate string spread report message ([#10751](typescript-eslint/typescript-eslint#10751)) - **eslint-plugin:** \[restrict-plus-operands] report adding bigints to strings when `allowNumberAndString` is `false` ([#10737](typescript-eslint/typescript-eslint#10737)) ##### ❤️ Thank You - Josh Goldberg ✨ - noah - Ronen Amiel You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
PR Checklist
allowNumberAndString: false
doesn't report when adding abigint
to astring
#10715Overview
If
allowNumberAndString
is set tofalse
,restrict-plus-operands
now reports when abigint
and astring
are added, instead of just reporting fornumber
andstring
. This is inline with the docs forallowNumberAndString
:Example
eslintrc
:Code snippet:
Warning
Operands of '+' operations must be a number or string, allowing a string + any of:
any
,boolean
,null
,RegExp
,undefined
. Gotbigint
+string
.