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(noTypeOnlyImportAttributes): ignore .cts files #4364

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Oct 22, 2024

Summary

Fix #4361

noTypeOnlyImportAttributes reports import type with import attributes because this is a syntax error in TypeScript.
However, since TypeScript 5.3, this is allowed in CommonJS files.

This PR makes noTypeOnlyImportAttributes to ignore files ending the .cts extension.

I notes that the test snapshot outputted the wrong Markdown language (ts instead of cts). Thus, I changed how we output the Markdown language in tests in order to output cts for cts files. As a side effect this also translates mts to cts. However, we have no test using this extension and this should not create any issue.

Test Plan

I added a test.

@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Oct 22, 2024
@Conaclos Conaclos force-pushed the conaclos/noTypeOnlyImportAttributes-allow-import-attribute-is-cts branch 2 times, most recently from 076f3ac to c523f26 Compare October 22, 2024 09:50
@github-actions github-actions bot added the A-Parser Area: parser label Oct 22, 2024
Copy link
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 48420 48420 0
Passed 47220 47220 0
Failed 1200 1200 0
Panics 0 0 0
Coverage 97.52% 97.52% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 40 40 0
Passed 37 37 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.50% 92.50% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 6578 6578 0
Passed 2205 2205 0
Failed 4373 4373 0
Panics 0 0 0
Coverage 33.52% 33.52% 0.00%

ts/babel

Test result main count This PR count Difference
Total 680 680 0
Passed 607 607 0
Failed 73 73 0
Panics 0 0 0
Coverage 89.26% 89.26% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18492 18492 0
Passed 14154 14154 0
Failed 4338 4338 0
Panics 0 0 0
Coverage 76.54% 76.54% 0.00%

@Conaclos Conaclos force-pushed the conaclos/noTypeOnlyImportAttributes-allow-import-attribute-is-cts branch from c523f26 to bf8a6c0 Compare October 22, 2024 10:20
Copy link

codspeed-hq bot commented Oct 22, 2024

CodSpeed Performance Report

Merging #4364 will not alter performance

Comparing conaclos/noTypeOnlyImportAttributes-allow-import-attribute-is-cts (bf8a6c0) with main (a1ae7bf)

Summary

✅ 101 untouched benchmarks

@Conaclos Conaclos merged commit edd82c0 into main Oct 22, 2024
12 checks passed
@Conaclos Conaclos deleted the conaclos/noTypeOnlyImportAttributes-allow-import-attribute-is-cts branch October 22, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Linter Area: linter A-Parser Area: parser L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 noTypeOnlyImportAttributes errors are flagged when linter is diabled
2 participants