Skip to content

Commit e28e191

Browse files
committed
refactor: apply prettier
1 parent d068fa6 commit e28e191

File tree

1 file changed

+51
-48
lines changed

1 file changed

+51
-48
lines changed

lib/utils/compat.ts

+51-48
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,79 @@
11
import { type TSESLint, type TSESTree } from '@typescript-eslint/utils';
22

33
declare module '@typescript-eslint/utils/dist/ts-eslint/Rule' {
4-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5-
export interface RuleContext<TMessageIds extends string, TOptions extends readonly unknown[]> {
6-
/**
7-
* The filename associated with the source.
8-
*/
9-
filename: string;
4+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5+
export interface RuleContext<
6+
TMessageIds extends string,
7+
TOptions extends readonly unknown[]
8+
> {
9+
/**
10+
* The filename associated with the source.
11+
*/
12+
filename: string;
1013

11-
/**
12-
* A SourceCode object that you can use to work with the source that
13-
* was passed to ESLint.
14-
*/
15-
sourceCode: Readonly<TSESLint.SourceCode>;
16-
}
14+
/**
15+
* A SourceCode object that you can use to work with the source that
16+
* was passed to ESLint.
17+
*/
18+
sourceCode: Readonly<TSESLint.SourceCode>;
19+
}
1720
}
1821

1922
declare module '@typescript-eslint/utils/dist/ts-eslint/SourceCode' {
20-
export interface SourceCode {
21-
/**
22-
* Returns the scope of the given node.
23-
* This information can be used track references to variables.
24-
* @since 8.37.0
25-
*/
26-
getScope(node: TSESTree.Node): TSESLint.Scope.Scope;
27-
/**
28-
* Returns an array of the ancestors of the given node, starting at
29-
* the root of the AST and continuing through the direct parent of the current node.
30-
* This array does not include the currently-traversed node itself.
31-
* @since 8.38.0
32-
*/
33-
getAncestors(node: TSESTree.Node): TSESTree.Node[];
34-
/**
35-
* Returns a list of variables declared by the given node.
36-
* This information can be used to track references to variables.
37-
* @since 8.38.0
38-
*/
39-
getDeclaredVariables(
40-
node: TSESTree.Node,
41-
): readonly TSESLint.Scope.Variable[];
42-
}
23+
export interface SourceCode {
24+
/**
25+
* Returns the scope of the given node.
26+
* This information can be used track references to variables.
27+
* @since 8.37.0
28+
*/
29+
getScope(node: TSESTree.Node): TSESLint.Scope.Scope;
30+
/**
31+
* Returns an array of the ancestors of the given node, starting at
32+
* the root of the AST and continuing through the direct parent of the current node.
33+
* This array does not include the currently-traversed node itself.
34+
* @since 8.38.0
35+
*/
36+
getAncestors(node: TSESTree.Node): TSESTree.Node[];
37+
/**
38+
* Returns a list of variables declared by the given node.
39+
* This information can be used to track references to variables.
40+
* @since 8.38.0
41+
*/
42+
getDeclaredVariables(
43+
node: TSESTree.Node
44+
): readonly TSESLint.Scope.Variable[];
45+
}
4346
}
4447

4548
/* istanbul ignore next */
4649
export const getFilename = (
47-
context: TSESLint.RuleContext<string, unknown[]>,
50+
context: TSESLint.RuleContext<string, unknown[]>
4851
) => {
49-
return context.filename ?? context.getFilename();
52+
return context.filename ?? context.getFilename();
5053
};
5154

5255
/* istanbul ignore next */
5356
export const getSourceCode = (
54-
context: TSESLint.RuleContext<string, unknown[]>,
57+
context: TSESLint.RuleContext<string, unknown[]>
5558
) => {
56-
return context.sourceCode ?? context.getSourceCode();
59+
return context.sourceCode ?? context.getSourceCode();
5760
};
5861

5962
/* istanbul ignore next */
6063
export const getScope = (
61-
context: TSESLint.RuleContext<string, unknown[]>,
62-
node: TSESTree.Node,
64+
context: TSESLint.RuleContext<string, unknown[]>,
65+
node: TSESTree.Node
6366
) => {
64-
return getSourceCode(context).getScope?.(node) ?? context.getScope();
67+
return getSourceCode(context).getScope?.(node) ?? context.getScope();
6568
};
6669

6770
/* istanbul ignore next */
6871
export const getDeclaredVariables = (
69-
context: TSESLint.RuleContext<string, unknown[]>,
70-
node: TSESTree.Node,
72+
context: TSESLint.RuleContext<string, unknown[]>,
73+
node: TSESTree.Node
7174
) => {
72-
return (
73-
getSourceCode(context).getDeclaredVariables?.(node) ??
74-
context.getDeclaredVariables(node)
75-
);
75+
return (
76+
getSourceCode(context).getDeclaredVariables?.(node) ??
77+
context.getDeclaredVariables(node)
78+
);
7679
};

0 commit comments

Comments
 (0)