eslint-plugin-replace-hooks

1.0.3 • Public • Published

eslint-plugin-replace-hooks

replace some hooks by other hooks

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-replace-hooks:

npm install eslint-plugin-replace-hooks --save-dev

Usage

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

{
  "plugins": [
    "replace-hooks" // this must be placed before `import`
  ]
}

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

{
  "rules": {
    "replace-hooks/no-forbidden-hooks": [
      "error",
      { "useState": { "tip": "your custom hooks", "dependency": "your module" } }
    ]
  }
}

Supported Rules

  • no-forbidden-hooks

Caution

  • this plugin should work with eslint-plugin-import, especially the rules import/no-duplicates to help merge import from same modules.

  • the plugin must be placed before eslint-plugin-import

    plugins: [ // other plugins, 'replace-hooks', 'import', ]

Package Sidebar

Install

npm i eslint-plugin-replace-hooks

Weekly Downloads

2

Version

1.0.3

License

MIT

Unpacked Size

12.7 kB

Total Files

10

Last publish

Collaborators

  • chj-damon