{"id":19906,"library":"eslint-plugin-react-web-api","title":"eslint-plugin-react-web-api","description":"An ESLint plugin for React that enforces correct usage of Web APIs, preventing common mistakes like missing cleanup in useEffect and unsafe fetch calls. Version 4.2.3 is the latest stable release for ESLint v10 and TypeScript 5.x. It is part of the eslint-react ecosystem, offering rules such as `no-leaked-fetch` and `no-missing-cleanup`. Unlike generic ESLint plugins, it is specifically tailored for React's lifecycle with TypeScript support and ships bundled type definitions.","status":"active","version":"4.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/Rel1cx/eslint-react","tags":["javascript","react","web-api","eslint","eslint-react","eslint-plugin","eslint-plugin-react-web-api","typescript"],"install":[{"cmd":"npm install eslint-plugin-react-web-api","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-react-web-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-react-web-api","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for the plugin to function","package":"eslint","optional":false},{"reason":"Peer dependency required for type-checked rules","package":"typescript","optional":true}],"imports":[{"note":"The plugin is ESM-only; CommonJS require is not supported in Node >=22.","wrong":"const reactWebApi = require('eslint-plugin-react-web-api')","symbol":"default","correct":"import reactWebApi from 'eslint-plugin-react-web-api'"},{"note":"Access rules directly from the plugin object; there is no separate export path.","wrong":"import { rules } from 'eslint-plugin-react-web-api/rules'","symbol":"rules","correct":"import { rules } from 'eslint-plugin-react-web-api'"},{"note":"Configurations are exported as 'configs' (e.g., configs.recommended).","wrong":null,"symbol":"configs","correct":"import { configs } from 'eslint-plugin-react-web-api'"}],"quickstart":{"code":"// eslint.config.js\nimport reactWebApi from 'eslint-plugin-react-web-api';\nimport tsParser from '@typescript-eslint/parser';\n\nexport default [\n  {\n    files: ['**/*.{js,jsx,ts,tsx}'],\n    plugins: {\n      'react-web-api': reactWebApi,\n    },\n    languageOptions: {\n      parser: tsParser,\n      parserOptions: {\n        ecmaFeatures: { jsx: true },\n      },\n    },\n    rules: {\n      'react-web-api/no-leaked-fetch': 'warn',\n      'react-web-api/no-missing-cleanup': 'error',\n    },\n  },\n];","lang":"typescript","description":"Configures the plugin with two rules: no-leaked-fetch and no-missing-cleanup, using TypeScript parser for type-checked rules."},"warnings":[{"fix":"Upgrade ESLint to v10+.","message":"ESLint v10 is required. Versions 4.x do not support ESLint <10.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade Node.js to v22+ or use a bundler that handles ESM.","message":"Node.js >=22 is required. The plugin uses ESM only.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use `plugins: { 'react-web-api': reactWebApi }` instead of `extends: ['plugin:react-web-api/recommended']`.","message":"The plugin must be placed in the 'plugins' array of the flat config, not as a string in the 'extends' array.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Migrate to flat config format.","message":"The legacy `.eslintrc` format is not supported. The plugin only works with the flat config (eslint.config.js).","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install eslint-plugin-react-web-api --save-dev`.","cause":"The plugin is not installed or is not in node_modules.","error":"ESLint couldn't find the plugin 'eslint-plugin-react-web-api'."},{"fix":"Use dynamic import or set `\"type\": \"module\"` in package.json.","cause":"The package is ESM-only and require is used instead of import.","error":"Cannot find module 'eslint-plugin-react-web-api'"},{"fix":"Add `import reactWebApi from 'eslint-plugin-react-web-api'` and reference it in `plugins: { 'react-web-api': reactWebApi }`.","cause":"The plugin was not added to the `plugins` array in the flat config.","error":"Plugin 'react-web-api' was not found."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}