File tree 7 files changed +11
-13
lines changed
packages/react-docgen/src
7 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import type Documentation from '../Documentation.js';
2
2
import { getDocblock } from '../utils/docblock.js' ;
3
3
import isReactForwardRefCall from '../utils/isReactForwardRefCall.js' ;
4
4
import resolveToValue from '../utils/resolveToValue.js' ;
5
- import type { NodePath , Node } from '@babel/traverse' ;
5
+ import type { NodePath } from '@babel/traverse' ;
6
6
import type { ComponentNode } from '../resolver/index.js' ;
7
7
import type { Handler } from './index.js' ;
8
8
@@ -21,7 +21,7 @@ function getDocblockFromComponent(path: NodePath): string | null {
21
21
}
22
22
if ( description == null ) {
23
23
// Find parent statement (e.g. var Component = React.createClass(<path>);)
24
- let searchPath : NodePath < Node > | null = path ;
24
+ let searchPath : NodePath | null = path ;
25
25
26
26
while ( searchPath && ! searchPath . isStatement ( ) ) {
27
27
searchPath = searchPath . parentPath ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import type Documentation from '../Documentation.js';
9
9
import type { DefaultValueDescriptor } from '../Documentation.js' ;
10
10
import type { NodePath } from '@babel/traverse' ;
11
11
import type {
12
- Node ,
13
12
ObjectMethod ,
14
13
ObjectProperty ,
15
14
RestElement ,
@@ -70,7 +69,7 @@ function getStatelessPropsPath(
70
69
function getDefaultPropsPath (
71
70
componentDefinition : NodePath < ComponentNode > ,
72
71
) : NodePath | null {
73
- let defaultPropsPath : NodePath < Node > | null = getMemberValuePath (
72
+ let defaultPropsPath : NodePath | null = getMemberValuePath (
74
73
componentDefinition ,
75
74
'defaultProps' ,
76
75
) ;
Original file line number Diff line number Diff line change 1
1
import type { NodePath } from '@babel/traverse' ;
2
- import type { Node } from '@babel/types' ;
3
2
import getMemberValuePath from '../utils/getMemberValuePath.js' ;
4
3
import resolveToValue from '../utils/resolveToValue.js' ;
5
4
import setPropDescription from '../utils/setPropDescription.js' ;
@@ -33,7 +32,7 @@ const propDocblockHandler: Handler = function (
33
32
documentation : Documentation ,
34
33
componentDefinition : NodePath < ComponentNode > ,
35
34
) : void {
36
- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
35
+ let propTypesPath : NodePath | null = getMemberValuePath (
37
36
componentDefinition ,
38
37
'propTypes' ,
39
38
) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import resolveToModule from '../utils/resolveToModule.js';
3
3
import resolveToValue from '../utils/resolveToValue.js' ;
4
4
import type Documentation from '../Documentation.js' ;
5
5
import type { NodePath } from '@babel/traverse' ;
6
- import type { ObjectExpression , Node } from '@babel/types' ;
6
+ import type { ObjectExpression } from '@babel/types' ;
7
7
import type { Handler } from './index.js' ;
8
8
import type { ComponentNode } from '../resolver/index.js' ;
9
9
@@ -37,7 +37,7 @@ const propTypeCompositionHandler: Handler = function (
37
37
documentation : Documentation ,
38
38
componentDefinition : NodePath < ComponentNode > ,
39
39
) : void {
40
- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
40
+ let propTypesPath : NodePath | null = getMemberValuePath (
41
41
componentDefinition ,
42
42
'propTypes' ,
43
43
) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import resolveToValue from '../utils/resolveToValue.js';
9
9
import type Documentation from '../Documentation.js' ;
10
10
import type { PropDescriptor , PropTypeDescriptor } from '../Documentation.js' ;
11
11
import type { NodePath } from '@babel/traverse' ;
12
- import type { Node } from '@babel/types' ;
13
12
import type { Handler } from './index.js' ;
14
13
import type { ComponentNode } from '../resolver/index.js' ;
15
14
@@ -65,7 +64,7 @@ function getPropTypeHandler(propName: string): Handler {
65
64
documentation : Documentation ,
66
65
componentDefinition : NodePath < ComponentNode > ,
67
66
) : void {
68
- let propTypesPath : NodePath < Node > | null = getMemberValuePath (
67
+ let propTypesPath : NodePath | null = getMemberValuePath (
69
68
componentDefinition ,
70
69
propName ,
71
70
) ;
Original file line number Diff line number Diff line change 1
1
/*eslint no-loop-func: 0, no-use-before-define: 0*/
2
2
3
3
import resolveToValue from './resolveToValue.js' ;
4
- import type { Node , NodePath } from '@babel/traverse' ;
4
+ import type { NodePath } from '@babel/traverse' ;
5
+ import type { Node } from '@babel/types' ;
5
6
6
7
/**
7
8
* Splits a MemberExpression or CallExpression into parts.
Original file line number Diff line number Diff line change 1
- import type { Node , NodePath } from '@babel/traverse' ;
1
+ import type { NodePath } from '@babel/traverse' ;
2
2
import getMembers from '../utils/getMembers.js' ;
3
3
4
4
/**
5
5
* Returns true of the prop is required, according to its type definition
6
6
*/
7
- export default function isRequiredPropType ( path : NodePath < Node > ) : boolean {
7
+ export default function isRequiredPropType ( path : NodePath ) : boolean {
8
8
return getMembers ( path ) . some (
9
9
( { computed, path : memberPath } ) =>
10
10
( ! computed && memberPath . isIdentifier ( { name : 'isRequired' } ) ) ||
You can’t perform that action at this time.
0 commit comments