Skip to content

fix(eslint-plugin): [no-magic-numbers] fix implementation of the ignore option #9167

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

Conversation

Vinccool96
Copy link
Contributor

PR Checklist

Overview

As discussed in #9161, the ignore option wasn't correctly implemented.

ignoreTypeIndexes was also added to defaultOptions since it was apparently missing.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Vinccool96!

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.

Copy link

netlify bot commented May 28, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 02d78e9
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/665cbcb3cd854700085498e1
😎 Deploy Preview https://deploy-preview-9167--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (🔴 down 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

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

@Vinccool96 Vinccool96 force-pushed the fix/no-magic-numbers-base-definition branch from f084106 to 79cbabd Compare May 31, 2024 13:41
Copy link

codecov bot commented May 31, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 87.48%. Comparing base (50cc96d) to head (215b965).

Current head 215b965 differs from pull request most recent head 02d78e9

Please upload reports for the commit 02d78e9 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9167      +/-   ##
==========================================
- Coverage   87.49%   87.48%   -0.02%     
==========================================
  Files         261      261              
  Lines       12709    12720      +11     
  Branches     3969     3977       +8     
==========================================
+ Hits        11120    11128       +8     
  Misses       1310     1310              
- Partials      279      282       +3     
Flag Coverage Δ
unittest 87.48% <75.00%> (-0.02%) ⬇️

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

Files Coverage Δ
...ckages/eslint-plugin/src/rules/no-magic-numbers.ts 82.19% <75.00%> (-1.68%) ⬇️

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Implementation looks great, thanks! I like the splitting out of the helpful functions. ✨

Requesting changes on the node.value type shenanigans and a bit more granular testing please.

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jun 2, 2024
@Vinccool96 Vinccool96 force-pushed the fix/no-magic-numbers-base-definition branch from 79cbabd to 215b965 Compare June 2, 2024 14:56
}
`,
options: [{ ignoreNumericLiteralTypes: true, ignore: [1] }],
},
Copy link
Member

Choose a reason for hiding this comment

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

[Praise] This is a perfect test 😁 tests one thing and is very clear. I like it!

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jun 2, 2024
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

💯 this is great! Thanks for massaging the tests a bunch!

Tom Hiddleston as Loki saying "Glorious"

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Jun 2, 2024
@Vinccool96
Copy link
Contributor Author

LET'S GOOOOOOO
image

Copy link

github-actions bot commented Jun 2, 2024

Uh oh! @Vinccool96, the image you shared is missing helpful alt text. Check #9167 (comment).

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@JoshuaKGoldberg JoshuaKGoldberg merged commit bf5394d into typescript-eslint:main Jun 6, 2024
62 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: no-magic-numbers Doesn't apply ignore to type definitions
2 participants