UNPKG

tslint-react-hooks

Version:

TSLint rule that enforces the Rules of Hooks

21 lines (20 loc) • 550 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isComponentIdentifier = isComponentIdentifier; /** * Tests if an identifier could be a component's name. * @param node */ function isComponentIdentifier(node) { return isComponentName(node.text); } /** * Tests if the name could be a component's name. * * @see https://github.com/facebook/react/blob/master/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js#L49 * * @param name */ function isComponentName(name) { return !/^[a-z]/.test(name); }