Skip to content

Commit

Permalink
feat(experimental-utils): expose ReferenceTracker.ESM (#3532)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuri Pieters <yuri.pieters@anaplan.com>
  • Loading branch information
MageJohn and Yuri Pieters committed Jun 17, 2021
1 parent a7fd7bb commit 4ac67c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
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;
};
}

0 comments on commit 4ac67c4

Please sign in to comment.