UNPKG

tslint-react-hooks

Version:

TSLint rule that enforces the Rules of Hooks

14 lines (13 loc) • 399 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isHookIdentifier = isHookIdentifier; function isHookIdentifier(node) { return isHookName(node.text); } /** * @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); }