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: v7.32 reports "react/jsx-key" for all children of a <div> #15645

Closed
1 task
rally25rs opened this issue Feb 25, 2022 · 2 comments
Closed
1 task

Bug: v7.32 reports "react/jsx-key" for all children of a <div> #15645

rally25rs opened this issue Feb 25, 2022 · 2 comments
Labels
3rd party plugin This is an issue related to a 3rd party plugin, config, or parser archived due to age This issue has been archived; please open a new issue for any further discussion
Projects

Comments

@rally25rs
Copy link

rally25rs commented Feb 25, 2022

Environment

Node version: v16.14.0
npm version: yarn 3.0.2
Local ESLint version: 7.32.0
Global ESLint version: none
Operating System: OSX

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration
module.exports = {
  plugins: ['react-hooks'],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    ecmaVersion: '2018',
    project: './tsconfig.json',
    sourceType: 'module',
  },
  ignorePatterns: [
    '.eslintrc.js',
    '.yarn/',
  ],
  settings: {
    react: {
      version: '17.0',
    },
  },
  extends: [
    'plugin:react/recommended',
    'plugin:react/jsx-runtime',
  ],
  env: {
    browser: true,
    es6: true,
    node: true,
  },
  overrides: [
    // typescript
    {
      files: ['*.ts', '*.tsx'],
      excludedFiles: ['*.js'],
      plugins: ['@typescript-eslint', 'react-hooks'],
      extends: [
        'plugin:@typescript-eslint/recommended',
        'plugin:react/recommended',
        'plugin:react/jsx-runtime',
      ],
    },
  ],
};
export const ExampleTwo = () => {
  return (
    <div>
      <button type="button">Clear</button>
    </div>
  );
};

What did you expect to happen?

No linting errors

What actually happened?

$ yarn eslint packages/react-components/src/test.stories.tsx

/Users/me/Projects/eslint-test/packages/react-components/src/test.stories.tsx
  4:7  error  Missing "key" prop for element in array  react/jsx-key

✖ 1 problem (1 error, 0 warnings)

eslint reports all child elements of a <div> as needing a "key" prop.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

Added a minimal repro example : https://github.com/rally25rs/eslint-issue-15645

@rally25rs rally25rs added bug ESLint is working incorrectly repro:needed labels Feb 25, 2022
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage Feb 25, 2022
@mdjermanovic mdjermanovic moved this from Needs Triage to Triaging in Triage Feb 25, 2022
@mdjermanovic mdjermanovic added 3rd party plugin This is an issue related to a 3rd party plugin, config, or parser and removed bug ESLint is working incorrectly repro:needed labels Feb 25, 2022
@mdjermanovic
Copy link
Member

Hi @rally25rs, thanks for the issue!

4:7 error Missing "key" prop for element in array react/jsx-key

This error is coming from a plugin rule react/jsx-key, which isn't maintained in this repository.

Can you report the issue in the plugin's repository:

https://github.com/yannickcr/eslint-plugin-react

I'm closing this issue since it isn't related to core ESLint or core ESLint rules.

Triage automation moved this from Triaging to Complete Feb 25, 2022
@rally25rs
Copy link
Author

@mdjermanovic thanks for the quick triage. I appreciate it!

For anyone else who stumbles across this from a search, it looks like it's been reported a couple times in that repo:

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Aug 25, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3rd party plugin This is an issue related to a 3rd party plugin, config, or parser archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

2 participants