Skip to content

Commit 72f3d72

Browse files
committed
fix lint
1 parent c99978c commit 72f3d72

7 files changed

+14
-7
lines changed

packages/react-docgen/src/handlers/defaultPropsHandler.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import type {
1515
RestElement,
1616
SpreadElement,
1717
} from '@babel/types';
18-
import type { ComponentNode } from '../resolver/index.js';
18+
import type {
19+
ComponentNode,
20+
StatelessComponentNode,
21+
} from '../resolver/index.js';
1922
import type { Handler } from './index.js';
20-
import type { StatelessComponentNode } from '../resolver/index.js';
2123

2224
function getDefaultValue(path: NodePath): DefaultValueDescriptor | null {
2325
let defaultValue: string | undefined;
@@ -57,7 +59,7 @@ function getDefaultValue(path: NodePath): DefaultValueDescriptor | null {
5759
}
5860

5961
function getStatelessPropsPath(
60-
componentDefinition: NodePath<StatelessComponentNode | CallExpression>,
62+
componentDefinition: NodePath<CallExpression | StatelessComponentNode>,
6163
): NodePath | undefined {
6264
let value: NodePath = componentDefinition;
6365

@@ -165,7 +167,7 @@ const defaultPropsHandler: Handler = function (
165167
*/
166168
if (!isReactComponentClass(componentDefinition)) {
167169
statelessProps = getStatelessPropsPath(
168-
componentDefinition as NodePath<StatelessComponentNode | CallExpression>,
170+
componentDefinition as NodePath<CallExpression | StatelessComponentNode>,
169171
);
170172
}
171173

packages/react-docgen/src/utils/flowUtilityTypes.ts

+3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,14 @@ export function isSupportedUtilityType(
2828
*/
2929
export function unwrapUtilityType(path: NodePath): NodePath {
3030
let resultPath: NodePath = path;
31+
3132
while (isSupportedUtilityType(resultPath)) {
3233
const typeParameters = resultPath.get('typeParameters');
34+
3335
if (!typeParameters.hasNode()) break;
3436

3537
const firstParam = typeParameters.get('params')[0];
38+
3639
if (!firstParam) break;
3740

3841
resultPath = firstParam;

packages/react-docgen/src/utils/getFlowType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const flowLiteralTypes = {
5353
const namedTypes: Record<
5454
string,
5555
(
56+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5657
path: NodePath<any>,
5758
typeParams: TypeParameters | null,
5859
) => TypeDescriptor | null

packages/react-docgen/src/utils/getTSType.ts

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const tsTypes: Record<string, string> = {
5858
const namedTypes: Record<
5959
string,
6060
(
61+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6162
path: NodePath<any>,
6263
typeParams: TypeParameters | null,
6364
) => TypeDescriptor | null

packages/react-docgen/src/utils/isReactChildrenElementCall.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NodePath } from '@babel/traverse';
22
import isReactModuleName from './isReactModuleName.js';
33
import resolveToModule from './resolveToModule.js';
4-
import { CallExpression } from '@babel/types';
4+
import type { CallExpression } from '@babel/types';
55

66
/**
77
* Returns true if the expression is a function call of the form

packages/react-docgen/src/utils/isReactCreateClassCall.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NodePath } from '@babel/traverse';
22
import resolveToModule from './resolveToModule.js';
33
import isReactBuiltinCall from './isReactBuiltinCall.js';
4-
import { CallExpression } from '@babel/types';
4+
import type { CallExpression } from '@babel/types';
55

66
/**
77
* Returns true if the expression is a function call of the form

packages/react-docgen/src/utils/isReactForwardRefCall.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { NodePath } from '@babel/traverse';
22
import isReactBuiltinCall from './isReactBuiltinCall.js';
3-
import { CallExpression } from '@babel/types';
3+
import type { CallExpression } from '@babel/types';
44

55
/**
66
* Returns true if the expression is a function call of the form

0 commit comments

Comments
 (0)