/
githubmr
/
facebook-react
Обзор
Документация
Войти
/
githubmr
/
facebook-react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
packages/eslint-plugin-react-hooks/src/shared/Utils.ts
22 строки
680 B
Jordan Brown
[lint] Enable custom hooks configuration for useEffectEvent calling rules (#34497)
30 сен 2025, 23:44
Не верифицирован
30 сен 2025, 23:44
92cfdc3
Код
Авторство
О чём код?
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import { Rule } from 'eslint'; const SETTINGS_KEY = 'react-hooks'; const SETTINGS_ADDITIONAL_EFFECT_HOOKS_KEY = 'additionalEffectHooks'; export function getAdditionalEffectHooksFromSettings( settings: Rule.RuleContext['settings'], ): RegExp | undefined { const additionalHooks = settings[SETTINGS_KEY]?.[SETTINGS_ADDITIONAL_EFFECT_HOOKS_KEY]; if (additionalHooks != null && typeof additionalHooks === 'string') { return new RegExp(additionalHooks); } return undefined; }