-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Description
Hi,
since version 7.17.0 of eslint-plugin-react linting failed with:
TypeError: Cannot read property 'type' of undefined
Occurred while linting /Users/literat/Work/lmc/fp-admin/src/components/UI/Forms/Hidden.js:15
at getKeyValue (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/ast.js:172:14)
at /Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/propTypes.js:284:19
at iterateProperties (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/propTypes.js:45:9)
at declarePropTypesForObjectTypeAnnotation (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/propTypes.js:271:5)
at markPropTypesAsDeclared (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/propTypes.js:474:33)
at Object.markAnnotatedFunctionArgumentsAsDeclared (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/propTypes.js:620:7)
at updatedRuleInstructions.<computed> (/Users/literat/Work/lmc/fp-admin/node_modules/eslint-plugin-react/lib/util/Components.js:883:43)
at /Users/literat/Work/lmc/fp-admin/node_modules/eslint/lib/util/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/Users/literat/Work/lmc/fp-admin/node_modules/eslint/lib/util/safe-emitter.js:45:38)
Failed component is this one:
// @flow
import React, { type Element } from 'react';
type THiddenProps = {|
id?: string,
name?: string,
defaultValue?: string,
...any,
|};
const defaultProps = {
defaultValue: '',
};
const Hidden = ({
id,
name,
defaultValue,
rest,
}: THiddenProps): Element<'input'> => (
<input
type="hidden"
id={id}
name={name}
defaultValue={defaultValue}
className="form-control"
{...rest}
/>
);
Hidden.defaultProps = defaultProps;
export default Hidden;
If I remove or comment out THiddenProps
everything works fine:
// @flow
import React, { type Element } from 'react';
type THiddenProps = {|
id?: string,
name?: string,
defaultValue?: string,
...any,
|};
const defaultProps = {
defaultValue: '',
};
const Hidden = (
{ id, name, defaultValue, rest } /**: THiddenProps*/,
): Element<'input'> => (
<input
type="hidden"
id={id}
name={name}
defaultValue={defaultValue}
className="form-control"
{...rest}
/>
);
Hidden.defaultProps = defaultProps;
export default Hidden;
Am I doing something wrong or is this a bug?
Thank you for your help.
Athelian