eslint-plugin-react-pug icon indicating copy to clipboard operation
eslint-plugin-react-pug copied to clipboard

Add supporting of pugjs with react

eslint-plugin-react-pug

Add supporting of pugjs with react.

npm version CI Status

It adds supporting of babel-plugin-transform-react-pug.

Table of Contents

  • Installation
  • Usage
  • List of supported rules

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-react-pug:

$ npm install eslint-plugin-react-pug --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-react-pug globally.

Usage

Add react-pug to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "react-pug"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "extends": [
        "plugin:react-pug/all"
    ]
}

List of supported rules

  • react-pug/empty-lines: Manage empty lines in Pug
  • react-pug/eslint: Lint JavaScript code inside Pug
  • react-pug/indent: Enforce consistent indentation
  • react-pug/no-broken-template: Disallow broken template
  • react-pug/no-interpolation: Disallow JavaScript interpolation
  • react-pug/no-undef: Disallow undeclared variables in Pug
  • react-pug/prop-types: Manage prop-types usage
  • react-pug/quotes: Manage quotes in Pug
  • react-pug/uses-react: Prevent React to be marked as unused
  • react-pug/uses-vars: Prevent variables used in Pug to be marked as unused

Experimental:

  • react-pug/pug-lint: Inherit pug-lint to validate pug