UNPKG

tslint-react-hooks

Version:

TSLint rule that enforces the Rules of Hooks

14 lines (13 loc) 412 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isHookIdentifier(node) { return isHookName(node.text); } exports.isHookIdentifier = isHookIdentifier; /** * @see https://github.com/facebook/react/blob/master/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js#L17 * @param name */ function isHookName(name) { return /^use[A-Z0-9].*$/.test(name); }