Skip to content

Commit c94dcba

Browse files
committed
chore: apply prettier -w
1 parent 0b9b9a8 commit c94dcba

File tree

10 files changed

+413
-265
lines changed

10 files changed

+413
-265
lines changed

lib/eslint-utils.d.ts

Lines changed: 121 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,144 @@
11
declare module "eslint-plugin-es-x" {
2-
export const rules: NonNullable<import('eslint').ESLint.Plugin["rules"]>;
2+
export const rules: NonNullable<import("eslint").ESLint.Plugin["rules"]>
33
}
44

55
declare module "@eslint-community/eslint-utils" {
6-
import * as estree from 'estree';
7-
import * as eslint from 'eslint';
6+
import * as estree from "estree"
7+
import * as eslint from "eslint"
88

9-
type Node = estree.Node | estree.Expression;
9+
type Node = estree.Node | estree.Expression
1010

11-
export const READ: unique symbol;
12-
export const CALL: unique symbol;
13-
export const CONSTRUCT: unique symbol;
14-
export const ESM: unique symbol;
11+
export const READ: unique symbol
12+
export const CALL: unique symbol
13+
export const CONSTRUCT: unique symbol
14+
export const ESM: unique symbol
1515
export class ReferenceTracker {
16-
constructor(globalScope: eslint.Scope.Scope, { mode, globalObjectNames, }?: {
17-
mode?: "legacy" | "strict" | undefined;
18-
globalObjectNames?: string[] | undefined;
19-
} | undefined);
20-
variableStack: eslint.Scope.Variable[];
21-
globalScope: eslint.Scope.Scope;
22-
mode: "legacy" | "strict";
23-
globalObjectNames: string[];
24-
iterateGlobalReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>;
25-
iterateCjsReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>;
26-
iterateEsmReferences<Info extends unknown>(traceMap: TraceMap<Info>): IterableIterator<Reference<Info>>;
16+
constructor(
17+
globalScope: eslint.Scope.Scope,
18+
{
19+
mode,
20+
globalObjectNames,
21+
}?:
22+
| {
23+
mode?: "legacy" | "strict" | undefined
24+
globalObjectNames?: string[] | undefined
25+
}
26+
| undefined
27+
)
28+
variableStack: eslint.Scope.Variable[]
29+
globalScope: eslint.Scope.Scope
30+
mode: "legacy" | "strict"
31+
globalObjectNames: string[]
32+
iterateGlobalReferences<Info extends unknown>(
33+
traceMap: TraceMap<Info>
34+
): IterableIterator<Reference<Info>>
35+
iterateCjsReferences<Info extends unknown>(
36+
traceMap: TraceMap<Info>
37+
): IterableIterator<Reference<Info>>
38+
iterateEsmReferences<Info extends unknown>(
39+
traceMap: TraceMap<Info>
40+
): IterableIterator<Reference<Info>>
2741
}
2842
export namespace ReferenceTracker {
29-
export { READ };
30-
export { CALL };
31-
export { CONSTRUCT };
32-
export { ESM };
43+
export { READ }
44+
export { CALL }
45+
export { CONSTRUCT }
46+
export { ESM }
3347
}
34-
type ReferenceType = typeof READ | typeof CALL | typeof CONSTRUCT;
48+
type ReferenceType = typeof READ | typeof CALL | typeof CONSTRUCT
3549
type TraceMap<Info extends unknown> = {
36-
[READ]?: Info;
37-
[CALL]?: Info;
38-
[CONSTRUCT]?: Info;
39-
[key: string]: TraceMap<Info> | undefined;
50+
[READ]?: Info
51+
[CALL]?: Info
52+
[CONSTRUCT]?: Info
53+
[key: string]: TraceMap<Info> | undefined
4054
}
41-
type RichNode = eslint.Rule.Node | Node;
55+
type RichNode = eslint.Rule.Node | Node
4256
type Reference<Info extends unknown> = {
43-
node: RichNode;
44-
path: string[];
45-
type: ReferenceType;
46-
info: Info;
47-
};
57+
node: RichNode
58+
path: string[]
59+
type: ReferenceType
60+
info: Info
61+
}
4862

49-
export function findVariable(initialScope: eslint.Scope.Scope, nameOrNode: string | Node): eslint.Scope.Variable | null;
63+
export function findVariable(
64+
initialScope: eslint.Scope.Scope,
65+
nameOrNode: string | Node
66+
): eslint.Scope.Variable | null
5067

51-
export function getFunctionHeadLocation(node: Extract<eslint.Rule.Node, {
52-
type: 'FunctionDeclaration' | 'FunctionExpression' | 'ArrowFunctionExpression';
53-
}>, sourceCode: eslint.SourceCode): eslint.AST.SourceLocation | null;
68+
export function getFunctionHeadLocation(
69+
node: Extract<
70+
eslint.Rule.Node,
71+
{
72+
type:
73+
| "FunctionDeclaration"
74+
| "FunctionExpression"
75+
| "ArrowFunctionExpression"
76+
}
77+
>,
78+
sourceCode: eslint.SourceCode
79+
): eslint.AST.SourceLocation | null
5480

55-
export function getFunctionNameWithKind(node: Extract<eslint.Rule.Node, {
56-
type: 'FunctionDeclaration' | 'FunctionExpression' | 'ArrowFunctionExpression';
57-
}>, sourceCode?: eslint.SourceCode | undefined): string;
81+
export function getFunctionNameWithKind(
82+
node: Extract<
83+
eslint.Rule.Node,
84+
{
85+
type:
86+
| "FunctionDeclaration"
87+
| "FunctionExpression"
88+
| "ArrowFunctionExpression"
89+
}
90+
>,
91+
sourceCode?: eslint.SourceCode | undefined
92+
): string
5893

