Linting

Primer React offers an ESLint plugin to enforce best practices and fix common problems.

On this page

On this page

eslint-plugin-primer-react is experimental. Please report issues in the primer/react repository.

Installation

  1. Assuming you already have ESLint and Primer React installed, run:

    npm install --save-dev eslint-plugin-primer-react
    # or
    yarn add --dev eslint-plugin-primer-react
  2. In your ESLint configuration file, extend the recommended Primer React ESLint config:

    {
    "extends": [
    // ...
    "plugin:primer-react/recommended"
    ]
    }

See the eslint-plugin-primer-react repository for a list of included lint rules.