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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -7,6 +7,7 @@ const ReferenceTrackerREAD: unique symbol = eslintUtils.ReferenceTracker.READ;
const ReferenceTrackerCALL: unique symbol = eslintUtils.ReferenceTracker.CALL;
const ReferenceTrackerCONSTRUCT: unique symbol =
eslintUtils.ReferenceTracker.CONSTRUCT;
const ReferenceTrackerESM: unique symbol = eslintUtils.ReferenceTracker.ESM;

interface ReferenceTracker {
/**
Expand Down Expand Up @@ -59,19 +60,22 @@ interface ReferenceTrackerStatic {
readonly READ: typeof ReferenceTrackerREAD;
readonly CALL: typeof ReferenceTrackerCALL;
readonly CONSTRUCT: typeof ReferenceTrackerCONSTRUCT;
readonly ESM: typeof ReferenceTrackerESM;
}

namespace ReferenceTracker {
export type READ = ReferenceTrackerStatic['READ'];
export type CALL = ReferenceTrackerStatic['CALL'];
export type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT'];
export type ESM = ReferenceTrackerStatic['ESM'];
export type ReferenceType = READ | CALL | CONSTRUCT;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type TraceMap<T = any> = Record<string, TraceMapElement<T>>;
export interface TraceMapElement<T> {
[ReferenceTrackerREAD]?: T;
[ReferenceTrackerCALL]?: T;
[ReferenceTrackerCONSTRUCT]?: T;
[ReferenceTrackerESM]?: true;
[key: string]: TraceMapElement<T>;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
1 change: 1 addition & 0 deletions packages/experimental-utils/typings/eslint-utils.d.ts
Expand Up @@ -35,6 +35,7 @@ declare module 'eslint-utils' {
readonly READ: never;
readonly CALL: never;
readonly CONSTRUCT: never;
readonly ESM: never;
new (): never;
};
}