Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Imported symbols are erroneously detected undefined when using JSX #17

Closed
n1k0 opened this issue Feb 28, 2015 · 8 comments
Closed

Imported symbols are erroneously detected undefined when using JSX #17

n1k0 opened this issue Feb 28, 2015 · 8 comments

Comments

@n1k0
Copy link

n1k0 commented Feb 28, 2015

import App from "./components/App";

React.render(<App />, document.querySelector("#app"));

Gives:

26:14  error  'App' is not defined  no-undef

Also,

import App from "./components/App";

React.render(App(), document.querySelector("#app"));

makes it going away, so it's a JSX-related thingy.

@gaearon
Copy link
Member

gaearon commented Feb 28, 2015

+1

@nzakas
Copy link

nzakas commented Mar 1, 2015

This is because ESLint doesn't yet support modules in our rules. See eslint/eslint#1903

BenoitZugmeyer added a commit to BenoitZugmeyer/babel-eslint that referenced this issue Mar 7, 2015
eslint does not support an escope "module" scope but we need it to
support modules syntax.

Simply pushing all variables from the "module" scope in the "global"
scope should fix many issues: babel#8, babel#15, babel#17, babel#21, babel#29
@kentcdodds
Copy link
Member

@nzakas, has that changed in the last 13 days? Currently on the website there's the ecmaFeatures.modules option, so that's why I ask. But I'm still experiencing this issue. Current workaround was to use const foo = require('./foo'); because I'm using webpack and it's cool like that, but would love to just use pure ES6 modues.

Note: I'm not using JSX

@nzakas
Copy link

nzakas commented Mar 13, 2015

Yup. We now support modules. I'd recommend either subscribing to the mailing list or following geteslint on Twitter for updates.

@kentcdodds
Copy link
Member

I'm following on Twitter. Do you know why I would bet getting this error:

import foo from 'foo';

foo.bar();

Results in:

error  'foo' is not defined  no-undef

I npm installed a commit from yesterday.

@nzakas
Copy link

nzakas commented Mar 13, 2015

If you think it's an error in ESLint (without babel-eslint), then please look at the issues over on the ESLint repo.

@sebmck
Copy link
Contributor

sebmck commented Apr 14, 2015

Can you please verify that this issue still exists on 3.0.1?

@sebmck
Copy link
Contributor

sebmck commented Apr 14, 2015

Not sure I can do anything about this. I'd recommend using the eslint-plugin-react rules.

@sebmck sebmck closed this as completed Apr 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants