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

eslint-plugin-putout can't detect JSX #53

Closed
EvgenyOrekhov opened this issue Apr 7, 2021 · 4 comments
Closed

eslint-plugin-putout can't detect JSX #53

EvgenyOrekhov opened this issue Apr 7, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@EvgenyOrekhov
Copy link

When I try to lint a simple *.tsx file, like

function MyComponent() {
  return (
    <div>Hello</div>
  );
}

ESLint gives me the following error:

SyntaxError: Unterminated regular expression

With other *.tsx files it gives me the following error:

SyntaxError: Unexpected token, expected "</>/<=/>="

When I disable the putout/putout rule, ESLint and all other plugins start to work fine.

So, as I understand it, Putout can't detect that *.tsx files use JSX.

@coderaiser coderaiser added bug Something isn't working and removed bug Something isn't working labels Apr 7, 2021
@coderaiser
Copy link
Owner

coderaiser commented Apr 7, 2021

Currently to determine that jsx is used, and plugin jsx should be connected to babel parser, getJSX is used, it checks if source file has react import.

Don't you import react? Could you please show me full file content?

@EvgenyOrekhov
Copy link
Author

We use Stencil. Stencil components don't have React import. You can see an example of Stencil component here: https://stenciljs.com/docs/my-first-component.

@coderaiser coderaiser added bug Something isn't working and removed triage labels Apr 7, 2021
@coderaiser
Copy link
Owner

Fixed with 1b35faf. Landed in v16.5.0 🎉. Is it works for you?

@EvgenyOrekhov
Copy link
Author

It works, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants