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

no-undef does not check Node.js scope for variables used in JSX #2093

Closed
yannickcr opened this issue Mar 17, 2015 · 8 comments
Closed

no-undef does not check Node.js scope for variables used in JSX #2093

yannickcr opened this issue Mar 17, 2015 · 8 comments
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules

Comments

@yannickcr
Copy link
Contributor

no-undef does not check Node.js scope for variables used in JSX

test.js

var App = require('App');

module.exports = <App />

.eslintrc

env:
    node: true
ecmaFeatures:
    jsx: true
rules:
    no-undef: 2

Output:

test.js
  3:18  error  'App' is not defined                                                 no-undef

✖ 1 problem (1 error, 0 warnings)
yannickcr added a commit to yannickcr/eslint that referenced this issue Mar 17, 2015
@srigi
Copy link

srigi commented Mar 18, 2015

+1, have same problem

@nzakas
Copy link
Member

nzakas commented Mar 18, 2015

Can you generalize this to something that isn't related to JSX/React? Right now, this is the correct behavior for ESLint without any plugins.

@nzakas nzakas added the triage An ESLint team member will look at this issue soon label Mar 18, 2015
@srigi
Copy link

srigi commented Mar 18, 2015

This looks like bug in babel-eslint. Non-JSX code checking works well.

@yannickcr
Copy link
Contributor Author

@nzakas This is totally related to JSX since the problem is in the checkIdentifierInJSX function.

I think this is the same problem as #2090 or #2064, the Node.js scope is not checked.

@nzakas
Copy link
Member

nzakas commented Mar 18, 2015

Ah, I thought that had been removed in the last release. We really shouldn't be checking JSX tag names in ESLint, as that's part of React semantics. So I think what we should be doing here is removing that functionality from no-undef.

@yannickcr
Copy link
Contributor Author

Sounds good to me. This way no-undef will stop reporting some errors on JSX tag names and I can add a JSX specific rule for this in my plugin.

@nzakas
Copy link
Member

nzakas commented Mar 19, 2015

👍

@nzakas nzakas added bug ESLint is working incorrectly rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Mar 21, 2015
@nzakas
Copy link
Member

nzakas commented Mar 21, 2015

Working on this.

@nzakas nzakas closed this as completed in 69e2c7e Mar 23, 2015
nzakas added a commit that referenced this issue Mar 23, 2015
Breaking: Remove JSX support from no-undef (fixes #2093)
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 7, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

3 participants