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

"Node must be provided when reporting error if location is not provided" error in 7.12.3 #2127

Closed
the-spyke opened this issue Jan 9, 2019 · 3 comments
Assignees
Labels

Comments

@the-spyke
Copy link

Linting this code with 7.12.3 gives me an error "AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided":

import React from "react";

export default class Controller extends React.Component {
    handleAdd = id => {
        this.setState((state, { name }) => {
            const item = this.buildItem(id);
        });
    };
}

Looks similar to #2095. Works fine in 7.11.0.

@ljharb ljharb self-assigned this Jan 9, 2019
@ljharb ljharb added the bug label Jan 9, 2019
@ljharb ljharb closed this as completed in 58ed9e9 Jan 9, 2019
@the-spyke
Copy link
Author

Thanks, ESLint works fine now in my monorepo.

@alexzherdev
Copy link
Contributor

@ljharb looking at your fix, it seems that we're still incorrectly detecting something as a prop being used (where in reality this example is not using any props). I'll see if I get time to figure it out.

@ljharb
Copy link
Member

ljharb commented Jan 10, 2019

Probably so, but this fix passed the test :-) improvements welcome!

This was referenced Jan 17, 2019
@ghost ghost mentioned this issue Jan 17, 2019
1 task
NimaSoroush pushed a commit to NimaSoroush/differencify that referenced this issue Feb 16, 2019
## The devDependency [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) was updated from `7.12.3` to `7.12.4`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v7.12.4</summary>

<h3>Fixed</h3>
<ul>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/no-unused-prop-types.md"><code>no-unused-prop-types</code></a>: avoid a crash (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2131" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2131/hovercard">#2131</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=45469" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/ljharb">@ljharb</a>)</li>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/prop-types.md"><code>prop-types</code></a>: avoid further crashes from nonexistent nodes in unusedPropTypes (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2127" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2127/hovercard">#2127</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=45469" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/ljharb">@ljharb</a>)</li>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/prop-types.md"><code>prop-types</code></a>: Read name of callee object (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/pull/2125" data-hovercard-type="pull_request" data-hovercard-url="/jsx-eslint/eslint-plugin-react/pull/2125/hovercard">#2125</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=817020" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/CrOrc">@CrOrc</a>)</li>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/prop-types.md"><code>prop-types</code></a>: Ignore reassignments when matching props declarations with components (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2051" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2051/hovercard">#2051</a>, <a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/1957" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/1957/hovercard">#1957</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=13209" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/yannickcr">@yannickcr</a>)</li>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/prop-types.md"><code>prop-types</code></a>, <a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/no-unused-prop-types.md"><code>no-unused-prop-types</code></a>, <a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/require-default-props.md"><code>require-default-props</code></a>: Detect components with return statement in switch/case (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2118" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2118/hovercard">#2118</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=13209" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/yannickcr">@yannickcr</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li><a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/prop-types.md"><code>prop-types</code></a>, <a href="/yannickcr/eslint-plugin-react/blob/v7.12.4/docs/rules/no-typos.md"><code>no-typos</code></a>: add passing test cases (<a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2123" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2123/hovercard">#2123</a>, <a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2128" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2128/hovercard">#2128</a>, <a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2136" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2136/hovercard">#2136</a>, <a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/issues/2134" data-hovercard-type="issue" data-hovercard-url="/jsx-eslint/eslint-plugin-react/issues/2134/hovercard">#2134</a>, <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=45469" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/ljharb">@ljharb</a>)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 10 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/433cc3f6fea3a202426cf8ea568aa4bf3fe7a415"><code>433cc3f</code></a> <code>Update CHANGELOG and bump version</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/536bc35643eacfacbeb2391c8ee49903b97954dc"><code>536bc35</code></a> <code>[Tests] <code>prop-types</code>: add case from #2134</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/df7ffc1b43964e5589f4c24eb8eaf03e1cb9a437"><code>df7ffc1</code></a> <code>[Tests] <code>no-typos</code>: test case from #2136</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/c7e5f384821d273f27c71030951fb6f02da5cfc6"><code>c7e5f38</code></a> <code>[Tests] improve version detection tests.</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/2dd2277cc4166e368a1dd172cfcebedcf930c212"><code>2dd2277</code></a> <code>[Tests] <code>prop-types</code>: add now-passing test case</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/84652b6527161f651a671754fb5f619296c3654e"><code>84652b6</code></a> <code>[Fix] <code>no-unused-prop-types</code>: avoid a crash</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/58ed9e9716f74dbf758766a5ac22425be411181f"><code>58ed9e9</code></a> <code>[Fix] <code>prop-types</code>: avoid further crashes from nonexistent nodes in unusedPropTypes</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/7f7b96d155dcb43baa3f438aa7c4720f0aa94298"><code>7f7b96d</code></a> <code>[Fix] <code>prop-types</code>: Read name of callee object.</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/5fc50aa9238768674cf2a2ca1d9676be629a920a"><code>5fc50aa</code></a> <code>[Fix] Ignore reassignments when matching props declarations with components</code></li>
<li><a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/commit/ba80a4c01b1086f6fd1202ebc9c262fc5f05b65b"><code>ba80a4c</code></a> <code>[Fix] Detect components with return statement in switch/case</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/yannickcr/eslint-plugin-react/compare/2f5cec96eca70cfe579038c8b9a81ba5a6a88594...433cc3f6fea3a202426cf8ea568aa4bf3fe7a415">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants