-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(utils): revert removal of backwards-compat functions
- Loading branch information
1 parent
8ef5f4b
commit 4dd19da
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Wrappers around ESLint's deprecation of existing methods | ||
/* eslint-disable deprecation/deprecation -- TODO - delete in the next major (v8) */ | ||
import type { Scope, SourceCode } from '../ts-eslint'; | ||
import type { RuleContext } from '../ts-eslint/Rule'; | ||
import type { TSESTree } from '../ts-estree'; | ||
|
||
/** @deprecated use `context.sourceCode.getAncestors(node)` */ | ||
export function getAncestors( | ||
context: Readonly<RuleContext<string, unknown[]>>, | ||
): TSESTree.Node[] { | ||
return context.getAncestors(); | ||
} | ||
|
||
/** @deprecated use `context.sourceCode.getCwd()` */ | ||
export function getCwd( | ||
context: Readonly<RuleContext<string, unknown[]>>, | ||
): string { | ||
return context.getCwd(); | ||
} | ||
|
||
/** @deprecated use `context.sourceCode.getDeclaredVariables(node)` */ | ||
export function getDeclaredVariables( | ||
context: Readonly<RuleContext<string, unknown[]>>, | ||
node: TSESTree.Node, | ||
): readonly Scope.Variable[] { | ||
return context.sourceCode.getDeclaredVariables(node); | ||
} | ||
|
||
/** @deprecated use `context.filename` */ | ||
export function getFilename( | ||
context: Readonly<RuleContext<string, unknown[]>>, | ||
): string { | ||
return context.filename; | ||
} | ||
|
||
/** @deprecated use `context.sourceCode.getScope(node) */ | ||
export function getScope( | ||
context: Readonly<RuleContext<string, readonly unknown[]>>, | ||
): Scope.Scope { | ||
return context.getScope(); | ||
} | ||
|
||
/** @deprecated use `context.sourceCode` */ | ||
export function getSourceCode( | ||
context: Readonly<RuleContext<string, readonly unknown[]>>, | ||
): Readonly<SourceCode> { | ||
return context.sourceCode; | ||
} |