Skip to content
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

v7.12.0 update throws AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided at assertValidNodeInfo #2095

Closed
connorsmallman opened this issue Dec 28, 2018 · 24 comments

Comments

@connorsmallman
Copy link

connorsmallman commented Dec 28, 2018

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>)
@ljharb
Copy link
Member

ljharb commented Dec 28, 2018

cc @alexzherdev

@ljharb
Copy link
Member

ljharb commented Dec 28, 2018

Could you provide the code that leads to this?

@jeffrigby
Copy link

jeffrigby commented Dec 28, 2018

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;
    ...
  }

@doochik
Copy link
Contributor

doochik commented Dec 29, 2018

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;

#2099 fixes this bug

@ljharb
Copy link
Member

ljharb commented Dec 30, 2018

Closed in #2099.

@ljharb ljharb closed this as completed Dec 30, 2018
@nicofrand
Copy link

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!

@ljharb
Copy link
Member

ljharb commented Jan 2, 2019

@nicofrand can you file a new issue with the details?

@nicofrand
Copy link

Well, I have the exact same error (line numbers etc.). I don't know what I should provide?

@ljharb
Copy link
Member

ljharb commented Jan 2, 2019

Specifically, the code that makes it crash - but if it’s generating the same error, then I’ll reopen.

@ljharb ljharb reopened this Jan 2, 2019
@nicofrand
Copy link

I narrowed it down to this file: https://framagit.org/kresusapp/kresus/blob/master/client/components/lazyLoader.js

Thanks for reopening.

@johnpmitsch
Copy link

@ljharb we are hitting this as well and updating eslint-plugin-react to use master fixes it. When do you anticipate 4da90ea will land in a release?

@ljharb
Copy link
Member

ljharb commented Jan 2, 2019

More than 9 hours after I’ve merged it, I’m sure.

Releases, as always, are done when a maintainer has time, and can’t be done any faster.

@johnpmitsch
Copy link

@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

@ljharb
Copy link
Member

ljharb commented Jan 2, 2019

I’ll try to find time today.

@the-spyke
Copy link

the-spyke commented Jan 9, 2019

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

@ljharb
Copy link
Member

ljharb commented Jan 9, 2019

@the-spyke please file that as a new issue, and we’ll fix it asap

@ghost ghost mentioned this issue Jan 12, 2019
1 task
@JustFly1984
Copy link

Yes, it is fixed for me in v7.12.4

@huixisheng
Copy link

  "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.

@ljharb
Copy link
Member

ljharb commented Dec 10, 2020

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.

@randyou

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests