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

refactor: update the default behavior of import check, closes #858 #860

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

Rel1cx
Copy link
Owner

@Rel1cx Rel1cx commented Nov 19, 2024

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • I have added a convincing reason for adding this feature, if necessary

Other information

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eslint-react 🔄 Building (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 0:37am

@Rel1cx Rel1cx merged commit 7cfbadc into main Nov 19, 2024
5 of 6 checks passed
@Rel1cx Rel1cx deleted the strict-import-check branch November 21, 2024 02:02
@kachkaev
Copy link

kachkaev commented Dec 2, 2024

👋 @Rel1cx! I think I’ve noticed new issue in @eslint-react/no-array-index-key, and bisecting has pointed me to this commit.

In 1.16.2-beta.6 code like this produces a linting error, which is expected:

foo.bar.map((value, index) => <MyComponent key={index} />);

However, after upgrading to 1.16.2-beta.7, the issue is no longer reported.

If I replace property chaining with const { bar } = foo; and then call bar.map(...) in JSX, @eslint-react/no-array-index-key is reported again as expected.

I am thinking of creating a new issue but in needs a proper reproduction and I don’t have time on it today. I’ve decided to ping you here first with my initial investigation to just sense-check what I observe. WDYT?

@Rel1cx
Copy link
Owner Author

Rel1cx commented Dec 2, 2024

👋 @Rel1cx! I think I’ve noticed new issue in @eslint-react/no-array-index-key, and bisecting has pointed me to this commit.

In 1.16.2-beta.6 code like this produces a linting error, which is expected:

foo.bar.map((value, index) => <MyComponent key={index} />);

However, after upgrading to 1.16.2-beta.7, the issue is no longer reported.

If I replace property chaining with const { bar } = foo; and then call bar.map(...) in JSX, @eslint-react/no-array-index-key is reported again as expected.

I am thinking of creating a new issue but in needs a proper reproduction and I don’t have time on it today. I’ve decided to ping you here first with my initial investigation to just sense-check what I observe. WDYT?

Hello! I just reviewed the code and have pinpointed the issue and started fixing it. Your initial investigation was correct and helpful; this commit indeed introduced the problem. Thank you for providing the information.

Rel1cx added a commit that referenced this pull request Dec 2, 2024
@kachkaev
Copy link

kachkaev commented Dec 2, 2024

Great, thanks for responding so quickly @Rel1cx! I just tried 1.17.3-beta.1 (which included #868) and it worked 🎉

@kachkaev
Copy link

kachkaev commented Dec 2, 2024

Another thing that I noticed after upgrading from 1.16.1 to newer versions is @eslint-react/prefer-read-only-props triggering everywhere. We use this coding style for React components:

import * as React from 'react';

export const Foo: React.FunctionComponent<{
  bar: string;
}> = ({ bar }) => {
  return <>{bar}</>;
};

The rule is included in recommended-type-checked but it was not triggering for us, probably until this PR.

I believe that we have a bug fix rather than a new problem, so no action needed on this one. Just sharing my observation with you for context. You might want to add some new tests though to avoid future regressions.

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

Successfully merging this pull request may close these issues.

2 participants