mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
34 lines
815 B
JavaScript
34 lines
815 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @emails react-core
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
module.exports = function(context) {
|
|
return {
|
|
Identifier(node) {
|
|
if (node.name === 'toWarnDev') {
|
|
let current = node;
|
|
while (current.parent) {
|
|
if (current.type === 'CallExpression') {
|
|
if (
|
|
current &&
|
|
current.callee &&
|
|
current.callee.property &&
|
|
current.callee.property.name === 'toThrow'
|
|
) {
|
|
context.report(node, 'toWarnDev() matcher should not be nested');
|
|
}
|
|
}
|
|
current = current.parent;
|
|
}
|
|
}
|
|
},
|
|
};
|
|
};
|