v7.12.0 is throws the following error
> eslint --ext .jsx,.js src/ etc/
AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided
at assertValidNodeInfo (/node_modules/eslint/lib/util/report-translator.js:96:9)
at args (/node_modules/eslint/lib/util/report-translator.js:246:9)
at Object.report (/node_modules/eslint/lib/linter.js:720:41)
at reportUndeclaredPropTypes (/node_modules/eslint-plugin-react/lib/rules/prop-types.js:175:17)
at Program:exit.Object.keys.filter.forEach.component (/node_modules/eslint-plugin-react/lib/rules/prop-types.js:193:11)
at Array.forEach (<anonymous>)
at Object.Program:exit (/node_modules/eslint-plugin-react/lib/rules/prop-types.js:192:81)
at updatedRuleInstructions.(anonymous function) (/node_modules/eslint-plugin-react/lib/util/Components.js:754:75)
at listeners.(anonymous function).forEach.listener (/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
cc @alexzherdev
Could you provide the code that leads to this?
I'm seeing this too. I use react-router which passes location and match as props. When I compare the location search, it throws this error:
componentDidUpdate(prevProps) {
const { match, location} = this.props;
const searchEquals = prevProps.location.search === location.search;
...
}
Example
const React = require('react');
const PropTypes = require('prop-types');
class MyComponent extends React.PureComponent {
componentDidUpdate(prevProps) {
const { items } = this.props;
const hasNewImage = items.length > prevProps.items.length;
}
render() {
return null;
}
}
MyComponent.propTypes = {
items: PropTypes.array,
};
module.exports = MyComponent;
https://github.com/yannickcr/eslint-plugin-react/pull/2099 fixes this bug
Closed in #2099.
Hi,
I am still getting this issue with 7.12.1. Am I the only one? I made sure the package was updated correctly.
Thanks for all the hard work!
@nicofrand can you file a new issue with the details?
Well, I have the exact same error (line numbers etc.). I don't know what I should provide?
Specifically, the code that makes it crash - but if it鈥檚 generating the same error, then I鈥檒l reopen.
I narrowed it down to this file: https://framagit.org/kresusapp/kresus/blob/master/client/components/lazyLoader.js
Thanks for reopening.
@ljharb we are hitting this as well and updating eslint-plugin-react to use master fixes it. When do you anticipate https://github.com/yannickcr/eslint-plugin-react/commit/4da90ea19f805cb8e67523a983c2352aab144783 will land in a release?
More than 9 hours after I鈥檝e merged it, I鈥檓 sure.
Releases, as always, are done when a maintainer has time, and can鈥檛 be done any faster.
@ljharb thanks for the update. Just to clarify, I wasn't trying to be pushy, I was just curious as the error is blocking our automation and we can take other steps if a release isn't planned in the near future. Apologies if it came off that way
I鈥檒l try to find time today.
I am still getting this error using [email protected].
The following code is triggering the error:
import React from 'react';
export default class extends React.Component {
onSubmit = () => {
this.setState((state, { a }) => {
a.b.c();
return null;
});
};
render() {
return null;
}
}
Mine was fixed with 7.12.2, many thanks!
@remcohaszing can you please file a new issue?
Thanks @ljharb
I've got this error with 7.12.3 and this code:
import React from "react";
export default class Controller extends React.Component {
handleAdd = id => {
this.setState((state, { name }) => {
const item = this.buildtem(id);
});
};
}
It's okay with 7.11.0
@the-spyke please file that as a new issue, and we鈥檒l fix it asap
Yes, it is fixed for me in v7.12.4
"resolutions": {
"eslint": "7.12.1",
"eslint-config-airbnb-typescript": "^12.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"@typescript-eslint/eslint-plugin": "^4.6.0"
},
It fixed.
I'm not sure why that would fix it, but either way, resolutions isn't an npm feature, and overriding dependency versions is not a good idea.
Most helpful comment
I鈥檒l try to find time today.