DEV Community

Jyoti Prakash Pradhan
Jyoti Prakash Pradhan

Posted on

Upgrade react-script 3.x.x to 4.x.x

Fix to unexpected token issue

Issue log

src/components/CommonStyles.tsx
  Line 4:41:  Parsing error: Unexpected token, expected ","

  2 | import { SunsetOrange, rem, xsmall } from 'styled/config';
  3 |
> 4 | export const Error = styled.p<{ noMargin?: boolean }>`
    |                                         ^
  5 |   color: ${SunsetOrange};
  6 |   font-size: ${rem(12)};
  7 |   line-height: 1;

src/components/Graphs/DataTable.tsx
  Line 28:37:  Parsing error: Unexpected token, expected ","

  26 | `;
  27 |
> 28 | const TableCell = styled.th<{ sticky?: boolean }>`
     |                                     ^
  29 |   background: ${White};
  30 |   border-bottom: 1px solid ${Plaster};
  31 |   font-size: 13px;

src/components/Icon/Icon.tsx
  Line 5:25:  Parsing error: Unexpected token, expected ","

  3 |
  4 | const Icon = styled.div<{
> 5 |   width: number | string;
    |                         ^
  6 |   height: number | string;
  7 |   color?: string;
  8 | }>`
Enter fullscreen mode Exit fullscreen mode

Fix

Add this below code to your package.json after upgrading react-script from 3 to 4

"eslintConfig": {
   "extends": [
     "react-app",
     "react-app/jest"
   ]
 },
Enter fullscreen mode Exit fullscreen mode

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

Best practices for optimal infrastructure performance with Magento

Running a Magento store? Struggling with performance bottlenecks? Join us and get actionable insights and real-world strategies to keep your store fast and reliable.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️