Skip to content

feat(parser): always enable comment, loc, range, tokens #8617

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

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Mar 7, 2024

BREAKING CHANGE: Changes opt-in options from @typescript-eslint/parser to always-on.

PR Checklist

Overview

Hardcodes those values to true in parser, and sets up the types so that generated ASTs always have the comment, range, and tokens.

Note that this doesn't change the values in typescript-estree. That package still has the generic AST type with conditional types on 'comment' and 'token'.

Adds some more unit tests while I'm in the area.

Co-authored-by: @bradzacher

💖

@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.

Copy link

netlify bot commented Mar 7, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 4332b9c
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65eb38e0df28270007585dd3
😎 Deploy Preview https://deploy-preview-8617--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.

@JoshuaKGoldberg JoshuaKGoldberg changed the title feat!(parser): always enable comment, loc, range, tokens feat(parser): always enable comment, loc, range, tokens Mar 7, 2024
@JoshuaKGoldberg JoshuaKGoldberg added the breaking change This change will require a new major version to be released label Mar 7, 2024
programs?: Program[] | null;
project?: string[] | string | boolean | null;
projectFolderIgnoreList?: (RegExp | string)[];
range?: boolean;
projectFolderIgnoreList?: string[];
Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't verified yet (typescript-eslint/examples#9), but it looks to me like we never actually supported the RegExp case?

const projectFolderIgnoreList = (
options.projectFolderIgnoreList ?? ['**/node_modules/**']
)
.reduce<string[]>((acc, folder) => {
if (typeof folder === 'string') {
acc.push(folder);
}
return acc;
}, [])

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

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

Project coverage is 87.98%. Comparing base (f9520fe) to head (4332b9c).

❗ Current head 4332b9c differs from pull request most recent head b8318a7. Consider uploading reports for the commit b8318a7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##               v8    #8617      +/-   ##
==========================================
+ Coverage   87.33%   87.98%   +0.64%     
==========================================
  Files         387      397      +10     
  Lines       13024    13881     +857     
  Branches     3771     4086     +315     
==========================================
+ Hits        11375    12213     +838     
- Misses       1358     1368      +10     
- Partials      291      300       +9     
Flag Coverage Δ
unittest 87.98% <80.00%> (+0.64%) ⬆️

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

Files Coverage Δ
...pt-estree/src/parseSettings/createParseSettings.ts 78.87% <80.00%> (ø)

... and 98 files with indirect coverage changes

@JoshuaKGoldberg JoshuaKGoldberg added this to the 8.0.0 milestone Mar 8, 2024
@JoshuaKGoldberg JoshuaKGoldberg changed the base branch from main to v8 March 18, 2024 13:04
@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team April 22, 2024 21:21
@JoshuaKGoldberg JoshuaKGoldberg merged commit 571bb9d into typescript-eslint:v8 Apr 26, 2024
54 checks passed
@JoshuaKGoldberg JoshuaKGoldberg deleted the parser-always-comments-etc branch April 26, 2024 13:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2024
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.

Enhancement: Differentiate AST node types without parent (for estree) and with parent (for eslint)
2 participants