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 ReferenceTracker.ESM #3532

Merged
merged 1 commit into from Jun 17, 2021
Merged

feat(experimental-utils): expose ReferenceTracker.ESM #3532

merged 1 commit into from Jun 17, 2021

Conversation

MageJohn
Copy link
Contributor

Fixes #3527

ReferenceTracker.ESM seems to be undocumented, but it marks a trace map as being an ES module. It is used only once that I can see, here: https://github.com/mysticatea/eslint-utils/blob/c3b1d38328dc3a5278b208a58186a0735315f58f/src/reference-tracker.js#L181

The code only checks if the trace map has they key, and does nothing with it's value. Therefore when adding it to the TraceMapElement type, I opted to type it as always true, if it's present. In theory something like any or unknown would work, but that wouldn't convey that it's just a flag; a type of boolean might lead to confusion if users think they can do [ReferenceTracker.ESM]: false and expect it to be disabled.

@nx-cloud
Copy link

nx-cloud bot commented Jun 15, 2021

Nx Cloud Report

CI ran the following commands for commit 7f75521. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=build --all --parallel
#000000 nx run-many --target=typecheck --all --parallel

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @MageJohn!

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

@JoshuaKGoldberg
Copy link
Member

Ah, this might be superseded by DefinitelyTyped/DefinitelyTyped#53803 ?

@bradzacher
Copy link
Member

bradzacher commented Jun 17, 2021

@JoshuaKGoldberg nah it won't be because we can't use the @types/eslint-utils here.
Those types are based off of @types/estree which conflict with our ESTree types.
same reason we can't use @types/eslint or @types/eslint-scope.

That's why we had to go this route of defining our own set of types for the packages :(

@bradzacher bradzacher added the enhancement New feature or request label Jun 17, 2021
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

thanks!

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #3532 (7f75521) into master (b3ac5f6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3532   +/-   ##
=======================================
  Coverage   92.63%   92.63%           
=======================================
  Files         325      325           
  Lines       11235    11236    +1     
  Branches     3168     3168           
=======================================
+ Hits        10408    10409    +1     
  Misses        367      367           
  Partials      460      460           
Flag Coverage Δ
unittest 92.63% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...ils/src/ast-utils/eslint-utils/ReferenceTracker.ts 100.00% <100.00%> (ø)

@bradzacher bradzacher merged commit 4ac67c4 into typescript-eslint:master Jun 17, 2021
@MageJohn MageJohn deleted the experimental-utils/ReferenceTracker-ESM branch June 17, 2021 10:47
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The ESM symbol from eslint-utils ReferenceTracker should be typed
3 participants