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(typescript-estree): added allowInvalidAST option to not throw on invalid tokens #6247

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Dec 18, 2022

PR Checklist

Overview

Adds an opt-in allowInvalidAST option to @typescript-eslint/typescript-estree and @typescript-eslint/parser. It enables checks for some known cases where TypeScript reports a syntactic issue as semantic:

Note that some previously reported cases seem to now be reported as syntactic issues by TypeScript:

Does not tackle more difficult cases:

@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 18, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 7144e90. 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 51 targets

Sent with 💌 from NxCloud.

@netlify
Copy link

netlify bot commented Dec 18, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 7144e90
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/64045ee30711b70008911df0
😎 Deploy Preview https://deploy-preview-6247--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.

@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from main to v6 December 18, 2022 03:57
@JoshuaKGoldberg JoshuaKGoldberg changed the title Typescript estree throw invalid tokens wip: throw on invalid tokens Dec 18, 2022
@JoshuaKGoldberg JoshuaKGoldberg changed the title wip: throw on invalid tokens feat(typescript-estree): added option to throw on invalid tokens Dec 23, 2022
@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Merging #6247 (7144e90) into v6 (f98afd2) will decrease coverage by 0.09%.
The diff coverage is 33.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v6    #6247      +/-   ##
==========================================
- Coverage   87.81%   87.72%   -0.09%     
==========================================
  Files         365      365              
  Lines       12455    12479      +24     
  Branches     3669     3679      +10     
==========================================
+ Hits        10937    10947      +10     
- Misses       1158     1170      +12     
- Partials      360      362       +2     
Flag Coverage Δ
unittest 87.72% <33.33%> (-0.09%) ⬇️

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

Impacted Files Coverage Δ
...pt-estree/src/parseSettings/createParseSettings.ts 89.79% <ø> (ø)
packages/typescript-estree/src/convert.ts 32.30% <26.47%> (+0.43%) ⬆️
packages/typescript-estree/src/node-utils.ts 65.10% <75.00%> (-0.33%) ⬇️
packages/typescript-estree/src/ast-converter.ts 100.00% <100.00%> (ø)
packages/eslint-plugin/src/rules/indent.ts 88.09% <0.00%> (-4.77%) ⬇️

@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Dec 23, 2022

I'm not so sure this is the right approach to fixing the issue. It'd be hard to add branching logic for every possible syntactic issue not reported as such by TypeScript.

Instead, I'll look at using our isolated program to catch them.

Let this PR serve as a reference for what this logic could look like. 🙂

Edit: the isolated program is too slow. We're going with this! 🚀

@JoshuaKGoldberg JoshuaKGoldberg deleted the typescript-estree-throw-invalid-tokens branch December 23, 2022 22:41
@JoshuaKGoldberg JoshuaKGoldberg restored the typescript-estree-throw-invalid-tokens branch December 23, 2022 22:42
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review February 6, 2023 16:25
@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Feb 17, 2023
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft February 17, 2023 15:41
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review February 19, 2023 05:25
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft February 21, 2023 20:50
@JoshuaKGoldberg JoshuaKGoldberg added this to the 6.0.0 milestone Feb 23, 2023
@JoshuaKGoldberg JoshuaKGoldberg changed the title feat(typescript-estree): added option to throw on invalid tokens feat(typescript-estree): added allowInvalidAST option to not throw on invalid tokens Feb 23, 2023
@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review February 23, 2023 06:26
@JoshuaKGoldberg JoshuaKGoldberg removed the awaiting response Issues waiting for a reply from the OP or another party label Feb 23, 2023
@JoshuaKGoldberg JoshuaKGoldberg requested review from bradzacher and removed request for bradzacher February 23, 2023 06:29
@bradzacher bradzacher merged commit a3b177d into typescript-eslint:v6 Mar 5, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the typescript-estree-throw-invalid-tokens branch March 5, 2023 17:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants