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

Javascript files are marked as JSX #266

Closed
Arcanemagus opened this issue Oct 12, 2016 · 3 comments
Closed

Javascript files are marked as JSX #266

Arcanemagus opened this issue Oct 12, 2016 · 3 comments
Labels

Comments

@Arcanemagus
Copy link

Arcanemagus commented Oct 12, 2016

It seems that for some reason this language package is marking all Javascript (source.js) files as JSX (source.js.jsx) files.

This is causing problems with Javascript linters as they "don't work" on Javascript files since they aren't marked as being compatible with JSX, see AtomLinter/linter-jshint#348 for some examples of users having issues with this.

@gandm
Copy link
Owner

gandm commented Oct 12, 2016

I can't see reason to change this. My grammar supports flowtype,, ES2015, ES2016, tc39 features JSX, etc. I can't tell from the filename what the file contents are. The vast majority of people name their JSX files as .js See airbnb/javascript#985 (comment)

As most of my user base are likely using React/JSX it's a hint that if you don't support JSX you'd best not apply it to files that my grammar supports. I could just scope the JSX bit as jsx and the global scope as source.js but this wouldn't help as it you'd still fail when linting some file that had JSX inside it, believing it to be a pure JS file.

Also, lots of snippets use the JSX scope to trigger them and historically I matched the react atom package which used this scope.

@Arcanemagus
Copy link
Author

I had no idea people wrote JSX files as .js... isn't it a templating language?!?

I'm not sure what I would do here myself, I suppose leaving it as putting all Javascript files as JSX is probably best for your audience so I'll go ahead and close this.

@gandm
Copy link
Owner

gandm commented Oct 12, 2016

I had no idea people wrote JSX files as .js ... isn't it a templating language?!?

No Facebook react (JSX) extends JavaScript and has to have a compile phase to turn it back
into spec compliant JavaScript - hence why my product is named Babel, after the transpiler. Simarlarly, flowtype is like Typescript and also needs a compile phase. Both significantly extend the syntax of JavaScript.

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

No branches or pull requests

2 participants