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

fix(eslint-plugin): [ban-ts-comment] more accurate handling of multiline comments #8416

Merged
merged 6 commits into from Mar 18, 2024

Conversation

auvred
Copy link
Member

@auvred auvred commented Feb 9, 2024

PR Checklist

Overview

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @auvred!

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 Feb 9, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit a108410
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65e9b1f31d90d40007b66f9e
😎 Deploy Preview https://deploy-preview-8416--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: 99 (🟢 up 9 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.

Comment on lines +158 to +161
const matchedPragma = execDirectiveRegEx(
singleLinePragmaRegEx,
`//${comment.value}`,
);
Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps to be fully consistent with TypeScript's behavior, we should even check that this comment is in the begging of the file. Because // @ts-nocheck placed after some code is not a valid pragma. Sounds like a good followup, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'd +1 filing that as an issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here it is - #8753

@auvred auvred marked this pull request as ready for review February 9, 2024 06:48
Copy link

codecov bot commented Feb 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.23%. Comparing base (25e6518) to head (a108410).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8416      +/-   ##
==========================================
+ Coverage   87.21%   87.23%   +0.01%     
==========================================
  Files         251      251              
  Lines       12305    12316      +11     
  Branches     3880     3881       +1     
==========================================
+ Hits        10732    10744      +12     
+ Misses       1303     1302       -1     
  Partials      270      270              
Flag Coverage Δ
unittest 87.23% <100.00%> (+0.01%) ⬆️

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

Files Coverage Δ
packages/eslint-plugin/src/rules/ban-ts-comment.ts 100.00% <100.00%> (+2.70%) ⬆️

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.

🔥 Really nicely done!

This reminds me that microsoft/TypeScript#38370 is still waiting for a spec. Heh.

Comment on lines +158 to +161
const matchedPragma = execDirectiveRegEx(
singleLinePragmaRegEx,
`//${comment.value}`,
);
Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'd +1 filing that as an issue.

@JoshuaKGoldberg JoshuaKGoldberg merged commit da006b1 into typescript-eslint:main Mar 18, 2024
59 checks passed
peanutenthusiast pushed a commit to peanutenthusiast/typescript-eslint that referenced this pull request Mar 27, 2024
…ine comments (typescript-eslint#8416)

* fix(eslint-plugin): [ban-ts-comment] more accurate handling of multiline comments

* chore: revert suggesstion message

---------

Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: [ban-ts-comment] incorrectly handles directives in multiline block comments
2 participants