Home

Awesome

eslint-plugin-github

Installation

npm install --save-dev eslint eslint-plugin-github

Setup

Add github to your list of plugins in your ESLint config.

JSON ESLint config example:

{
  "plugins": ["github"]
}

Extend the configs you wish to use.

JSON ESLint config example:

{
  "extends": ["plugin:github/recommended"]
}

The available configs are:

Component mapping (Experimental)

Note: This is experimental and subject to change.

The react config includes rules which target specific HTML elements. You may provide a mapping of custom components to an HTML element in your eslintrc configuration to increase linter coverage.

By default, these eslint rules will check the "as" prop for underlying element changes. If your repo uses a different prop name for polymorphic components provide the prop name in your eslintrc configuration under polymorphicPropName.

{
  "settings": {
    "github": {
      "polymorphicPropName": "asChild",
      "components": {
        "Box": "p",
        "Link": "a"
      }
    }
  }
}

This config will be interpreted in the following way:

Rules

<!-- begin auto-generated rules list -->

πŸ’Ό Configurations enabled in.
πŸ” Set in the browser configuration.
πŸ” Set in the internal configuration.
βš›οΈ Set in the react configuration.
βœ… Set in the recommended configuration.
πŸ”§ Automatically fixable by the --fix CLI option.
❌ Deprecated.

NameΒ Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β DescriptionπŸ’ΌπŸ”§βŒ
a11y-aria-label-is-well-formatted[aria-label] text should be formatted as you would visual text.βš›οΈ
a11y-no-generic-link-textdisallow generic link text❌
a11y-no-title-attributeGuards against developers using the title attributeβš›οΈ
a11y-no-visually-hidden-interactive-elementEnsures that interactive elements are not visually hiddenβš›οΈ
a11y-role-supports-aria-propsEnforce that elements with explicit or implicit roles defined contain only aria-* properties supported by that role.βš›οΈ
a11y-svg-has-accessible-nameSVGs must have an accessible nameβš›οΈ
array-foreachenforce for..of loops over Array.forEachβœ…
async-currenttargetdisallow event.currentTarget calls inside of async functionsπŸ”
async-preventdefaultdisallow event.preventDefault calls inside of async functionsπŸ”
authenticity-tokendisallow usage of CSRF tokens in JavaScriptπŸ”
get-attributedisallow wrong usage of attribute namesπŸ”πŸ”§
js-class-nameenforce a naming convention for js- prefixed classesπŸ”
no-blurdisallow usage of Element.prototype.blur()πŸ”
no-d-nonedisallow usage the d-none CSS classπŸ”
no-datasetenforce usage of Element.prototype.getAttribute instead of Element.prototype.datalistπŸ”
no-dynamic-script-tagdisallow creating dynamic script tagsβœ…
no-implicit-buggy-globalsdisallow implicit global variablesβœ…
no-inner-htmldisallow Element.prototype.innerHTML in favor of Element.prototype.textContentπŸ”
no-innerTextdisallow Element.prototype.innerText in favor of Element.prototype.textContentπŸ”πŸ”§
no-thenenforce using async/await syntax over Promisesβœ…
no-useless-passivedisallow marking a event handler as passive when it has no effectπŸ”πŸ”§
prefer-observersdisallow poorly performing event listenersπŸ”
require-passive-eventsenforce marking high frequency event handlers as passiveπŸ”
unescaped-html-literaldisallow unescaped HTML literalsπŸ”
<!-- end auto-generated rules list -->