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

Usage with Typescript React #3

Closed
DanielHZhang opened this issue Jan 1, 2019 · 1 comment
Closed

Usage with Typescript React #3

DanielHZhang opened this issue Jan 1, 2019 · 1 comment

Comments

@DanielHZhang
Copy link

Hey @eternalphane! Nice extension! I'd really love to use it, but it doesn't work when formatting typescript react files.

An example of the error logs:

[Error - 2019-01-01, 5:51:53 p.m.] Formatting failed
src\components\landing\nav-bar.tsx(50,14) error TS1005: '>' expected.
src\components\landing\nav-bar.tsx(50,17) error TS1005: ',' expected.
src\components\landing\nav-bar.tsx(51,16) error TS1005: '>' expected.
src\components\landing\nav-bar.tsx(51,18) error TS1005: ',' expected.
src\components\landing\nav-bar.tsx(51,37) error TS1005: ',' expected.
src\components\landing\nav-bar.tsx(51,43) error TS1161: Unterminated regular expression literal.
src\components\landing\nav-bar.tsx(52,10) error TS1161: Unterminated regular expression literal.
...

The formatter errors anywhere there is JSX, e.g.:

if (loggedIn) {
      return [
        <Item key='sets'>                  // Line 50
          <Link to='/sets'>Sets</Link>     // Line 51
        </Item>,                           // Line 52
        <Item key='explorer'>
          <Link to='/explorer'>Explorer</Link>
        </Item>,
        <Item key='logout'>
          Logout
        </Item>,
      ];
}

TS1005 and TS1161 are unrelated, so I think the errors are because JSX is not being recognized.


I have not changed the extension settings, so I'm assuming that the extension using my tsconfig.json and tslint.json under src/. My typescript and tslint versions are also up to date. Do I need to change something to allow usage with react?

Thanks!

@eternalphane
Copy link
Owner

Hi @FadeZhanger. Sorry for the late reply, I'm really busy these days. Please try the new version and see if it works. Thanks for your support!

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

No branches or pull requests

2 participants