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

[Bug]: "Do not use isMounted" linting errors after upgrading to latest eslint-plugin-react (v7.36.0) #3819

Closed
2 tasks done
ethanPlumbly opened this issue Sep 12, 2024 · 9 comments · Fixed by #3821
Closed
2 tasks done
Labels

Comments

@ethanPlumbly
Copy link

ethanPlumbly commented Sep 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

Before upgrading from v7.35.2 to v7.36.0, my linting tests were running with no errors, now they throw 4 errors about the usage of isMounted

npm run lint output:

  277:5   error    Do not use isMounted                      react/no-is-mounted
  281:21  error    Do not use isMounted                      react/no-is-mounted
  359:5   error    Do not use isMounted                      react/no-is-mounted
  378:5   error    Do not use isMounted                      react/no-is-mounted

✖ 40 problems (4 errors, 36 warnings)

We are not using isMounted in our codebase

full command used: npm run rm && npm i --dev && npm run build && npm run lint

I later pinned the version back to v7.35.2 and the errors were no longer present

Expected Behavior

Before the upgrade:

✖ 36 problems (0 errors, 36 warnings)

eslint-plugin-react version

v7.36.0

eslint version

v8.57.0

node version

v16.20.2

@ethanPlumbly ethanPlumbly changed the title [Bug]: "Do not use isMounted" linting error [Bug]: "Do not use isMounted" linting error after upgrading to latest eslint-plugin-react (v7.36.0) Sep 12, 2024
@ethanPlumbly ethanPlumbly changed the title [Bug]: "Do not use isMounted" linting error after upgrading to latest eslint-plugin-react (v7.36.0) [Bug]: "Do not use isMounted" linting errors after upgrading to latest eslint-plugin-react (v7.36.0) Sep 12, 2024
@dartess
Copy link

dartess commented Sep 12, 2024

0a8092f#diff-a68b4df806433028f9365f075dfa2c89c1c0737f311412f95c6c5cd239001d58R42

Now we get an error with callee.object.type === 'ThisExpression' and any callee.property.name.

@Mathias-S
Copy link
Contributor

Mathias-S commented Sep 12, 2024

0a8092f#diff-a68b4df806433028f9365f075dfa2c89c1c0737f311412f95c6c5cd239001d58R42

Now we get an error with callee.object.type === 'ThisExpression' and any callee.property.name.

Yes, changing the && to || in that check fixes the check.

I've submitted a PR that fixes this issue: #3821.

fengmk2 pushed a commit to cnpm/bug-versions that referenced this issue Sep 12, 2024
See jsx-eslint/eslint-plugin-react#3819

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Chores**
- Updated dependency management for `eslint-plugin-react` to ensure
alignment with the latest stable releases.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@dan-serendipity
Copy link

dan-serendipity commented Sep 12, 2024

Minimal reproduction for anyone interested:

class C {
  a() {}
  b() {
   this.a(); // Do not use isMounted
  }
}

Confirmed in (typescript-eslint v5, typescript v5.1); (typescript-eslint v8, typescript v5.5); (typescript-eslint v8, typescript v5.6)

@ljharb
Copy link
Member

ljharb commented Sep 12, 2024

Thanks; #3821 already has a test case, and will be landed and released soon.

@bombillazo
Copy link

I was going crazy, happy to see this was reported.

@bombillazo
Copy link

Hey, v7.36.1 should be tagged as latest.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2024

It is (as is every publish automatically/by default), and never wasn't.

@bombillazo
Copy link

bombillazo commented Sep 12, 2024

sorry I meant in GitHub, I was misled from the GH UI, but the npm install worked as expected
image

@ljharb
Copy link
Member

ljharb commented Sep 12, 2024

ah, thanks. fixed.

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

Successfully merging a pull request may close this issue.

6 participants