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): [no-unsafe-enum-comparison] add rule #6107

Merged

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Nov 27, 2022

PR Checklist

Overview

Adds the no-unsafe-enum-comparison rule to prevent comparing enum values against literals.

Extracted from #6091.

Co-authored-by: @Zamiell

also fixes for codebase
@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 Nov 27, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 68ad65c. 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 Nov 27, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit b1c9bec
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/642dc3851bc43d0007bdce5f
😎 Deploy Preview https://deploy-preview-6107--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.

@codecov
Copy link

codecov bot commented Nov 27, 2022

Codecov Report

Merging #6107 (b1c9bec) into main (75806c9) will increase coverage by 0.02%.
The diff coverage is 93.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6107      +/-   ##
==========================================
+ Coverage   87.34%   87.36%   +0.02%     
==========================================
  Files         384      386       +2     
  Lines       13147    13190      +43     
  Branches     3858     3867       +9     
==========================================
+ Hits        11483    11524      +41     
- Misses       1298     1300       +2     
  Partials      366      366              
Flag Coverage Δ
unittest 87.36% <93.18%> (+0.02%) ⬆️

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

Impacted Files Coverage Δ
packages/type-utils/src/typeFlagUtils.ts 76.92% <50.00%> (+1.92%) ⬆️
...kages/eslint-plugin/src/rules/enum-utils/shared.ts 81.81% <81.81%> (ø)
...lint-plugin/src/rules/no-unsafe-enum-comparison.ts 100.00% <100.00%> (ø)

@bradzacher bradzacher added enhancement: plugin rule option New rule option for an existing eslint-plugin rule enhancement: new plugin rule New rule request for eslint-plugin and removed enhancement: plugin rule option New rule option for an existing eslint-plugin rule labels Jan 30, 2023
@JoshuaKGoldberg JoshuaKGoldberg merged commit 915f9c2 into typescript-eslint:main Apr 5, 2023
40 checks passed
@@ -29,6 +29,7 @@ export = {
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
Copy link
Member

Choose a reason for hiding this comment

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

changing the recommended configs is considered a breaking change

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh shoot

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah wait, per https://typescript-eslint.io/linting/configs, strict isn't considered stable. It's not in our "recommended" configs list. 😌

Still filing #6890 just in case.

@JoshuaKGoldberg JoshuaKGoldberg deleted the no-unsafe-enum-comparison branch April 12, 2023 01:38
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: new plugin rule New rule request for eslint-plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants