1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @emails react-core
    
  8.  */
    
  9. 
    
  10. 'use strict';
    
  11. 
    
  12. module.exports = {
    
  13.   meta: {
    
  14.     schema: [],
    
  15.   },
    
  16.   create(context) {
    
  17.     return {
    
  18.       Identifier(node) {
    
  19.         if (node.name === 'toWarnDev' || node.name === 'toErrorDev') {
    
  20.           let current = node;
    
  21.           while (current.parent) {
    
  22.             if (current.type === 'CallExpression') {
    
  23.               if (
    
  24.                 current &&
    
  25.                 current.callee &&
    
  26.                 current.callee.property &&
    
  27.                 current.callee.property.name === 'toThrow'
    
  28.               ) {
    
  29.                 context.report(
    
  30.                   node,
    
  31.                   node.name + '() matcher should not be nested'
    
  32.                 );
    
  33.               }
    
  34.             }
    
  35.             current = current.parent;
    
  36.           }
    
  37.         }
    
  38.       },
    
  39.     };
    
  40.   },
    
  41. };