Registry / testing / eslint-plugin-github

eslint-plugin-github

JSON →
library6.0.0jsnpmunverified

An opinionated collection of ESLint shared configs and rules used by GitHub. Current stable version is 6.0.0, which includes flat config support and ESM-only. The package provides configs for browser, React, TypeScript, and internal GitHub applications. Key differentiators: it enforces GitHub's own coding standards, includes accessibility rules (a11y), async/await best practices, and actionable rules like array-foreach and no-then. It supports both legacy .eslintrc and flat config via getFlatConfigs().

npm install eslint-plugin-github
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-GITH
E
eslint-plugin-github
testingjavascriptv6.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import github from 'eslint-plugin-github'
const github = require('eslint-plugin-github')
v6.0.0 is ESM-only. CommonJS require() will fail; use dynamic import() in CommonJS if needed, or stay on v5.
github.getFlatConfigs
github.getFlatConfigs()
require('eslint-plugin-github').getFlatConfigs()
Only available with flat config (ESLint v9). Legacy .eslintrc users should use extends: plugin:github/recommended.
Rule: github/array-foreach
'github/array-foreach': 'error'
'array-foreach': 'error'
Custom rules are prefixed with github/ when using the plugin. For example, github/async-preventdefault, github/no-then, github/a11y-aria-label-is-well-formatted.

Shows flat config usage with recommended, browser, react, typescript configs and custom rules.

npm install --save-dev eslint eslint-plugin-github # Create eslint.config.js (ESM flat config) import github from 'eslint-plugin-github' export default [ github.getFlatConfigs().recommended, github.getFlatConfigs().browser, github.getFlatConfigs().react, ...github.getFlatConfigs().typescript, { files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'], ignores: ['eslint.config.mjs'], rules: { 'github/array-foreach': 'error', 'github/async-preventdefault': 'warn', 'github/no-then': 'error', 'github/no-blur': 'error', }, }, ]
Debug
Known issues
breakingv6.0.0 is ESM-only. Requires Node >= 20.
fix
Upgrade to Node 20 or later, or continue using v5.x (legacy CommonJS).
affects: >=6.0.0
breakingv6.0.0 removed github plugin from typescript config; previously included rules may no longer apply.
fix
Explicitly add rules from removed plugin if needed. See changelog for details.
affects: >=6.0.0
deprecatedfilenames/match-regex rule renamed to github/filenames-match-regex (the original eslint-filenames-plugin is unmaintained).
fix
Update rule name from 'filenames/match-regex' to 'github/filenames-match-regex'.
affects: >=5.1.3
gotchaWhen using flat config, plugin namespace must be explicit in rule names (e.g., 'github/array-foreach'), not just 'array-foreach'.
fix
Prefix custom rules with 'github/'.
affects: >=5.1.0
gotchaThe react config requires a component mapping setting for polymorphic components; otherwise some a11y rules may not apply correctly.
fix
Add 'settings.github.components' mapping and 'settings.github.polymorphicPropName' in your ESLint config.
affects: >=5.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/eslint-plugin-github/dist/index.js from .../eslint.config.js not supported. Instead rename the index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change the required code to use ESM.
v6.0.0 is ESM-only; CommonJS require() fails.
fix
Use dynamic import() or set type: module in package.json. Alternatively, downgrade to v5.x.
Definition for rule 'array-foreach' was not found.
Rule name missing plugin prefix 'github/'.
fix
Change 'array-foreach' to 'github/array-foreach' in your ESLint config.
ESLint couldn't find the plugin 'eslint-plugin-github'.
Plugin not installed or not added to plugins array in flat config.
fix
Install with npm install --save-dev eslint-plugin-github, and import it at the top of eslint.config.js.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency: required to use this plugin; v6 requires eslint ^8 or ^9
Agent activity
2 hits · last 30 days
node
2
Resources
eslint-plugin-github — npm install eslint-plugin-github · libregistry