59-
export function getInnermostScope(initialScope: eslint.Scope.Scope, node: Node): eslint.Scope.Scope;
94+
export function getInnermostScope(
95+
initialScope: eslint.Scope.Scope,
96+
node: Node
97+
): eslint.Scope.Scope
6098

61-
export function getPropertyName(node: Extract<Node, {
62-
type: 'MemberExpression' | 'Property' | 'MethodDefinition' | 'PropertyDefinition';
63-
}>, initialScope?: eslint.Scope.Scope | undefined): string | null;
99+
export function getPropertyName(
100+
node: Extract<
101+
Node,
102+
{
103+
type:
104+
| "MemberExpression"
105+
| "Property"
106+
| "MethodDefinition"
107+
| "PropertyDefinition"
108+
}
109+
>,
110+
initialScope?: eslint.Scope.Scope | undefined
111+
): string | null
64112

65-
export function getStaticValue(node: Node, initialScope?: eslint.Scope.Scope | null | undefined): {
66-
value: unknown;
67-
optional?: never;
68-
} | {
69-
value: undefined;
70-
optional?: true;
71-
} | null;
113+
export function getStaticValue(
114+
node: Node,
115+
initialScope?: eslint.Scope.Scope | null | undefined
116+
):
117+
| {
118+
value: unknown
119+
optional?: never
120+
}
121+
| {
122+
value: undefined
123+
optional?: true
124+
}
125+
| null
72126

73-
export function getStringIfConstant(node: Node, initialScope?: eslint.Scope.Scope | null | undefined): string | null;
127+
export function getStringIfConstant(
128+
node: Node,
129+
initialScope?: eslint.Scope.Scope | null | undefined
130+
): string | null
74131

75-
export function hasSideEffect(node: eslint.Rule.Node, sourceCode: eslint.SourceCode, { considerGetters, considerImplicitTypeConversion }?: VisitOptions | undefined): boolean;
132+
export function hasSideEffect(
133+
node: eslint.Rule.Node,
134+
sourceCode: eslint.SourceCode,
135+
{
136+
considerGetters,
137+
considerImplicitTypeConversion,
138+
}?: VisitOptions | undefined
139+
): boolean
76140
type VisitOptions = {
77-
considerGetters?: boolean | undefined;
78-
considerImplicitTypeConversion?: boolean | undefined;
79-
};
141+
considerGetters?: boolean | undefined
142+
considerImplicitTypeConversion?: boolean | undefined
143+
}
80144
}

lib/rules/no-path-concat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
getStringIfConstant,
1212
} = require("@eslint-community/eslint-utils")
1313
const { hasParentNode } = require("../util/has-parent-node.js")
14-
const {getSourceCode} = require("../util/eslint-compat")
14+
const { getSourceCode } = require("../util/eslint-compat")
1515

1616
/**
1717
* Get the first char of the specified template element.
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
export = CodePathAnalyzer;
1+
export = CodePathAnalyzer
22

33
interface EventGenerator {
4-
emitter: import('node:events').EventEmitter;
5-
enterNode(node: import('eslint').Rule.Node): void;
6-
leaveNode(node: import('eslint').Rule.Node): void;
4+
emitter: import("node:events").EventEmitter
5+
enterNode(node: import("eslint").Rule.Node): void
6+
leaveNode(node: import("eslint").Rule.Node): void
77
}
88

99
/**
@@ -14,34 +14,34 @@ declare class CodePathAnalyzer {
1414
/**
1515
* @param {EventGenerator} eventGenerator An event generator to wrap.
1616
*/
17-
constructor(eventGenerator: EventGenerator);
18-
original: EventGenerator;
19-
emitter: any;
20-
codePath: any;
21-
idGenerator: IdGenerator;
22-
currentNode: any;
17+
constructor(eventGenerator: EventGenerator)
18+
original: EventGenerator
19+
emitter: any
20+
codePath: any
21+
idGenerator: IdGenerator
22+
currentNode: any
2323
/**
2424
* This is called on a code path looped.
2525
* Then this raises a looped event.
2626
* @param {CodePathSegment} fromSegment A segment of prev.
2727
* @param {CodePathSegment} toSegment A segment of next.
2828
* @returns {void}
2929
*/
30-
onLooped(fromSegment: CodePathSegment, toSegment: CodePathSegment): void;
30+
onLooped(fromSegment: CodePathSegment, toSegment: CodePathSegment): void
3131
/**
3232
* Does the process to enter a given AST node.
3333
* This updates state of analysis and calls `enterNode` of the wrapped.
3434
* @param {ASTNode} node A node which is entering.
3535
* @returns {void}
3636
*/
37-
enterNode(node: import('eslint').Rule.Node): void;
37+
enterNode(node: import("eslint").Rule.Node): void
3838
/**
3939
* Does the process to leave a given AST node.
4040
* This updates state of analysis and calls `leaveNode` of the wrapped.
4141
* @param {ASTNode} node A node which is leaving.
4242
* @returns {void}
4343
*/
44-
leaveNode(node: import('eslint').Rule.Node): void;
44+
leaveNode(node: import("eslint").Rule.Node): void
4545
}
46-
import IdGenerator = require("./id-generator");
47-
import CodePathSegment = require("./code-path-segment");
46+
import IdGenerator = require("./id-generator")
47+
import CodePathSegment = require("./code-path-segment")

0 commit comments

Comments
 (0)