Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Parsing error: Unexpected token, expected "," in index.tsx?

i'm occuring that problem:

Line 9:38: Parsing error: Unexpected token, expected "," prettier/prettier

in index.tsx file.

import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const rootElement = document.getElementById('root');
const root = createRoot(rootElement as Element);

root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

reportWebVitals();

I can't find fix on the internet, anyone know how to fix that?

like image 633
xFlame Avatar asked Nov 27 '25 18:11

xFlame


1 Answers

I found the issue by cloning into your repo. It is with "parser": "babel" in eslint.rc prettier/prettier.

Use "parser": "babel-ts" or "parser": "typescript".

enter image description here

enter image description here

like image 196
Pratik Wadekar Avatar answered Nov 30 '25 08:11

Pratik Wadekar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!