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

Errorneous linting of jsx fragments #5466

Closed
vadzim opened this issue Oct 17, 2018 · 7 comments
Closed

Errorneous linting of jsx fragments #5466

vadzim opened this issue Oct 17, 2018 · 7 comments

Comments

@vadzim
Copy link
Contributor

vadzim commented Oct 17, 2018

Is this a bug report?

yes

Steps to Reproduce

  1. create app npx create-react-app app
  2. replace content of src/App.js with
import React from 'react';

const App = (
  <>App</>
);

export default App;
  1. run npx eslint ./src inside app

Expected Behavior

no errors, no warnings

Actual Behavior

There is a warning:

.../src/App.js
  1:8  warning  'React' is defined but never used  no-unused-vars

✖ 1 problem (0 errors, 1 warning)

If I remove react import from src/App.js, then it shows an error:

.../src/App.js
  2:3  error  'React' must be in scope when using JSX  react/react-in-jsx-scope

✖ 1 problem (1 error, 0 warnings)

Reproducible Demo

https://github.com/vadzim/errorneous-fragment-linting.git

@bugzpodder
Copy link

bugzpodder commented Oct 17, 2018

[edit] Oops, I missed your package.json which extends react-app

@yordis
Copy link

yordis commented Oct 17, 2018

Wouldn't be the case that this is happening because CRA does not use .eslintrc or any other file that eslint command would use instead it is passing the config directly in the loader

extends: [require.resolve('eslint-config-react-app')],

@vadzim
Copy link
Contributor Author

vadzim commented Oct 18, 2018

It seems this is fixed in jsx-eslint/eslint-plugin-react@18898e1#diff-d41ba36daf851354b9587064dc4ee0ac
but still not published

@stale
Copy link

stale bot commented Nov 17, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Nov 17, 2018
@tim-phillips
Copy link

tim-phillips commented Nov 22, 2018

Issue tracking the publication of a new release: jsx-eslint/eslint-plugin-react#2046

@stale stale bot removed the stale label Nov 22, 2018
@stale
Copy link

stale bot commented Dec 27, 2018

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Dec 27, 2018
@stale
Copy link

stale bot commented Jan 1, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Jan 1, 2019
@lock lock bot locked and limited conversation to collaborators Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants