New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'properties' of null #1499
Comments
Any idea on which file this is breaking, and what the code looks like? |
I use flow, so it may be related. |
@ljharb any debug flag I can turn on or any line I can add a console.log to see the filename? |
If I add a console.log function declarePropTypesForIntersectionTypeAnnotation(propTypes, declaredPropTypes) {
+ console.log(propTypes)
|
i think |
@ljharb Found it. Seems to be because of the
|
Thanks, that's very helpful. |
Hi, same problem, here.
|
Same problem, as @brunolemos found out, it seems to be related to Flow's Throws with these test cases: // @flow
import React from 'react';
import type { Node } from 'react'
type BasePropsType = {
className?: string,
text?: string,
}
type SomeComponentPropsType<T> = BasePropsType & {
something: string,
someOtherThing: T,
}
const SomeComponent = <T>(props: SomeComponentPropsType<T>): Node => <div /> // @flow
import React from 'react';
import type { Node } from 'react'
type BasePropsType = {
className?: string,
text?: string,
}
type SomeComponentPropsType = BasePropsType & {
something: string,
}
const SomeComponent = (props: SomeComponentPropsType): Node => <div /> // @flow
import React from 'react';
import type { Node } from 'react'
type BasePropsType = {
className?: string,
text?: string,
}
type SomeComponentPropsType<T> = BasePropsType & {
something: string,
someOtherThing: T,
}
const SomeComponent = (props: SomeComponentPropsType<*>): Node => <div /> Does not throw with: // @flow
import React from 'react';
import type { Node } from 'react'
type SomeComponentPropsType<T> = {
something: string,
someOtherThing: T,
}
const SomeComponent = <T>(props: SomeComponentPropsType<T>): Node => <div /> node: package: {
"eslint": "^4.10.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.3.0",
"eslint-plugin-ava": "^4.2.1",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0"
} eslintrc.js module.exports = {
parser: 'babel-eslint',
plugins: [
'ava',
'babel',
'flowtype',
'import',
'jsx-a11y',
'react',
],
extends: [
'airbnb',
'plugin:ava/recommended',
'plugin:flowtype/recommended',
'plugin:import/errors',
'plugin:import/warnings',
"prettier",
"prettier/flowtype",
"prettier/react",
],
...
} |
Same problem on node v8.9.0.
|
There’s no need for more comments; this is a bug, and it’s waiting for a fix - PRs are welcome. |
Does anyone what version introduced this? I'm trying to figure out which version to rollback to. |
I tried rolling back to 7.3.0, 7.2.0 along with airbnb config ^15.0.0 but now I started getting this error:
|
@mrchief if |
I rolled back config to 15 from 16. 15 is what I have been using so far. Are you saying I need to roll back further? npm ls
Deps & Dev Deps
|
Ok, this combination works (my rollback solution):
|
@mrchief Thanks! Those deps worked for me Note: If you use |
The crash was fixed in #1529. But the rule other-file.js: // @flow
export type SomeType = {
baz: string,
}; MyStatelessComponent.js: // @flow
import React from 'react';
import type { SomeType } from './other-file';
type Props = SomeType & {
foo: string,
bar?: string,
};
const MyStatelessComponent = (props: Props) => (
<div>Hello {props.foo} {props.bar} {props.baz}</div>
);
MyStatelessComponent.defaultProps = {
bar: 'some default',
}; Error:
@ljharb Could this issue be reopened? |
@alexvb I believe this is a common issue with other rules as well (e.g. We should probably ignore validation when using types imported from another file? |
@alexvb can you file a new one for it instead? |
.eslintrc
The text was updated successfully, but these errors were encountered: