Skip to content
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

feat(eslint-plugin): [restrict-plus-operands] add allow* options #6161

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Dec 3, 2022

PR Checklist

Overview

Brings in the allowBoolean, allowNullish, and allowRegExp options from @typescript-eslint/restrict-template-expressions. Also adds an allowNumberWithString option equivalent to the allowNumber option, as a more-specific-to-this-rule name.

Internally streamlines the rule a bit by having comparisons directly refer to ts.TypeFlags checks whenever possible.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

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.

@nx-cloud
Copy link

nx-cloud bot commented Dec 3, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 548b7df. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 47 targets

Sent with 💌 from NxCloud.

@netlify
Copy link

netlify bot commented Dec 3, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 548b7df
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/638b0ee56015fb00081386a5
😎 Deploy Preview https://deploy-preview-6161--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.


if (types.some(value => value === 'bigint')) {
return 'bigint';
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These three inner if (types.some(... cases weren't covered by code coverage. Most of the intersections in the previous test suite reduced to never. I got rid of most of them.

@codecov
Copy link

codecov bot commented Dec 3, 2022

Codecov Report

Merging #6161 (548b7df) into main (e458b5a) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6161      +/-   ##
==========================================
+ Coverage   91.26%   91.31%   +0.04%     
==========================================
  Files         366      366              
  Lines       12427    12426       -1     
  Branches     3639     3644       +5     
==========================================
+ Hits        11342    11347       +5     
+ Misses        774      768       -6     
  Partials      311      311              
Flag Coverage Δ
unittest 91.31% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...-plugin/src/rules/restrict-template-expressions.ts 100.00% <ø> (ø)
.../eslint-plugin/src/rules/restrict-plus-operands.ts 100.00% <100.00%> (+11.32%) ⬆️

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review December 3, 2022 09:19
@bradzacher bradzacher added the enhancement: plugin rule option New rule option for an existing eslint-plugin rule label Jan 30, 2023
@JoshuaKGoldberg
Copy link
Member Author

Drafting this pending discussion in #6110

@bradzacher bradzacher marked this pull request as draft March 13, 2023 02:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review April 5, 2023 20:24
@JoshuaKGoldberg JoshuaKGoldberg requested review from bradzacher and removed request for bradzacher June 10, 2023 00:50
@JoshuaKGoldberg JoshuaKGoldberg added this to the 6.0.0 milestone Jun 13, 2023
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

image

Yeah looks good - nice and loud and explicit to help people understand better practices

@JoshuaKGoldberg JoshuaKGoldberg merged commit def09f8 into typescript-eslint:main Jun 15, 2023
38 of 39 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the restrict-plus-operands-allow-options branch June 15, 2023 16:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: plugin rule option New rule option for an existing eslint-plugin rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement: [restrict-plus-operands] Bring in options from restrict-template-expressions
2 participants