Skip to content

Commit 7ee1de4

Browse files
committed
fix(linter/plugins, napi/parser): add parent field to FormalParameterRest and TSParameterProperty in TS type defs
1 parent 5d7c505 commit 7ee1de4

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

apps/oxlint/src-js/generated/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ export interface FormalParameterRest extends Span {
673673
optional?: boolean;
674674
typeAnnotation?: TSTypeAnnotation | null;
675675
value?: null;
676+
parent: Node;
676677
}
677678

678679
export type FormalParameter = {
@@ -687,6 +688,7 @@ export interface TSParameterProperty extends Span {
687688
parameter: FormalParameter;
688689
readonly: boolean;
689690
static: boolean;
691+
parent: Node;
690692
}
691693

692694
export interface FunctionBody extends Span {

apps/oxlint/src-js/plugins/scope.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,6 @@ export function getScope(node: ESTree.Node): Scope {
261261
return scope.type === 'function-expression-name' ? scope.childScopes[0] : scope;
262262
}
263263

264-
// TODO: `TSParameterProperty` type should have a `parent` property.
265-
// @ts-expect-error
266264
node = node.parent;
267265
} while (node !== null);
268266

crates/oxc_ast/src/ast/js.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,7 @@ pub enum FunctionType {
18511851
optional?: boolean;
18521852
typeAnnotation?: TSTypeAnnotation | null;
18531853
value?: null;
1854+
parent/* IF !LINTER */?/* END IF */: Node;
18541855
}
18551856
"
18561857
)]
@@ -1886,6 +1887,7 @@ pub struct FormalParameters<'a> {
18861887
parameter: FormalParameter;
18871888
readonly: boolean;
18881889
static: boolean;
1890+
parent/* IF !LINTER */?/* END IF */: Node;
18891891
}
18901892
"
18911893
)]

npm/oxc-types/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ export interface FormalParameterRest extends Span {
669669
optional?: boolean;
670670
typeAnnotation?: TSTypeAnnotation | null;
671671
value?: null;
672+
parent?: Node;
672673
}
673674

674675
export type FormalParameter = {
@@ -683,6 +684,7 @@ export interface TSParameterProperty extends Span {
683684
parameter: FormalParameter;
684685
readonly: boolean;
685686
static: boolean;
687+
parent?: Node;
686688
}
687689

688690
export interface FunctionBody extends Span {

0 commit comments

Comments
 (0)