Skip to content

Commit 5aa0e3d

Browse files
phateddanez
authored andcommitted
Lint fixes
1 parent 1e0cbf3 commit 5aa0e3d

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

src/handlers/__tests__/propDocblockHandler-test.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88

99
jest.mock('../../Documentation');
1010

11-
import { expression, statement, noopImporter, makeMockImporter } from '../../../tests/utils';
11+
import {
12+
expression,
13+
statement,
14+
noopImporter,
15+
makeMockImporter,
16+
} from '../../../tests/utils';
1217

1318
describe('propDocBlockHandler', () => {
1419
let documentation;
@@ -249,9 +254,13 @@ describe('propDocBlockHandler', () => {
249254

250255
it('does not error if propTypes cannot be found', () => {
251256
let definition = expression('{fooBar: 42}');
252-
expect(() => propDocBlockHandler(documentation, definition, noopImporter)).not.toThrow();
257+
expect(() =>
258+
propDocBlockHandler(documentation, definition, noopImporter),
259+
).not.toThrow();
253260

254261
definition = statement('class Foo {}');
255-
expect(() => propDocBlockHandler(documentation, definition, noopImporter)).not.toThrow();
262+
expect(() =>
263+
propDocBlockHandler(documentation, definition, noopImporter),
264+
).not.toThrow();
256265
});
257266
});

src/utils/__tests__/getMemberValuePath-test.js

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ describe('getMemberValuePath', () => {
3636
const path = expression('foo``');
3737

3838
getMemberValuePath(path, 'foo', noopImporter);
39-
expect(getMemberExpressionValuePath).toBeCalledWith(path, 'foo', noopImporter);
39+
expect(getMemberExpressionValuePath).toBeCalledWith(
40+
path,
41+
'foo',
42+
noopImporter,
43+
);
4044
});
4145

4246
it('handles ClassExpressions', () => {
@@ -50,21 +54,41 @@ describe('getMemberValuePath', () => {
5054
const path = expression('system({is: "button"}, "space")');
5155

5256
getMemberValuePath(path, 'foo', noopImporter);
53-
expect(getMemberExpressionValuePath).toBeCalledWith(path, 'foo', noopImporter);
57+
expect(getMemberExpressionValuePath).toBeCalledWith(
58+
path,
59+
'foo',
60+
noopImporter,
61+
);
5462
});
5563

5664
it('tries synonyms', () => {
5765
let path = expression('{}');
5866

5967
getMemberValuePath(path, 'defaultProps', noopImporter);
60-
expect(getPropertyValuePath).toBeCalledWith(path, 'defaultProps', noopImporter);
61-
expect(getPropertyValuePath).toBeCalledWith(path, 'getDefaultProps', noopImporter);
68+
expect(getPropertyValuePath).toBeCalledWith(
69+
path,
70+
'defaultProps',
71+
noopImporter,
72+
);
73+
expect(getPropertyValuePath).toBeCalledWith(
74+
path,
75+
'getDefaultProps',
76+
noopImporter,
77+
);
6278

6379
path = statement('class Foo {}');
6480

6581
getMemberValuePath(path, 'defaultProps', noopImporter);
66-
expect(getClassMemberValuePath).toBeCalledWith(path, 'defaultProps', noopImporter);
67-
expect(getClassMemberValuePath).toBeCalledWith(path, 'getDefaultProps', noopImporter);
82+
expect(getClassMemberValuePath).toBeCalledWith(
83+
path,
84+
'defaultProps',
85+
noopImporter,
86+
);
87+
expect(getClassMemberValuePath).toBeCalledWith(
88+
path,
89+
'getDefaultProps',
90+
noopImporter,
91+
);
6892
});
6993

7094
it('returns the result of getPropertyValuePath and getClassMemberValuePath', () => {

src/utils/getClassMemberValuePath.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { Importer } from '../types';
1414
export default function getClassMemberValuePath(
1515
classDefinition: NodePath,
1616
memberName: string,
17-
_importer: Importer,
17+
_importer: Importer, // eslint-disable-line no-unused-vars
1818
): ?NodePath {
1919
// Fortunately it seems like that all members of a class body, be it
2020
// ClassProperty or MethodDefinition, have the same structure: They have a

src/utils/getMemberValuePath.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@ const SYNONYMS = {
1818
defaultProps: 'getDefaultProps',
1919
};
2020

21-
let postprocessPropTypes = (path, importer) =>
21+
const postprocessPropTypes = (path, importer) =>
2222
t.Function.check(path.node)
2323
? resolveFunctionDefinitionToReturnValue(path, importer)
2424
: path;
2525

26-
const POSTPROCESS_MEMBERS = new Map([
27-
['propTypes', postprocessPropTypes]
28-
]);
26+
const POSTPROCESS_MEMBERS = new Map([['propTypes', postprocessPropTypes]]);
2927

3028
const LOOKUP_METHOD = new Map([
3129
[t.ArrowFunctionExpression.name, getMemberExpressionValuePath],

src/utils/resolveToValue.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ export default function resolveToValue(
172172
}
173173
return propertyPath;
174174
} else if (isSupportedDefinitionType(resolved)) {
175-
const memberPath = getMemberValuePath(resolved, path.node.property.name, importer);
175+
const memberPath = getMemberValuePath(
176+
resolved,
177+
path.node.property.name,
178+
importer,
179+
);
176180
if (memberPath) {
177181
return resolveToValue(memberPath, importer);
178182
}

0 commit comments

Comments
 (0)