Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Latest commit

 

History

History
62 lines (46 loc) · 730 Bytes

nue-not-use-hooks.md

File metadata and controls

62 lines (46 loc) · 730 Bytes

nue-not-use-hooks

The Nue component determines if Hooks are used.

Options

// .eslintrc.js

module.exports = {
  extends: ["plugin:scd/recommended"],
  plugins: ["scd"],
  rules: {
    "nue-not-use-hooks": [
      "error",
      {
        message: String, // default : "Nue components should not use Hooks"
      },
    ],
  },
};

Pass Example

function AnyFunc() {
  /* ... */
}

function Nue() {
  AnyFunc();

  return <div>Any</div>;
}

const Nue = () => {
  AnyFunc();

  return <div>Any</div>;
};

Error Example

function useAnyFunc() {
  /* ... */
}

function Nue() {
  useAnyFunc();

  return <div>Any</div>;
}

const Nue = () => {
  useAnyFunc();

  return <div>Any</div>;
};