ESLint Configuration for Create React App

7.0.1 · active · verified Sun Apr 19

eslint-config-react-app provides the official ESLint configuration used by Create React App projects. It ensures a consistent and opinionated linting setup, enforcing best practices for React applications, JavaScript/TypeScript syntax, accessibility, and code quality without requiring extensive manual configuration. The package is currently stable at version 7.0.1, with updates typically coinciding with major Create React App releases to align with new React features, tool updates (like Webpack, Jest, ESLint itself), and evolving language standards. Its primary differentiator is its tight integration and maintenance by the Create React App team, offering a battle-tested and low-overhead solution for linting React projects initialized with CRA. This configuration simplifies managing a complex ESLint setup, making it ideal for developers who prefer a zero-configuration start for their React projects and rely on community-vetted defaults.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart shows how to configure ESLint to extend `eslint-config-react-app` in a `.eslintrc.json` file for a Create React App project, including Jest rules, and provides an example `package.json` with relevant dependencies and lint script.

/* .eslintrc.json */
{
  "extends": [
    "react-app",
    "react-app/jest"
  ],
  "rules": {
    // Override or add custom rules here if necessary
    // For example, to relax a rule:
    "no-unused-vars": "warn",
    // Or to enforce a rule:
    "react/jsx-uses-react": "off",
    "react/react-in-jsx-scope": "off"
  }
}

/* package.json (example dependencies) */
{
  "name": "my-react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1"
  },
  "devDependencies": {
    "eslint": "^8.0.0",
    "eslint-config-react-app": "^7.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  }
}

view raw JSON →