Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Lonercode
Copy link

PR Checklist

Overview

This PR extracts the AST check (checkForStatementDeclaration) from convert.ts to a file ast-checks.ts as requested in the issue due to the increasing length of code in the file. Therefore, a new fie has been added (ast-checks.ts), one modified (convert.ts) and tests have been run.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Lonercode!

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.

@netlify
Copy link

netlify bot commented Nov 9, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 001ea12
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6918915f3e193400084f6a85
😎 Deploy Preview https://deploy-preview-11748--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: 96 (no change from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (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 project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Nov 9, 2025

View your CI Pipeline Execution ↗ for commit 001ea12

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 5m 21s View ↗
nx run-many -t lint ✅ Succeeded 3m 11s View ↗
nx run-many -t typecheck ✅ Succeeded 2m 14s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 20s View ↗
nx run integration-tests:test ✅ Succeeded 5s View ↗
nx run types:build ✅ Succeeded 6s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 3s View ↗
nx run generate-configs ✅ Succeeded 9s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-11-15 14:53:11 UTC

@Lonercode Lonercode changed the title Chore: Extract AST check from convert.ts to ast-checks.ts chore: Extract AST check from convert.ts to ast-checks.ts Nov 9, 2025
@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

❌ Patch coverage is 96.10390% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.66%. Comparing base (189a7f7) to head (001ea12).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
packages/typescript-estree/src/convert.ts 77.77% 2 Missing ⚠️
packages/typescript-estree/src/ast-checks.ts 98.52% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11748      +/-   ##
==========================================
- Coverage   90.66%   90.66%   -0.01%     
==========================================
  Files         518      523       +5     
  Lines       52444    53090     +646     
  Branches     8690     8861     +171     
==========================================
+ Hits        47548    48133     +585     
- Misses       4882     4942      +60     
- Partials       14       15       +1     
Flag Coverage Δ
unittest 90.66% <96.10%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
packages/typescript-estree/src/ast-checks.ts 98.52% <98.52%> (ø)
packages/typescript-estree/src/convert.ts 31.59% <77.77%> (+0.53%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Lonercode Lonercode changed the title chore: Extract AST check from convert.ts to ast-checks.ts chore: extract AST check from convert.ts to ast-checks.ts Nov 9, 2025
@fisker
Copy link
Contributor

fisker commented Nov 14, 2025

Can we run the AST check from https://github.com/Lonercode/typescript-eslint/blob/65803e4127b9557ec6cf4802df12e588370d9930/packages/typescript-estree/src/convert.ts#L509, and have a big switch-case in the new file to check every ts node?

@Lonercode
Copy link
Author

Can we run the AST check from https://github.com/Lonercode/typescript-eslint/blob/65803e4127b9557ec6cf4802df12e588370d9930/packages/typescript-estree/src/convert.ts#L509, and have a big switch-case in the new file to check every ts node?

AST check checkModifier function is in https://github.com/Lonercode/typescript-eslint/blob/65803e4127b9557ec6cf4802df12e588370d9930/packages/typescript-estree/src/check-modifiers.ts#L139. Do you mean it should be in the new file with a check for every ts node? Or I modify checkForStatementDeclaration in the new file?

@fisker
Copy link
Contributor

fisker commented Nov 15, 2025

No need change check-modifiers.ts.

In the new file export a function to check ts node, it calls checkModifier and do other checks currently lives in convert.ts


case SyntaxKind.ForInStatement:
this.#checkForStatementDeclaration(node.initializer, node.kind);
this.#checkTSNode(node, node.initializer, node.kind);
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be able to be removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Repo: Extract AST check from Converter

2 participants