ESLint plugin providing lint rules for Primer React components, currently at version 8.6.0. Requires ESLint ^9.0.0 and Node >=20. Actively maintained with frequent releases. Offers rules for enforcing best practices like using styled-react imports, no deprecated components, and preventing ReDoS vulnerabilities. Differentiates from generic React linting by being specific to Primer's design system.
npm install eslint-plugin-primer-reactVerified import paths — ran on the pinned version, not inferred.
Basic ESLint configuration using eslint-plugin-primer-react with three common rules enabled.
Update to v8.0.0 or later and ensure ESLint ^9.0.0 is installed.
Use Node.js 20 or newer.
Replace Octicon imports with named icon imports like {IconCheck} from '@primer/octicons-react'.Use import syntax or dynamic import() in CJS modules.
Upgrade to v8.5.2 or later to mitigate the vulnerability.
Change eslint.config.js to ESM (add 'type': 'module' in package.json) or use dynamic import: const primerReact = (await import('eslint-plugin-primer-react')).defaultRun 'npm install eslint-plugin-primer-react@latest --save-dev'
Ensure the plugin is in the 'plugins' key and the rule in 'rules'.