Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/eslint-plugin-react/lib/util/props.js

    rd565449 r0c6b92a  
    1010 * Checks if the Identifier node passed in looks like a propTypes declaration.
    1111 * @param {ASTNode} node The node to check. Must be an Identifier node.
    12  * @returns {Boolean} `true` if the node is a propTypes declaration, `false` if not
     12 * @returns {boolean} `true` if the node is a propTypes declaration, `false` if not
    1313 */
    1414function isPropTypesDeclaration(node) {
     
    2525 * Checks if the node passed in looks like a contextTypes declaration.
    2626 * @param {ASTNode} node The node to check.
    27  * @returns {Boolean} `true` if the node is a contextTypes declaration, `false` if not
     27 * @returns {boolean} `true` if the node is a contextTypes declaration, `false` if not
    2828 */
    2929function isContextTypesDeclaration(node) {
     
    4040 * Checks if the node passed in looks like a contextType declaration.
    4141 * @param {ASTNode} node The node to check.
    42  * @returns {Boolean} `true` if the node is a contextType declaration, `false` if not
     42 * @returns {boolean} `true` if the node is a contextType declaration, `false` if not
    4343 */
    4444function isContextTypeDeclaration(node) {
     
    4949 * Checks if the node passed in looks like a childContextTypes declaration.
    5050 * @param {ASTNode} node The node to check.
    51  * @returns {Boolean} `true` if the node is a childContextTypes declaration, `false` if not
     51 * @returns {boolean} `true` if the node is a childContextTypes declaration, `false` if not
    5252 */
    5353function isChildContextTypesDeclaration(node) {
     
    5858 * Checks if the Identifier node passed in looks like a defaultProps declaration.
    5959 * @param {ASTNode} node The node to check. Must be an Identifier node.
    60  * @returns {Boolean} `true` if the node is a defaultProps declaration, `false` if not
     60 * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not
    6161 */
    6262function isDefaultPropsDeclaration(node) {
     
    6868 * Checks if we are declaring a display name
    6969 * @param {ASTNode} node The AST node being checked.
    70  * @returns {Boolean} True if we are declaring a display name, false if not.
     70 * @returns {boolean} True if we are declaring a display name, false if not.
    7171 */
    7272function isDisplayNameDeclaration(node) {
     
    8787 * Checks if the PropTypes MemberExpression node passed in declares a required propType.
    8888 * @param {ASTNode} propTypeExpression node to check. Must be a `PropTypes` MemberExpression.
    89  * @returns {Boolean} `true` if this PropType is required, `false` if not.
     89 * @returns {boolean} `true` if this PropType is required, `false` if not.
    9090 */
    9191function isRequiredPropType(propTypeExpression) {
    92   return propTypeExpression.type === 'MemberExpression' && propTypeExpression.property.name === 'isRequired';
     92  return propTypeExpression.type === 'MemberExpression'
     93    && propTypeExpression.property.name === 'isRequired';
     94}
     95
     96/**
     97 * Returns the type arguments of a node or type parameters if type arguments are not available.
     98 * @param {ASTNode} node The node to get the type arguments from.
     99 * @returns {ASTNode} The type arguments or type parameters of the node.
     100 */
     101function getTypeArguments(node) {
     102  if ('typeArguments' in node) {
     103    return node.typeArguments;
     104  }
     105  return node.typeParameters;
     106}
     107
     108/**
     109 * Returns the super type arguments of a node or super type parameters if type arguments are not available.
     110 * @param {ASTNode} node The node to get the super type arguments from.
     111 * @returns {ASTNode} The super type arguments or parameters of the node.
     112 */
     113function getSuperTypeArguments(node) {
     114  if ('superTypeArguments' in node) {
     115    return node.superTypeArguments;
     116  }
     117  return node.superTypeParameters;
    93118}
    94119
     
    101126  isDisplayNameDeclaration,
    102127  isRequiredPropType,
     128  getTypeArguments,
     129  getSuperTypeArguments,
    103130};
Note: See TracChangeset for help on using the changeset viewer.