<!-- UPDATE-PACKAGES:START - Do not remove or modify this section -->

# `@justia/eslint-config-react` ![version 3.0.3](https://img.shields.io/badge/version-3.0.3-blue?style=flat-square) <!-- omit from toc -->

> Justia's ESLint configuration for React projects

<!-- UPDATE-PACKAGES:END -->

This package uses [`@justia/eslint-config`](https://github.com/justia/front-end-projects/tree/develop/packages/eslint-config) as a base configuration, slightly modifies **prettier** rules and adds React-specific rules for React projects.

## Install

Install the correct versions of the peer dependencies, which are listed by the command:

```shell
npm info "@justia/eslint-config-react@latest" peerDependencies
```

If using **npm 5+**, use this shortcut

```shell
npx install-peerdeps --dev @justia/eslint-config-react
```

If using npm < 5, Linux/OSX users can run

```shell
(
export PKG=@justia/eslint-config-react;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
)
```

Which produces and runs a command like:

```shell
npm install --save-dev @justia/eslint-config-react eslint@^#.#.# prettier@^#.#.# babel-eslint@^#.#.# eslint-config-prettier@^#.#.# eslint-plugin-import@^#.#.# eslint-plugin-prettier@^#.#.# eslint-plugin-promise@^#.#.# eslint-plugin-jsx-a11y@^#.#.# eslint-plugin-react@^#.#.# eslint-plugin-react-hooks@^#.#.#
```

## Usage

### `@justia/eslint-config-react`

Default configuration that contains all the base ESLint rules, including ECMAScript 6+ and React. It requires the following external packages:

- `eslint`
- `prettier`
- `babel-eslint`
- `eslint-config-prettier`
- `eslint-plugin-import`
- `eslint-plugin-prettier`
- `eslint-plugin-promise`
- `eslint-plugin-jsx-a11y`
- `eslint-plugin-react`

After installation of the package and the peer dependencies, add `"extends": ["@justia/eslint-config-react"]` to your `.eslintrc`.

### `@justia/eslint-config-react/hooks`

This entry point enables the linting rules for React hooks (requires v16.8+). It requires `eslint-plugin-react-hooks`.

To use, add the following to your `.eslintrc`:

```json
{
  "extends": [
    "@justia/eslint-config-react",
    "@justia/eslint-config-react/hooks"
  ]
}
```
