+ * The representation is used to verify nested used properties.
+ * @param {ASTNode} node
+ * @return {string | undefined}
+ */
+ function getLeftMostTypeName(node) {
+ if (node.name) return node.name;
+ if (node.left) return getLeftMostTypeName(node.left);
+ }
+
+ function getRightMostTypeName(node) {
+ if (node.name) return node.name;
+ if (node.right) return getRightMostTypeName(node.right);
+ }
+
+ /**
+ * Returns true if the node is either a interface or type alias declaration
+ * @param {ASTNode} node
+ * @return {boolean}
+ */
+ function filterInterfaceOrTypeAlias(node) {
+ return (
+ astUtil.isTSInterfaceDeclaration(node) || astUtil.isTSTypeAliasDeclaration(node)
+ );
+ }
+
+ /**
+ * Returns true if the interface or type alias declaration node name matches the type-name str
+ * @param {ASTNode} node
+ * @param {string} typeName
+ * @return {boolean}
+ */
+ function filterInterfaceOrAliasByName(node, typeName) {
+ return (
+ node.id
+ && node.id.name === typeName
+ ) || (
+ node.declaration
+ && node.declaration.id
+ && node.declaration.id.name === typeName
+ );
+ }
+
+ class DeclarePropTypesForTSTypeAnnotation {
+ constructor(propTypes, declaredPropTypes, rootNode) {
+ this.propTypes = propTypes;
+ this.declaredPropTypes = declaredPropTypes;
+ this.foundDeclaredPropertiesList = [];
+ this.referenceNameMap = new Set();
+ this.sourceCode = getSourceCode(context);
+ this.shouldIgnorePropTypes = false;
+ this.rootNode = rootNode;
+ this.visitTSNode(this.propTypes);
+ this.endAndStructDeclaredPropTypes();
+ }
+
+ /**
+ * The node will be distribute to different function.
+ * @param {ASTNode} node
+ */
+ visitTSNode(node) {
+ if (!node) return;
+ if (astUtil.isTSTypeAnnotation(node)) {
+ const typeAnnotation = node.typeAnnotation;
+ this.visitTSNode(typeAnnotation);
+ } else if (astUtil.isTSTypeReference(node)) {
+ this.searchDeclarationByName(node);
+ } else if (astUtil.isTSInterfaceHeritage(node)) {
+ this.searchDeclarationByName(node);
+ } else if (astUtil.isTSTypeLiteral(node)) {
+ // Check node is an object literal
+ if (Array.isArray(node.members)) {
+ this.foundDeclaredPropertiesList = this.foundDeclaredPropertiesList.concat(node.members);
+ }
+ } else if (astUtil.isTSIntersectionType(node)) {
+ this.convertIntersectionTypeToPropTypes(node);
+ } else if (astUtil.isTSParenthesizedType(node)) {
+ const typeAnnotation = node.typeAnnotation;
+ this.visitTSNode(typeAnnotation);
+ } else if (astUtil.isTSTypeParameterInstantiation(node)) {
+ if (Array.isArray(node.params)) {
+ node.params.forEach((x) => this.visitTSNode(x));
+ }
+ } else {
+ this.shouldIgnorePropTypes = true;
+ }
+ }
+
+ /**
+ * Search TSInterfaceDeclaration or TSTypeAliasDeclaration,
+ * by using TSTypeReference and TSInterfaceHeritage name.
+ * @param {ASTNode} node
+ */
+ searchDeclarationByName(node) {
+ let typeName;
+ if (astUtil.isTSTypeReference(node)) {
+ typeName = node.typeName.name;
+ const leftMostName = getLeftMostTypeName(node.typeName);
+ const shouldTraverseTypeParams = genericReactTypesImport.has(leftMostName);
+ const nodeTypeArguments = propsUtil.getTypeArguments(node);
+ if (shouldTraverseTypeParams && nodeTypeArguments && nodeTypeArguments.length !== 0) {
+ // All react Generic types are derived from:
+ // type PropsWithChildren = P & { children?: ReactNode | undefined }
+ // So we should construct an optional children prop
+ this.shouldSpecifyOptionalChildrenProps = true;
+
+ const rightMostName = getRightMostTypeName(node.typeName);
+ if (
+ leftMostName === 'React'
+ && (
+ rightMostName === 'HTMLAttributes'
+ || rightMostName === 'HTMLElement'
+ || rightMostName === 'HTMLProps'
+ )
+ ) {
+ this.shouldSpecifyClassNameProp = true;
+ }
+
+ const importedName = localToImportedMap[rightMostName];
+ const idx = genericTypeParamIndexWherePropsArePresent[
+ leftMostName !== rightMostName ? rightMostName : importedName
+ ];
+ const nextNode = nodeTypeArguments.params[idx];
+ this.visitTSNode(nextNode);
+ return;
+ }
+ } else if (astUtil.isTSInterfaceHeritage(node)) {
+ if (!node.expression && node.id) {
+ typeName = node.id.name;
+ } else {
+ typeName = node.expression.name;
+ }
+ }
+ if (!typeName) {
+ this.shouldIgnorePropTypes = true;
+ return;
+ }
+ if (typeName === 'ReturnType') {
+ this.convertReturnTypeToPropTypes(node, this.rootNode);
+ return;
+ }
+ // Prevent recursive inheritance will cause maximum callstack.
+ if (this.referenceNameMap.has(typeName)) {
+ this.shouldIgnorePropTypes = true;
+ return;
+ }
+ // Add typeName to Set and consider it as traversed.
+ this.referenceNameMap.add(typeName);
+
+ /**
+ * From line 577 to line 581, and line 588 to line 590 are trying to handle typescript-eslint-parser
+ * Need to be deprecated after remove typescript-eslint-parser support.
+ */
+ const candidateTypes = this.sourceCode.ast.body.filter((item) => astUtil.isTSTypeDeclaration(item));
+
+ const declarations = flatMap(
+ candidateTypes,
+ (type) => (
+ type.declarations
+ || (
+ type.declaration
+ && type.declaration.declarations
+ )
+ || type.declaration
+ )
+ );
+
+ // we tried to find either an interface or a type with the TypeReference name
+ const typeDeclaration = declarations.filter((dec) => dec.id.name === typeName);
+
+ const interfaceDeclarations = this.sourceCode.ast.body
+ .filter(filterInterfaceOrTypeAlias)
+ .filter((item) => filterInterfaceOrAliasByName(item, typeName))
+ .map((item) => (item.declaration || item));
+
+ if (typeDeclaration.length !== 0) {
+ typeDeclaration.map((t) => t.init || t.typeAnnotation).forEach(this.visitTSNode, this);
+ } else if (interfaceDeclarations.length !== 0) {
+ interfaceDeclarations.forEach(this.traverseDeclaredInterfaceOrTypeAlias, this);
+ } else {
+ this.shouldIgnorePropTypes = true;
+ }
+ }
+
+ /**
+ * Traverse TSInterfaceDeclaration and TSTypeAliasDeclaration
+ * which retrieve from function searchDeclarationByName;
+ * @param {ASTNode} node
+ */
+ traverseDeclaredInterfaceOrTypeAlias(node) {
+ if (astUtil.isTSInterfaceDeclaration(node)) {
+ // Handle TSInterfaceDeclaration interface Props { name: string, id: number}, should put in properties list directly;
+ this.foundDeclaredPropertiesList = this.foundDeclaredPropertiesList.concat(node.body.body);
+ }
+ // Handle TSTypeAliasDeclaration type Props = {name:string}
+ if (astUtil.isTSTypeAliasDeclaration(node)) {
+ const typeAnnotation = node.typeAnnotation;
+ this.visitTSNode(typeAnnotation);
+ }
+ if (Array.isArray(node.extends)) {
+ node.extends.forEach((x) => this.visitTSNode(x));
+ // This line is trying to handle typescript-eslint-parser
+ // typescript-eslint-parser extension is name as heritage
+ } else if (Array.isArray(node.heritage)) {
+ node.heritage.forEach((x) => this.visitTSNode(x));
+ }
+ }
+
+ convertIntersectionTypeToPropTypes(node) {
+ if (!node) return;
+ if (Array.isArray(node.types)) {
+ node.types.forEach((x) => this.visitTSNode(x));
+ } else {
+ this.shouldIgnorePropTypes = true;
+ }
+ }
+
+ convertReturnTypeToPropTypes(node, rootNode) {
+ // ReturnType should always have one parameter
+ const nodeTypeArguments = propsUtil.getTypeArguments(node);
+ if (nodeTypeArguments) {
+ if (nodeTypeArguments.params.length === 1) {
+ let returnType = nodeTypeArguments.params[0];
+ // This line is trying to handle typescript-eslint-parser
+ // typescript-eslint-parser TSTypeQuery is wrapped by TSTypeReference
+ if (astUtil.isTSTypeReference(returnType)) {
+ returnType = returnType.typeName;
+ }
+ // Handle ReturnType
+ if (astUtil.isTSTypeQuery(returnType)) {
+ const returnTypeFunction = flatMap(this.sourceCode.ast.body
+ .filter((item) => item.type === 'VariableDeclaration'
+ && item.declarations.find((dec) => dec.id.name === returnType.exprName.name)
+ ), (type) => type.declarations).map((dec) => dec.init);
+
+ if (Array.isArray(returnTypeFunction)) {
+ if (returnTypeFunction.length === 0) {
+ // Cannot find identifier in current scope. It might be an exported type.
+ this.shouldIgnorePropTypes = true;
+ return;
+ }
+ returnTypeFunction.forEach((func) => {
+ if (isFunctionType(func)) {
+ let res = func.body;
+ if (res.type === 'BlockStatement') {
+ res = astUtil.findReturnStatement(func);
+ if (res) {
+ res = res.argument;
+ }
+ }
+ switch (res.type) {
+ case 'ObjectExpression':
+ iterateProperties(context, res.properties, (key, value, propNode) => {
+ if (propNode && astUtil.isCallExpression(propNode.argument)) {
+ const propNodeTypeArguments = propsUtil.getTypeArguments(propNode.argument);
+ if (propNodeTypeArguments) {
+ this.visitTSNode(propNodeTypeArguments);
+ } else {
+ // Ignore this CallExpression return value since it doesn't have any typeParameters to let us know it's types.
+ this.shouldIgnorePropTypes = true;
+ return;
+ }
+ }
+ if (!value) {
+ this.shouldIgnorePropTypes = true;
+ return;
+ }
+ const types = buildReactDeclarationTypes(value, key, rootNode);
+ types.fullName = key;
+ types.name = key;
+ types.node = propNode;
+ types.isRequired = propsUtil.isRequiredPropType(value);
+ this.declaredPropTypes[key] = types;
+ });
+ break;
+ case 'CallExpression':
+ if (propsUtil.getTypeArguments(res)) {
+ this.visitTSNode(propsUtil.getTypeArguments(res));
+ } else {
+ // Ignore this CallExpression return value since it doesn't have any typeParameters to let us know it's types.
+ this.shouldIgnorePropTypes = true;
+ }
+ break;
+ default:
+ }
+ }
+ });
+ return;
+ }
+ }
+ // Handle ReturnType<()=>returnType>
+ if (astUtil.isTSFunctionType(returnType)) {
+ if (astUtil.isTSTypeAnnotation(returnType.returnType)) {
+ this.visitTSNode(returnType.returnType);
+ return;
+ }
+ // This line is trying to handle typescript-eslint-parser
+ // typescript-eslint-parser TSFunction name returnType as typeAnnotation
+ if (astUtil.isTSTypeAnnotation(returnType.typeAnnotation)) {
+ this.visitTSNode(returnType.typeAnnotation);
+ return;
+ }
+ }
+ }
+ }
+ this.shouldIgnorePropTypes = true;
+ }
+
+ endAndStructDeclaredPropTypes() {
+ if (this.shouldSpecifyOptionalChildrenProps) {
+ this.declaredPropTypes.children = {
+ fullName: 'children',
+ name: 'children',
+ isRequired: false,
+ };
+ }
+ if (this.shouldSpecifyClassNameProp) {
+ this.declaredPropTypes.className = {
+ fullName: 'className',
+ name: 'className',
+ isRequired: false,
+ };
+ }
+
+ this.foundDeclaredPropertiesList.forEach((tsInterfaceBody) => {
+ if (tsInterfaceBody && (tsInterfaceBody.type === 'TSPropertySignature' || tsInterfaceBody.type === 'TSMethodSignature')) {
+ let accessor = 'name';
+ if (tsInterfaceBody.key.type === 'Literal') {
+ if (typeof tsInterfaceBody.key.value === 'number') {
+ accessor = 'raw';
+ } else {
+ accessor = 'value';
+ }
+ }
+ this.declaredPropTypes[tsInterfaceBody.key[accessor]] = {
+ fullName: tsInterfaceBody.key[accessor],
+ name: tsInterfaceBody.key[accessor],
+ node: tsInterfaceBody,
+ isRequired: !tsInterfaceBody.optional,
+ };
+ }
+ });
+ }
+ }
+
+ /**
+ * Mark a prop type as declared
+ * @param {ASTNode} node The AST node being checked.
+ * @param {ASTNode} propTypes The AST node containing the proptypes
+ * @param {ASTNode} rootNode
+ */
+ function markPropTypesAsDeclared(node, propTypes, rootNode) {
+ let componentNode = node;
+ while (componentNode && !components.get(componentNode)) {
+ componentNode = componentNode.parent;
+ }
+ const component = components.get(componentNode);
+ let declaredPropTypes = (component && component.declaredPropTypes) || {};
+ let ignorePropsValidation = (component && component.ignorePropsValidation) || false;
+ switch (propTypes && propTypes.type) {
+ case 'ObjectTypeAnnotation':
+ ignorePropsValidation = declarePropTypesForObjectTypeAnnotation(propTypes, declaredPropTypes);
+ break;
+ case 'ObjectExpression':
+ iterateProperties(context, propTypes.properties, (key, value, propNode) => {
+ if (!value) {
+ ignorePropsValidation = true;
+ return;
+ }
+ const types = buildReactDeclarationTypes(value, key, rootNode);
+ types.fullName = key;
+ types.name = key;
+ types.node = propNode;
+ types.isRequired = propsUtil.isRequiredPropType(value);
+ declaredPropTypes[key] = types;
+ });
+ break;
+ case 'MemberExpression': {
+ let curDeclaredPropTypes = declaredPropTypes;
+ // Walk the list of properties, until we reach the assignment
+ // ie: ClassX.propTypes.a.b.c = ...
+ while (
+ propTypes
+ && propTypes.parent
+ && propTypes.parent.type !== 'AssignmentExpression'
+ && propTypes.property
+ && curDeclaredPropTypes
+ ) {
+ const propName = propTypes.property.name;
+ if (propName in curDeclaredPropTypes) {
+ curDeclaredPropTypes = curDeclaredPropTypes[propName].children;
+ propTypes = propTypes.parent;
+ } else {
+ // This will crash at runtime because we haven't seen this key before
+ // stop this and do not declare it
+ propTypes = null;
+ }
+ }
+ if (propTypes && propTypes.parent && propTypes.property) {
+ if (!(propTypes === propTypes.parent.left && propTypes.parent.left.object)) {
+ ignorePropsValidation = true;
+ break;
+ }
+ const parentProp = getText(context, propTypes.parent.left.object).replace(/^.*\.propTypes\./, '');
+ const types = buildReactDeclarationTypes(
+ propTypes.parent.right,
+ parentProp,
+ rootNode
+ );
+
+ types.name = propTypes.property.name;
+ types.fullName = [parentProp, propTypes.property.name].join('.');
+ types.node = propTypes.parent;
+ types.isRequired = propsUtil.isRequiredPropType(propTypes.parent.right);
+ curDeclaredPropTypes[propTypes.property.name] = types;
+ } else {
+ let isUsedInPropTypes = false;
+ let n = propTypes;
+ while (n) {
+ if (((n.type === 'AssignmentExpression') && propsUtil.isPropTypesDeclaration(n.left))
+ || ((n.type === 'ClassProperty' || n.type === 'PropertyDefinition' || n.type === 'Property') && propsUtil.isPropTypesDeclaration(n))) {
+ // Found a propType used inside of another propType. This is not considered usage, we'll still validate
+ // this component.
+ isUsedInPropTypes = true;
+ break;
+ }
+ n = n.parent;
+ }
+ if (!isUsedInPropTypes) {
+ ignorePropsValidation = true;
+ }
+ }
+ break;
+ }
+ case 'Identifier': {
+ const firstMatchingVariable = variableUtil.getVariableFromContext(context, node, propTypes.name);
+ if (firstMatchingVariable) {
+ const defInScope = firstMatchingVariable.defs[firstMatchingVariable.defs.length - 1];
+ markPropTypesAsDeclared(node, defInScope.node && defInScope.node.init, rootNode);
+ return;
+ }
+ ignorePropsValidation = true;
+ break;
+ }
+ case 'CallExpression': {
+ if (
+ propWrapperUtil.isPropWrapperFunction(
+ context,
+ getText(context, propTypes.callee)
+ )
+ && propTypes.arguments && propTypes.arguments[0]
+ ) {
+ markPropTypesAsDeclared(node, propTypes.arguments[0], rootNode);
+ return;
+ }
+ break;
+ }
+ case 'IntersectionTypeAnnotation':
+ ignorePropsValidation = declarePropTypesForIntersectionTypeAnnotation(propTypes, declaredPropTypes);
+ break;
+ case 'GenericTypeAnnotation':
+ if (propTypes.id.name === '$ReadOnly') {
+ const propTypeArguments = propsUtil.getTypeArguments(propTypes);
+ ignorePropsValidation = declarePropTypesForObjectTypeAnnotation(
+ propTypeArguments.params[0],
+ declaredPropTypes
+ );
+ } else {
+ ignorePropsValidation = true;
+ }
+ break;
+ case 'TSTypeReference':
+ case 'TSTypeAnnotation': {
+ const tsTypeAnnotation = new DeclarePropTypesForTSTypeAnnotation(propTypes, declaredPropTypes, rootNode);
+ ignorePropsValidation = tsTypeAnnotation.shouldIgnorePropTypes;
+ declaredPropTypes = tsTypeAnnotation.declaredPropTypes;
+ }
+ break;
+ case null:
+ break;
+ default:
+ ignorePropsValidation = true;
+ break;
+ }
+
+ components.set(node, {
+ declaredPropTypes,
+ ignorePropsValidation,
+ });
+ }
+
+ /**
+ * @param {ASTNode} node We expect either an ArrowFunctionExpression,
+ * FunctionDeclaration, or FunctionExpression
+ * @param {ASTNode} rootNode
+ */
+ function markAnnotatedFunctionArgumentsAsDeclared(node, rootNode) {
+ if (!node.params || !node.params.length) {
+ return;
+ }
+
+ let propTypesArguments = null;
+ if (node.parent) {
+ propTypesArguments = propsUtil.getTypeArguments(node.parent);
+ }
+
+ if (
+ node.parent
+ && node.parent.callee
+ && propTypesArguments
+ && propTypesArguments.params
+ && (
+ node.parent.callee.name === 'forwardRef' || (
+ node.parent.callee.object
+ && node.parent.callee.property
+ && node.parent.callee.object.name === 'React'
+ && node.parent.callee.property.name === 'forwardRef'
+ )
+ )
+ ) {
+ const declaredPropTypes = {};
+ const obj = new DeclarePropTypesForTSTypeAnnotation(propTypesArguments.params[1], declaredPropTypes, rootNode);
+ components.set(node, {
+ declaredPropTypes: obj.declaredPropTypes,
+ ignorePropsValidation: obj.shouldIgnorePropTypes,
+ });
+ return;
+ }
+
+ const siblingIdentifier = node.parent && node.parent.id;
+ const siblingHasTypeAnnotation = siblingIdentifier && siblingIdentifier.typeAnnotation;
+ const isNodeAnnotated = annotations.isAnnotatedFunctionPropsDeclaration(node, context);
+
+ if (!isNodeAnnotated && !siblingHasTypeAnnotation) {
+ return;
+ }
+
+ // https://github.com/jsx-eslint/eslint-plugin-react/issues/2784
+ if (isInsideClassBody(node) && !astUtil.isFunction(node)) {
+ return;
+ }
+
+ // Should ignore function that not return JSXElement
+ if (!utils.isReturningJSXOrNull(node) || startWithCapitalizedLetter(node)) {
+ return;
+ }
+
+ if (isNodeAnnotated) {
+ const param = node.params[0];
+ if (param.typeAnnotation && param.typeAnnotation.typeAnnotation && param.typeAnnotation.typeAnnotation.type === 'UnionTypeAnnotation') {
+ param.typeAnnotation.typeAnnotation.types.forEach((annotation) => {
+ if (annotation.type === 'GenericTypeAnnotation') {
+ markPropTypesAsDeclared(node, resolveTypeAnnotation(annotation), rootNode);
+ } else {
+ markPropTypesAsDeclared(node, annotation, rootNode);
+ }
+ });
+ } else {
+ markPropTypesAsDeclared(node, resolveTypeAnnotation(param), rootNode);
+ }
+ } else {
+ // implements what's discussed here: https://github.com/jsx-eslint/eslint-plugin-react/issues/2777#issuecomment-683944481
+ const annotation = siblingIdentifier.typeAnnotation.typeAnnotation;
+
+ if (
+ annotation
+ && annotation.type !== 'TSTypeReference'
+ && propsUtil.getTypeArguments(annotation) == null
+ ) {
+ return;
+ }
+
+ if (!isValidReactGenericTypeAnnotation(annotation)) return;
+
+ markPropTypesAsDeclared(node, resolveTypeAnnotation(siblingIdentifier), rootNode);
+ }
+ }
+
+ /**
+ * Resolve the type annotation for a given class declaration node.
+ *
+ * @param {ASTNode} node The annotation or a node containing the type annotation.
+ * @returns {ASTNode} The resolved type annotation for the node.
+ */
+ function resolveSuperParameterPropsType(node) {
+ let propsParameterPosition;
+ const parameters = propsUtil.getSuperTypeArguments(node);
+
+ try {
+ // Flow <=0.52 had 3 required TypedParameters of which the second one is the Props.
+ // Flow >=0.53 has 2 optional TypedParameters of which the first one is the Props.
+ propsParameterPosition = testFlowVersion(context, '>= 0.53.0') ? 0 : 1;
+ } catch (e) {
+ // In case there is no flow version defined, we can safely assume that when there are 3 Props we are dealing with version <= 0.52
+ propsParameterPosition = parameters.params.length <= 2 ? 0 : 1;
+ }
+
+ let annotation = parameters.params[propsParameterPosition];
+ while (annotation && (annotation.type === 'TypeAnnotation' || annotation.type === 'NullableTypeAnnotation')) {
+ annotation = annotation.typeAnnotation;
+ }
+
+ if (annotation && annotation.type === 'GenericTypeAnnotation' && getInTypeScope(annotation.id.name)) {
+ return getInTypeScope(annotation.id.name);
+ }
+ return annotation;
+ }
+
+ /**
+ * Checks if we are declaring a `props` class property with a flow type annotation.
+ * @param {ASTNode} node The AST node being checked.
+ * @returns {boolean} True if the node is a type annotated props declaration, false if not.
+ */
+ function isAnnotatedClassPropsDeclaration(node) {
+ if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) {
+ const tokens = getFirstTokens(context, node, 2);
+ if (
+ node.typeAnnotation && (
+ tokens[0].value === 'props'
+ || (tokens[1] && tokens[1].value === 'props')
+ )
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ return {
+ ClassExpression(node) {
+ // TypeParameterDeclaration need to be added to typeScope in order to handle ClassExpressions.
+ // This visitor is executed before TypeParameterDeclaration are scoped, therefore we postpone
+ // processing class expressions until when the program exists.
+ classExpressions.push(node);
+ },
+
+ ClassDeclaration(node) {
+ if (isSuperTypeParameterPropsDeclaration(node)) {
+ markPropTypesAsDeclared(node, resolveSuperParameterPropsType(node), node);
+ }
+ },
+
+ 'ClassProperty, PropertyDefinition'(node) {
+ if (isAnnotatedClassPropsDeclaration(node)) {
+ markPropTypesAsDeclared(node, resolveTypeAnnotation(node), node);
+ } else if (propsUtil.isPropTypesDeclaration(node)) {
+ markPropTypesAsDeclared(node, node.value, node);
+ }
+ },
+
+ ObjectExpression(node) {
+ // Search for the proptypes declaration
+ node.properties.forEach((property) => {
+ if (!propsUtil.isPropTypesDeclaration(property)) {
+ return;
+ }
+ markPropTypesAsDeclared(node, property.value, node);
+ });
+ },
+
+ FunctionExpression(node) {
+ if (node.parent.type !== 'MethodDefinition') {
+ markAnnotatedFunctionArgumentsAsDeclared(node, node);
+ }
+ },
+
+ ImportDeclaration(node) {
+ // parse `import ... from 'react`
+ if (node.source.value === 'react') {
+ node.specifiers.forEach((specifier) => {
+ if (
+ // handles import * as X from 'react'
+ specifier.type === 'ImportNamespaceSpecifier'
+ // handles import React from 'react'
+ || specifier.type === 'ImportDefaultSpecifier'
+ ) {
+ genericReactTypesImport.add(specifier.local.name);
+ }
+
+ // handles import { FC } from 'react' or import { FC as X } from 'react'
+ if (specifier.type === 'ImportSpecifier' && allowedGenericTypes.has(specifier.imported.name)) {
+ genericReactTypesImport.add(specifier.local.name);
+ localToImportedMap[specifier.local.name] = specifier.imported.name;
+ }
+ });
+ }
+ },
+
+ FunctionDeclaration: markAnnotatedFunctionArgumentsAsDeclared,
+
+ ArrowFunctionExpression: markAnnotatedFunctionArgumentsAsDeclared,
+
+ MemberExpression(node) {
+ if (propsUtil.isPropTypesDeclaration(node)) {
+ const component = utils.getRelatedComponent(node);
+ if (!component) {
+ return;
+ }
+ try {
+ markPropTypesAsDeclared(component.node, node.parent.right || node.parent, node);
+ } catch (e) {
+ if (e.constructor !== RangeError) { throw e; }
+ }
+ }
+ },
+
+ MethodDefinition(node) {
+ if (!node.static || node.kind !== 'get' || !propsUtil.isPropTypesDeclaration(node)) {
+ return;
+ }
+
+ let i = node.value.body.body.length - 1;
+ for (; i >= 0; i--) {
+ if (node.value.body.body[i].type === 'ReturnStatement') {
+ break;
+ }
+ }
+
+ if (i >= 0) {
+ markPropTypesAsDeclared(node, node.value.body.body[i].argument, node);
+ }
+ },
+
+ TypeAlias(node) {
+ setInTypeScope(node.id.name, node.right);
+ },
+
+ TypeParameterDeclaration(node) {
+ const identifier = node.params[0];
+
+ if (identifier.typeAnnotation) {
+ setInTypeScope(identifier.name, identifier.typeAnnotation.typeAnnotation);
+ }
+ },
+
+ Program() {
+ stack = [{}];
+ },
+
+ BlockStatement() {
+ stack.push(Object.create(typeScope()));
+ },
+
+ 'BlockStatement:exit'() {
+ stack.pop();
+ },
+
+ 'Program:exit'() {
+ classExpressions.forEach((node) => {
+ if (isSuperTypeParameterPropsDeclaration(node)) {
+ markPropTypesAsDeclared(node, resolveSuperParameterPropsType(node), node);
+ }
+ });
+ },
+ };
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts b/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..01c2d4006281551b4a22ae9eb3a7c7062734bb28
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts
@@ -0,0 +1,40 @@
+/**
+ * Fixes sort order of prop types.
+ *
+ * @param {Context} context the second element to compare.
+ * @param {Fixer} fixer the first element to compare.
+ * @param {Array} declarations The context of the two nodes.
+ * @param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
+ * @param {boolean=} requiredFirst whether or not to sort required elements first.
+ * @param {boolean=} callbacksLast whether or not to sort callbacks after everything else.
+ * @param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.
+ * @param {boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape.
+ * @param {boolean=} checkTypes whether or not sorting of prop type definitions are checked.
+ * @returns {Object|*|{range, text}} the sort order of the two elements.
+ */
+export function fixPropTypesSort(context: Context, fixer: Fixer, declarations: any[], ignoreCase?: boolean | undefined, requiredFirst?: boolean | undefined, callbacksLast?: boolean | undefined, noSortAlphabetically?: boolean | undefined, sortShapeProp?: boolean | undefined, checkTypes?: boolean | undefined): any | any | {
+ range;
+ text;
+};
+/**
+ * Checks if the proptype is a callback by checking if it starts with 'on'.
+ *
+ * @param {string} propName the name of the proptype to check.
+ * @returns {boolean} true if the proptype is a callback.
+ */
+export function isCallbackPropName(propName: string): boolean;
+/**
+ * Checks if the prop is required or not.
+ *
+ * @param {ASTNode} node the prop to check.
+ * @returns {boolean} true if the prop is required.
+ */
+export function isRequiredProp(node: ASTNode): boolean;
+/**
+ * Checks if the prop is PropTypes.shape.
+ *
+ * @param {ASTNode} node the prop to check.
+ * @returns {boolean} true if the prop is PropTypes.shape.
+ */
+export function isShapeProp(node: ASTNode): boolean;
+//# sourceMappingURL=propTypesSort.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts.map b/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..e9c8efbc3ed073421a433c34d7f48772aff0bd3f
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propTypesSort.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"propTypesSort.d.ts","sourceRoot":"","sources":["propTypesSort.js"],"names":[],"mappings":"AA4HA;;;;;;;;;;;;;GAaG;AACH,0CAXW,OAAO,SACP,KAAK,oCAEL,OAAO,8BACP,OAAO,8BACP,OAAO,qCACP,OAAO,8BACP,OAAO,2BACP,OAAO,eACL,YAAS;IAAC,KAAK,CAAC;IAAC,IAAI,CAAA;CAAC,CAyFlC;AA7LD;;;;;GAKG;AACH,6CAHW,MAAM,GACJ,OAAO,CAInB;AAlBD;;;;;GAKG;AACH,qCAHW,OAAO,GACL,OAAO,CAInB;AAYD;;;;;GAKG;AACH,kCAHW,OAAO,GACL,OAAO,CASnB"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/propTypesSort.js b/node_modules/eslint-plugin-react/lib/util/propTypesSort.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b42904c63ad1d7d854a76b20855c56244a860c4
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propTypesSort.js
@@ -0,0 +1,233 @@
+/**
+ * @fileoverview Common propTypes sorting functionality.
+ */
+
+'use strict';
+
+const toSorted = require('array.prototype.tosorted');
+
+const astUtil = require('./ast');
+const eslintUtil = require('./eslint');
+
+const getSourceCode = eslintUtil.getSourceCode;
+const getText = eslintUtil.getText;
+
+/**
+ * Returns the value name of a node.
+ *
+ * @param {ASTNode} node the node to check.
+ * @returns {string} The name of the node.
+ */
+function getValueName(node) {
+ return node.type === 'Property'
+ && node.value.property
+ && node.value.property.name;
+}
+
+/**
+ * Checks if the prop is required or not.
+ *
+ * @param {ASTNode} node the prop to check.
+ * @returns {boolean} true if the prop is required.
+ */
+function isRequiredProp(node) {
+ return getValueName(node) === 'isRequired';
+}
+
+/**
+ * Checks if the proptype is a callback by checking if it starts with 'on'.
+ *
+ * @param {string} propName the name of the proptype to check.
+ * @returns {boolean} true if the proptype is a callback.
+ */
+function isCallbackPropName(propName) {
+ return /^on[A-Z]/.test(propName);
+}
+
+/**
+ * Checks if the prop is PropTypes.shape.
+ *
+ * @param {ASTNode} node the prop to check.
+ * @returns {boolean} true if the prop is PropTypes.shape.
+ */
+function isShapeProp(node) {
+ return !!(
+ node
+ && node.callee
+ && node.callee.property
+ && node.callee.property.name === 'shape'
+ );
+}
+
+/**
+ * Returns the properties of a PropTypes.shape.
+ *
+ * @param {ASTNode} node the prop to check.
+ * @returns {Array} the properties of the PropTypes.shape node.
+ */
+function getShapeProperties(node) {
+ return node.arguments
+ && node.arguments[0]
+ && node.arguments[0].properties;
+}
+
+/**
+ * Compares two elements.
+ *
+ * @param {ASTNode} a the first element to compare.
+ * @param {ASTNode} b the second element to compare.
+ * @param {Context} context The context of the two nodes.
+ * @param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
+ * @param {boolean=} requiredFirst whether or not to sort required elements first.
+ * @param {boolean=} callbacksLast whether or not to sort callbacks after everything else.
+ * @param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.
+ * @returns {number} the sort order of the two elements.
+ */
+function sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically) {
+ const aKey = String(astUtil.getKeyValue(context, a));
+ const bKey = String(astUtil.getKeyValue(context, b));
+
+ if (requiredFirst) {
+ if (isRequiredProp(a) && !isRequiredProp(b)) {
+ return -1;
+ }
+ if (!isRequiredProp(a) && isRequiredProp(b)) {
+ return 1;
+ }
+ }
+
+ if (callbacksLast) {
+ if (isCallbackPropName(aKey) && !isCallbackPropName(bKey)) {
+ return 1;
+ }
+ if (!isCallbackPropName(aKey) && isCallbackPropName(bKey)) {
+ return -1;
+ }
+ }
+
+ if (!noSortAlphabetically) {
+ if (ignoreCase) {
+ return aKey.localeCompare(bKey);
+ }
+
+ if (aKey < bKey) {
+ return -1;
+ }
+ if (aKey > bKey) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+const commentnodeMap = new WeakMap(); // all nodes reference WeakMap for start and end range
+
+/**
+ * Fixes sort order of prop types.
+ *
+ * @param {Context} context the second element to compare.
+ * @param {Fixer} fixer the first element to compare.
+ * @param {Array} declarations The context of the two nodes.
+ * @param {boolean=} ignoreCase whether or not to ignore case when comparing the two elements.
+ * @param {boolean=} requiredFirst whether or not to sort required elements first.
+ * @param {boolean=} callbacksLast whether or not to sort callbacks after everything else.
+ * @param {boolean=} noSortAlphabetically whether or not to disable alphabetical sorting of the elements.
+ * @param {boolean=} sortShapeProp whether or not to sort propTypes defined in PropTypes.shape.
+ * @param {boolean=} checkTypes whether or not sorting of prop type definitions are checked.
+ * @returns {Object|*|{range, text}} the sort order of the two elements.
+ */
+function fixPropTypesSort(
+ context,
+ fixer,
+ declarations,
+ ignoreCase,
+ requiredFirst,
+ callbacksLast,
+ noSortAlphabetically,
+ sortShapeProp,
+ checkTypes
+) {
+ function sortInSource(allNodes, source) {
+ const originalSource = source;
+ const sourceCode = getSourceCode(context);
+ for (let i = 0; i < allNodes.length; i++) {
+ const node = allNodes[i];
+ let commentAfter = [];
+ let commentBefore = [];
+ let newStart = 0;
+ let newEnd = 0;
+ try {
+ commentBefore = sourceCode.getCommentsBefore(node);
+ commentAfter = sourceCode.getCommentsAfter(node);
+ } catch (e) { /**/ }
+
+ if (commentAfter.length === 0 || commentBefore.length === 0) {
+ newStart = node.range[0];
+ newEnd = node.range[1];
+ }
+
+ const firstCommentBefore = commentBefore[0];
+ if (commentBefore.length >= 1) {
+ newStart = firstCommentBefore.range[0];
+ }
+ const lastCommentAfter = commentAfter[commentAfter.length - 1];
+ if (commentAfter.length >= 1) {
+ newEnd = lastCommentAfter.range[1];
+ }
+ commentnodeMap.set(node, { start: newStart, end: newEnd, hasComment: true });
+ }
+ const nodeGroups = allNodes.reduce((acc, curr) => {
+ if (curr.type === 'ExperimentalSpreadProperty' || curr.type === 'SpreadElement') {
+ acc.push([]);
+ } else {
+ acc[acc.length - 1].push(curr);
+ }
+ return acc;
+ }, [[]]);
+
+ nodeGroups.forEach((nodes) => {
+ const sortedAttributes = toSorted(
+ nodes,
+ (a, b) => sorter(a, b, context, ignoreCase, requiredFirst, callbacksLast, noSortAlphabetically)
+ );
+
+ const sourceCodeText = getText(context);
+ let separator = '';
+ source = nodes.reduceRight((acc, attr, index) => {
+ const sortedAttr = sortedAttributes[index];
+ const commentNode = commentnodeMap.get(sortedAttr);
+ let sortedAttrText = sourceCodeText.slice(commentNode.start, commentNode.end);
+ const sortedAttrTextLastChar = sortedAttrText[sortedAttrText.length - 1];
+ if (!separator && [';', ','].some((allowedSep) => sortedAttrTextLastChar === allowedSep)) {
+ separator = sortedAttrTextLastChar;
+ }
+ if (sortShapeProp && isShapeProp(sortedAttr.value)) {
+ const shape = getShapeProperties(sortedAttr.value);
+ if (shape) {
+ const attrSource = sortInSource(
+ shape,
+ originalSource
+ );
+ sortedAttrText = attrSource.slice(sortedAttr.range[0], sortedAttr.range[1]);
+ }
+ }
+ const sortedAttrTextVal = checkTypes && !sortedAttrText.endsWith(separator) ? `${sortedAttrText}${separator}` : sortedAttrText;
+ return `${acc.slice(0, commentnodeMap.get(attr).start)}${sortedAttrTextVal}${acc.slice(commentnodeMap.get(attr).end)}`;
+ }, source);
+ });
+ return source;
+ }
+
+ const source = sortInSource(declarations, getText(context));
+
+ const rangeStart = commentnodeMap.get(declarations[0]).start;
+ const rangeEnd = commentnodeMap.get(declarations[declarations.length - 1]).end;
+ return fixer.replaceTextRange([rangeStart, rangeEnd], source.slice(rangeStart, rangeEnd));
+}
+
+module.exports = {
+ fixPropTypesSort,
+ isCallbackPropName,
+ isRequiredProp,
+ isShapeProp,
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts b/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..74e8cca7ffa877ef47aac67aaec612d430a961ac
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts
@@ -0,0 +1,6 @@
+export function formatPropWrapperFunctions(propWrapperFunctions: any): string;
+export function getExactPropWrapperFunctions(context: any): Set;
+export function getPropWrapperFunctions(context: any): Set;
+export function isExactPropWrapperFunction(context: any, name: any): any;
+export function isPropWrapperFunction(context: any, name: any): any;
+//# sourceMappingURL=propWrapper.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts.map b/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..adf81d91e5cd5c7c172b1c476e0afecc37806080
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propWrapper.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"propWrapper.d.ts","sourceRoot":"","sources":["propWrapper.js"],"names":[],"mappings":"AA0CA,8EAUC;AArBD,qEAIC;AAhBD,gEAEC;AAgBD,yEAGC;AAjBD,oEAMC"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/propWrapper.js b/node_modules/eslint-plugin-react/lib/util/propWrapper.js
new file mode 100644
index 0000000000000000000000000000000000000000..66dac8803d1123db917fec53e5c86d4b34e8479e
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/propWrapper.js
@@ -0,0 +1,61 @@
+/**
+ * @fileoverview Utility functions for propWrapperFunctions setting
+ */
+
+'use strict';
+
+const filter = require('es-iterator-helpers/Iterator.prototype.filter');
+const some = require('es-iterator-helpers/Iterator.prototype.some');
+
+function searchPropWrapperFunctions(name, propWrapperFunctions) {
+ const splitName = name.split('.');
+ return some(propWrapperFunctions.values(), (func) => {
+ if (splitName.length === 2 && func.object === splitName[0] && func.property === splitName[1]) {
+ return true;
+ }
+ return name === func || func.property === name;
+ });
+}
+
+function getPropWrapperFunctions(context) {
+ return new Set(context.settings.propWrapperFunctions || []);
+}
+
+function isPropWrapperFunction(context, name) {
+ if (typeof name !== 'string') {
+ return false;
+ }
+ const propWrapperFunctions = getPropWrapperFunctions(context);
+ return searchPropWrapperFunctions(name, propWrapperFunctions);
+}
+
+function getExactPropWrapperFunctions(context) {
+ const propWrapperFunctions = getPropWrapperFunctions(context);
+ const exactPropWrappers = filter(propWrapperFunctions.values(), (func) => func.exact === true);
+ return new Set(exactPropWrappers);
+}
+
+function isExactPropWrapperFunction(context, name) {
+ const exactPropWrappers = getExactPropWrapperFunctions(context);
+ return searchPropWrapperFunctions(name, exactPropWrappers);
+}
+
+function formatPropWrapperFunctions(propWrapperFunctions) {
+ return Array.from(propWrapperFunctions, (func) => {
+ if (func.object && func.property) {
+ return `'${func.object}.${func.property}'`;
+ }
+ if (func.property) {
+ return `'${func.property}'`;
+ }
+ return `'${func}'`;
+ }).join(', ');
+}
+
+module.exports = {
+ formatPropWrapperFunctions,
+ getExactPropWrapperFunctions,
+ getPropWrapperFunctions,
+ isExactPropWrapperFunction,
+ isPropWrapperFunction,
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/props.d.ts b/node_modules/eslint-plugin-react/lib/util/props.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..40bea76d4e62fc0276fceace45b04a0418b20755
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/props.d.ts
@@ -0,0 +1,55 @@
+/**
+ * Checks if the Identifier node passed in looks like a propTypes declaration.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @returns {boolean} `true` if the node is a propTypes declaration, `false` if not
+ */
+export function isPropTypesDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if the node passed in looks like a contextTypes declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a contextTypes declaration, `false` if not
+ */
+export function isContextTypesDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if the node passed in looks like a contextType declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a contextType declaration, `false` if not
+ */
+export function isContextTypeDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if the node passed in looks like a childContextTypes declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a childContextTypes declaration, `false` if not
+ */
+export function isChildContextTypesDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if the Identifier node passed in looks like a defaultProps declaration.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not
+ */
+export function isDefaultPropsDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if we are declaring a display name
+ * @param {ASTNode} node The AST node being checked.
+ * @returns {boolean} True if we are declaring a display name, false if not.
+ */
+export function isDisplayNameDeclaration(node: ASTNode): boolean;
+/**
+ * Checks if the PropTypes MemberExpression node passed in declares a required propType.
+ * @param {ASTNode} propTypeExpression node to check. Must be a `PropTypes` MemberExpression.
+ * @returns {boolean} `true` if this PropType is required, `false` if not.
+ */
+export function isRequiredPropType(propTypeExpression: ASTNode): boolean;
+/**
+ * Returns the type arguments of a node or type parameters if type arguments are not available.
+ * @param {ASTNode} node The node to get the type arguments from.
+ * @returns {ASTNode} The type arguments or type parameters of the node.
+ */
+export function getTypeArguments(node: ASTNode): ASTNode;
+/**
+ * Returns the super type arguments of a node or super type parameters if type arguments are not available.
+ * @param {ASTNode} node The node to get the super type arguments from.
+ * @returns {ASTNode} The super type arguments or parameters of the node.
+ */
+export function getSuperTypeArguments(node: ASTNode): ASTNode;
+//# sourceMappingURL=props.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/props.d.ts.map b/node_modules/eslint-plugin-react/lib/util/props.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..cc23fd7eeecc17ff577df07a82090831243b9dd1
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/props.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["props.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,6CAHW,OAAO,GACL,OAAO,CAUnB;AAED;;;;GAIG;AACH,gDAHW,OAAO,GACL,OAAO,CAUnB;AAED;;;;GAIG;AACH,+CAHW,OAAO,GACL,OAAO,CAInB;AAED;;;;GAIG;AACH,qDAHW,OAAO,GACL,OAAO,CAInB;AAED;;;;GAIG;AACH,gDAHW,OAAO,GACL,OAAO,CAKnB;AAED;;;;GAIG;AACH,+CAHW,OAAO,GACL,OAAO,CAcnB;AAED;;;;GAIG;AACH,uDAHW,OAAO,GACL,OAAO,CAKnB;AAED;;;;GAIG;AACH,uCAHW,OAAO,GACL,OAAO,CAOnB;AAED;;;;GAIG;AACH,4CAHW,OAAO,GACL,OAAO,CAOnB"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/props.js b/node_modules/eslint-plugin-react/lib/util/props.js
new file mode 100644
index 0000000000000000000000000000000000000000..ac4ed8703bc7be88616051226aeb9c0eaf3a20e6
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/props.js
@@ -0,0 +1,130 @@
+/**
+ * @fileoverview Utility functions for props
+ */
+
+'use strict';
+
+const astUtil = require('./ast');
+
+/**
+ * Checks if the Identifier node passed in looks like a propTypes declaration.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @returns {boolean} `true` if the node is a propTypes declaration, `false` if not
+ */
+function isPropTypesDeclaration(node) {
+ if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) {
+ // Flow support
+ if (node.typeAnnotation && node.key.name === 'props') {
+ return true;
+ }
+ }
+ return astUtil.getPropertyName(node) === 'propTypes';
+}
+
+/**
+ * Checks if the node passed in looks like a contextTypes declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a contextTypes declaration, `false` if not
+ */
+function isContextTypesDeclaration(node) {
+ if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) {
+ // Flow support
+ if (node.typeAnnotation && node.key.name === 'context') {
+ return true;
+ }
+ }
+ return astUtil.getPropertyName(node) === 'contextTypes';
+}
+
+/**
+ * Checks if the node passed in looks like a contextType declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a contextType declaration, `false` if not
+ */
+function isContextTypeDeclaration(node) {
+ return astUtil.getPropertyName(node) === 'contextType';
+}
+
+/**
+ * Checks if the node passed in looks like a childContextTypes declaration.
+ * @param {ASTNode} node The node to check.
+ * @returns {boolean} `true` if the node is a childContextTypes declaration, `false` if not
+ */
+function isChildContextTypesDeclaration(node) {
+ return astUtil.getPropertyName(node) === 'childContextTypes';
+}
+
+/**
+ * Checks if the Identifier node passed in looks like a defaultProps declaration.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not
+ */
+function isDefaultPropsDeclaration(node) {
+ const propName = astUtil.getPropertyName(node);
+ return (propName === 'defaultProps' || propName === 'getDefaultProps');
+}
+
+/**
+ * Checks if we are declaring a display name
+ * @param {ASTNode} node The AST node being checked.
+ * @returns {boolean} True if we are declaring a display name, false if not.
+ */
+function isDisplayNameDeclaration(node) {
+ switch (node.type) {
+ case 'ClassProperty':
+ case 'PropertyDefinition':
+ return node.key && node.key.name === 'displayName';
+ case 'Identifier':
+ return node.name === 'displayName';
+ case 'Literal':
+ return node.value === 'displayName';
+ default:
+ return false;
+ }
+}
+
+/**
+ * Checks if the PropTypes MemberExpression node passed in declares a required propType.
+ * @param {ASTNode} propTypeExpression node to check. Must be a `PropTypes` MemberExpression.
+ * @returns {boolean} `true` if this PropType is required, `false` if not.
+ */
+function isRequiredPropType(propTypeExpression) {
+ return propTypeExpression.type === 'MemberExpression'
+ && propTypeExpression.property.name === 'isRequired';
+}
+
+/**
+ * Returns the type arguments of a node or type parameters if type arguments are not available.
+ * @param {ASTNode} node The node to get the type arguments from.
+ * @returns {ASTNode} The type arguments or type parameters of the node.
+ */
+function getTypeArguments(node) {
+ if ('typeArguments' in node) {
+ return node.typeArguments;
+ }
+ return node.typeParameters;
+}
+
+/**
+ * Returns the super type arguments of a node or super type parameters if type arguments are not available.
+ * @param {ASTNode} node The node to get the super type arguments from.
+ * @returns {ASTNode} The super type arguments or parameters of the node.
+ */
+function getSuperTypeArguments(node) {
+ if ('superTypeArguments' in node) {
+ return node.superTypeArguments;
+ }
+ return node.superTypeParameters;
+}
+
+module.exports = {
+ isPropTypesDeclaration,
+ isContextTypesDeclaration,
+ isContextTypeDeclaration,
+ isChildContextTypesDeclaration,
+ isDefaultPropsDeclaration,
+ isDisplayNameDeclaration,
+ isRequiredPropType,
+ getTypeArguments,
+ getSuperTypeArguments,
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/report.d.ts b/node_modules/eslint-plugin-react/lib/util/report.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..306332c3cb4431b7642f79262028678e2db4e17a
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/report.d.ts
@@ -0,0 +1,3 @@
+declare function _exports(context: any, message: any, messageId: any, data: any): void;
+export = _exports;
+//# sourceMappingURL=report.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/report.d.ts.map b/node_modules/eslint-plugin-react/lib/util/report.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..01007c159f22c06bec55df3b2048434528aa4e01
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/report.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["report.js"],"names":[],"mappings":"AAIiB,uFAOhB"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/report.js b/node_modules/eslint-plugin-react/lib/util/report.js
new file mode 100644
index 0000000000000000000000000000000000000000..9c10a13501e99cf28abe2c2c812960aae646efc9
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/report.js
@@ -0,0 +1,12 @@
+'use strict';
+
+const getMessageData = require('./message');
+
+module.exports = function report(context, message, messageId, data) {
+ context.report(
+ Object.assign(
+ getMessageData(messageId, message),
+ data
+ )
+ );
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9e3c1a98cc70e0eadb2111abba0b8225df679fa7
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts
@@ -0,0 +1,15 @@
+declare function _exports(context: any, components: any, utils: any): {
+ VariableDeclarator(node: any): void;
+ FunctionDeclaration: (node: ASTNode) => void;
+ ArrowFunctionExpression: (node: ASTNode) => void;
+ FunctionExpression: (node: ASTNode) => void;
+ 'FunctionDeclaration:exit': () => void;
+ 'ArrowFunctionExpression:exit': () => void;
+ 'FunctionExpression:exit': () => void;
+ JSXSpreadAttribute(node: any): void;
+ 'MemberExpression, OptionalMemberExpression'(node: any): void;
+ ObjectPattern(node: any): void;
+ 'Program:exit'(): void;
+};
+export = _exports;
+//# sourceMappingURL=usedPropTypes.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts.map b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..eea2ef9a0fbee6f6969cd3642b209a6e23fa9593
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"usedPropTypes.d.ts","sourceRoot":"","sources":["usedPropTypes.js"],"names":[],"mappings":"AAiTiB;;gCA2JJ,OAAO;oCAAP,OAAO;+BAAP,OAAO;;;;;;;;EA2HnB"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js
new file mode 100644
index 0000000000000000000000000000000000000000..41eb307d6bd5d7533b4d453f074ec63d9675cbb0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/usedPropTypes.js
@@ -0,0 +1,584 @@
+/**
+ * @fileoverview Common used propTypes detection functionality.
+ */
+
+'use strict';
+
+const values = require('object.values');
+
+const astUtil = require('./ast');
+const componentUtil = require('./componentUtil');
+const testReactVersion = require('./version').testReactVersion;
+const ast = require('./ast');
+const eslintUtil = require('./eslint');
+
+const getScope = eslintUtil.getScope;
+const getSourceCode = eslintUtil.getSourceCode;
+
+// ------------------------------------------------------------------------------
+// Constants
+// ------------------------------------------------------------------------------
+
+const LIFE_CYCLE_METHODS = ['componentWillReceiveProps', 'shouldComponentUpdate', 'componentWillUpdate', 'componentDidUpdate'];
+const ASYNC_SAFE_LIFE_CYCLE_METHODS = ['getDerivedStateFromProps', 'getSnapshotBeforeUpdate', 'UNSAFE_componentWillReceiveProps', 'UNSAFE_componentWillUpdate'];
+
+function createPropVariables() {
+ /** @type {Map} Maps the variable to its definition. `props.a.b` is stored as `['a', 'b']` */
+ let propVariables = new Map();
+ let hasBeenWritten = false;
+ const stack = [{ propVariables, hasBeenWritten }];
+ return {
+ pushScope() {
+ // popVariables is not copied until first write.
+ stack.push({ propVariables, hasBeenWritten: false });
+ },
+ popScope() {
+ stack.pop();
+ propVariables = stack[stack.length - 1].propVariables;
+ hasBeenWritten = stack[stack.length - 1].hasBeenWritten;
+ },
+ /**
+ * Add a variable name to the current scope
+ * @param {string} name
+ * @param {string[]} allNames Example: `props.a.b` should be formatted as `['a', 'b']`
+ * @returns {Map}
+ */
+ set(name, allNames) {
+ if (!hasBeenWritten) {
+ // copy on write
+ propVariables = new Map(propVariables);
+ Object.assign(stack[stack.length - 1], { propVariables, hasBeenWritten: true });
+ stack[stack.length - 1].hasBeenWritten = true;
+ }
+ return propVariables.set(name, allNames);
+ },
+ /**
+ * Get the definition of a variable.
+ * @param {string} name
+ * @returns {string[]} Example: `props.a.b` is represented by `['a', 'b']`
+ */
+ get(name) {
+ return propVariables.get(name);
+ },
+ };
+}
+
+/**
+ * Checks if the string is one of `props`, `nextProps`, or `prevProps`
+ * @param {string} name The AST node being checked.
+ * @returns {boolean} True if the prop name matches
+ */
+function isCommonVariableNameForProps(name) {
+ return name === 'props' || name === 'nextProps' || name === 'prevProps';
+}
+
+/**
+ * Checks if the component must be validated
+ * @param {Object} component The component to process
+ * @returns {boolean} True if the component must be validated, false if not.
+ */
+function mustBeValidated(component) {
+ return !!(component && !component.ignorePropsValidation);
+}
+
+/**
+ * Check if we are in a lifecycle method
+ * @param {object} context
+ * @param {ASTNode} node The AST node being checked.
+ * @param {boolean} checkAsyncSafeLifeCycles
+ * @return {boolean} true if we are in a class constructor, false if not
+ */
+function inLifeCycleMethod(context, node, checkAsyncSafeLifeCycles) {
+ let scope = getScope(context, node);
+ while (scope) {
+ if (scope.block && scope.block.parent && scope.block.parent.key) {
+ const name = scope.block.parent.key.name;
+
+ if (LIFE_CYCLE_METHODS.indexOf(name) >= 0) {
+ return true;
+ }
+ if (checkAsyncSafeLifeCycles && ASYNC_SAFE_LIFE_CYCLE_METHODS.indexOf(name) >= 0) {
+ return true;
+ }
+ }
+ scope = scope.upper;
+ }
+ return false;
+}
+
+/**
+ * Returns true if the given node is a React Component lifecycle method
+ * @param {ASTNode} node The AST node being checked.
+ * @param {boolean} checkAsyncSafeLifeCycles
+ * @return {boolean} True if the node is a lifecycle method
+ */
+function isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles) {
+ if (node.key) {
+ if (node.kind === 'constructor') {
+ return true;
+ }
+
+ const nodeKeyName = node.key.name;
+
+ if (typeof nodeKeyName !== 'string') {
+ return false;
+ }
+
+ if (LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) {
+ return true;
+ }
+ if (checkAsyncSafeLifeCycles && ASYNC_SAFE_LIFE_CYCLE_METHODS.indexOf(nodeKeyName) >= 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Returns true if the given node is inside a React Component lifecycle
+ * method.
+ * @param {ASTNode} node The AST node being checked.
+ * @param {boolean} checkAsyncSafeLifeCycles
+ * @return {boolean} True if the node is inside a lifecycle method
+ */
+function isInLifeCycleMethod(node, checkAsyncSafeLifeCycles) {
+ if (
+ (node.type === 'MethodDefinition' || node.type === 'Property')
+ && isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles)
+ ) {
+ return true;
+ }
+
+ if (node.parent) {
+ return isInLifeCycleMethod(node.parent, checkAsyncSafeLifeCycles);
+ }
+
+ return false;
+}
+
+/**
+ * Check if a function node is a setState updater
+ * @param {ASTNode} node a function node
+ * @return {boolean}
+ */
+function isSetStateUpdater(node) {
+ const unwrappedParentCalleeNode = astUtil.isCallExpression(node.parent)
+ && ast.unwrapTSAsExpression(node.parent.callee);
+
+ return unwrappedParentCalleeNode
+ && unwrappedParentCalleeNode.property
+ && unwrappedParentCalleeNode.property.name === 'setState'
+ // Make sure we are in the updater not the callback
+ && node.parent.arguments[0] === node;
+}
+
+function isPropArgumentInSetStateUpdater(context, node, name) {
+ if (typeof name !== 'string') {
+ return;
+ }
+ let scope = getScope(context, node);
+ while (scope) {
+ const unwrappedParentCalleeNode = scope.block
+ && astUtil.isCallExpression(scope.block.parent)
+ && ast.unwrapTSAsExpression(scope.block.parent.callee);
+ if (
+ unwrappedParentCalleeNode
+ && unwrappedParentCalleeNode.property
+ && unwrappedParentCalleeNode.property.name === 'setState'
+ // Make sure we are in the updater not the callback
+ && scope.block.parent.arguments[0].range[0] === scope.block.range[0]
+ && scope.block.parent.arguments[0].params
+ && scope.block.parent.arguments[0].params.length > 1
+ ) {
+ return scope.block.parent.arguments[0].params[1].name === name;
+ }
+ scope = scope.upper;
+ }
+ return false;
+}
+
+/**
+ * @param {Context} context
+ * @param {ASTNode} node
+ * @returns {boolean}
+ */
+function isInClassComponent(context, node) {
+ return !!(componentUtil.getParentES6Component(context, node) || componentUtil.getParentES5Component(context, node));
+}
+
+/**
+ * Checks if the node is `this.props`
+ * @param {ASTNode|undefined} node
+ * @returns {boolean}
+ */
+function isThisDotProps(node) {
+ return !!node
+ && node.type === 'MemberExpression'
+ && ast.unwrapTSAsExpression(node.object).type === 'ThisExpression'
+ && node.property.name === 'props';
+}
+
+/**
+ * Checks if the prop has spread operator.
+ * @param {object} context
+ * @param {ASTNode} node The AST node being marked.
+ * @returns {boolean} True if the prop has spread operator, false if not.
+ */
+function hasSpreadOperator(context, node) {
+ const tokens = getSourceCode(context).getTokens(node);
+ return tokens.length && tokens[0].value === '...';
+}
+
+/**
+ * Checks if the node is a propTypes usage of the form `this.props.*`, `props.*`, `prevProps.*`, or `nextProps.*`.
+ * @param {Context} context
+ * @param {ASTNode} node
+ * @param {Object} utils
+ * @param {boolean} checkAsyncSafeLifeCycles
+ * @returns {boolean}
+ */
+function isPropTypesUsageByMemberExpression(context, node, utils, checkAsyncSafeLifeCycles) {
+ const unwrappedObjectNode = ast.unwrapTSAsExpression(node.object);
+
+ if (isInClassComponent(context, node)) {
+ // this.props.*
+ if (isThisDotProps(unwrappedObjectNode)) {
+ return true;
+ }
+ // props.* or prevProps.* or nextProps.*
+ if (
+ isCommonVariableNameForProps(unwrappedObjectNode.name)
+ && (inLifeCycleMethod(context, node, checkAsyncSafeLifeCycles) || astUtil.inConstructor(context, node))
+ ) {
+ return true;
+ }
+ // this.setState((_, props) => props.*))
+ if (isPropArgumentInSetStateUpdater(context, node, unwrappedObjectNode.name)) {
+ return true;
+ }
+ return false;
+ }
+ // props.* in function component
+ return unwrappedObjectNode.name === 'props' && !ast.isAssignmentLHS(node);
+}
+
+/**
+ * Retrieve the name of a property node
+ * @param {Context} context
+ * @param {ASTNode} node The AST node with the property.
+ * @param {Object} utils
+ * @param {boolean} checkAsyncSafeLifeCycles
+ * @return {string|undefined} the name of the property or undefined if not found
+ */
+function getPropertyName(context, node, utils, checkAsyncSafeLifeCycles) {
+ const property = node.property;
+ if (property) {
+ switch (property.type) {
+ case 'Identifier':
+ if (node.computed) {
+ return '__COMPUTED_PROP__';
+ }
+ return property.name;
+ case 'MemberExpression':
+ return;
+ case 'Literal':
+ // Accept computed properties that are literal strings
+ if (typeof property.value === 'string') {
+ return property.value;
+ }
+ // Accept number as well but only accept props[123]
+ if (typeof property.value === 'number') {
+ if (isPropTypesUsageByMemberExpression(context, node, utils, checkAsyncSafeLifeCycles)) {
+ return property.raw;
+ }
+ }
+ // falls through
+ default:
+ if (node.computed) {
+ return '__COMPUTED_PROP__';
+ }
+ break;
+ }
+ }
+}
+
+module.exports = function usedPropTypesInstructions(context, components, utils) {
+ const checkAsyncSafeLifeCycles = testReactVersion(context, '>= 16.3.0');
+
+ const propVariables = createPropVariables();
+ const pushScope = propVariables.pushScope;
+ const popScope = propVariables.popScope;
+
+ /**
+ * Mark a prop type as used
+ * @param {ASTNode} node The AST node being marked.
+ * @param {string[]} [parentNames]
+ */
+ function markPropTypesAsUsed(node, parentNames) {
+ parentNames = parentNames || [];
+ let type;
+ let name;
+ let allNames;
+ let properties;
+ switch (node.type) {
+ case 'OptionalMemberExpression':
+ case 'MemberExpression':
+ name = getPropertyName(context, node, utils, checkAsyncSafeLifeCycles);
+ if (name) {
+ allNames = parentNames.concat(name);
+ if (
+ // Match props.foo.bar, don't match bar[props.foo]
+ node.parent.type === 'MemberExpression'
+ && node.parent.object === node
+ ) {
+ markPropTypesAsUsed(node.parent, allNames);
+ }
+ // Handle the destructuring part of `const {foo} = props.a.b`
+ if (
+ node.parent.type === 'VariableDeclarator'
+ && node.parent.id.type === 'ObjectPattern'
+ ) {
+ node.parent.id.parent = node.parent; // patch for bug in eslint@4 in which ObjectPattern has no parent
+ markPropTypesAsUsed(node.parent.id, allNames);
+ }
+
+ // const a = props.a
+ if (
+ node.parent.type === 'VariableDeclarator'
+ && node.parent.id.type === 'Identifier'
+ ) {
+ propVariables.set(node.parent.id.name, allNames);
+ }
+ // Do not mark computed props as used.
+ type = name !== '__COMPUTED_PROP__' ? 'direct' : null;
+ }
+ break;
+ case 'ArrowFunctionExpression':
+ case 'FunctionDeclaration':
+ case 'FunctionExpression': {
+ if (node.params.length === 0) {
+ break;
+ }
+ type = 'destructuring';
+ const propParam = isSetStateUpdater(node) ? node.params[1] : node.params[0];
+ properties = propParam.type === 'AssignmentPattern'
+ ? propParam.left.properties
+ : propParam.properties;
+ break;
+ }
+ case 'ObjectPattern':
+ type = 'destructuring';
+ properties = node.properties;
+ break;
+ case 'TSEmptyBodyFunctionExpression':
+ break;
+ default:
+ throw new Error(`${node.type} ASTNodes are not handled by markPropTypesAsUsed`);
+ }
+
+ const component = components.get(utils.getParentComponent(node));
+ const usedPropTypes = (component && component.usedPropTypes) || [];
+ let ignoreUnusedPropTypesValidation = (component && component.ignoreUnusedPropTypesValidation) || false;
+
+ switch (type) {
+ case 'direct': {
+ // Ignore Object methods
+ if (name in Object.prototype) {
+ break;
+ }
+
+ const reportedNode = node.property;
+ usedPropTypes.push({
+ name,
+ allNames,
+ node: reportedNode,
+ });
+ break;
+ }
+ case 'destructuring': {
+ for (let k = 0, l = (properties || []).length; k < l; k++) {
+ if (hasSpreadOperator(context, properties[k]) || properties[k].computed) {
+ ignoreUnusedPropTypesValidation = true;
+ break;
+ }
+ const propName = ast.getKeyValue(context, properties[k]);
+
+ if (!propName || properties[k].type !== 'Property') {
+ break;
+ }
+
+ usedPropTypes.push({
+ allNames: parentNames.concat([propName]),
+ name: propName,
+ node: properties[k],
+ });
+
+ if (properties[k].value.type === 'ObjectPattern') {
+ markPropTypesAsUsed(properties[k].value, parentNames.concat([propName]));
+ } else if (properties[k].value.type === 'Identifier') {
+ propVariables.set(properties[k].value.name, parentNames.concat(propName));
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ components.set(component ? component.node : node, {
+ usedPropTypes,
+ ignoreUnusedPropTypesValidation,
+ });
+ }
+
+ /**
+ * @param {ASTNode} node We expect either an ArrowFunctionExpression,
+ * FunctionDeclaration, or FunctionExpression
+ */
+ function markDestructuredFunctionArgumentsAsUsed(node) {
+ const param = node.params && isSetStateUpdater(node) ? node.params[1] : node.params[0];
+
+ const destructuring = param && (
+ param.type === 'ObjectPattern'
+ || ((param.type === 'AssignmentPattern') && (param.left.type === 'ObjectPattern'))
+ );
+
+ if (destructuring && (components.get(node) || components.get(node.parent))) {
+ markPropTypesAsUsed(node);
+ }
+ }
+
+ function handleSetStateUpdater(node) {
+ if (!node.params || node.params.length < 2 || !isSetStateUpdater(node)) {
+ return;
+ }
+ markPropTypesAsUsed(node);
+ }
+
+ /**
+ * Handle both stateless functions and setState updater functions.
+ * @param {ASTNode} node We expect either an ArrowFunctionExpression,
+ * FunctionDeclaration, or FunctionExpression
+ */
+ function handleFunctionLikeExpressions(node) {
+ pushScope();
+ handleSetStateUpdater(node);
+ markDestructuredFunctionArgumentsAsUsed(node);
+ }
+
+ function handleCustomValidators(component) {
+ const propTypes = component.declaredPropTypes;
+ if (!propTypes) {
+ return;
+ }
+
+ Object.keys(propTypes).forEach((key) => {
+ const node = propTypes[key].node;
+
+ if (node && node.value && astUtil.isFunctionLikeExpression(node.value)) {
+ markPropTypesAsUsed(node.value);
+ }
+ });
+ }
+
+ return {
+ VariableDeclarator(node) {
+ const unwrappedInitNode = ast.unwrapTSAsExpression(node.init);
+
+ // let props = this.props
+ if (isThisDotProps(unwrappedInitNode) && isInClassComponent(context, node) && node.id.type === 'Identifier') {
+ propVariables.set(node.id.name, []);
+ }
+
+ // Only handles destructuring
+ if (node.id.type !== 'ObjectPattern' || !unwrappedInitNode) {
+ return;
+ }
+
+ // let {props: {firstname}} = this
+ const propsProperty = node.id.properties.find((property) => (
+ property.key
+ && (property.key.name === 'props' || property.key.value === 'props')
+ ));
+
+ if (unwrappedInitNode.type === 'ThisExpression' && propsProperty && propsProperty.value.type === 'ObjectPattern') {
+ markPropTypesAsUsed(propsProperty.value);
+ return;
+ }
+
+ // let {props} = this
+ if (unwrappedInitNode.type === 'ThisExpression' && propsProperty && propsProperty.value.name === 'props') {
+ propVariables.set('props', []);
+ return;
+ }
+
+ // let {firstname} = props
+ if (
+ isCommonVariableNameForProps(unwrappedInitNode.name)
+ && (utils.getParentStatelessComponent(node) || isInLifeCycleMethod(node, checkAsyncSafeLifeCycles))
+ ) {
+ markPropTypesAsUsed(node.id);
+ return;
+ }
+
+ // let {firstname} = this.props
+ if (isThisDotProps(unwrappedInitNode) && isInClassComponent(context, node)) {
+ markPropTypesAsUsed(node.id);
+ return;
+ }
+
+ // let {firstname} = thing, where thing is defined by const thing = this.props.**.*
+ if (propVariables.get(unwrappedInitNode.name)) {
+ markPropTypesAsUsed(node.id, propVariables.get(unwrappedInitNode.name));
+ }
+ },
+
+ FunctionDeclaration: handleFunctionLikeExpressions,
+
+ ArrowFunctionExpression: handleFunctionLikeExpressions,
+
+ FunctionExpression: handleFunctionLikeExpressions,
+
+ 'FunctionDeclaration:exit': popScope,
+
+ 'ArrowFunctionExpression:exit': popScope,
+
+ 'FunctionExpression:exit': popScope,
+
+ JSXSpreadAttribute(node) {
+ const component = components.get(utils.getParentComponent(node));
+ components.set(component ? component.node : node, {
+ ignoreUnusedPropTypesValidation: node.argument.type !== 'ObjectExpression',
+ });
+ },
+
+ 'MemberExpression, OptionalMemberExpression'(node) {
+ if (isPropTypesUsageByMemberExpression(context, node, utils, checkAsyncSafeLifeCycles)) {
+ markPropTypesAsUsed(node);
+ return;
+ }
+
+ const propVariable = propVariables.get(ast.unwrapTSAsExpression(node.object).name);
+ if (propVariable) {
+ markPropTypesAsUsed(node, propVariable);
+ }
+ },
+
+ ObjectPattern(node) {
+ // If the object pattern is a destructured props object in a lifecycle
+ // method -- mark it for used props.
+ if (isNodeALifeCycleMethod(node.parent.parent, checkAsyncSafeLifeCycles) && node.properties.length > 0) {
+ markPropTypesAsUsed(node.parent);
+ }
+ },
+
+ 'Program:exit'() {
+ values(components.list())
+ .filter((component) => mustBeValidated(component))
+ .forEach((component) => {
+ handleCustomValidators(component);
+ });
+ },
+ };
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/variable.d.ts b/node_modules/eslint-plugin-react/lib/util/variable.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..de070fe91fca826218b1a81c26cf555713a1b5e6
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/variable.d.ts
@@ -0,0 +1,38 @@
+/**
+ * Search a particular variable in a list
+ * @param {Array} variables The variables list.
+ * @param {string} name The name of the variable to search.
+ * @returns {boolean} True if the variable was found, false if not.
+ */
+export function findVariable(variables: any[], name: string): boolean;
+/**
+ * Find a variable by name in the current scope.
+ * @param {Object} context The current rule context.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @param {string} name Name of the variable to look for.
+ * @returns {ASTNode|null} Return null if the variable could not be found, ASTNode otherwise.
+ */
+export function findVariableByName(context: any, node: ASTNode, name: string): ASTNode | null;
+/**
+ * Find and return a particular variable in a list
+ * @param {Array} variables The variables list.
+ * @param {string} name The name of the variable to search.
+ * @returns {Object} Variable if the variable was found, null if not.
+ */
+export function getVariable(variables: any[], name: string): any;
+/**
+ * Searches for a variable in the given scope.
+ *
+ * @param {Object} context The current rule context.
+ * @param {ASTNode} node The node to start looking from.
+ * @param {string} name The name of the variable to search.
+ * @returns {Object | undefined} Variable if the variable was found, undefined if not.
+ */
+export function getVariableFromContext(context: any, node: ASTNode, name: string): any | undefined;
+/**
+ * Returns the latest definition of the variable.
+ * @param {Object} variable
+ * @returns {Object | undefined} The latest variable definition or undefined.
+ */
+export function getLatestVariableDefinition(variable: any): any | undefined;
+//# sourceMappingURL=variable.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/variable.d.ts.map b/node_modules/eslint-plugin-react/lib/util/variable.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..5187e71363c4bb4d530e9ebdfa14e7dde94f2cfa
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/variable.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"variable.d.ts","sourceRoot":"","sources":["variable.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,qDAHW,MAAM,GACJ,OAAO,CAInB;AA0CD;;;;;;GAMG;AACH,uDAJW,OAAO,QACN,MAAM,GACL,OAAO,GAAC,IAAI,CAkBxB;AA/DD;;;;;GAKG;AACH,oDAHW,MAAM,OAKhB;AAED;;;;;;;GAOG;AACH,2DAJW,OAAO,QACP,MAAM,GACJ,MAAS,SAAS,CAsB9B;AA2BD;;;;GAIG;AACH,4DAFa,MAAS,SAAS,CAI9B"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/variable.js b/node_modules/eslint-plugin-react/lib/util/variable.js
new file mode 100644
index 0000000000000000000000000000000000000000..a92a20930f24844a39ca2b07b2e5e868f59c215a
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/variable.js
@@ -0,0 +1,100 @@
+/**
+ * @fileoverview Utility functions for React components detection
+ * @author Yannick Croissant
+ */
+
+'use strict';
+
+const getScope = require('./eslint').getScope;
+
+/**
+ * Search a particular variable in a list
+ * @param {Array} variables The variables list.
+ * @param {string} name The name of the variable to search.
+ * @returns {boolean} True if the variable was found, false if not.
+ */
+function findVariable(variables, name) {
+ return variables.some((variable) => variable.name === name);
+}
+
+/**
+ * Find and return a particular variable in a list
+ * @param {Array} variables The variables list.
+ * @param {string} name The name of the variable to search.
+ * @returns {Object} Variable if the variable was found, null if not.
+ */
+function getVariable(variables, name) {
+ return variables.find((variable) => variable.name === name);
+}
+
+/**
+ * Searches for a variable in the given scope.
+ *
+ * @param {Object} context The current rule context.
+ * @param {ASTNode} node The node to start looking from.
+ * @param {string} name The name of the variable to search.
+ * @returns {Object | undefined} Variable if the variable was found, undefined if not.
+ */
+function getVariableFromContext(context, node, name) {
+ let scope = getScope(context, node);
+
+ while (scope) {
+ let variable = getVariable(scope.variables, name);
+
+ if (!variable && scope.childScopes.length) {
+ variable = getVariable(scope.childScopes[0].variables, name);
+
+ if (!variable && scope.childScopes[0].childScopes.length) {
+ variable = getVariable(scope.childScopes[0].childScopes[0].variables, name);
+ }
+ }
+
+ if (variable) {
+ return variable;
+ }
+ scope = scope.upper;
+ }
+ return undefined;
+}
+
+/**
+ * Find a variable by name in the current scope.
+ * @param {Object} context The current rule context.
+ * @param {ASTNode} node The node to check. Must be an Identifier node.
+ * @param {string} name Name of the variable to look for.
+ * @returns {ASTNode|null} Return null if the variable could not be found, ASTNode otherwise.
+ */
+function findVariableByName(context, node, name) {
+ const variable = getVariableFromContext(context, node, name);
+
+ if (!variable || !variable.defs[0] || !variable.defs[0].node) {
+ return null;
+ }
+
+ if (variable.defs[0].node.type === 'TypeAlias') {
+ return variable.defs[0].node.right;
+ }
+
+ if (variable.defs[0].type === 'ImportBinding') {
+ return variable.defs[0].node;
+ }
+
+ return variable.defs[0].node.init;
+}
+
+/**
+ * Returns the latest definition of the variable.
+ * @param {Object} variable
+ * @returns {Object | undefined} The latest variable definition or undefined.
+ */
+function getLatestVariableDefinition(variable) {
+ return variable.defs[variable.defs.length - 1];
+}
+
+module.exports = {
+ findVariable,
+ findVariableByName,
+ getVariable,
+ getVariableFromContext,
+ getLatestVariableDefinition,
+};
diff --git a/node_modules/eslint-plugin-react/lib/util/version.d.ts b/node_modules/eslint-plugin-react/lib/util/version.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e423fc38d766a8c8ac2180519fb07ba844f285f8
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/version.d.ts
@@ -0,0 +1,6 @@
+export function testReactVersion(context: any, semverRange: any): boolean;
+export function testFlowVersion(context: any, semverRange: any): boolean;
+export function resetWarningFlag(): void;
+export function resetDetectedVersion(): void;
+export function resetDefaultVersion(): void;
+//# sourceMappingURL=version.d.ts.map
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/version.d.ts.map b/node_modules/eslint-plugin-react/lib/util/version.d.ts.map
new file mode 100644
index 0000000000000000000000000000000000000000..e9d69637bc0629745cbe07ca50cf907f6dc36771
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/version.d.ts.map
@@ -0,0 +1 @@
+{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["version.js"],"names":[],"mappings":"AAmLA,0EAEC;AAED,yEAEC;AAvKD,yCAEC;AAID,6CAEC;AA6BD,4CAEC"}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/lib/util/version.js b/node_modules/eslint-plugin-react/lib/util/version.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9dc683b7d149c5a3a941bdcbd32f657facdfbf6
--- /dev/null
+++ b/node_modules/eslint-plugin-react/lib/util/version.js
@@ -0,0 +1,194 @@
+/**
+ * @fileoverview Utility functions for React and Flow version configuration
+ * @author Yannick Croissant
+ */
+
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+
+const resolve = require('resolve');
+const semver = require('semver');
+const error = require('./error');
+
+const ULTIMATE_LATEST_SEMVER = '999.999.999';
+
+let warnedForMissingVersion = false;
+
+function resetWarningFlag() {
+ warnedForMissingVersion = false;
+}
+
+let cachedDetectedReactVersion;
+
+function resetDetectedVersion() {
+ cachedDetectedReactVersion = undefined;
+}
+
+function resolveBasedir(contextOrFilename) {
+ if (contextOrFilename) {
+ const filename = typeof contextOrFilename === 'string' ? contextOrFilename : contextOrFilename.getFilename();
+ const dirname = path.dirname(filename);
+ try {
+ if (fs.statSync(filename).isFile()) {
+ // dirname must be dir here
+ return dirname;
+ }
+ } catch (err) {
+ // https://github.com/eslint/eslint/issues/11989
+ if (err.code === 'ENOTDIR') {
+ // virtual filename could be recursive
+ return resolveBasedir(dirname);
+ }
+ }
+ }
+ return process.cwd();
+}
+
+function convertConfVerToSemver(confVer) {
+ const fullSemverString = /^[0-9]+\.[0-9]+$/.test(confVer) ? `${confVer}.0` : confVer;
+ return semver.coerce(fullSemverString.split('.').map((part) => Number(part)).join('.'));
+}
+
+let defaultVersion = ULTIMATE_LATEST_SEMVER;
+
+function resetDefaultVersion() {
+ defaultVersion = ULTIMATE_LATEST_SEMVER;
+}
+
+function readDefaultReactVersionFromContext(context) {
+ // .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
+ if (context.settings && context.settings.react && context.settings.react.defaultVersion) {
+ let settingsDefaultVersion = context.settings.react.defaultVersion;
+ if (typeof settingsDefaultVersion !== 'string') {
+ error(`Warning: default React version specified in eslint-pluigin-react-settings must be a string; got "${typeof settingsDefaultVersion}"`);
+ }
+ settingsDefaultVersion = String(settingsDefaultVersion);
+ const result = convertConfVerToSemver(settingsDefaultVersion);
+ if (result) {
+ defaultVersion = result.version;
+ } else {
+ error(`Warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “${settingsDefaultVersion}”. Falling back to latest version as default.`);
+ }
+ } else {
+ defaultVersion = ULTIMATE_LATEST_SEMVER;
+ }
+}
+
+// TODO, semver-major: remove context fallback
+function detectReactVersion(context) {
+ if (cachedDetectedReactVersion) {
+ return cachedDetectedReactVersion;
+ }
+
+ const basedir = resolveBasedir(context);
+
+ try {
+ const reactPath = resolve.sync('react', { basedir });
+ const react = require(reactPath); // eslint-disable-line global-require, import/no-dynamic-require
+ cachedDetectedReactVersion = react.version;
+ return cachedDetectedReactVersion;
+ } catch (e) {
+ if (e.code === 'MODULE_NOT_FOUND') {
+ if (!warnedForMissingVersion) {
+ let sentence2 = 'Assuming latest React version for linting.';
+ if (defaultVersion !== ULTIMATE_LATEST_SEMVER) {
+ sentence2 = `Assuming default React version for linting: "${defaultVersion}".`;
+ }
+ error(`Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. ${sentence2}`);
+ warnedForMissingVersion = true;
+ }
+ cachedDetectedReactVersion = defaultVersion;
+ return cachedDetectedReactVersion;
+ }
+ throw e;
+ }
+}
+
+function getReactVersionFromContext(context) {
+ readDefaultReactVersionFromContext(context);
+ let confVer = defaultVersion;
+ // .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
+ if (context.settings && context.settings.react && context.settings.react.version) {
+ let settingsVersion = context.settings.react.version;
+ if (settingsVersion === 'detect') {
+ settingsVersion = detectReactVersion(context);
+ }
+ if (typeof settingsVersion !== 'string') {
+ error(`Warning: React version specified in eslint-plugin-react-settings must be a string; got “${typeof settingsVersion}”`);
+ }
+ confVer = String(settingsVersion);
+ } else if (!warnedForMissingVersion) {
+ error('Warning: React version not specified in eslint-plugin-react settings. See https://github.com/jsx-eslint/eslint-plugin-react#configuration .');
+ warnedForMissingVersion = true;
+ }
+
+ const result = convertConfVerToSemver(confVer);
+ if (!result) {
+ error(`Warning: React version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “${confVer}”`);
+ }
+ return result ? result.version : defaultVersion;
+}
+
+// TODO, semver-major: remove context fallback
+function detectFlowVersion(context) {
+ const basedir = resolveBasedir(context);
+
+ try {
+ const flowPackageJsonPath = resolve.sync('flow-bin/package.json', { basedir });
+ const flowPackageJson = require(flowPackageJsonPath); // eslint-disable-line global-require, import/no-dynamic-require
+ return flowPackageJson.version;
+ } catch (e) {
+ if (e.code === 'MODULE_NOT_FOUND') {
+ error('Warning: Flow version was set to "detect" in eslint-plugin-react settings, '
+ + 'but the "flow-bin" package is not installed. Assuming latest Flow version for linting.');
+ return ULTIMATE_LATEST_SEMVER;
+ }
+ throw e;
+ }
+}
+
+function getFlowVersionFromContext(context) {
+ let confVer = defaultVersion;
+ // .eslintrc shared settings (https://eslint.org/docs/user-guide/configuring#adding-shared-settings)
+ if (context.settings.react && context.settings.react.flowVersion) {
+ let flowVersion = context.settings.react.flowVersion;
+ if (flowVersion === 'detect') {
+ flowVersion = detectFlowVersion(context);
+ }
+ if (typeof flowVersion !== 'string') {
+ error('Warning: Flow version specified in eslint-plugin-react-settings must be a string; '
+ + `got “${typeof flowVersion}”`);
+ }
+ confVer = String(flowVersion);
+ } else {
+ throw 'Could not retrieve flowVersion from settings'; // eslint-disable-line no-throw-literal
+ }
+
+ const result = convertConfVerToSemver(confVer);
+ if (!result) {
+ error(`Warning: Flow version specified in eslint-plugin-react-settings must be a valid semver version, or "detect"; got “${confVer}”`);
+ }
+ return result ? result.version : defaultVersion;
+}
+
+function test(semverRange, confVer) {
+ return semver.satisfies(confVer, semverRange);
+}
+
+function testReactVersion(context, semverRange) {
+ return test(semverRange, getReactVersionFromContext(context));
+}
+
+function testFlowVersion(context, semverRange) {
+ return test(semverRange, getFlowVersionFromContext(context));
+}
+
+module.exports = {
+ testReactVersion,
+ testFlowVersion,
+ resetWarningFlag,
+ resetDetectedVersion,
+ resetDefaultVersion,
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/.bin/resolve b/node_modules/eslint-plugin-react/node_modules/.bin/resolve
new file mode 100644
index 0000000000000000000000000000000000000000..21d1a87eec1fe1557a535fc0cdfd877908cb5c71
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/.bin/resolve
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+
+'use strict';
+
+var path = require('path');
+var fs = require('fs');
+
+if (
+ String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
+ && (
+ !process.argv
+ || process.argv.length < 2
+ || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
+ || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename)
+ )
+) {
+ console.error('Error: `resolve` must be run directly as an executable');
+ process.exit(1);
+}
+
+var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag');
+
+var preserveSymlinks = false;
+for (var i = 2; i < process.argv.length; i += 1) {
+ if (process.argv[i].slice(0, 2) === '--') {
+ if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') {
+ preserveSymlinks = true;
+ } else if (process.argv[i].length > 2) {
+ console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, ''));
+ process.exit(2);
+ }
+ process.argv.splice(i, 1);
+ i -= 1;
+ if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax
+ }
+}
+
+if (process.argv.length < 3) {
+ console.error('Error: `resolve` expects a specifier');
+ process.exit(2);
+}
+
+var resolve = require('../');
+
+var result = resolve.sync(process.argv[2], {
+ basedir: process.cwd(),
+ preserveSymlinks: preserveSymlinks
+});
+
+console.log(result);
diff --git a/node_modules/eslint-plugin-react/node_modules/.bin/semver b/node_modules/eslint-plugin-react/node_modules/.bin/semver
new file mode 100644
index 0000000000000000000000000000000000000000..666034a75d8442be9bb2d9c55c3909b55a093cb5
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/.bin/semver
@@ -0,0 +1,174 @@
+#!/usr/bin/env node
+// Standalone semver comparison program.
+// Exits successfully and prints matching version(s) if
+// any supplied version is valid and passes all tests.
+
+var argv = process.argv.slice(2)
+
+var versions = []
+
+var range = []
+
+var inc = null
+
+var version = require('../package.json').version
+
+var loose = false
+
+var includePrerelease = false
+
+var coerce = false
+
+var rtl = false
+
+var identifier
+
+var semver = require('../semver')
+
+var reverse = false
+
+var options = {}
+
+main()
+
+function main () {
+ if (!argv.length) return help()
+ while (argv.length) {
+ var a = argv.shift()
+ var indexOfEqualSign = a.indexOf('=')
+ if (indexOfEqualSign !== -1) {
+ a = a.slice(0, indexOfEqualSign)
+ argv.unshift(a.slice(indexOfEqualSign + 1))
+ }
+ switch (a) {
+ case '-rv': case '-rev': case '--rev': case '--reverse':
+ reverse = true
+ break
+ case '-l': case '--loose':
+ loose = true
+ break
+ case '-p': case '--include-prerelease':
+ includePrerelease = true
+ break
+ case '-v': case '--version':
+ versions.push(argv.shift())
+ break
+ case '-i': case '--inc': case '--increment':
+ switch (argv[0]) {
+ case 'major': case 'minor': case 'patch': case 'prerelease':
+ case 'premajor': case 'preminor': case 'prepatch':
+ inc = argv.shift()
+ break
+ default:
+ inc = 'patch'
+ break
+ }
+ break
+ case '--preid':
+ identifier = argv.shift()
+ break
+ case '-r': case '--range':
+ range.push(argv.shift())
+ break
+ case '-c': case '--coerce':
+ coerce = true
+ break
+ case '--rtl':
+ rtl = true
+ break
+ case '--ltr':
+ rtl = false
+ break
+ case '-h': case '--help': case '-?':
+ return help()
+ default:
+ versions.push(a)
+ break
+ }
+ }
+
+ var options = { loose: loose, includePrerelease: includePrerelease, rtl: rtl }
+
+ versions = versions.map(function (v) {
+ return coerce ? (semver.coerce(v, options) || { version: v }).version : v
+ }).filter(function (v) {
+ return semver.valid(v)
+ })
+ if (!versions.length) return fail()
+ if (inc && (versions.length !== 1 || range.length)) { return failInc() }
+
+ for (var i = 0, l = range.length; i < l; i++) {
+ versions = versions.filter(function (v) {
+ return semver.satisfies(v, range[i], options)
+ })
+ if (!versions.length) return fail()
+ }
+ return success(versions)
+}
+
+function failInc () {
+ console.error('--inc can only be used on a single version with no range')
+ fail()
+}
+
+function fail () { process.exit(1) }
+
+function success () {
+ var compare = reverse ? 'rcompare' : 'compare'
+ versions.sort(function (a, b) {
+ return semver[compare](a, b, options)
+ }).map(function (v) {
+ return semver.clean(v, options)
+ }).map(function (v) {
+ return inc ? semver.inc(v, inc, options, identifier) : v
+ }).forEach(function (v, i, _) { console.log(v) })
+}
+
+function help () {
+ console.log(['SemVer ' + version,
+ '',
+ 'A JavaScript implementation of the https://semver.org/ specification',
+ 'Copyright Isaac Z. Schlueter',
+ '',
+ 'Usage: semver [options] [ [...]]',
+ 'Prints valid versions sorted by SemVer precedence',
+ '',
+ 'Options:',
+ '-r --range ',
+ ' Print versions that match the specified range.',
+ '',
+ '-i --increment []',
+ ' Increment a version by the specified level. Level can',
+ ' be one of: major, minor, patch, premajor, preminor,',
+ " prepatch, or prerelease. Default level is 'patch'.",
+ ' Only one version may be specified.',
+ '',
+ '--preid ',
+ ' Identifier to be used to prefix premajor, preminor,',
+ ' prepatch or prerelease version increments.',
+ '',
+ '-l --loose',
+ ' Interpret versions and ranges loosely',
+ '',
+ '-p --include-prerelease',
+ ' Always include prerelease versions in range matching',
+ '',
+ '-c --coerce',
+ ' Coerce a string into SemVer if possible',
+ ' (does not imply --loose)',
+ '',
+ '--rtl',
+ ' Coerce version strings right to left',
+ '',
+ '--ltr',
+ ' Coerce version strings left to right (default)',
+ '',
+ 'Program exits successfully if any valid version satisfies',
+ 'all supplied ranges, and prints all satisfying versions.',
+ '',
+ 'If no satisfying versions are found, then exits failure.',
+ '',
+ 'Versions are printed in ascending order, so supplying',
+ 'multiple versions to the utility will just sort them.'
+ ].join('\n'))
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/.editorconfig b/node_modules/eslint-plugin-react/node_modules/resolve/.editorconfig
new file mode 100644
index 0000000000000000000000000000000000000000..a4eb76e1d7ce44b87bbd3145ed2cb8c88d57d191
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/.editorconfig
@@ -0,0 +1,34 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+max_line_length = 200
+
+[*.js]
+block_comment_start = /*
+block_comment = *
+block_comment_end = */
+
+[*.yml]
+indent_size = 1
+
+[package.json]
+indent_style = tab
+
+[CHANGELOG.md]
+indent_style = space
+indent_size = 2
+
+[{*.json,Makefile}]
+max_line_length = unset
+
+[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*]
+indent_style = unset
+indent_size = unset
+max_line_length = unset
+insert_final_newline = unset
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/.eslintrc b/node_modules/eslint-plugin-react/node_modules/resolve/.eslintrc
new file mode 100644
index 0000000000000000000000000000000000000000..1cc95e4643561308da9195f05b957df484f03e14
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/.eslintrc
@@ -0,0 +1,65 @@
+{
+ "root": true,
+
+ "extends": "@ljharb",
+
+ "rules": {
+ "indent": [2, 4],
+ "strict": 0,
+ "complexity": 0,
+ "consistent-return": 0,
+ "curly": 0,
+ "dot-notation": [2, { "allowKeywords": true }],
+ "func-name-matching": 0,
+ "func-style": 0,
+ "global-require": 1,
+ "id-length": [2, { "min": 1, "max": 40 }],
+ "max-lines": [2, 350],
+ "max-lines-per-function": 1,
+ "max-nested-callbacks": 0,
+ "max-params": 0,
+ "max-statements-per-line": [2, { "max": 2 }],
+ "max-statements": 0,
+ "no-magic-numbers": 0,
+ "no-shadow": 0,
+ "no-use-before-define": 0,
+ "sort-keys": 0,
+ },
+ "overrides": [
+ {
+ "files": "bin/**",
+ "rules": {
+ "no-process-exit": "off",
+ },
+ },
+ {
+ "files": "example/**",
+ "rules": {
+ "no-console": 0,
+ },
+ },
+ {
+ "files": "test/resolver/nested_symlinks/mylib/*.js",
+ "rules": {
+ "no-throw-literal": 0,
+ },
+ },
+ {
+ "files": "test/**",
+ "parserOptions": {
+ "ecmaVersion": 5,
+ "allowReserved": false,
+ },
+ "rules": {
+ "dot-notation": [2, { "allowPattern": "throws" }],
+ "max-lines": 0,
+ "max-lines-per-function": 0,
+ "no-unused-vars": [2, { "vars": "all", "args": "none" }],
+ },
+ },
+ ],
+
+ "ignorePatterns": [
+ "./test/resolver/malformed_package_json/package.json",
+ ],
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/.github/FUNDING.yml b/node_modules/eslint-plugin-react/node_modules/resolve/.github/FUNDING.yml
new file mode 100644
index 0000000000000000000000000000000000000000..d9c05955459660bd6b6a972499502b8d09958220
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: [ljharb]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: npm/resolve
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/LICENSE b/node_modules/eslint-plugin-react/node_modules/resolve/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..ff4fce28af33a4504d6960856a0bd603860a62e0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2012 James Halliday
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/SECURITY.md b/node_modules/eslint-plugin-react/node_modules/resolve/SECURITY.md
new file mode 100644
index 0000000000000000000000000000000000000000..82e4285adc6285693cd6c06af02d606e09dd8fcd
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/SECURITY.md
@@ -0,0 +1,3 @@
+# Security
+
+Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/async.js b/node_modules/eslint-plugin-react/node_modules/resolve/async.js
new file mode 100644
index 0000000000000000000000000000000000000000..f38c5813ebd04ab8bf6988cc0186b9f95433f7e2
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/async.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('./lib/async');
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/bin/resolve b/node_modules/eslint-plugin-react/node_modules/resolve/bin/resolve
new file mode 100644
index 0000000000000000000000000000000000000000..21d1a87eec1fe1557a535fc0cdfd877908cb5c71
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/bin/resolve
@@ -0,0 +1,50 @@
+#!/usr/bin/env node
+
+'use strict';
+
+var path = require('path');
+var fs = require('fs');
+
+if (
+ String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
+ && (
+ !process.argv
+ || process.argv.length < 2
+ || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
+ || (process.env.npm_lifecycle_event !== 'npx' && process.env._ && fs.realpathSync(path.resolve(process.env._)) !== __filename)
+ )
+) {
+ console.error('Error: `resolve` must be run directly as an executable');
+ process.exit(1);
+}
+
+var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag');
+
+var preserveSymlinks = false;
+for (var i = 2; i < process.argv.length; i += 1) {
+ if (process.argv[i].slice(0, 2) === '--') {
+ if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') {
+ preserveSymlinks = true;
+ } else if (process.argv[i].length > 2) {
+ console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, ''));
+ process.exit(2);
+ }
+ process.argv.splice(i, 1);
+ i -= 1;
+ if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax
+ }
+}
+
+if (process.argv.length < 3) {
+ console.error('Error: `resolve` expects a specifier');
+ process.exit(2);
+}
+
+var resolve = require('../');
+
+var result = resolve.sync(process.argv[2], {
+ basedir: process.cwd(),
+ preserveSymlinks: preserveSymlinks
+});
+
+console.log(result);
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/example/async.js b/node_modules/eslint-plugin-react/node_modules/resolve/example/async.js
new file mode 100644
index 0000000000000000000000000000000000000000..20e65dc281dbaa3947a1c5d1b1a0bc94167c2073
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/example/async.js
@@ -0,0 +1,5 @@
+var resolve = require('../');
+resolve('tap', { basedir: __dirname }, function (err, res) {
+ if (err) console.error(err);
+ else console.log(res);
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/example/sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/example/sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..54b2cc1004223d114e38bbd46fe9a0f5b73ca7e2
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/example/sync.js
@@ -0,0 +1,3 @@
+var resolve = require('../');
+var res = resolve.sync('tap', { basedir: __dirname });
+console.log(res);
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..46746e47d77e865093c907d123f2115dd6cd8ae0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/index.js
@@ -0,0 +1,4 @@
+var async = require('./lib/async');
+async.sync = require('./lib/sync');
+
+module.exports = async;
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/index.mjs b/node_modules/eslint-plugin-react/node_modules/resolve/index.mjs
new file mode 100644
index 0000000000000000000000000000000000000000..875341347183ecd78c0faae0c63c5ba5e481bf25
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/index.mjs
@@ -0,0 +1,4 @@
+import async from 'resolve/async';
+import sync from 'resolve/sync';
+
+export { async, sync };
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/async.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/async.js
new file mode 100644
index 0000000000000000000000000000000000000000..07f18a680437e58a7a2ae7c7f5f747da4375656f
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/async.js
@@ -0,0 +1,349 @@
+var fs = require('fs');
+var getHomedir = require('./homedir');
+var path = require('path');
+var caller = require('./caller');
+var nodeModulesPaths = require('./node-modules-paths');
+var normalizeOptions = require('./normalize-options');
+var isCore = require('is-core-module');
+
+var realpathFS = process.platform !== 'win32' && fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
+
+var homedir = getHomedir();
+var defaultPaths = function () {
+ return [
+ path.join(homedir, '.node_modules'),
+ path.join(homedir, '.node_libraries')
+ ];
+};
+
+var defaultIsFile = function isFile(file, cb) {
+ fs.stat(file, function (err, stat) {
+ if (!err) {
+ return cb(null, stat.isFile() || stat.isFIFO());
+ }
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
+ return cb(err);
+ });
+};
+
+var defaultIsDir = function isDirectory(dir, cb) {
+ fs.stat(dir, function (err, stat) {
+ if (!err) {
+ return cb(null, stat.isDirectory());
+ }
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
+ return cb(err);
+ });
+};
+
+var defaultRealpath = function realpath(x, cb) {
+ realpathFS(x, function (realpathErr, realPath) {
+ if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr);
+ else cb(null, realpathErr ? x : realPath);
+ });
+};
+
+var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) {
+ if (!opts || !opts.preserveSymlinks) {
+ realpath(x, cb);
+ } else {
+ cb(null, x);
+ }
+};
+
+var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) {
+ readFile(pkgfile, function (readFileErr, body) {
+ if (readFileErr) cb(readFileErr);
+ else {
+ try {
+ var pkg = JSON.parse(body);
+ cb(null, pkg);
+ } catch (jsonErr) {
+ cb(jsonErr);
+ }
+ }
+ });
+};
+
+var getPackageCandidates = function getPackageCandidates(x, start, opts) {
+ var dirs = nodeModulesPaths(start, opts, x);
+ for (var i = 0; i < dirs.length; i++) {
+ dirs[i] = path.join(dirs[i], x);
+ }
+ return dirs;
+};
+
+module.exports = function resolve(x, options, callback) {
+ var cb = callback;
+ var opts = options;
+ if (typeof options === 'function') {
+ cb = opts;
+ opts = {};
+ }
+ if (typeof x !== 'string') {
+ var err = new TypeError('Path must be a string.');
+ return process.nextTick(function () {
+ cb(err);
+ });
+ }
+
+ opts = normalizeOptions(x, opts);
+
+ var isFile = opts.isFile || defaultIsFile;
+ var isDirectory = opts.isDirectory || defaultIsDir;
+ var readFile = opts.readFile || fs.readFile;
+ var realpath = opts.realpath || defaultRealpath;
+ var readPackage = opts.readPackage || defaultReadPackage;
+ if (opts.readFile && opts.readPackage) {
+ var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.');
+ return process.nextTick(function () {
+ cb(conflictErr);
+ });
+ }
+ var packageIterator = opts.packageIterator;
+
+ var extensions = opts.extensions || ['.js'];
+ var includeCoreModules = opts.includeCoreModules !== false;
+ var basedir = opts.basedir || path.dirname(caller());
+ var parent = opts.filename || basedir;
+
+ opts.paths = opts.paths || defaultPaths();
+
+ // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
+ var absoluteStart = path.resolve(basedir);
+
+ maybeRealpath(
+ realpath,
+ absoluteStart,
+ opts,
+ function (err, realStart) {
+ if (err) cb(err);
+ else validateBasedir(realStart);
+ }
+ );
+
+ function validateBasedir(basedir) {
+ if (opts.basedir) {
+ var dirError = new TypeError('Provided basedir "' + basedir + '" is not a directory' + (opts.preserveSymlinks ? '' : ', or a symlink to a directory'));
+ dirError.code = 'INVALID_BASEDIR';
+ isDirectory(basedir, function (err, result) {
+ if (err) return cb(err);
+ if (!result) { return cb(dirError); }
+ validBasedir(basedir);
+ });
+ } else {
+ validBasedir(basedir);
+ }
+ }
+
+ var res;
+ function validBasedir(basedir) {
+ if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
+ res = path.resolve(basedir, x);
+ if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
+ if ((/\/$/).test(x) && res === basedir) {
+ loadAsDirectory(res, opts.package, onfile);
+ } else loadAsFile(res, opts.package, onfile);
+ } else if (includeCoreModules && isCore(x)) {
+ return cb(null, x);
+ } else loadNodeModules(x, basedir, function (err, n, pkg) {
+ if (err) cb(err);
+ else if (n) {
+ return maybeRealpath(realpath, n, opts, function (err, realN) {
+ if (err) {
+ cb(err);
+ } else {
+ cb(null, realN, pkg);
+ }
+ });
+ } else {
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
+ moduleError.code = 'MODULE_NOT_FOUND';
+ cb(moduleError);
+ }
+ });
+ }
+
+ function onfile(err, m, pkg) {
+ if (err) cb(err);
+ else if (m) cb(null, m, pkg);
+ else loadAsDirectory(res, function (err, d, pkg) {
+ if (err) cb(err);
+ else if (d) {
+ maybeRealpath(realpath, d, opts, function (err, realD) {
+ if (err) {
+ cb(err);
+ } else {
+ cb(null, realD, pkg);
+ }
+ });
+ } else {
+ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
+ moduleError.code = 'MODULE_NOT_FOUND';
+ cb(moduleError);
+ }
+ });
+ }
+
+ function loadAsFile(x, thePackage, callback) {
+ var loadAsFilePackage = thePackage;
+ var cb = callback;
+ if (typeof loadAsFilePackage === 'function') {
+ cb = loadAsFilePackage;
+ loadAsFilePackage = undefined;
+ }
+
+ var exts = [''].concat(extensions);
+ load(exts, x, loadAsFilePackage);
+
+ function load(exts, x, loadPackage) {
+ if (exts.length === 0) return cb(null, undefined, loadPackage);
+ var file = x + exts[0];
+
+ var pkg = loadPackage;
+ if (pkg) onpkg(null, pkg);
+ else loadpkg(path.dirname(file), onpkg);
+
+ function onpkg(err, pkg_, dir) {
+ pkg = pkg_;
+ if (err) return cb(err);
+ if (dir && pkg && opts.pathFilter) {
+ var rfile = path.relative(dir, file);
+ var rel = rfile.slice(0, rfile.length - exts[0].length);
+ var r = opts.pathFilter(pkg, x, rel);
+ if (r) return load(
+ [''].concat(extensions.slice()),
+ path.resolve(dir, r),
+ pkg
+ );
+ }
+ isFile(file, onex);
+ }
+ function onex(err, ex) {
+ if (err) return cb(err);
+ if (ex) return cb(null, file, pkg);
+ load(exts.slice(1), x, pkg);
+ }
+ }
+ }
+
+ function loadpkg(dir, cb) {
+ if (dir === '' || dir === '/') return cb(null);
+ if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
+ return cb(null);
+ }
+ if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null);
+
+ maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) {
+ if (unwrapErr) return loadpkg(path.dirname(dir), cb);
+ var pkgfile = path.join(pkgdir, 'package.json');
+ isFile(pkgfile, function (err, ex) {
+ // on err, ex is false
+ if (!ex) return loadpkg(path.dirname(dir), cb);
+
+ readPackage(readFile, pkgfile, function (err, pkgParam) {
+ if (err && !(err instanceof SyntaxError)) cb(err);
+
+ var pkg = pkgParam;
+
+ if (pkg && opts.packageFilter) {
+ pkg = opts.packageFilter(pkg, pkgfile, dir);
+ }
+ cb(null, pkg, dir);
+ });
+ });
+ });
+ }
+
+ function loadAsDirectory(x, loadAsDirectoryPackage, callback) {
+ var cb = callback;
+ var fpkg = loadAsDirectoryPackage;
+ if (typeof fpkg === 'function') {
+ cb = fpkg;
+ fpkg = opts.package;
+ }
+
+ maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) {
+ if (unwrapErr) return loadAsDirectory(path.dirname(x), fpkg, cb);
+ var pkgfile = path.join(pkgdir, 'package.json');
+ isFile(pkgfile, function (err, ex) {
+ if (err) return cb(err);
+ if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb);
+
+ readPackage(readFile, pkgfile, function (err, pkgParam) {
+ if (err) return cb(err);
+
+ var pkg = pkgParam;
+
+ if (pkg && opts.packageFilter) {
+ pkg = opts.packageFilter(pkg, pkgfile, pkgdir);
+ }
+
+ if (pkg && pkg.main) {
+ if (typeof pkg.main !== 'string') {
+ var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
+ mainError.code = 'INVALID_PACKAGE_MAIN';
+ return cb(mainError);
+ }
+ if (pkg.main === '.' || pkg.main === './') {
+ pkg.main = 'index';
+ }
+ loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) {
+ if (err) return cb(err);
+ if (m) return cb(null, m, pkg);
+ if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb);
+
+ var dir = path.resolve(x, pkg.main);
+ loadAsDirectory(dir, pkg, function (err, n, pkg) {
+ if (err) return cb(err);
+ if (n) return cb(null, n, pkg);
+ loadAsFile(path.join(x, 'index'), pkg, function (err, m, pkg) {
+ if (err) return cb(err);
+ if (m) return cb(null, m, pkg);
+ var incorrectMainError = new Error("Cannot find module '" + path.resolve(x, pkg.main) + "'. Please verify that the package.json has a valid \"main\" entry");
+ incorrectMainError.code = 'INCORRECT_PACKAGE_MAIN';
+ return cb(incorrectMainError);
+ });
+ });
+ });
+ return;
+ }
+
+ loadAsFile(path.join(x, '/index'), pkg, cb);
+ });
+ });
+ });
+ }
+
+ function processDirs(cb, dirs) {
+ if (dirs.length === 0) return cb(null, undefined);
+ var dir = dirs[0];
+
+ isDirectory(path.dirname(dir), isdir);
+
+ function isdir(err, isdir) {
+ if (err) return cb(err);
+ if (!isdir) return processDirs(cb, dirs.slice(1));
+ loadAsFile(dir, opts.package, onfile);
+ }
+
+ function onfile(err, m, pkg) {
+ if (err) return cb(err);
+ if (m) return cb(null, m, pkg);
+ loadAsDirectory(dir, opts.package, ondir);
+ }
+
+ function ondir(err, n, pkg) {
+ if (err) return cb(err);
+ if (n) return cb(null, n, pkg);
+ processDirs(cb, dirs.slice(1));
+ }
+ }
+ function loadNodeModules(x, start, cb) {
+ var thunk = function () { return getPackageCandidates(x, start, opts); };
+ processDirs(
+ cb,
+ packageIterator ? packageIterator(x, start, thunk, opts) : thunk()
+ );
+ }
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/caller.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/caller.js
new file mode 100644
index 0000000000000000000000000000000000000000..b14a2804ae828a4c39c9f949611236cd6ef7a45d
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/caller.js
@@ -0,0 +1,8 @@
+module.exports = function () {
+ // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
+ var origPrepareStackTrace = Error.prepareStackTrace;
+ Error.prepareStackTrace = function (_, stack) { return stack; };
+ var stack = (new Error()).stack;
+ Error.prepareStackTrace = origPrepareStackTrace;
+ return stack[2].getFileName();
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/homedir.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/homedir.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ffdf73bb336aea8649f285547a6f08f779a7be1
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/homedir.js
@@ -0,0 +1,24 @@
+'use strict';
+
+var os = require('os');
+
+// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js
+
+module.exports = os.homedir || function homedir() {
+ var home = process.env.HOME;
+ var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
+
+ if (process.platform === 'win32') {
+ return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
+ }
+
+ if (process.platform === 'darwin') {
+ return home || (user ? '/Users/' + user : null);
+ }
+
+ if (process.platform === 'linux') {
+ return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens
+ }
+
+ return home || null;
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/node-modules-paths.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/node-modules-paths.js
new file mode 100644
index 0000000000000000000000000000000000000000..1cff0107b5862c3cf080030ac3eeb8244e7328b5
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/node-modules-paths.js
@@ -0,0 +1,42 @@
+var path = require('path');
+var parse = path.parse || require('path-parse'); // eslint-disable-line global-require
+
+var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) {
+ var prefix = '/';
+ if ((/^([A-Za-z]:)/).test(absoluteStart)) {
+ prefix = '';
+ } else if ((/^\\\\/).test(absoluteStart)) {
+ prefix = '\\\\';
+ }
+
+ var paths = [absoluteStart];
+ var parsed = parse(absoluteStart);
+ while (parsed.dir !== paths[paths.length - 1]) {
+ paths.push(parsed.dir);
+ parsed = parse(parsed.dir);
+ }
+
+ return paths.reduce(function (dirs, aPath) {
+ return dirs.concat(modules.map(function (moduleDir) {
+ return path.resolve(prefix, aPath, moduleDir);
+ }));
+ }, []);
+};
+
+module.exports = function nodeModulesPaths(start, opts, request) {
+ var modules = opts && opts.moduleDirectory
+ ? [].concat(opts.moduleDirectory)
+ : ['node_modules'];
+
+ if (opts && typeof opts.paths === 'function') {
+ return opts.paths(
+ request,
+ start,
+ function () { return getNodeModulesDirs(start, modules); },
+ opts
+ );
+ }
+
+ var dirs = getNodeModulesDirs(start, modules);
+ return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/normalize-options.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/normalize-options.js
new file mode 100644
index 0000000000000000000000000000000000000000..4b56904eaea72ba024f96728fff40e1be4af7df0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/normalize-options.js
@@ -0,0 +1,10 @@
+module.exports = function (x, opts) {
+ /**
+ * This file is purposefully a passthrough. It's expected that third-party
+ * environments will override it at runtime in order to inject special logic
+ * into `resolve` (by manipulating the options). One such example is the PnP
+ * code path in Yarn.
+ */
+
+ return opts || {};
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/lib/sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/lib/sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..ddc468adcf019c39dc57f3f71e7511d132ce8adf
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/lib/sync.js
@@ -0,0 +1,221 @@
+var isCore = require('is-core-module');
+var fs = require('fs');
+var path = require('path');
+var getHomedir = require('./homedir');
+var caller = require('./caller');
+var nodeModulesPaths = require('./node-modules-paths');
+var normalizeOptions = require('./normalize-options');
+
+var realpathFS = process.platform !== 'win32' && fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
+
+var homedir = getHomedir();
+var defaultPaths = function () {
+ return [
+ path.join(homedir, '.node_modules'),
+ path.join(homedir, '.node_libraries')
+ ];
+};
+
+var defaultIsFile = function isFile(file) {
+ try {
+ var stat = fs.statSync(file, { throwIfNoEntry: false });
+ } catch (e) {
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
+ throw e;
+ }
+ return !!stat && (stat.isFile() || stat.isFIFO());
+};
+
+var defaultIsDir = function isDirectory(dir) {
+ try {
+ var stat = fs.statSync(dir, { throwIfNoEntry: false });
+ } catch (e) {
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
+ throw e;
+ }
+ return !!stat && stat.isDirectory();
+};
+
+var defaultRealpathSync = function realpathSync(x) {
+ try {
+ return realpathFS(x);
+ } catch (realpathErr) {
+ if (realpathErr.code !== 'ENOENT') {
+ throw realpathErr;
+ }
+ }
+ return x;
+};
+
+var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) {
+ if (!opts || !opts.preserveSymlinks) {
+ return realpathSync(x);
+ }
+ return x;
+};
+
+var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) {
+ return JSON.parse(readFileSync(pkgfile));
+};
+
+var getPackageCandidates = function getPackageCandidates(x, start, opts) {
+ var dirs = nodeModulesPaths(start, opts, x);
+ for (var i = 0; i < dirs.length; i++) {
+ dirs[i] = path.join(dirs[i], x);
+ }
+ return dirs;
+};
+
+module.exports = function resolveSync(x, options) {
+ if (typeof x !== 'string') {
+ throw new TypeError('Path must be a string.');
+ }
+ var opts = normalizeOptions(x, options);
+
+ var isFile = opts.isFile || defaultIsFile;
+ var isDirectory = opts.isDirectory || defaultIsDir;
+ var readFileSync = opts.readFileSync || fs.readFileSync;
+ var realpathSync = opts.realpathSync || defaultRealpathSync;
+ var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
+ if (opts.readFileSync && opts.readPackageSync) {
+ throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.');
+ }
+ var packageIterator = opts.packageIterator;
+
+ var extensions = opts.extensions || ['.js'];
+ var includeCoreModules = opts.includeCoreModules !== false;
+ var basedir = opts.basedir || path.dirname(caller());
+ var parent = opts.filename || basedir;
+
+ opts.paths = opts.paths || defaultPaths();
+
+ // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory
+ var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
+
+ if (opts.basedir && !isDirectory(absoluteStart)) {
+ var dirError = new TypeError('Provided basedir "' + opts.basedir + '" is not a directory' + (opts.preserveSymlinks ? '' : ', or a symlink to a directory'));
+ dirError.code = 'INVALID_BASEDIR';
+ throw dirError;
+ }
+
+ if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) {
+ var res = path.resolve(absoluteStart, x);
+ if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/';
+ var m = loadAsFileSync(res) || loadAsDirectorySync(res);
+ if (m) return maybeRealpathSync(realpathSync, m, opts);
+ } else if (includeCoreModules && isCore(x)) {
+ return x;
+ } else {
+ var n = loadNodeModulesSync(x, absoluteStart);
+ if (n) return maybeRealpathSync(realpathSync, n, opts);
+ }
+
+ var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
+ err.code = 'MODULE_NOT_FOUND';
+ throw err;
+
+ function loadAsFileSync(x) {
+ var pkg = loadpkg(path.dirname(x));
+
+ if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
+ var rfile = path.relative(pkg.dir, x);
+ var r = opts.pathFilter(pkg.pkg, x, rfile);
+ if (r) {
+ x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign
+ }
+ }
+
+ if (isFile(x)) {
+ return x;
+ }
+
+ for (var i = 0; i < extensions.length; i++) {
+ var file = x + extensions[i];
+ if (isFile(file)) {
+ return file;
+ }
+ }
+ }
+
+ function loadpkg(dir) {
+ if (dir === '' || dir === '/') return;
+ if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) {
+ return;
+ }
+ if ((/[/\\]node_modules[/\\]*$/).test(dir)) return;
+
+ var pkgfile = path.join(isDirectory(dir) ? maybeRealpathSync(realpathSync, dir, opts) : dir, 'package.json');
+
+ if (!isFile(pkgfile)) {
+ return loadpkg(path.dirname(dir));
+ }
+
+ var pkg;
+ try {
+ pkg = readPackageSync(readFileSync, pkgfile);
+ } catch (e) {
+ if (!(e instanceof SyntaxError)) {
+ throw e;
+ }
+ }
+
+ if (pkg && opts.packageFilter) {
+ pkg = opts.packageFilter(pkg, pkgfile, dir);
+ }
+
+ return { pkg: pkg, dir: dir };
+ }
+
+ function loadAsDirectorySync(x) {
+ var pkgfile = path.join(isDirectory(x) ? maybeRealpathSync(realpathSync, x, opts) : x, '/package.json');
+ if (isFile(pkgfile)) {
+ try {
+ var pkg = readPackageSync(readFileSync, pkgfile);
+ } catch (e) {}
+
+ if (pkg && opts.packageFilter) {
+ pkg = opts.packageFilter(pkg, pkgfile, x);
+ }
+
+ if (pkg && pkg.main) {
+ if (typeof pkg.main !== 'string') {
+ var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string');
+ mainError.code = 'INVALID_PACKAGE_MAIN';
+ throw mainError;
+ }
+ if (pkg.main === '.' || pkg.main === './') {
+ pkg.main = 'index';
+ }
+ try {
+ var mainPath = path.resolve(x, pkg.main);
+ var m = loadAsFileSync(mainPath);
+ if (m) return m;
+ var n = loadAsDirectorySync(mainPath);
+ if (n) return n;
+ var checkIndex = loadAsFileSync(path.resolve(x, 'index'));
+ if (checkIndex) return checkIndex;
+ } catch (e) { }
+ var incorrectMainError = new Error("Cannot find module '" + path.resolve(x, pkg.main) + "'. Please verify that the package.json has a valid \"main\" entry");
+ incorrectMainError.code = 'INCORRECT_PACKAGE_MAIN';
+ throw incorrectMainError;
+ }
+ }
+
+ return loadAsFileSync(path.join(x, '/index'));
+ }
+
+ function loadNodeModulesSync(x, start) {
+ var thunk = function () { return getPackageCandidates(x, start, opts); };
+ var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk();
+
+ for (var i = 0; i < dirs.length; i++) {
+ var dir = dirs[i];
+ if (isDirectory(path.dirname(dir))) {
+ var m = loadAsFileSync(dir);
+ if (m) return m;
+ var n = loadAsDirectorySync(dir);
+ if (n) return n;
+ }
+ }
+ }
+};
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..e4f4b5094cbca27d0dbcdfd2d2c030bb94ba6b89
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/package.json
@@ -0,0 +1,83 @@
+{
+ "name": "resolve",
+ "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
+ "version": "2.0.0-next.5",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/browserify/resolve.git"
+ },
+ "bin": {
+ "resolve": "./bin/resolve"
+ },
+ "main": "index.js",
+ "exports": {
+ ".": [
+ {
+ "import": "./index.mjs",
+ "default": "./index.js"
+ },
+ "./index.js"
+ ],
+ "./sync": "./lib/sync.js",
+ "./async": "./lib/async.js",
+ "./package.json": "./package.json"
+ },
+ "keywords": [
+ "resolve",
+ "require",
+ "node",
+ "module"
+ ],
+ "scripts": {
+ "prepack": "npmignore --auto --commentLines=autogenerated",
+ "prepublishOnly": "safe-publish-latest",
+ "prepublish": "not-in-publish || npm run prepublishOnly",
+ "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
+ "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'",
+ "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
+ "tests-only": "tape test/*.js",
+ "pretest": "npm run lint",
+ "test": "npm run --silent tests-only",
+ "posttest": "npm run test:multirepo && aud --production",
+ "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test"
+ },
+ "devDependencies": {
+ "@ljharb/eslint-config": "^21.1.0",
+ "array.prototype.map": "^1.0.6",
+ "aud": "^2.0.3",
+ "copy-dir": "^1.3.0",
+ "eclint": "^2.8.1",
+ "eslint": "=8.8.0",
+ "in-publish": "^2.0.1",
+ "mkdirp": "^0.5.5",
+ "mv": "^2.1.1",
+ "npmignore": "^0.3.0",
+ "object-keys": "^1.1.1",
+ "rimraf": "^2.7.1",
+ "safe-publish-latest": "^2.0.0",
+ "tap": "^0.4.13",
+ "tape": "^5.7.0",
+ "tmp": "^0.0.31"
+ },
+ "license": "MIT",
+ "author": {
+ "name": "James Halliday",
+ "email": "mail@substack.net",
+ "url": "http://substack.net"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ },
+ "dependencies": {
+ "is-core-module": "^2.13.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "publishConfig": {
+ "ignore": [
+ ".github/workflows",
+ "appveyor.yml",
+ "test/resolver/malformed_package_json"
+ ]
+ }
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/readme.markdown b/node_modules/eslint-plugin-react/node_modules/resolve/readme.markdown
new file mode 100644
index 0000000000000000000000000000000000000000..9e15d7a064656b0e841d2efdc07cbcfd59b92680
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/readme.markdown
@@ -0,0 +1,294 @@
+# resolve [![Version Badge][2]][1]
+
+implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously
+
+[![github actions][actions-image]][actions-url]
+[![coverage][codecov-image]][codecov-url]
+[![dependency status][5]][6]
+[![dev dependency status][7]][8]
+[![License][license-image]][license-url]
+[![Downloads][downloads-image]][downloads-url]
+
+[![npm badge][11]][1]
+
+# example
+
+asynchronously resolve:
+
+```js
+var resolve = require('resolve/async'); // or, require('resolve')
+resolve('tap', { basedir: __dirname }, function (err, res) {
+ if (err) console.error(err);
+ else console.log(res);
+});
+```
+
+```
+$ node example/async.js
+/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
+```
+
+synchronously resolve:
+
+```js
+var resolve = require('resolve/sync'); // or, `require('resolve').sync
+var res = resolve('tap', { basedir: __dirname });
+console.log(res);
+```
+
+```
+$ node example/sync.js
+/home/substack/projects/node-resolve/node_modules/tap/lib/main.js
+```
+
+# methods
+
+```js
+var resolve = require('resolve');
+var async = require('resolve/async');
+var sync = require('resolve/sync');
+```
+
+For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values:
+
+- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module
+- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory
+- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string)
+
+## resolve(id, opts={}, cb)
+
+Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`.
+
+options are:
+
+* opts.basedir - directory to begin resolving from
+
+* opts.package - `package.json` data applicable to the module being loaded
+
+* opts.extensions - array of file extensions to search in order
+
+* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search
+
+* opts.readFile - how to read files asynchronously
+
+* opts.isFile - function to asynchronously test whether a file exists
+
+* opts.isDirectory - function to asynchronously test whether a file exists and is a directory
+
+* opts.realpath - function to asynchronously resolve a potential symlink to its real path
+
+* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file
+ * readFile - the passed `opts.readFile` or `fs.readFile` if not specified
+ * pkgfile - path to package.json
+ * cb - callback. a SyntaxError error argument will be ignored, all other error arguments will be treated as an error.
+
+* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field
+ * pkg - package data
+ * pkgfile - path to package.json
+ * dir - directory that contains package.json
+
+* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
+ * pkg - package data
+ * path - the path being resolved
+ * relativePath - the path relative from the package.json location
+ * returns - a relative path that will be joined from the package.json location
+
+* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this)
+
+ For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function
+ * request - the import specifier being resolved
+ * start - lookup path
+ * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
+ * opts - the resolution options
+
+* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this)
+ * request - the import specifier being resolved
+ * start - lookup path
+ * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
+ * opts - the resolution options
+
+* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
+
+* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
+This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
+
+default `opts` values:
+
+```js
+{
+ paths: [],
+ basedir: __dirname,
+ extensions: ['.js'],
+ includeCoreModules: true,
+ readFile: fs.readFile,
+ isFile: function isFile(file, cb) {
+ fs.stat(file, function (err, stat) {
+ if (!err) {
+ return cb(null, stat.isFile() || stat.isFIFO());
+ }
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
+ return cb(err);
+ });
+ },
+ isDirectory: function isDirectory(dir, cb) {
+ fs.stat(dir, function (err, stat) {
+ if (!err) {
+ return cb(null, stat.isDirectory());
+ }
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
+ return cb(err);
+ });
+ },
+ realpath: function realpath(file, cb) {
+ var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;
+ realpath(file, function (realPathErr, realPath) {
+ if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr);
+ else cb(null, realPathErr ? file : realPath);
+ });
+ },
+ readPackage: function defaultReadPackage(readFile, pkgfile, cb) {
+ readFile(pkgfile, function (readFileErr, body) {
+ if (readFileErr) cb(readFileErr);
+ else {
+ try {
+ var pkg = JSON.parse(body);
+ cb(null, pkg);
+ } catch (jsonErr) {
+ cb(jsonErr);
+ }
+ }
+ });
+ },
+ moduleDirectory: 'node_modules',
+ preserveSymlinks: false
+}
+```
+
+## resolve.sync(id, opts)
+
+Synchronously resolve the module path string `id`, returning the result and
+throwing an error when `id` can't be resolved.
+
+options are:
+
+* opts.basedir - directory to begin resolving from
+
+* opts.extensions - array of file extensions to search in order
+
+* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search
+
+* opts.readFileSync - how to read files synchronously
+
+* opts.isFile - function to synchronously test whether a file exists
+
+* opts.isDirectory - function to synchronously test whether a file exists and is a directory
+
+* opts.realpathSync - function to synchronously resolve a potential symlink to its real path
+
+* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file. a thrown SyntaxError will be ignored, all other exceptions will propagate.
+ * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified
+ * pkgfile - path to package.json
+
+* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field
+ * pkg - package data
+ * pkgfile - path to package.json
+ * dir - directory that contains package.json
+
+* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package
+ * pkg - package data
+ * path - the path being resolved
+ * relativePath - the path relative from the package.json location
+ * returns - a relative path that will be joined from the package.json location
+
+* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this)
+
+ For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function
+ * request - the import specifier being resolved
+ * start - lookup path
+ * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
+ * opts - the resolution options
+
+* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this)
+ * request - the import specifier being resolved
+ * start - lookup path
+ * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution
+ * opts - the resolution options
+
+* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"`
+
+* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving.
+This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag.
+
+default `opts` values:
+
+```js
+{
+ paths: [],
+ basedir: __dirname,
+ extensions: ['.js'],
+ includeCoreModules: true,
+ readFileSync: fs.readFileSync,
+ isFile: function isFile(file) {
+ try {
+ var stat = fs.statSync(file);
+ } catch (e) {
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
+ throw e;
+ }
+ return stat.isFile() || stat.isFIFO();
+ },
+ isDirectory: function isDirectory(dir) {
+ try {
+ var stat = fs.statSync(dir);
+ } catch (e) {
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
+ throw e;
+ }
+ return stat.isDirectory();
+ },
+ realpathSync: function realpathSync(file) {
+ try {
+ var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync;
+ return realpath(file);
+ } catch (realPathErr) {
+ if (realPathErr.code !== 'ENOENT') {
+ throw realPathErr;
+ }
+ }
+ return file;
+ },
+ readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) {
+ return JSON.parse(readFileSync(pkgfile));
+ },
+ moduleDirectory: 'node_modules',
+ preserveSymlinks: false
+}
+```
+
+# install
+
+With [npm](https://npmjs.org) do:
+
+```sh
+npm install resolve
+```
+
+# license
+
+MIT
+
+[1]: https://npmjs.org/package/resolve
+[2]: https://versionbadg.es/browserify/resolve.svg
+[5]: https://david-dm.org/browserify/resolve.svg
+[6]: https://david-dm.org/browserify/resolve
+[7]: https://david-dm.org/browserify/resolve/dev-status.svg
+[8]: https://david-dm.org/browserify/resolve#info=devDependencies
+[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true
+[license-image]: https://img.shields.io/npm/l/resolve.svg
+[license-url]: LICENSE
+[downloads-image]: https://img.shields.io/npm/dm/resolve.svg
+[downloads-url]: https://npm-stat.com/charts.html?package=resolve
+[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg
+[codecov-url]: https://app.codecov.io/gh/browserify/resolve/
+[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve
+[actions-url]: https://github.com/browserify/resolve/actions
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..cd0ee040177e92c676b1a063406c743289719bd0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/sync.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('./lib/sync');
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot.js
new file mode 100644
index 0000000000000000000000000000000000000000..30806659be2ef27d410722636d6f79c8f8e999b0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot.js
@@ -0,0 +1,29 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('dotdot', function (t) {
+ t.plan(4);
+ var dir = path.join(__dirname, '/dotdot/abc');
+
+ resolve('..', { basedir: dir }, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(__dirname, 'dotdot/index.js'));
+ });
+
+ resolve('.', { basedir: dir }, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, 'index.js'));
+ });
+});
+
+test('dotdot sync', function (t) {
+ t.plan(2);
+ var dir = path.join(__dirname, '/dotdot/abc');
+
+ var a = resolve.sync('..', { basedir: dir });
+ t.equal(a, path.join(__dirname, 'dotdot/index.js'));
+
+ var b = resolve.sync('.', { basedir: dir });
+ t.equal(b, path.join(dir, 'index.js'));
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot/abc/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot/abc/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/dotdot/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/faulty_basedir.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/faulty_basedir.js
new file mode 100644
index 0000000000000000000000000000000000000000..94d42b5e658d139884a750a04caf192ef51a6a3d
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/faulty_basedir.js
@@ -0,0 +1,29 @@
+var test = require('tape');
+var path = require('path');
+var resolve = require('../');
+
+test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) {
+ t.plan(1);
+
+ var resolverDir = 'C:\\a\\b\\c\\d';
+
+ resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) {
+ t.equal(!!err, true);
+ });
+});
+
+test('non-existent basedir should not throw when preserveSymlinks is false', function (t) {
+ t.plan(2);
+
+ var opts = {
+ basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'),
+ preserveSymlinks: false
+ };
+
+ var module = './dotdot/abc';
+
+ resolve(module, opts, function (err, res) {
+ t.equal(err.code, 'INVALID_BASEDIR');
+ t.equal(res, undefined);
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/filter.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/filter.js
new file mode 100644
index 0000000000000000000000000000000000000000..6388671de4d59c4f3d69d44bb1da319d25d19658
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/filter.js
@@ -0,0 +1,37 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('filter', function (t) {
+ t.plan(5);
+ var dir = path.join(__dirname, 'resolver');
+ var packageFilterArgs;
+ resolve('./baz', {
+ basedir: dir,
+ packageFilter: function (pkg, pkgfile, dir) {
+ pkg.main = 'doom'; // eslint-disable-line no-param-reassign
+ packageFilterArgs = [pkg, pkgfile, dir];
+ return pkg;
+ }
+ }, function (err, res, pkg) {
+ if (err) t.fail(err);
+
+ t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works');
+
+ var packageData = packageFilterArgs[0];
+ t.equal(pkg, packageData, 'first packageFilter argument is "pkg"');
+ t.equal(packageData.main, 'doom', 'package "main" was altered');
+
+ var packageFile = packageFilterArgs[1];
+ t.equal(
+ packageFile,
+ path.join(dir, 'baz/package.json'),
+ 'second packageFilter argument is "pkgfile"'
+ );
+
+ var packageFileDir = packageFilterArgs[2];
+ t.equal(packageFileDir, path.join(dir, 'baz'), 'third packageFilter argument is "dir"');
+
+ t.end();
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/filter_sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/filter_sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..0ee8a4da645278fb02cef25047febfb32859202e
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/filter_sync.js
@@ -0,0 +1,33 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('filter', function (t) {
+ var dir = path.join(__dirname, 'resolver');
+ var packageFilterArgs;
+ var res = resolve.sync('./baz', {
+ basedir: dir,
+ packageFilter: function (pkg, pkgfile, dir) {
+ pkg.main = 'doom'; // eslint-disable-line no-param-reassign
+ packageFilterArgs = [pkg, pkgfile, dir];
+ return pkg;
+ }
+ });
+
+ t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works');
+
+ var packageData = packageFilterArgs[0];
+ t.equal(packageData.main, 'doom', 'package "main" was altered');
+
+ var packageFile = packageFilterArgs[1];
+ t.equal(
+ packageFile,
+ path.join(dir, 'baz/package.json'),
+ 'second packageFilter argument is "pkgfile"'
+ );
+
+ var packageDir = packageFilterArgs[2];
+ t.equal(packageDir, path.join(dir, 'baz'), 'third packageFilter argument is "dir"');
+
+ t.end();
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths.js
new file mode 100644
index 0000000000000000000000000000000000000000..3b8c9b32c87bd73fb2a3ec42494d13faae1594e4
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths.js
@@ -0,0 +1,127 @@
+'use strict';
+
+var fs = require('fs');
+var homedir = require('../lib/homedir');
+var path = require('path');
+
+var test = require('tape');
+var mkdirp = require('mkdirp');
+var rimraf = require('rimraf');
+var mv = require('mv');
+var copyDir = require('copy-dir');
+var tmp = require('tmp');
+
+var HOME = homedir();
+
+var hnm = path.join(HOME, '.node_modules');
+var hnl = path.join(HOME, '.node_libraries');
+
+var resolve = require('../async');
+
+function makeDir(t, dir, cb) {
+ mkdirp(dir, function (err) {
+ if (err) {
+ cb(err);
+ } else {
+ t.teardown(function cleanup() {
+ rimraf.sync(dir);
+ });
+ cb();
+ }
+ });
+}
+
+function makeTempDir(t, dir, cb) {
+ if (fs.existsSync(dir)) {
+ var tmpResult = tmp.dirSync();
+ t.teardown(tmpResult.removeCallback);
+ var backup = path.join(tmpResult.name, path.basename(dir));
+ mv(dir, backup, function (err) {
+ if (err) {
+ cb(err);
+ } else {
+ t.teardown(function () {
+ mv(backup, dir, cb);
+ });
+ makeDir(t, dir, cb);
+ }
+ });
+ } else {
+ makeDir(t, dir, cb);
+ }
+}
+
+test('homedir module paths', function (t) {
+ t.plan(7);
+
+ makeTempDir(t, hnm, function (err) {
+ t.error(err, 'no error with HNM temp dir');
+ if (err) {
+ return t.end();
+ }
+
+ var bazHNMDir = path.join(hnm, 'baz');
+ var dotMainDir = path.join(hnm, 'dot_main');
+ copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir);
+ copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir);
+
+ var bazPkg = { name: 'baz', main: 'quux.js' };
+ var dotMainPkg = { main: 'index' };
+
+ var bazHNMmain = path.join(bazHNMDir, 'quux.js');
+ t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`');
+ var dotMainMain = path.join(dotMainDir, 'index.js');
+ t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`');
+
+ makeTempDir(t, hnl, function (err) {
+ t.error(err, 'no error with HNL temp dir');
+ if (err) {
+ return t.end();
+ }
+ var bazHNLDir = path.join(hnl, 'baz');
+ copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir);
+
+ var dotSlashMainDir = path.join(hnl, 'dot_slash_main');
+ var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js');
+ var dotSlashMainPkg = { main: 'index' };
+ copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir);
+
+ t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`');
+ t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`');
+
+ t.test('with temp dirs', function (st) {
+ st.plan(3);
+
+ st.test('just in `$HOME/.node_modules`', function (s2t) {
+ s2t.plan(3);
+
+ resolve('dot_main', function (err, res, pkg) {
+ s2t.error(err, 'no error resolving `dot_main`');
+ s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`');
+ s2t.deepEqual(pkg, dotMainPkg);
+ });
+ });
+
+ st.test('just in `$HOME/.node_libraries`', function (s2t) {
+ s2t.plan(3);
+
+ resolve('dot_slash_main', function (err, res, pkg) {
+ s2t.error(err, 'no error resolving `dot_slash_main`');
+ s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`');
+ s2t.deepEqual(pkg, dotSlashMainPkg);
+ });
+ });
+
+ st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) {
+ s2t.plan(3);
+
+ resolve('baz', function (err, res, pkg) {
+ s2t.error(err, 'no error resolving `baz`');
+ s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both');
+ s2t.deepEqual(pkg, bazPkg);
+ });
+ });
+ });
+ });
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths_sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths_sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..5d2c56fd35d0a3ad072c3549f12695c93654aaed
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/home_paths_sync.js
@@ -0,0 +1,114 @@
+'use strict';
+
+var fs = require('fs');
+var homedir = require('../lib/homedir');
+var path = require('path');
+
+var test = require('tape');
+var mkdirp = require('mkdirp');
+var rimraf = require('rimraf');
+var mv = require('mv');
+var copyDir = require('copy-dir');
+var tmp = require('tmp');
+
+var HOME = homedir();
+
+var hnm = path.join(HOME, '.node_modules');
+var hnl = path.join(HOME, '.node_libraries');
+
+var resolve = require('../sync');
+
+function makeDir(t, dir, cb) {
+ mkdirp(dir, function (err) {
+ if (err) {
+ cb(err);
+ } else {
+ t.teardown(function cleanup() {
+ rimraf.sync(dir);
+ });
+ cb();
+ }
+ });
+}
+
+function makeTempDir(t, dir, cb) {
+ if (fs.existsSync(dir)) {
+ var tmpResult = tmp.dirSync();
+ t.teardown(tmpResult.removeCallback);
+ var backup = path.join(tmpResult.name, path.basename(dir));
+ mv(dir, backup, function (err) {
+ if (err) {
+ cb(err);
+ } else {
+ t.teardown(function () {
+ mv(backup, dir, cb);
+ });
+ makeDir(t, dir, cb);
+ }
+ });
+ } else {
+ makeDir(t, dir, cb);
+ }
+}
+
+test('homedir module paths', function (t) {
+ t.plan(7);
+
+ makeTempDir(t, hnm, function (err) {
+ t.error(err, 'no error with HNM temp dir');
+ if (err) {
+ return t.end();
+ }
+
+ var bazHNMDir = path.join(hnm, 'baz');
+ var dotMainDir = path.join(hnm, 'dot_main');
+ copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir);
+ copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir);
+
+ var bazHNMmain = path.join(bazHNMDir, 'quux.js');
+ t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`');
+ var dotMainMain = path.join(dotMainDir, 'index.js');
+ t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`');
+
+ makeTempDir(t, hnl, function (err) {
+ t.error(err, 'no error with HNL temp dir');
+ if (err) {
+ return t.end();
+ }
+ var bazHNLDir = path.join(hnl, 'baz');
+ copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir);
+
+ var dotSlashMainDir = path.join(hnl, 'dot_slash_main');
+ var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js');
+ copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir);
+
+ t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`');
+ t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`');
+
+ t.test('with temp dirs', function (st) {
+ st.plan(3);
+
+ st.test('just in `$HOME/.node_modules`', function (s2t) {
+ s2t.plan(1);
+
+ var res = resolve('dot_main');
+ s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`');
+ });
+
+ st.test('just in `$HOME/.node_libraries`', function (s2t) {
+ s2t.plan(1);
+
+ var res = resolve('dot_slash_main');
+ s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`');
+ });
+
+ st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) {
+ s2t.plan(1);
+
+ var res = resolve('baz');
+ s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both');
+ });
+ });
+ });
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/mock.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/mock.js
new file mode 100644
index 0000000000000000000000000000000000000000..611627549889541b31e4eb8d8f9277871a452076
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/mock.js
@@ -0,0 +1,315 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('mock', function (t) {
+ t.plan(8);
+
+ var files = {};
+ files[path.resolve('/foo/bar/baz.js')] = 'beep';
+
+ var dirs = {};
+ dirs[path.resolve('/foo/bar')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ readFile: function (file, cb) {
+ cb(null, files[path.resolve(file)]);
+ },
+ realpath: function (file, cb) {
+ cb(null, file);
+ }
+ };
+ }
+
+ resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/baz.js'));
+ t.equal(pkg, undefined);
+ });
+
+ resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/baz.js'));
+ t.equal(pkg, undefined);
+ });
+
+ resolve('baz', opts('/foo/bar'), function (err, res) {
+ t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
+ t.equal(err.code, 'MODULE_NOT_FOUND');
+ });
+
+ resolve('../baz', opts('/foo/bar'), function (err, res) {
+ t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
+ t.equal(err.code, 'MODULE_NOT_FOUND');
+ });
+});
+
+test('mock from package', function (t) {
+ t.plan(8);
+
+ var files = {};
+ files[path.resolve('/foo/bar/baz.js')] = 'beep';
+
+ var dirs = {};
+ dirs[path.resolve('/foo/bar')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, file));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ 'package': { main: 'bar' },
+ readFile: function (file, cb) {
+ cb(null, files[file]);
+ },
+ realpath: function (file, cb) {
+ cb(null, file);
+ }
+ };
+ }
+
+ resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/baz.js'));
+ t.equal(pkg && pkg.main, 'bar');
+ });
+
+ resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/baz.js'));
+ t.equal(pkg && pkg.main, 'bar');
+ });
+
+ resolve('baz', opts('/foo/bar'), function (err, res) {
+ t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'");
+ t.equal(err.code, 'MODULE_NOT_FOUND');
+ });
+
+ resolve('../baz', opts('/foo/bar'), function (err, res) {
+ t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'");
+ t.equal(err.code, 'MODULE_NOT_FOUND');
+ });
+});
+
+test('mock package', function (t) {
+ t.plan(2);
+
+ var files = {};
+ files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
+ files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
+ main: './baz.js'
+ });
+
+ var dirs = {};
+ dirs[path.resolve('/foo')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ readFile: function (file, cb) {
+ cb(null, files[path.resolve(file)]);
+ },
+ realpath: function (file, cb) {
+ cb(null, file);
+ }
+ };
+ }
+
+ resolve('bar', opts('/foo'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
+ t.equal(pkg && pkg.main, './baz.js');
+ });
+});
+
+test('mock package from package', function (t) {
+ t.plan(2);
+
+ var files = {};
+ files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
+ files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
+ main: './baz.js'
+ });
+
+ var dirs = {};
+ dirs[path.resolve('/foo')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ 'package': { main: 'bar' },
+ readFile: function (file, cb) {
+ cb(null, files[path.resolve(file)]);
+ },
+ realpath: function (file, cb) {
+ cb(null, file);
+ }
+ };
+ }
+
+ resolve('bar', opts('/foo'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
+ t.equal(pkg && pkg.main, './baz.js');
+ });
+});
+
+test('symlinked', function (t) {
+ t.plan(4);
+
+ var files = {};
+ files[path.resolve('/foo/bar/baz.js')] = 'beep';
+ files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep';
+
+ var dirs = {};
+ dirs[path.resolve('/foo/bar')] = true;
+ dirs[path.resolve('/foo/bar/symlinked')] = true;
+
+ function opts(basedir) {
+ return {
+ preserveSymlinks: false,
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ readFile: function (file, cb) {
+ cb(null, files[path.resolve(file)]);
+ },
+ realpath: function (file, cb) {
+ var resolved = path.resolve(file);
+
+ if (resolved.indexOf('symlinked') >= 0) {
+ cb(null, resolved);
+ return;
+ }
+
+ var ext = path.extname(resolved);
+
+ if (ext) {
+ var dir = path.dirname(resolved);
+ var base = path.basename(resolved);
+ cb(null, path.join(dir, 'symlinked', base));
+ } else {
+ cb(null, path.join(resolved, 'symlinked'));
+ }
+ }
+ };
+ }
+
+ resolve('./baz', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
+ t.equal(pkg, undefined);
+ });
+
+ resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) {
+ if (err) return t.fail(err);
+ t.equal(res, path.resolve('/foo/bar/symlinked/baz.js'));
+ t.equal(pkg, undefined);
+ });
+});
+
+test('readPackage', function (t) {
+ t.plan(3);
+
+ var files = {};
+ files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep';
+ files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
+ main: './baz.js'
+ });
+ files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop';
+
+ var dirs = {};
+ dirs[path.resolve('/foo')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file, cb) {
+ cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file)));
+ },
+ isDirectory: function (dir, cb) {
+ cb(null, !!dirs[path.resolve(dir)]);
+ },
+ 'package': { main: 'bar' },
+ readFile: function (file, cb) {
+ cb(null, files[path.resolve(file)]);
+ },
+ realpath: function (file, cb) {
+ cb(null, file);
+ }
+ };
+ }
+
+ t.test('with readFile', function (st) {
+ st.plan(3);
+
+ resolve('bar', opts('/foo'), function (err, res, pkg) {
+ st.error(err);
+ st.equal(res, path.resolve('/foo/node_modules/bar/baz.js'));
+ st.equal(pkg && pkg.main, './baz.js');
+ });
+ });
+
+ var readPackage = function (readFile, file, cb) {
+ var barPackage = path.join('bar', 'package.json');
+ if (file.slice(-barPackage.length) === barPackage) {
+ cb(null, { main: './something-else.js' });
+ } else {
+ cb(null, JSON.parse(files[path.resolve(file)]));
+ }
+ };
+
+ t.test('with readPackage', function (st) {
+ st.plan(3);
+
+ var options = opts('/foo');
+ delete options.readFile;
+ options.readPackage = readPackage;
+ resolve('bar', options, function (err, res, pkg) {
+ st.error(err);
+ st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js'));
+ st.equal(pkg && pkg.main, './something-else.js');
+ });
+ });
+
+ t.test('with readFile and readPackage', function (st) {
+ st.plan(1);
+
+ var options = opts('/foo');
+ options.readPackage = readPackage;
+ resolve('bar', options, function (err) {
+ st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided');
+ });
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/mock_sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/mock_sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..fa19f647e03d300e3b09a5818ae23e72a5d78456
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/mock_sync.js
@@ -0,0 +1,215 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('mock', function (t) {
+ t.plan(4);
+
+ var files = {};
+ files[path.resolve('/foo/bar/baz.js')] = 'beep';
+
+ var dirs = {};
+ dirs[path.resolve('/foo/bar')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file) {
+ return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
+ },
+ isDirectory: function (dir) {
+ return !!dirs[path.resolve(dir)];
+ },
+ readFileSync: function (file) {
+ return files[path.resolve(file)];
+ },
+ realpathSync: function (file) {
+ return file;
+ }
+ };
+ }
+
+ t.equal(
+ resolve.sync('./baz', opts('/foo/bar')),
+ path.resolve('/foo/bar/baz.js')
+ );
+
+ t.equal(
+ resolve.sync('./baz.js', opts('/foo/bar')),
+ path.resolve('/foo/bar/baz.js')
+ );
+
+ t.throws(function () {
+ resolve.sync('baz', opts('/foo/bar'));
+ });
+
+ t.throws(function () {
+ resolve.sync('../baz', opts('/foo/bar'));
+ });
+});
+
+test('mock package', function (t) {
+ t.plan(1);
+
+ var files = {};
+ files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep';
+ files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
+ main: './baz.js'
+ });
+
+ var dirs = {};
+ dirs[path.resolve('/foo')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file) {
+ return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
+ },
+ isDirectory: function (dir) {
+ return !!dirs[path.resolve(dir)];
+ },
+ readFileSync: function (file) {
+ return files[path.resolve(file)];
+ },
+ realpathSync: function (file) {
+ return file;
+ }
+ };
+ }
+
+ t.equal(
+ resolve.sync('bar', opts('/foo')),
+ path.resolve('/foo/node_modules/bar/baz.js')
+ );
+});
+
+test('symlinked', function (t) {
+ t.plan(2);
+
+ var files = {};
+ files[path.resolve('/foo/bar/baz.js')] = 'beep';
+ files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep';
+
+ var dirs = {};
+ dirs[path.resolve('/foo/bar')] = true;
+ dirs[path.resolve('/foo/bar/symlinked')] = true;
+
+ function opts(basedir) {
+ return {
+ preserveSymlinks: false,
+ basedir: path.resolve(basedir),
+ isFile: function (file) {
+ return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
+ },
+ isDirectory: function (dir) {
+ return !!dirs[path.resolve(dir)];
+ },
+ readFileSync: function (file) {
+ return files[path.resolve(file)];
+ },
+ realpathSync: function (file) {
+ var resolved = path.resolve(file);
+
+ if (resolved.indexOf('symlinked') >= 0) {
+ return resolved;
+ }
+
+ var ext = path.extname(resolved);
+
+ if (ext) {
+ var dir = path.dirname(resolved);
+ var base = path.basename(resolved);
+ return path.join(dir, 'symlinked', base);
+ }
+ return path.join(resolved, 'symlinked');
+ }
+ };
+ }
+
+ t.equal(
+ resolve.sync('./baz', opts('/foo/bar')),
+ path.resolve('/foo/bar/symlinked/baz.js')
+ );
+
+ t.equal(
+ resolve.sync('./baz.js', opts('/foo/bar')),
+ path.resolve('/foo/bar/symlinked/baz.js')
+ );
+});
+
+test('readPackageSync', function (t) {
+ t.plan(3);
+
+ var files = {};
+ files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep';
+ files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({
+ main: './baz.js'
+ });
+ files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop';
+
+ var dirs = {};
+ dirs[path.resolve('/foo')] = true;
+ dirs[path.resolve('/foo/node_modules')] = true;
+
+ function opts(basedir, useReadPackage) {
+ return {
+ basedir: path.resolve(basedir),
+ isFile: function (file) {
+ return Object.prototype.hasOwnProperty.call(files, path.resolve(file));
+ },
+ isDirectory: function (dir) {
+ return !!dirs[path.resolve(dir)];
+ },
+ readFileSync: useReadPackage ? null : function (file) {
+ return files[path.resolve(file)];
+ },
+ realpathSync: function (file) {
+ return file;
+ }
+ };
+ }
+ t.test('with readFile', function (st) {
+ st.plan(1);
+
+ st.equal(
+ resolve.sync('bar', opts('/foo')),
+ path.resolve('/foo/node_modules/bar/baz.js')
+ );
+ });
+
+ var readPackageSync = function (readFileSync, file) {
+ if (file.indexOf(path.join('bar', 'package.json')) >= 0) {
+ return { main: './something-else.js' };
+ }
+ return JSON.parse(files[path.resolve(file)]);
+ };
+
+ t.test('with readPackage', function (st) {
+ st.plan(1);
+
+ var options = opts('/foo');
+ delete options.readFileSync;
+ options.readPackageSync = readPackageSync;
+
+ st.equal(
+ resolve.sync('bar', options),
+ path.resolve('/foo/node_modules/bar/something-else.js')
+ );
+ });
+
+ t.test('with readFile and readPackage', function (st) {
+ st.plan(1);
+
+ var options = opts('/foo');
+ options.readPackageSync = readPackageSync;
+ st.throws(
+ function () { resolve.sync('bar', options); },
+ TypeError,
+ 'errors when both readFile and readPackage are provided'
+ );
+ });
+});
+
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir.js
new file mode 100644
index 0000000000000000000000000000000000000000..b50e5bb1751d69694deaae36d5f0bc6691498008
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir.js
@@ -0,0 +1,56 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('moduleDirectory strings', function (t) {
+ t.plan(4);
+ var dir = path.join(__dirname, 'module_dir');
+ var xopts = {
+ basedir: dir,
+ moduleDirectory: 'xmodules'
+ };
+ resolve('aaa', xopts, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
+ });
+
+ var yopts = {
+ basedir: dir,
+ moduleDirectory: 'ymodules'
+ };
+ resolve('aaa', yopts, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
+ });
+});
+
+test('moduleDirectory array', function (t) {
+ t.plan(6);
+ var dir = path.join(__dirname, 'module_dir');
+ var aopts = {
+ basedir: dir,
+ moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
+ };
+ resolve('aaa', aopts, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, '/xmodules/aaa/index.js'));
+ });
+
+ var bopts = {
+ basedir: dir,
+ moduleDirectory: ['zmodules', 'ymodules', 'xmodules']
+ };
+ resolve('aaa', bopts, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, '/ymodules/aaa/index.js'));
+ });
+
+ var copts = {
+ basedir: dir,
+ moduleDirectory: ['xmodules', 'ymodules', 'zmodules']
+ };
+ resolve('bbb', copts, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, '/zmodules/bbb/main.js'));
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/xmodules/aaa/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/ymodules/aaa/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/zmodules/bbb/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..c13b8cf6acfd3344bc2c7969a31d930d933fdf22
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/module_dir/zmodules/bbb/package.json
@@ -0,0 +1,3 @@
+{
+ "main": "main.js"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node-modules-paths.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node-modules-paths.js
new file mode 100644
index 0000000000000000000000000000000000000000..675441db2ced7b7facac9b7344fe8ea98c16e45b
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/node-modules-paths.js
@@ -0,0 +1,143 @@
+var test = require('tape');
+var path = require('path');
+var parse = path.parse || require('path-parse');
+var keys = require('object-keys');
+
+var nodeModulesPaths = require('../lib/node-modules-paths');
+
+var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) {
+ var moduleDirs = [].concat(moduleDirectories || 'node_modules');
+ if (paths) {
+ for (var k = 0; k < paths.length; ++k) {
+ moduleDirs.push(path.basename(paths[k]));
+ }
+ }
+
+ var foundModuleDirs = {};
+ var uniqueDirs = {};
+ var parsedDirs = {};
+ for (var i = 0; i < dirs.length; ++i) {
+ var parsed = parse(dirs[i]);
+ if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; }
+ foundModuleDirs[parsed.base] += 1;
+ parsedDirs[parsed.dir] = true;
+ uniqueDirs[dirs[i]] = true;
+ }
+ t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has');
+ var foundModuleDirNames = keys(foundModuleDirs);
+ t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found');
+ t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique');
+
+ var counts = {};
+ for (var j = 0; j < foundModuleDirNames.length; ++j) {
+ counts[foundModuleDirs[j]] = true;
+ }
+ t.equal(keys(counts).length, 1, 'all found module directories had the same count');
+};
+
+test('node-modules-paths', function (t) {
+ t.test('no options', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var dirs = nodeModulesPaths(start);
+
+ verifyDirs(t, start, dirs);
+
+ t.end();
+ });
+
+ t.test('empty options', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var dirs = nodeModulesPaths(start, {});
+
+ verifyDirs(t, start, dirs);
+
+ t.end();
+ });
+
+ t.test('with paths=array option', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var paths = ['a', 'b'];
+ var dirs = nodeModulesPaths(start, { paths: paths });
+
+ verifyDirs(t, start, dirs, null, paths);
+
+ t.end();
+ });
+
+ t.test('with paths=function option', function (t) {
+ var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) {
+ return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request));
+ };
+
+ var start = path.join(__dirname, 'resolver');
+ var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg');
+
+ verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]);
+
+ t.end();
+ });
+
+ t.test('with paths=function skipping node modules resolution', function (t) {
+ var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) {
+ return [];
+ };
+ var start = path.join(__dirname, 'resolver');
+ var dirs = nodeModulesPaths(start, { paths: paths });
+ t.deepEqual(dirs, [], 'no node_modules was computed');
+ t.end();
+ });
+
+ t.test('with moduleDirectory option', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var moduleDirectory = 'not node modules';
+ var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory });
+
+ verifyDirs(t, start, dirs, moduleDirectory);
+
+ t.end();
+ });
+
+ t.test('with 1 moduleDirectory and paths options', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var paths = ['a', 'b'];
+ var moduleDirectory = 'not node modules';
+ var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory });
+
+ verifyDirs(t, start, dirs, moduleDirectory, paths);
+
+ t.end();
+ });
+
+ t.test('with 1+ moduleDirectory and paths options', function (t) {
+ var start = path.join(__dirname, 'resolver');
+ var paths = ['a', 'b'];
+ var moduleDirectories = ['not node modules', 'other modules'];
+ var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
+
+ verifyDirs(t, start, dirs, moduleDirectories, paths);
+
+ t.end();
+ });
+
+ t.test('combine paths correctly on Windows', function (t) {
+ var start = 'C:\\Users\\username\\myProject\\src';
+ var paths = [];
+ var moduleDirectories = ['node_modules', start];
+ var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
+
+ t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
+
+ t.end();
+ });
+
+ t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) {
+ var start = '/Users/username/git/myProject/src';
+ var paths = [];
+ var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src'];
+ var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories });
+
+ t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir');
+
+ t.end();
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path.js
new file mode 100644
index 0000000000000000000000000000000000000000..e463d6c8c313b3554d5d4e07643fea29cfa86c51
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path.js
@@ -0,0 +1,70 @@
+var fs = require('fs');
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('$NODE_PATH', function (t) {
+ t.plan(8);
+
+ var isDir = function (dir, cb) {
+ if (dir === '/node_path' || dir === 'node_path/x') {
+ return cb(null, true);
+ }
+ fs.stat(dir, function (err, stat) {
+ if (!err) {
+ return cb(null, stat.isDirectory());
+ }
+ if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false);
+ return cb(err);
+ });
+ };
+
+ resolve('aaa', {
+ paths: [
+ path.join(__dirname, '/node_path/x'),
+ path.join(__dirname, '/node_path/y')
+ ],
+ basedir: __dirname,
+ isDirectory: isDir
+ }, function (err, res) {
+ t.error(err);
+ t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves');
+ });
+
+ resolve('bbb', {
+ paths: [
+ path.join(__dirname, '/node_path/x'),
+ path.join(__dirname, '/node_path/y')
+ ],
+ basedir: __dirname,
+ isDirectory: isDir
+ }, function (err, res) {
+ t.error(err);
+ t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves');
+ });
+
+ resolve('ccc', {
+ paths: [
+ path.join(__dirname, '/node_path/x'),
+ path.join(__dirname, '/node_path/y')
+ ],
+ basedir: __dirname,
+ isDirectory: isDir
+ }, function (err, res) {
+ t.error(err);
+ t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves');
+ });
+
+ // ensure that relative paths still resolve against the regular `node_modules` correctly
+ resolve('tap', {
+ paths: [
+ 'node_path'
+ ],
+ basedir: path.join(__dirname, 'node_path/x'),
+ isDirectory: isDir
+ }, function (err, res) {
+ var root = require('tap/package.json').main; // eslint-disable-line global-require
+ t.error(err);
+ t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves');
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/x/aaa/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/x/aaa/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/x/ccc/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/x/ccc/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/y/bbb/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/y/bbb/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/y/ccc/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/node_path/y/ccc/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/nonstring.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/nonstring.js
new file mode 100644
index 0000000000000000000000000000000000000000..ef63c40f9393dc63219d5e3debb7ed6db175c455
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/nonstring.js
@@ -0,0 +1,9 @@
+var test = require('tape');
+var resolve = require('../');
+
+test('nonstring', function (t) {
+ t.plan(1);
+ resolve(555, function (err, res, pkg) {
+ t.ok(err);
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter.js
new file mode 100644
index 0000000000000000000000000000000000000000..16519aeae51c4fb65b8ccdd69f303a2315358ef3
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter.js
@@ -0,0 +1,75 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+var resolverDir = path.join(__dirname, '/pathfilter/deep_ref');
+
+var pathFilterFactory = function (t) {
+ return function (pkg, x, remainder) {
+ t.equal(pkg.version, '1.2.3');
+ t.equal(x, path.join(resolverDir, 'node_modules/deep/ref'));
+ t.equal(remainder, 'ref');
+ return 'alt';
+ };
+};
+
+test('#62: deep module references and the pathFilter', function (t) {
+ t.test('deep/ref.js', function (st) {
+ st.plan(3);
+
+ resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) {
+ if (err) st.fail(err);
+
+ st.equal(pkg.version, '1.2.3');
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
+ });
+
+ var res = resolve.sync('deep/ref', { basedir: resolverDir });
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
+ });
+
+ t.test('deep/deeper/ref', function (st) {
+ st.plan(4);
+
+ resolve(
+ 'deep/deeper/ref',
+ { basedir: resolverDir },
+ function (err, res, pkg) {
+ if (err) t.fail(err);
+ st.notEqual(pkg, undefined);
+ st.equal(pkg.version, '1.2.3');
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
+ }
+ );
+
+ var res = resolve.sync(
+ 'deep/deeper/ref',
+ { basedir: resolverDir }
+ );
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
+ });
+
+ t.test('deep/ref alt', function (st) {
+ st.plan(8);
+
+ var pathFilter = pathFilterFactory(st);
+
+ var res = resolve.sync(
+ 'deep/ref',
+ { basedir: resolverDir, pathFilter: pathFilter }
+ );
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
+
+ resolve(
+ 'deep/ref',
+ { basedir: resolverDir, pathFilter: pathFilter },
+ function (err, res, pkg) {
+ if (err) st.fail(err);
+ st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
+ st.end();
+ }
+ );
+ });
+
+ t.end();
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter/deep_ref/main.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter/deep_ref/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter_sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter_sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..e1ff72843c0462e81300750c5c30e698266c4f16
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/pathfilter_sync.js
@@ -0,0 +1,24 @@
+var test = require('tape');
+var path = require('path');
+var resolve = require('../');
+
+test('synchronous pathfilter', function (t) {
+ var res;
+ var resolverDir = __dirname + '/pathfilter/deep_ref';
+ var pathFilter = function (pkg, x, remainder) {
+ t.equal(pkg.version, '1.2.3');
+ t.equal(x, path.join(resolverDir, 'node_modules', 'deep', 'ref'));
+ t.equal(remainder, 'ref');
+ return 'alt';
+ };
+
+ res = resolve.sync('deep/ref', { basedir: resolverDir });
+ t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'ref.js'));
+
+ res = resolve.sync('deep/deeper/ref', { basedir: resolverDir });
+ t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'deeper', 'ref.js'));
+
+ res = resolve.sync('deep/ref', { basedir: resolverDir, pathFilter: pathFilter });
+ t.equal(res, path.join(resolverDir, 'node_modules', 'deep', 'alt.js'));
+ t.end();
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence.js
new file mode 100644
index 0000000000000000000000000000000000000000..2febb598fbc06832ce5b076735cb9f79fb257c7c
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence.js
@@ -0,0 +1,23 @@
+var path = require('path');
+var test = require('tape');
+var resolve = require('../');
+
+test('precedence', function (t) {
+ t.plan(3);
+ var dir = path.join(__dirname, 'precedence/aaa');
+
+ resolve('./', { basedir: dir }, function (err, res, pkg) {
+ t.ifError(err);
+ t.equal(res, path.join(dir, 'index.js'));
+ t.equal(pkg.name, 'resolve');
+ });
+});
+
+test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string
+ t.plan(1);
+ var dir = path.join(__dirname, 'precedence/bbb');
+
+ resolve('./', { basedir: dir }, function (err, res, pkg) {
+ t.ok(err);
+ });
+});
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa/main.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/aaa/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/bbb.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/bbb.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/bbb/main.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/precedence/bbb/main.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/doom.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/doom.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2f77720b8672a0e2ed8b49636775335884cb3ec0
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "baz",
+ "main": "quux.js"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/quux.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/baz/quux.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/a.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/a.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/b.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/b.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..bf406f0830f8aab6aaec9e3f60f1623fbe6854e6
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/browser_field/package.json
@@ -0,0 +1,5 @@
+{
+ "name": "browser_field",
+ "main": "a",
+ "browser": "b"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/cup.coffee b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/cup.coffee
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/cup.coffee
@@ -0,0 +1 @@
+
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..d7f4fc8079f60aaee820b293537b21d488a1bc31
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_main/package.json
@@ -0,0 +1,3 @@
+{
+ "main": "."
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_slash_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_slash_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_slash_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_slash_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51287b9d1e739a8827578a541e89f7e91450615
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/dot_slash_main/package.json
@@ -0,0 +1,3 @@
+{
+ "main": "./"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/empty_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/empty_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/empty_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/empty_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..dbb176e65c61b760b5df1b2d717846a98614e02f
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/empty_main/package.json
@@ -0,0 +1,3 @@
+{
+ "main": ""
+}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/false_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/false_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/false_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/false_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..a7416c0c7aa4a1df56419f92dcc7519836db8978
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/false_main/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "false_main",
+ "main": false
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/foo.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/foo.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/incorrect_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/incorrect_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/incorrect_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/incorrect_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..b7188041763f8a94977f173a26c41fdbf5f2effb
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/incorrect_main/package.json
@@ -0,0 +1,3 @@
+{
+ "main": "wrong.js"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/invalid_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/invalid_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..0590748642ae2eadb17726ec3d1b501c94652277
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/invalid_main/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "invalid_main",
+ "main": [
+ "why is this a thing",
+ "srsly omg wtf"
+ ]
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_index/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_index/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f2c75cf8e443b44d42ba5fd2527554f1f90c0db2
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_index/package.json
@@ -0,0 +1,3 @@
+{
+ "main": "index.js"
+}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..0bf896ce2608fb56bba875b23b90fb0e670db264
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/missing_main/package.json
@@ -0,0 +1,3 @@
+{
+ "notmain": "index.js"
+}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/mug.coffee b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/mug.coffee
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/mug.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/mug.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/lerna.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/lerna.json
new file mode 100644
index 0000000000000000000000000000000000000000..d6707ca0cd64d48d212b90abe2e72f24b092572f
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/lerna.json
@@ -0,0 +1,6 @@
+{
+ "packages": [
+ "packages/*"
+ ],
+ "version": "0.0.0"
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..4391d392ea2761caea4d8286cc8ccc56cfa3e4a5
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/package.json
@@ -0,0 +1,20 @@
+{
+ "name": "ljharb-monorepo-symlink-test",
+ "private": true,
+ "version": "0.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "postinstall": "lerna bootstrap",
+ "test": "node packages/package-a"
+ },
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "jquery": "^3.3.1",
+ "resolve": "../../../"
+ },
+ "devDependencies": {
+ "lerna": "^3.4.3"
+ }
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..8875a32df0ffc4eda94bb6c6dd9855ac604820c4
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js
@@ -0,0 +1,35 @@
+'use strict';
+
+var assert = require('assert');
+var path = require('path');
+var resolve = require('resolve');
+
+var basedir = __dirname + '/node_modules/@my-scope/package-b';
+
+var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js');
+
+/*
+ * preserveSymlinks === false
+ * will search NPM package from
+ * - packages/package-b/node_modules
+ * - packages/node_modules
+ * - node_modules
+ */
+assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected);
+assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected);
+
+/*
+ * preserveSymlinks === true
+ * will search NPM package from
+ * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules
+ * - packages/package-a/node_modules/@my-scope/packages/node_modules
+ * - packages/package-a/node_modules/@my-scope/node_modules
+ * - packages/package-a/node_modules/node_modules
+ * - packages/package-a/node_modules
+ * - packages/node_modules
+ * - node_modules
+ */
+assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected);
+assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected);
+
+console.log(' * all monorepo paths successfully resolved through symlinks');
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..204de51e05878b3451223ba654c5e4a790ef1e51
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@my-scope/package-a",
+ "version": "0.0.0",
+ "private": true,
+ "description": "",
+ "license": "MIT",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: run tests from root\" && exit 1"
+ },
+ "dependencies": {
+ "@my-scope/package-b": "^0.0.0"
+ }
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f57c3b5f5e454d3948e1a4bc5aec10fdcd79d8b5
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@my-scope/package-b",
+ "private": true,
+ "version": "0.0.0",
+ "description": "",
+ "license": "MIT",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: run tests from root\" && exit 1"
+ },
+ "dependencies": {
+ "@my-scope/package-a": "^0.0.0"
+ }
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js
new file mode 100644
index 0000000000000000000000000000000000000000..9b4846a82a77be169097f041f791070732229cb7
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js
@@ -0,0 +1,26 @@
+var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
+var b;
+var c;
+
+var test = function test() {
+ console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
+ console.log(b, ': preserveSymlinks true');
+ console.log(c, ': preserveSymlinks false');
+
+ if (a !== b && a !== c) {
+ throw 'async: no match';
+ }
+ console.log('async: success! a matched either b or c\n');
+};
+
+require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) {
+ if (err) { throw err; }
+ b = result.replace(process.cwd(), '$CWD');
+ if (b && c) { test(); }
+});
+require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) {
+ if (err) { throw err; }
+ c = result.replace(process.cwd(), '$CWD');
+ if (b && c) { test(); }
+});
+
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..acfe9e9517720ab5532c247052fadb214c5ffef3
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "mylib",
+ "version": "0.0.0",
+ "description": "",
+ "private": true,
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "buffer": "*"
+ }
+}
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js
new file mode 100644
index 0000000000000000000000000000000000000000..3283efc2ec81f8d2a62be9a1fd28a192403ce549
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js
@@ -0,0 +1,12 @@
+var a = require.resolve('buffer/').replace(process.cwd(), '$CWD');
+var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD');
+var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD');
+
+console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false'));
+console.log(b, ': preserveSymlinks true');
+console.log(c, ': preserveSymlinks false');
+
+if (a !== b && a !== c) {
+ throw 'sync: no match';
+}
+console.log('sync: success! a matched either b or c\n');
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/null_main/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/null_main/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/null_main/package.json b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/null_main/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..b82890e2b0f11de27628dd9347e003a852d07759
--- /dev/null
+++ b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/null_main/package.json
@@ -0,0 +1,3 @@
+{
+ "main": null
+}
\ No newline at end of file
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/other_path/lib/other-lib.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/other_path/root.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/other_path/root.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/quux/foo/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/quux/foo/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/same_names/foo.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/same_names/foo.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/same_names/foo/index.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/same_names/foo/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/package/bar.js b/node_modules/eslint-plugin-react/node_modules/resolve/test/resolver/symlinked/package/bar.js
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391