JSPM

eslint-plugin-react-use-props

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 361
  • Score
    100M100P100Q93151F
  • License MIT

eslint plugin for enforce that all components that require or deprecate props

Package Exports

  • eslint-plugin-react-use-props

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eslint-plugin-react-use-props) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

eslint-plugin-react-use-props

ESLint plugin to require or deprecate props that components use

Installation

You'll first need to install ESLint:

# npm
npm install eslint --save-dev

# yarn
yarn add eslint --dev

Next, install eslint-plugin-react-use-props:

# npm
npm install eslint-plugin-react-use-props --save-dev

# yarn
yarn add eslint-plugin-react-use-props --dev

Usage

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

{
  "plugins": ["react-use-props"]
}

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

{
  "rules": {
    "react-use-props/require": [2,
      { "element": "img", "props": ["width", "height"] }
    ],
    "react-use-props/deprecate": [2,
      { "element": "div", "props": ["align"] }
    ]
  }
}

Recomended rules

Force required size props to prevent Layout Shift from occurring.

{
  "rules": {
    "react-use-props/require": [2,
      { "element": "img", "props": ["width", "height"] },
      { "element": "iframe", "props": ["width", "height"] }
    ]
  }
}

Supported Rules