quick-lint-js

Find bugs in JavaScript programs.

E0306: React/JSX is not allowed in vanilla TypeScript code

Vanilla TypeScript does not support JSX syntax (used in React code). It is a syntax error to create a JSX element or JSX fragment in vanilla TypeScript:

ReactDOM.render(
  <h1 className='title'>Hello, world!</h1>,
  document.getElementById('root')
);

To fix this error, rename your .ts file to have a .tsx suffix instead.

Alternatively, use React.createElement instead of JSX syntax:

ReactDOM.render(
  React.createElement(
    'h1',
    {className: 'title'},
    'Hello, world!',
  ),
  document.getElementById('root'),
);

Introduced in quick-lint-js version 2.10.0.

Documentation for other errors