eslint-config-standard-react is an ESLint shareable configuration designed to extend the JavaScript Standard Style with support for React and JSX syntax. The current stable version is 13.0.0, released on December 15, 2022. This package integrates React-specific linting rules, including those for React Hooks (introduced in v13.0.0), into the opinionated `standard` ecosystem. It functions as an additive layer on top of `eslint-config-standard` and `eslint-config-standard-jsx`, requiring these and specific ESLint plugins (such as `eslint-plugin-react` and `eslint-plugin-react-hooks`) to be installed as peer dependencies. The project maintains an active status, with major version bumps typically aligning with significant updates like ESLint version support (e.g., v12.0.0 for ESLint 8.x) or new React feature linting. Unlike the main `standard` package, this config is intended for advanced users who prefer to manage their ESLint setup manually rather than relying on the `standard` CLI tool directly, offering more granular control over the linting process.
npm install eslint-config-standard-reactVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the full installation of `eslint-config-standard-react` and its necessary peer dependencies, along with the correct `.eslintrc.json` configuration for a typical React project using JavaScript Standard Style. It includes basic `parserOptions`, `env` settings, and common rule overrides for modern React applications using the new JSX transform.
Upgrade `eslint` to `^8.8.0` (or newer compatible version) and update all related ESLint plugins and configs in your project.
Review your React Hooks usage and refactor code to comply with the 'Rules of Hooks'. Ensure `@babel/eslint-parser` and `@babel/core` are installed and configured correctly, potentially adding `requireConfigFile: false` to `parserOptions`.
Always install the complete set of recommended dependencies as listed in the package's README or the quickstart section, typically using `npm install --save-dev` for all listed packages.
Add `"react/jsx-uses-react": "off"` and `"react/react-in-jsx-scope": "off"` to the `rules` section of your `.eslintrc` file.
Run `npm install --save-dev @babel/eslint-parser @babel/core`.
Ensure `eslint-config-standard-react` and all its peer dependencies (e.g., `eslint-plugin-react`) are installed: `npm install --save-dev eslint-config-standard-react eslint-plugin-react eslint-plugin-react-hooks` and verify the `extends` entry is `"standard-react"`.
Refactor your code to ensure Hooks are only called at the top level of React function components or custom Hooks, and not inside loops, conditions, or nested functions.
Ensure `parserOptions` in your `.eslintrc` includes `"sourceType": "module"` and `"ecmaVersion": 2020` (or higher), and `"ecmaFeatures": { "jsx": true }`.