Skip to Content
logoESLint React

Configure Project Config

ESLint React uses your Project Config for static analysis. This page details which options are used and how they affect the linting process.

JSX Transform

ESLint React uses compiler options in tsconfig.json or jsconfig.json to determine the JSX transform the project is using.

The following compiler options are respected:

Prop

Type

If nothing is specified, it defaults to automatic.

Since this part does not perform type checking, there is almost no performance impact.

Pragma Annotations

In addition to compiler options, ESLint React also respects JSX pragma comments found in the source file, mirroring tsc behavior:

  • @jsx <factory> — overrides jsxFactory
  • @jsxFrag <factory> — overrides jsxFragmentFactory
  • @jsxRuntime classic | automatic — overrides jsx (other values are ignored)
  • @jsxImportSource <source> — overrides jsxImportSource

Pragma annotations take precedence over compiler options. When the same pragma appears multiple times, the first @jsx/@jsxFrag applies, while the last @jsxRuntime/@jsxImportSource applies.

Example:

// @jsxRuntime classic
// @jsxImportSource preact

Type Information

ESLint React uses the Typed Linting API from typescript-eslint to retrieve type information for the rules that require it.

The following rules require type information:

Some rules, such as react-x/no-leaked-conditional-rendering, work better when certain TypeScript compiler options are enabled. We recommend enabling strictNullChecks in your tsconfig.json or jsconfig.json:

{
  "compilerOptions": {
    "strictNullChecks": true,
    // ...
  }
}

The project or projectService options in parserOptions must be set correctly for the rules to work.

Enabling these rules will have performance impact, but they are more powerful than traditional lint rules.

Resources

For more information, see:

On this page