eslint-plugin-baitshop-hooks

1.0.2 • Public • Published

eslint-plugin-baitshop-hooks

npm license issues PRs welcome

This is an ESLint plugin which extends and replaces React's "react-hooks/rules-of-hooks" eslint rule to support the use of hooks inside the baitshop Hook's onRender() method. It does not include the "react-hooks/exhaustive-deps" rule so you'll need to configure that rule separately if you want the full Rules of Hooks eslint experience.

The code provided here is mostly copied directly from the react eslint plugin with very little modification to support baitshop.

Installation

Assuming you already have ESLint installed, run:

# npm 
npm install eslint-plugin-baitshop-hooks --save-dev
 
# yarn 
yarn add eslint-plugin-baitshop-hooks --dev

Then extend the recommended eslint config:

{
  "extends": [
    // ...
    "plugin:baitshop-hooks/recommended"
  ]
}

Custom Configuration

If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:

{
  "plugins": [
    // ...
    "baitshop-hooks"
  ],
  "rules": {
    // ...
    "baitshop-hooks/rules-of-hooks": "error",
  }
}

Valid and Invalid Examples

Please refer to the Rules of Hooks documentation and the Hooks FAQ to learn more about this rule.

License

BSD-3-Clause

Package Sidebar

Install

npm i eslint-plugin-baitshop-hooks

Weekly Downloads

1

Version

1.0.2

License

BSD-3-Clause

Unpacked Size

27.2 kB

Total Files

5

Last publish

Collaborators

  • aarongoin