diff --git a/lib/rules/boolean-prop-naming.js b/lib/rules/boolean-prop-naming.js index e6ea400025..fe55d52065 100644 --- a/lib/rules/boolean-prop-naming.js +++ b/lib/rules/boolean-prop-naming.js @@ -128,7 +128,7 @@ module.exports = { /** * Checks if prop is declared in flow way * @param {Object} prop Property object, single prop type declaration - * @returns {Boolean} + * @returns {boolean} */ function flowCheck(prop) { return ( @@ -141,7 +141,7 @@ module.exports = { /** * Checks if prop is declared in regular way * @param {Object} prop Property object, single prop type declaration - * @returns {Boolean} + * @returns {boolean} */ function regularCheck(prop) { const propKey = getPropKey(prop); @@ -165,7 +165,7 @@ module.exports = { /** * Checks if prop is nested * @param {Object} prop Property object, single prop type declaration - * @returns {Boolean} + * @returns {boolean} */ function nestedPropTypes(prop) { return ( diff --git a/lib/rules/display-name.js b/lib/rules/display-name.js index 7108367ec2..5e5b8b6980 100644 --- a/lib/rules/display-name.js +++ b/lib/rules/display-name.js @@ -73,7 +73,7 @@ module.exports = { /** * Checks if React.forwardRef is nested inside React.memo * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if React.forwardRef is nested inside React.memo, false if not. + * @returns {boolean} True if React.forwardRef is nested inside React.memo, false if not. */ function isNestedMemo(node) { const argumentIsCallExpression = node.arguments && node.arguments[0] && node.arguments[0].type === 'CallExpression'; @@ -111,7 +111,7 @@ module.exports = { /** * Checks if the component have a name set by the transpiler * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if component has a name, false if not. + * @returns {boolean} True if component has a name, false if not. */ function hasTranspilerName(node) { const namedObjectAssignment = ( diff --git a/lib/rules/jsx-closing-bracket-location.js b/lib/rules/jsx-closing-bracket-location.js index 21f99ffc9c..f3286826b3 100644 --- a/lib/rules/jsx-closing-bracket-location.js +++ b/lib/rules/jsx-closing-bracket-location.js @@ -100,7 +100,7 @@ module.exports = { /** * Get expected location for the closing bracket * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop - * @return {String} Expected location for the closing bracket + * @return {string} Expected location for the closing bracket */ function getExpectedLocation(tokens) { let location; @@ -121,7 +121,7 @@ module.exports = { * Get the correct 0-indexed column for the closing bracket, given the * expected location. * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop - * @param {String} expectedLocation Expected location for the closing bracket + * @param {string} expectedLocation Expected location for the closing bracket * @return {?Number} The correct column for the closing bracket, or null */ function getCorrectColumn(tokens, expectedLocation) { @@ -140,8 +140,8 @@ module.exports = { /** * Check if the closing bracket is correctly located * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop - * @param {String} expectedLocation Expected location for the closing bracket - * @return {Boolean} True if the closing bracket is correctly located, false if not + * @param {string} expectedLocation Expected location for the closing bracket + * @return {boolean} True if the closing bracket is correctly located, false if not */ function hasCorrectLocation(tokens, expectedLocation) { switch (expectedLocation) { @@ -163,9 +163,9 @@ module.exports = { /** * Get the characters used for indentation on the line to be matched * @param {Object} tokens Locations of the opening bracket, closing bracket and last prop - * @param {String} expectedLocation Expected location for the closing bracket - * @param {Number} [correctColumn] Expected column for the closing bracket. Default to 0 - * @return {String} The characters used for indentation + * @param {string} expectedLocation Expected location for the closing bracket + * @param {number} [correctColumn] Expected column for the closing bracket. Default to 0 + * @return {string} The characters used for indentation */ function getIndentation(tokens, expectedLocation, correctColumn) { const newColumn = correctColumn || 0; @@ -235,7 +235,7 @@ module.exports = { * Get an unique ID for a given JSXOpeningElement * * @param {ASTNode} node The AST node being checked. - * @returns {String} Unique ID (based on its range) + * @returns {string} Unique ID (based on its range) */ function getOpeningElementId(node) { return node.range.join(':'); diff --git a/lib/rules/jsx-indent-props.js b/lib/rules/jsx-indent-props.js index 10adb1b8d9..4e7c048511 100644 --- a/lib/rules/jsx-indent-props.js +++ b/lib/rules/jsx-indent-props.js @@ -116,8 +116,8 @@ module.exports = { /** * Reports a given indent violation and properly pluralizes the message * @param {ASTNode} node Node violating the indent rule - * @param {Number} needed Expected indentation character count - * @param {Number} gotten Indentation character count in the actual node/code + * @param {number} needed Expected indentation character count + * @param {number} gotten Indentation character count in the actual node/code */ function report(node, needed, gotten) { const msgContext = { @@ -141,7 +141,7 @@ module.exports = { /** * Get node indent * @param {ASTNode} node Node to examine - * @return {Number} Indent + * @return {number} Indent */ function getNodeIndent(node) { let src = getText(context, node, node.loc.start.column + extraColumnStart); @@ -173,7 +173,7 @@ module.exports = { /** * Check indent for nodes list * @param {ASTNode[]} nodes list of node objects - * @param {Number} indent needed indent + * @param {number} indent needed indent */ function checkNodesIndent(nodes, indent) { let nestedIndent = indent; diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index 0bfd0507dd..243a17b485 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -105,7 +105,7 @@ module.exports = { /** * Responsible for fixing the indentation issue fix * @param {ASTNode} node Node violating the indent rule - * @param {Number} needed Expected indentation character count + * @param {number} needed Expected indentation character count * @returns {Function} function to be executed by the fixer * @private */ @@ -146,8 +146,8 @@ module.exports = { /** * Reports a given indent violation and properly pluralizes the message * @param {ASTNode} node Node violating the indent rule - * @param {Number} needed Expected indentation character count - * @param {Number} gotten Indentation character count in the actual node/code + * @param {number} needed Expected indentation character count + * @param {number} gotten Indentation character count in the actual node/code * @param {Object} [loc] Error line and column location */ function report(node, needed, gotten, loc) { @@ -168,9 +168,9 @@ module.exports = { /** * Get node indent * @param {ASTNode} node Node to examine - * @param {Boolean} [byLastLine] get indent of node's last line - * @param {Boolean} [excludeCommas] skip comma on start of line - * @return {Number} Indent + * @param {boolean} [byLastLine] get indent of node's last line + * @param {boolean} [excludeCommas] skip comma on start of line + * @return {number} Indent */ function getNodeIndent(node, byLastLine, excludeCommas) { let src = getText(context, node, node.loc.start.column + extraColumnStart); @@ -197,7 +197,7 @@ module.exports = { /** * Check if the node is the right member of a logical expression * @param {ASTNode} node The node to check - * @return {Boolean} true if its the case, false if not + * @return {boolean} true if its the case, false if not */ function isRightInLogicalExp(node) { return ( @@ -212,7 +212,7 @@ module.exports = { /** * Check if the node is the alternate member of a conditional expression * @param {ASTNode} node The node to check - * @return {Boolean} true if its the case, false if not + * @return {boolean} true if its the case, false if not */ function isAlternateInConditionalExp(node) { return ( @@ -227,7 +227,7 @@ module.exports = { /** * Check if the node is within a DoExpression block but not the first expression (which need to be indented) * @param {ASTNode} node The node to check - * @return {Boolean} true if its the case, false if not + * @return {boolean} true if its the case, false if not */ function isSecondOrSubsequentExpWithinDoExp(node) { /* @@ -298,8 +298,8 @@ module.exports = { /** * Check indent for nodes list * @param {ASTNode} node The node to check - * @param {Number} indent needed indent - * @param {Boolean} [excludeCommas] skip comma on start of line + * @param {number} indent needed indent + * @param {boolean} [excludeCommas] skip comma on start of line */ function checkNodesIndent(node, indent, excludeCommas) { const nodeIndent = getNodeIndent(node, false, excludeCommas); @@ -318,7 +318,7 @@ module.exports = { /** * Check indent for Literal Node or JSXText Node * @param {ASTNode} node The node to check - * @param {Number} indent needed indent + * @param {number} indent needed indent */ function checkLiteralNodeIndent(node, indent) { const value = node.value; diff --git a/lib/rules/jsx-no-target-blank.js b/lib/rules/jsx-no-target-blank.js index 4ad12a464f..9f5d239d6c 100644 --- a/lib/rules/jsx-no-target-blank.js +++ b/lib/rules/jsx-no-target-blank.js @@ -70,7 +70,7 @@ function hasDynamicLink(node, linkAttributes) { * Get the string(s) from a value * @param {ASTNode} value The AST node being checked. * @param {ASTNode} targetValue The AST node being checked. - * @returns {String | String[] | null} The string value, or null if not a string. + * @returns {string | string[] | null} The string value, or null if not a string. */ function getStringFromValue(value, targetValue) { if (value) { diff --git a/lib/rules/jsx-sort-default-props.js b/lib/rules/jsx-sort-default-props.js index 379d80677c..0de8f221c3 100644 --- a/lib/rules/jsx-sort-default-props.js +++ b/lib/rules/jsx-sort-default-props.js @@ -57,7 +57,7 @@ module.exports = { /** * Get properties name * @param {Object} node - Property. - * @returns {String} Property name. + * @returns {string} Property name. */ function getPropertyName(node) { if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) { @@ -78,7 +78,7 @@ module.exports = { /** * 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 + * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not */ function isDefaultPropsDeclaration(node) { const propName = getPropertyName(node); diff --git a/lib/rules/jsx-sort-props.js b/lib/rules/jsx-sort-props.js index 4c138e9f69..ec9d869b74 100644 --- a/lib/rules/jsx-sort-props.js +++ b/lib/rules/jsx-sort-props.js @@ -276,8 +276,8 @@ function generateFixerFunction(node, context, reservedList) { /** * Checks if the `reservedFirst` option is valid * @param {Object} context The context of the rule - * @param {Boolean|Array} reservedFirst The `reservedFirst` option - * @return {Function|undefined} If an error is detected, a function to generate the error message, otherwise, `undefined` + * @param {boolean | string[]} reservedFirst The `reservedFirst` option + * @return {Function | undefined} If an error is detected, a function to generate the error message, otherwise, `undefined` */ // eslint-disable-next-line consistent-return function validateReservedFirstConfig(context, reservedFirst) { diff --git a/lib/rules/no-children-prop.js b/lib/rules/no-children-prop.js index 508488e4d9..3ccaf53729 100644 --- a/lib/rules/no-children-prop.js +++ b/lib/rules/no-children-prop.js @@ -17,7 +17,7 @@ const report = require('../util/report'); * Checks if the node is a createElement call with a props literal. * @param {ASTNode} node - The AST node being checked. * @param {Context} context - The AST node being checked. - * @returns {Boolean} - True if node is a createElement call with a props + * @returns {boolean} - True if node is a createElement call with a props * object literal, False if not. */ function isCreateElementWithProps(node, context) { diff --git a/lib/rules/no-danger-with-children.js b/lib/rules/no-danger-with-children.js index 9f07d0c535..edf5073a71 100644 --- a/lib/rules/no-danger-with-children.js +++ b/lib/rules/no-danger-with-children.js @@ -85,7 +85,7 @@ module.exports = { /** * Checks to see if a node is a line break * @param {ASTNode} node The AST node being checked - * @returns {Boolean} True if node is a line break, false if not + * @returns {boolean} True if node is a line break, false if not */ function isLineBreak(node) { const isLiteral = node.type === 'Literal' || node.type === 'JSXText'; diff --git a/lib/rules/no-danger.js b/lib/rules/no-danger.js index be5c961e61..fb70263208 100644 --- a/lib/rules/no-danger.js +++ b/lib/rules/no-danger.js @@ -29,7 +29,7 @@ const DANGEROUS_PROPERTIES = fromEntries(DANGEROUS_PROPERTY_NAMES.map((prop) => /** * Checks if a JSX attribute is dangerous. - * @param {String} name - Name of the attribute to check. + * @param {string} name - Name of the attribute to check. * @returns {boolean} Whether or not the attribute is dangerous. */ function isDangerous(name) { diff --git a/lib/rules/no-direct-mutation-state.js b/lib/rules/no-direct-mutation-state.js index ef9cba77f0..761151fbb8 100644 --- a/lib/rules/no-direct-mutation-state.js +++ b/lib/rules/no-direct-mutation-state.js @@ -38,7 +38,7 @@ module.exports = { /** * Checks if the component is valid * @param {Object} component The component to process - * @returns {Boolean} True if the component is valid, false if not. + * @returns {boolean} True if the component is valid, false if not. */ function isValid(component) { return !!component && !component.mutateSetState; @@ -73,7 +73,7 @@ module.exports = { /** * Determine if we should currently ignore assignments in this component. * @param {?Object} component The component to process - * @returns {Boolean} True if we should skip assignment checks. + * @returns {boolean} True if we should skip assignment checks. */ function shouldIgnoreComponent(component) { return !component || (component.inConstructor && !component.inCallExpression); diff --git a/lib/rules/no-multi-comp.js b/lib/rules/no-multi-comp.js index 76b3fa0af7..8cf73c90bc 100644 --- a/lib/rules/no-multi-comp.js +++ b/lib/rules/no-multi-comp.js @@ -50,7 +50,7 @@ module.exports = { /** * Checks if the component is ignored * @param {Object} component The component being checked. - * @returns {Boolean} True if the component is ignored, false if not. + * @returns {boolean} True if the component is ignored, false if not. */ function isIgnored(component) { return ( diff --git a/lib/rules/no-redundant-should-component-update.js b/lib/rules/no-redundant-should-component-update.js index 849191d176..e7a439d8e8 100644 --- a/lib/rules/no-redundant-should-component-update.js +++ b/lib/rules/no-redundant-should-component-update.js @@ -36,7 +36,7 @@ module.exports = { /** * Checks for shouldComponentUpdate property * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} Whether or not the property exists. + * @returns {boolean} Whether or not the property exists. */ function hasShouldComponentUpdate(node) { const properties = astUtil.getComponentProperties(node); @@ -49,7 +49,7 @@ module.exports = { /** * Get name of node if available * @param {ASTNode} node The AST node being checked. - * @return {String} The name of the node + * @return {string} The name of the node */ function getNodeName(node) { if (node.id) { diff --git a/lib/rules/no-set-state.js b/lib/rules/no-set-state.js index 78244c38d8..0866552141 100644 --- a/lib/rules/no-set-state.js +++ b/lib/rules/no-set-state.js @@ -38,7 +38,7 @@ module.exports = { /** * Checks if the component is valid * @param {Object} component The component to process - * @returns {Boolean} True if the component is valid, false if not. + * @returns {boolean} True if the component is valid, false if not. */ function isValid(component) { return !!component && !component.useSetState; diff --git a/lib/rules/no-string-refs.js b/lib/rules/no-string-refs.js index 09ce286685..c5c3b29166 100644 --- a/lib/rules/no-string-refs.js +++ b/lib/rules/no-string-refs.js @@ -46,7 +46,7 @@ module.exports = { /** * Checks if we are using refs * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if we are using refs, false if not. + * @returns {boolean} True if we are using refs, false if not. */ function isRefsUsage(node) { return !!( @@ -59,7 +59,7 @@ module.exports = { /** * Checks if we are using a ref attribute * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if we are using a ref attribute, false if not. + * @returns {boolean} True if we are using a ref attribute, false if not. */ function isRefAttribute(node) { return !!( @@ -72,7 +72,7 @@ module.exports = { /** * Checks if a node contains a string value * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if the node contains a string value, false if not. + * @returns {boolean} True if the node contains a string value, false if not. */ function containsStringLiteral(node) { return !!( @@ -85,7 +85,7 @@ module.exports = { /** * Checks if a node contains a string value within a jsx expression * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if the node contains a string value within a jsx expression, false if not. + * @returns {boolean} True if the node contains a string value within a jsx expression, false if not. */ function containsStringExpressionContainer(node) { return !!( diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index 674e93071f..61ca8ad809 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -415,8 +415,8 @@ function isValidHTMLTagInJSX(childNode) { * * Note - these exclusions are not made by React core team, but `eslint-plugin-react` community. * - * @param {String} name - Attribute name to be normalized - * @returns {String} Result + * @param {string} name - Attribute name to be normalized + * @returns {string} Result */ function normalizeAttributeCase(name) { return DOM_PROPERTIES_IGNORE_CASE.find((element) => element.toLowerCase() === name.toLowerCase()) || name; @@ -428,7 +428,7 @@ function normalizeAttributeCase(name) { * not start with any casing of "xml", and separated by hyphens (-) (which is also called "kebab case" or "dash case"), * then the attribute is a valid data attribute. * - * @param {String} name - Attribute name to be tested + * @param {string} name - Attribute name to be tested * @returns {boolean} Result */ function isValidDataAttribute(name) { @@ -438,7 +438,7 @@ function isValidDataAttribute(name) { /** * Checks if an attribute name has at least one uppercase characters * - * @param {String} name + * @param {string} name * @returns {boolean} Result */ function hasUpperCaseCharacter(name) { @@ -449,8 +449,8 @@ function hasUpperCaseCharacter(name) { * Checks if an attribute name is a standard aria attribute by compering it to a list * of standard aria property names * - * @param {String} name - Attribute name to be tested - * @returns {Boolean} Result + * @param {string} name - Attribute name to be tested + * @returns {boolean} Result */ function isValidAriaAttribute(name) { @@ -460,7 +460,7 @@ function isValidAriaAttribute(name) { /** * Extracts the tag name for the JSXAttribute * @param {JSXAttribute} node - JSXAttribute being tested. - * @returns {String|null} tag name + * @returns {string | null} tag name */ function getTagName(node) { if (node && node.parent && node.parent.name && node.parent.name) { @@ -473,7 +473,7 @@ function getTagName(node) { * Test wether the tag name for the JSXAttribute is * something like * @param {JSXAttribute} node - JSXAttribute being tested. - * @returns {Boolean} result + * @returns {boolean} result */ function tagNameHasDot(node) { return !!( @@ -485,9 +485,9 @@ function tagNameHasDot(node) { /** * Get the standard name of the attribute. - * @param {String} name - Name of the attribute. - * @param {String} context - eslint context - * @returns {String | undefined} The standard name of the attribute, or undefined if no standard name was found. + * @param {string} name - Name of the attribute. + * @param {string} context - eslint context + * @returns {string | undefined} The standard name of the attribute, or undefined if no standard name was found. */ function getStandardName(name, context) { if (has(DOM_ATTRIBUTE_NAMES, name)) { diff --git a/lib/rules/no-unstable-nested-components.js b/lib/rules/no-unstable-nested-components.js index c1dd606b6a..909d8110e7 100644 --- a/lib/rules/no-unstable-nested-components.js +++ b/lib/rules/no-unstable-nested-components.js @@ -23,8 +23,8 @@ const HOOK_REGEXP = /^use[A-Z0-9].*$/; /** * Generate error message with given parent component name - * @param {String} parentName Name of the parent component, if known - * @returns {String} Error message with parent component name + * @param {string} parentName Name of the parent component, if known + * @returns {string} Error message with parent component name */ function generateErrorMessageWithParentName(parentName) { return `Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component${parentName ? ` “${parentName}” ` : ' '}and pass data as props.`; @@ -32,8 +32,8 @@ function generateErrorMessageWithParentName(parentName) { /** * Check whether given text starts with `render`. Comparison is case-sensitive. - * @param {String} text Text to validate - * @returns {Boolean} + * @param {string} text Text to validate + * @returns {boolean} */ function startsWithRender(text) { return (text || '').startsWith('render'); @@ -62,7 +62,7 @@ function getClosestMatchingParent(node, context, matcher) { * Matcher used to check whether given node is a `createElement` call * @param {ASTNode} node The AST node * @param {Context} context eslint context - * @returns {Boolean} True if node is a `createElement` call, false if not + * @returns {boolean} True if node is a `createElement` call, false if not */ function isCreateElementMatcher(node, context) { return ( @@ -75,7 +75,7 @@ function isCreateElementMatcher(node, context) { /** * Matcher used to check whether given node is a `ObjectExpression` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is a `ObjectExpression`, false if not + * @returns {boolean} True if node is a `ObjectExpression`, false if not */ function isObjectExpressionMatcher(node) { return node && node.type === 'ObjectExpression'; @@ -84,7 +84,7 @@ function isObjectExpressionMatcher(node) { /** * Matcher used to check whether given node is a `JSXExpressionContainer` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is a `JSXExpressionContainer`, false if not + * @returns {boolean} True if node is a `JSXExpressionContainer`, false if not */ function isJSXExpressionContainerMatcher(node) { return node && node.type === 'JSXExpressionContainer'; @@ -93,7 +93,7 @@ function isJSXExpressionContainerMatcher(node) { /** * Matcher used to check whether given node is a `JSXAttribute` of `JSXExpressionContainer` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is a `JSXAttribute` of `JSXExpressionContainer`, false if not + * @returns {boolean} True if node is a `JSXAttribute` of `JSXExpressionContainer`, false if not */ function isJSXAttributeOfExpressionContainerMatcher(node) { return ( @@ -107,7 +107,7 @@ function isJSXAttributeOfExpressionContainerMatcher(node) { /** * Matcher used to check whether given node is an object `Property` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is a `Property`, false if not + * @returns {boolean} True if node is a `Property`, false if not */ function isPropertyOfObjectExpressionMatcher(node) { return ( @@ -120,7 +120,7 @@ function isPropertyOfObjectExpressionMatcher(node) { /** * Matcher used to check whether given node is a `CallExpression` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is a `CallExpression`, false if not + * @returns {boolean} True if node is a `CallExpression`, false if not */ function isCallExpressionMatcher(node) { return node && node.type === 'CallExpression'; @@ -132,7 +132,7 @@ function isCallExpressionMatcher(node) { * {items.map(item =>
  • )} * ``` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is directly inside `map` call, false if not + * @returns {boolean} True if node is directly inside `map` call, false if not */ function isMapCall(node) { return ( @@ -147,7 +147,7 @@ function isMapCall(node) { * Check whether given node is `ReturnStatement` of a React hook * @param {ASTNode} node The AST node * @param {Context} context eslint context - * @returns {Boolean} True if node is a `ReturnStatement` of a React hook, false if not + * @returns {boolean} True if node is a `ReturnStatement` of a React hook, false if not */ function isReturnStatementOfHook(node, context) { if ( @@ -174,7 +174,7 @@ function isReturnStatementOfHook(node, context) { * ``` * @param {ASTNode} node The AST node * @param {Context} context eslint context - * @returns {Boolean} True if component is declared inside a render prop, false if not + * @returns {boolean} True if component is declared inside a render prop, false if not */ function isComponentInRenderProp(node, context) { if ( @@ -231,7 +231,7 @@ function isComponentInRenderProp(node, context) { *
    }] } /> * ``` * @param {ASTNode} node The AST node - * @returns {Boolean} True if component is declared inside a render property, false if not + * @returns {boolean} True if component is declared inside a render property, false if not */ function isDirectValueOfRenderProperty(node) { return ( @@ -247,7 +247,7 @@ function isDirectValueOfRenderProperty(node) { /** * Resolve the component name of given node * @param {ASTNode} node The AST node of the component - * @returns {String} Name of the component, if any + * @returns {string} Name of the component, if any */ function resolveComponentName(node) { const parentName = node.id && node.id.name; @@ -303,7 +303,7 @@ module.exports = { * ... * ``` * @param {ASTNode} node The AST node being checked - * @returns {Boolean} True if node is inside class component's render block, false if not + * @returns {boolean} True if node is inside class component's render block, false if not */ function isInsideRenderMethod(node) { const parentComponent = utils.getParentComponent(node); @@ -331,7 +331,7 @@ module.exports = { * ... * ``` * @param {ASTNode} node The AST node being checked - * @returns {Boolean} True if given node a function component declared inside class component, false if not + * @returns {boolean} True if given node a function component declared inside class component, false if not */ function isFunctionComponentInsideClassComponent(node) { const parentComponent = utils.getParentComponent(node); @@ -354,7 +354,7 @@ module.exports = { * }) * ``` * @param {ASTNode} node The AST node - * @returns {Boolean} True if node is declare inside `createElement` call's props, false if not + * @returns {boolean} True if node is declare inside `createElement` call's props, false if not */ function isComponentInsideCreateElementsProp(node) { if (!components.get(node)) { @@ -377,7 +377,7 @@ module.exports = { * { footer: () =>
    } * ``` * @param {ASTNode} node The AST node being checked - * @returns {Boolean} True if node is a component declared inside prop, false if not + * @returns {boolean} True if node is a component declared inside prop, false if not */ function isComponentInProp(node) { if (isPropertyOfObjectExpressionMatcher(node)) { @@ -399,7 +399,7 @@ module.exports = { * {{ a: () => null }} * ``` * @param {ASTNode} node The AST node being checked - * @returns {Boolean} True if node is a stateless component returning non-JSX, false if not + * @returns {boolean} True if node is a stateless component returning non-JSX, false if not */ function isStatelessComponentReturningNull(node) { const component = utils.getStatelessComponent(node); diff --git a/lib/rules/no-unused-prop-types.js b/lib/rules/no-unused-prop-types.js index 6da1b3d68f..55a21881ff 100644 --- a/lib/rules/no-unused-prop-types.js +++ b/lib/rules/no-unused-prop-types.js @@ -64,8 +64,8 @@ module.exports = { /** * Checks if the prop is ignored - * @param {String} name Name of the prop to check. - * @returns {Boolean} True if the prop is ignored, false if not. + * @param {string} name Name of the prop to check. + * @returns {boolean} True if the prop is ignored, false if not. */ function isIgnored(name) { return configuration.ignore.indexOf(name) !== -1; @@ -74,7 +74,7 @@ module.exports = { /** * 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. + * @returns {boolean} True if the component must be validated, false if not. */ function mustBeValidated(component) { return !!component && !component.ignoreUnusedPropTypesValidation; @@ -84,7 +84,7 @@ module.exports = { * Checks if a prop is used * @param {ASTNode} node The AST node being checked. * @param {Object} prop Declared prop object - * @returns {Boolean} True if the prop is used, false if not. + * @returns {boolean} True if the prop is used, false if not. */ function isPropUsed(node, prop) { const usedPropTypes = node.usedPropTypes || []; diff --git a/lib/rules/prefer-stateless-function.js b/lib/rules/prefer-stateless-function.js index bfbabe76be..8ba33a1a97 100644 --- a/lib/rules/prefer-stateless-function.js +++ b/lib/rules/prefer-stateless-function.js @@ -191,7 +191,7 @@ module.exports = { /** * Check if a given AST node have any other properties the ones available in stateless components * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if the node has at least one other property, false if not. + * @returns {boolean} True if the node has at least one other property, false if not. */ function hasOtherProperties(node) { const properties = astUtil.getComponentProperties(node); diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index eb6bab1c09..dabe5b0e7b 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -64,8 +64,8 @@ module.exports = { /** * Checks if the prop is ignored - * @param {String} name Name of the prop to check. - * @returns {Boolean} True if the prop is ignored, false if not. + * @param {string} name Name of the prop to check. + * @returns {boolean} True if the prop is ignored, false if not. */ function isIgnored(name) { return ignored.indexOf(name) !== -1; @@ -89,7 +89,7 @@ module.exports = { /** * Internal: Checks if the prop is declared * @param {Object} declaredPropTypes Description of propTypes declared in the current component - * @param {String[]} keyList Dot separated name of the prop to check. + * @param {string[]} keyList Dot separated name of the prop to check. * @returns {boolean} True if the prop is declared, false if not. */ function internalIsDeclaredInComponent(declaredPropTypes, keyList) { @@ -148,8 +148,8 @@ module.exports = { /** * Checks if the prop is declared * @param {ASTNode} node The AST node being checked. - * @param {String[]} names List of names of the prop to check. - * @returns {Boolean} True if the prop is declared, false if not. + * @param {string[]} names List of names of the prop to check. + * @returns {boolean} True if the prop is declared, false if not. */ function isDeclaredInComponent(node, names) { while (node) { @@ -190,7 +190,7 @@ module.exports = { /** * @param {Object} component The current component to process * @param {Array} list The all components to process - * @returns {Boolean} True if the component is nested False if not. + * @returns {boolean} True if the component is nested False if not. */ function checkNestedComponent(component, list) { const componentIsMemo = component.node.callee && component.node.callee.name === 'memo'; diff --git a/lib/rules/require-optimization.js b/lib/rules/require-optimization.js index a58c47a191..da6a7e0830 100644 --- a/lib/rules/require-optimization.js +++ b/lib/rules/require-optimization.js @@ -50,7 +50,7 @@ module.exports = { /** * Checks to see if our component is decorated by PureRenderMixin via reactMixin * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if node is decorated with a PureRenderMixin, false if not. + * @returns {boolean} True if node is decorated with a PureRenderMixin, false if not. */ function hasPureRenderDecorator(node) { if (node.decorators && node.decorators.length) { @@ -77,7 +77,7 @@ module.exports = { /** * Checks to see if our component is custom decorated * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if node is decorated name with a custom decorated, false if not. + * @returns {boolean} True if node is decorated name with a custom decorated, false if not. */ function hasCustomDecorator(node) { const allowLength = allowDecorators.length; @@ -101,7 +101,7 @@ module.exports = { /** * Checks if we are declaring a shouldComponentUpdate method * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if we are declaring a shouldComponentUpdate method, false if not. + * @returns {boolean} True if we are declaring a shouldComponentUpdate method, false if not. */ function isSCUDeclared(node) { return !!node && node.name === 'shouldComponentUpdate'; @@ -110,7 +110,7 @@ module.exports = { /** * Checks if we are declaring a PureRenderMixin mixin * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} True if we are declaring a PureRenderMixin method, false if not. + * @returns {boolean} True if we are declaring a PureRenderMixin method, false if not. */ function isPureRenderDeclared(node) { let hasPR = false; diff --git a/lib/rules/sort-comp.js b/lib/rules/sort-comp.js index e35574a682..ee409b780d 100644 --- a/lib/rules/sort-comp.js +++ b/lib/rules/sort-comp.js @@ -234,7 +234,7 @@ module.exports = { /** * Get properties name * @param {Object} node - Property. - * @returns {String} Property name. + * @returns {string} Property name. */ function getPropertyName(node) { if (node.kind === 'get') { diff --git a/lib/rules/sort-default-props.js b/lib/rules/sort-default-props.js index 2101307e00..50bd7ed53c 100644 --- a/lib/rules/sort-default-props.js +++ b/lib/rules/sort-default-props.js @@ -52,7 +52,7 @@ module.exports = { /** * Get properties name * @param {Object} node - Property. - * @returns {String} Property name. + * @returns {string} Property name. */ function getPropertyName(node) { if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) { @@ -73,7 +73,7 @@ module.exports = { /** * 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 + * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not */ function isDefaultPropsDeclaration(node) { const propName = getPropertyName(node); diff --git a/lib/rules/static-property-placement.js b/lib/rules/static-property-placement.js index 7baf2faeb4..ce38a8e42e 100644 --- a/lib/rules/static-property-placement.js +++ b/lib/rules/static-property-placement.js @@ -99,7 +99,7 @@ module.exports = { /** * Checks if we are declaring context in class * @param {ASTNode} node - * @returns {Boolean} True if we are declaring context in class, false if not. + * @returns {boolean} True if we are declaring context in class, false if not. */ function isContextInClass(node) { let blockNode; diff --git a/lib/util/Components.js b/lib/util/Components.js index 0ef615a133..6d9d9e5a9b 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -70,7 +70,7 @@ class Components { * Add a node to the components list, or update it if it's already in the list * * @param {ASTNode} node The AST node being added. - * @param {Number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes) + * @param {number} confidence Confidence in the component detection (0=banned, 1=maybe, 2=yes) * @returns {Object} Added component object */ add(node, confidence) { @@ -183,7 +183,7 @@ class Components { * Return the length of the components list * Components for which we are not confident are not counted * - * @returns {Number} Components list length + * @returns {number} Components list length */ length() { const list = Lists.get(this); @@ -751,7 +751,7 @@ function componentRule(rule, context) { * * @param {ASTNode} node The AST node being searched. (expects CallExpression) * @param {('useCallback'|'useContext'|'useDebugValue'|'useEffect'|'useImperativeHandle'|'useLayoutEffect'|'useMemo'|'useReducer'|'useRef'|'useState')[]} [expectedHookNames] React hook names to which search is limited. - * @returns {Boolean} True if the node is a call to a React hook + * @returns {boolean} True if the node is a call to a React hook */ isReactHookCall(node, expectedHookNames) { if (node.type !== 'CallExpression') { diff --git a/lib/util/annotations.js b/lib/util/annotations.js index 24b18074c0..2bc1437ff1 100644 --- a/lib/util/annotations.js +++ b/lib/util/annotations.js @@ -12,7 +12,7 @@ const getFirstTokens = require('./eslint').getFirstTokens; * Checks if we are declaring a `props` argument with a flow type annotation. * @param {ASTNode} node The AST node being checked. * @param {Object} context - * @returns {Boolean} True if the node is a type annotated props declaration, false if not. + * @returns {boolean} True if the node is a type annotated props declaration, false if not. */ function isAnnotatedFunctionPropsDeclaration(node, context) { if (!node || !node.params || !node.params.length) { diff --git a/lib/util/ast.js b/lib/util/ast.js index 8d0ec3cad8..9a11b7532f 100644 --- a/lib/util/ast.js +++ b/lib/util/ast.js @@ -160,7 +160,7 @@ function getPropertyNameNode(node) { /** * Get properties name * @param {Object} node - Property. - * @returns {String} Property name. + * @returns {string} Property name. */ function getPropertyName(node) { const nameNode = getPropertyNameNode(node); @@ -210,7 +210,7 @@ function getFirstNodeInLine(context, node) { * Checks if the node is the first in its line, excluding whitespace. * @param {Object} context The node to check * @param {ASTNode} node The node to check - * @return {Boolean} true if it's the first node in its line + * @return {boolean} true if it's the first node in its line */ function isNodeFirstInLine(context, node) { const token = getFirstNodeInLine(context, node); @@ -222,7 +222,7 @@ function isNodeFirstInLine(context, node) { /** * Checks if the node is a function or arrow function expression. * @param {ASTNode} node The node to check - * @return {Boolean} true if it's a function-like expression + * @return {boolean} true if it's a function-like expression */ function isFunctionLikeExpression(node) { return node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression'; @@ -231,7 +231,7 @@ function isFunctionLikeExpression(node) { /** * Checks if the node is a function. * @param {ASTNode} node The node to check - * @return {Boolean} true if it's a function + * @return {boolean} true if it's a function */ function isFunction(node) { return node.type === 'FunctionExpression' || node.type === 'FunctionDeclaration'; @@ -240,7 +240,7 @@ function isFunction(node) { /** * Checks if node is a function declaration or expression or arrow function. * @param {ASTNode} node The node to check - * @return {Boolean} true if it's a function-like + * @return {boolean} true if it's a function-like */ function isFunctionLike(node) { return node.type === 'FunctionDeclaration' || isFunctionLikeExpression(node); @@ -249,7 +249,7 @@ function isFunctionLike(node) { /** * Checks if the node is a class. * @param {ASTNode} node The node to check - * @return {Boolean} true if it's a class + * @return {boolean} true if it's a class */ function isClass(node) { return node.type === 'ClassDeclaration' || node.type === 'ClassExpression'; @@ -329,7 +329,7 @@ function isParenthesized(context, node) { /** * Checks if a node is being assigned a value: props.bar = 'bar' * @param {ASTNode} node The AST node being checked. - * @returns {Boolean} + * @returns {boolean} */ function isAssignmentLHS(node) { return ( diff --git a/lib/util/error.js b/lib/util/error.js index bbfc3d6f09..cca6e6c13f 100644 --- a/lib/util/error.js +++ b/lib/util/error.js @@ -2,7 +2,7 @@ /** * Logs out a message if there is no format option set. - * @param {String} message - Message to log. + * @param {string} message - Message to log. */ function error(message) { if (!/=-(f|-format)=/.test(process.argv.join('='))) { diff --git a/lib/util/isCreateContext.js b/lib/util/isCreateContext.js index d5fdfe4551..858f463ccb 100644 --- a/lib/util/isCreateContext.js +++ b/lib/util/isCreateContext.js @@ -3,7 +3,7 @@ /** * Checks if the node is a React.createContext call * @param {ASTNode} node - The AST node being checked. - * @returns {Boolean} - True if node is a React.createContext call, false if not. + * @returns {boolean} - True if node is a React.createContext call, false if not. */ module.exports = function isCreateContext(node) { if ( diff --git a/lib/util/isFirstLetterCapitalized.js b/lib/util/isFirstLetterCapitalized.js index bc55a1970b..9bbce69c66 100644 --- a/lib/util/isFirstLetterCapitalized.js +++ b/lib/util/isFirstLetterCapitalized.js @@ -2,8 +2,8 @@ /** * Check if the first letter of a string is capitalized. - * @param {String} word String to check - * @returns {Boolean} True if first letter is capitalized. + * @param {string} word String to check + * @returns {boolean} True if first letter is capitalized. */ function isFirstLetterCapitalized(word) { if (!word) { diff --git a/lib/util/jsx.js b/lib/util/jsx.js index 07a09a8022..477dd36f5e 100644 --- a/lib/util/jsx.js +++ b/lib/util/jsx.js @@ -88,9 +88,9 @@ function isWhiteSpaces(value) { * * @param {Context} context The context of `ASTNode`. * @param {ASTNode} ASTnode The AST node being checked - * @param {Boolean} [strict] If true, in a ternary condition the node must return JSX in both cases - * @param {Boolean} [ignoreNull] If true, null return values will be ignored - * @returns {Boolean} True if the node is returning JSX or null, false if not + * @param {boolean} [strict] If true, in a ternary condition the node must return JSX in both cases + * @param {boolean} [ignoreNull] If true, null return values will be ignored + * @returns {boolean} True if the node is returning JSX or null, false if not */ function isReturningJSX(context, ASTnode, strict, ignoreNull) { const isJSXValue = (node) => { @@ -145,7 +145,7 @@ function isReturningJSX(context, ASTnode, strict, ignoreNull) { * * @param {ASTNode} ASTnode The AST node being checked * @param {Context} context The context of `ASTNode`. - * @returns {Boolean} True if the node is returning only null values + * @returns {boolean} True if the node is returning only null values */ function isReturningOnlyNull(ASTnode, context) { let found = false; diff --git a/lib/util/log.js b/lib/util/log.js index 9782b21990..55271e15f2 100644 --- a/lib/util/log.js +++ b/lib/util/log.js @@ -2,7 +2,7 @@ /** * Logs out a message if there is no format option set. - * @param {String} message - Message to log. + * @param {string} message - Message to log. */ function log(message) { if (!/=-(f|-format)=/.test(process.argv.join('='))) { diff --git a/lib/util/propTypes.js b/lib/util/propTypes.js index 9525989bd8..8322aab1ce 100644 --- a/lib/util/propTypes.js +++ b/lib/util/propTypes.js @@ -23,7 +23,7 @@ const getText = eslintUtil.getText; /** * Check if node is function type. * @param {ASTNode} node - * @returns {Boolean} + * @returns {boolean} */ function isFunctionType(node) { if (!node) return false; @@ -37,7 +37,7 @@ function isFunctionType(node) { * Checks if we are declaring a props as a generic type in a flow-annotated class. * * @param {ASTNode} node the AST node being checked. - * @returns {Boolean} True if the node is a class with generic prop types, false if not. + * @returns {boolean} True if the node is a class with generic prop types, false if not. */ function isSuperTypeParameterPropsDeclaration(node) { if (node && (node.type === 'ClassDeclaration' || node.type === 'ClassExpression')) { @@ -77,7 +77,7 @@ function iterateProperties(context, properties, fn, handleSpreadFn) { * Checks if a node is inside a class body. * * @param {ASTNode} node the AST node being checked. - * @returns {Boolean} True if the node has a ClassBody ancestor, false if not. + * @returns {boolean} True if the node has a ClassBody ancestor, false if not. */ function isInsideClassBody(node) { let parent = node.parent; @@ -152,8 +152,8 @@ module.exports = function propTypesInstructions(context, components, utils) { /** * Checks if prop should be validated by plugin-react-proptypes - * @param {String} validator Name of validator to check. - * @returns {Boolean} True if validator should be checked by custom validator. + * @param {string} validator Name of validator to check. + * @returns {boolean} True if validator should be checked by custom validator. */ function hasCustomValidator(validator) { return customValidators.indexOf(validator) !== -1; @@ -267,7 +267,7 @@ module.exports = function propTypesInstructions(context, components, utils) { * Creates the representation of the React props type annotation for the component. * The representation is used to verify nested used properties. * @param {ASTNode} annotation Type annotation for the props class property. - * @param {String} parentName + * @param {string} parentName * @param {Set} [seen] * @return {Object} The representation of the declaration, empty object means * the property is declared without the need for further analysis. @@ -296,7 +296,7 @@ module.exports = function propTypesInstructions(context, components, utils) { * Modifies the declaredProperties object * @param {ASTNode} propTypes * @param {Object} declaredPropTypes - * @returns {Boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) + * @returns {boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) */ function declarePropTypesForObjectTypeAnnotation(propTypes, declaredPropTypes) { let ignorePropsValidation = false; @@ -334,7 +334,7 @@ module.exports = function propTypesInstructions(context, components, utils) { * Modifies the declaredPropTypes object * @param {ASTNode} propTypes * @param {Object} declaredPropTypes - * @returns {Boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) + * @returns {boolean} True if propTypes should be ignored (e.g. when a type can't be resolved, when it is imported) */ function declarePropTypesForIntersectionTypeAnnotation(propTypes, declaredPropTypes) { return propTypes.types.some((annotation) => { @@ -1135,7 +1135,7 @@ module.exports = function propTypesInstructions(context, components, utils) { /** * 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. + * @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')) { diff --git a/lib/util/propTypesSort.js b/lib/util/propTypesSort.js index 21898a490c..a6bb2124b3 100644 --- a/lib/util/propTypesSort.js +++ b/lib/util/propTypesSort.js @@ -16,7 +16,7 @@ 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. + * @returns {string} The name of the node. */ function getValueName(node) { return node.type === 'Property' && node.value.property && node.value.property.name; @@ -26,7 +26,7 @@ function getValueName(node) { * Checks if the prop is required or not. * * @param {ASTNode} node the prop to check. - * @returns {Boolean} true if the prop is required. + * @returns {boolean} true if the prop is required. */ function isRequiredProp(node) { return getValueName(node) === 'isRequired'; @@ -35,8 +35,8 @@ function isRequiredProp(node) { /** * 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. + * @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); @@ -46,7 +46,7 @@ function isCallbackPropName(propName) { * Checks if the prop is PropTypes.shape. * * @param {ASTNode} node the prop to check. - * @returns {Boolean} true if the prop is PropTypes.shape. + * @returns {boolean} true if the prop is PropTypes.shape. */ function isShapeProp(node) { return !!( @@ -73,11 +73,11 @@ function getShapeProperties(node) { * @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. + * @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)); @@ -124,12 +124,12 @@ const commentnodeMap = new WeakMap(); // all nodes reference WeakMap for start a * @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. + * @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( diff --git a/lib/util/props.js b/lib/util/props.js index 4cd89584e5..b5c992890b 100644 --- a/lib/util/props.js +++ b/lib/util/props.js @@ -9,7 +9,7 @@ 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 + * @returns {boolean} `true` if the node is a propTypes declaration, `false` if not */ function isPropTypesDeclaration(node) { if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) { @@ -24,7 +24,7 @@ function isPropTypesDeclaration(node) { /** * 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 + * @returns {boolean} `true` if the node is a contextTypes declaration, `false` if not */ function isContextTypesDeclaration(node) { if (node && (node.type === 'ClassProperty' || node.type === 'PropertyDefinition')) { @@ -39,7 +39,7 @@ function isContextTypesDeclaration(node) { /** * 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 + * @returns {boolean} `true` if the node is a contextType declaration, `false` if not */ function isContextTypeDeclaration(node) { return astUtil.getPropertyName(node) === 'contextType'; @@ -48,7 +48,7 @@ function isContextTypeDeclaration(node) { /** * 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 + * @returns {boolean} `true` if the node is a childContextTypes declaration, `false` if not */ function isChildContextTypesDeclaration(node) { return astUtil.getPropertyName(node) === 'childContextTypes'; @@ -57,7 +57,7 @@ function isChildContextTypesDeclaration(node) { /** * 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 + * @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not */ function isDefaultPropsDeclaration(node) { const propName = astUtil.getPropertyName(node); @@ -67,7 +67,7 @@ function isDefaultPropsDeclaration(node) { /** * 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. + * @returns {boolean} True if we are declaring a display name, false if not. */ function isDisplayNameDeclaration(node) { switch (node.type) { @@ -86,7 +86,7 @@ function isDisplayNameDeclaration(node) { /** * 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. + * @returns {boolean} `true` if this PropType is required, `false` if not. */ function isRequiredPropType(propTypeExpression) { return propTypeExpression.type === 'MemberExpression' && propTypeExpression.property.name === 'isRequired'; diff --git a/lib/util/usedPropTypes.js b/lib/util/usedPropTypes.js index 9ecef0af37..52d0a2bb66 100644 --- a/lib/util/usedPropTypes.js +++ b/lib/util/usedPropTypes.js @@ -66,7 +66,7 @@ function createPropVariables() { /** * 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 + * @returns {boolean} True if the prop name matches */ function isCommonVariableNameForProps(name) { return name === 'props' || name === 'nextProps' || name === 'prevProps'; @@ -75,7 +75,7 @@ function isCommonVariableNameForProps(name) { /** * 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. + * @returns {boolean} True if the component must be validated, false if not. */ function mustBeValidated(component) { return !!(component && !component.ignorePropsValidation); @@ -110,7 +110,7 @@ function inLifeCycleMethod(context, node, checkAsyncSafeLifeCycles) { * 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 + * @return {boolean} True if the node is a lifecycle method */ function isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles) { const nodeKeyName = (node.key || /** @type {ASTNode} */ ({})).name; @@ -133,7 +133,7 @@ function isNodeALifeCycleMethod(node, checkAsyncSafeLifeCycles) { * method. * @param {ASTNode} node The AST node being checked. * @param {boolean} checkAsyncSafeLifeCycles - * @return {Boolean} True if the node is inside a lifecycle method + * @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)) { @@ -214,7 +214,7 @@ function isThisDotProps(node) { * 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. + * @returns {boolean} True if the prop has spread operator, false if not. */ function hasSpreadOperator(context, node) { const tokens = getSourceCode(context).getTokens(node); diff --git a/lib/util/variable.js b/lib/util/variable.js index c0017533be..a92a20930f 100644 --- a/lib/util/variable.js +++ b/lib/util/variable.js @@ -11,7 +11,7 @@ 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. + * @returns {boolean} True if the variable was found, false if not. */ function findVariable(variables, name) { return variables.some((variable) => variable.name === name);