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(experimental-utils): expose ast utility functions #1670

merged 3 commits into from Mar 20, 2020


Copy link

I figured that other plugin developers might find some use from having these utility functions exposed.
No sense in hoarding all of these for ourselves, esp the type predicate functions.

There is probably even more functions that we can move over in future, but I figured this was a good start.

This pr does the following:

  • moves eslint-plugin/src/utils/astUtils.ts to the experimental-utils package.
  • converts our local for the eslint-utils package into a form that can be consumed via experimental-utils
    • same as what we did for eslint-scope
    • these defs are just a thin layer which type the package using our TSESTree types.
  • updates eslint-plugin to use these new types, removing the direct dependency on eslint-utils

@bradzacher bradzacher added enhancement New feature or request refactor PRs that refactor code only labels Mar 4, 2020
Copy link

Thanks for the PR, @bradzacher!

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 As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #1670 into master will decrease coverage by 0.21%.
The diff coverage is 77.98%.

@@            Coverage Diff             @@
##           master    #1670      +/-   ##
- Coverage   95.19%   94.97%   -0.22%     
  Files         148      158      +10     
  Lines        6971     7047      +76     
  Branches     2010     2010              
+ Hits         6636     6693      +57     
- Misses        124      154      +30     
+ Partials      211      200      -11
Flag Coverage Δ
#unittest 94.97% <77.98%> (-0.22%) ⬇️
Impacted Files Coverage Δ
...mental-utils/src/ts-eslint-scope/PatternVisitor.ts 100% <ø> (ø) ⬆️ 100% <ø> (ø) ⬆️
...ges/experimental-utils/src/ts-eslint/SourceCode.ts 100% <ø> (ø) ⬆️
...rimental-utils/src/ts-eslint-scope/ScopeManager.ts 100% <ø> (ø) ⬆️
...ges/experimental-utils/src/ts-eslint/RuleTester.ts 28.57% <ø> (ø) ⬆️
...s/eslint-plugin/src/rules/prefer-optional-chain.ts 95.09% <ø> (-0.05%) ⬇️ 100% <ø> (ø) ⬆️
...perimental-utils/src/ts-eslint-scope/Definition.ts 100% <ø> (ø) ⬆️
...nt-plugin/src/rules/switch-exhaustiveness-check.ts 100% <ø> (ø) ⬆️
...xperimental-utils/src/ts-eslint-scope/Reference.ts 100% <ø> (ø) ⬆️
... and 37 more

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
enhancement New feature or request refactor PRs that refactor code only
None yet

Successfully merging this pull request may close these issues.

None yet

1 participant