diff --git a/lib/rules/destructuring-assignment.js b/lib/rules/destructuring-assignment.js index 9f7d28255f..db1f675d5f 100644 --- a/lib/rules/destructuring-assignment.js +++ b/lib/rules/destructuring-assignment.js @@ -127,7 +127,7 @@ module.exports = { handleSFCUsage(node); } if (classComponent) { - handleClassUsage(node, classComponent); + handleClassUsage(node); } }, diff --git a/lib/rules/jsx-curly-brace-presence.js b/lib/rules/jsx-curly-brace-presence.js index c9de7fa83f..0020934b1a 100755 --- a/lib/rules/jsx-curly-brace-presence.js +++ b/lib/rules/jsx-curly-brace-presence.js @@ -110,7 +110,7 @@ module.exports = { /** * Report and fix an unnecessary curly brace violation on a node - * @param {ASTNode} node - The AST node with an unnecessary JSX expression + * @param {ASTNode} JSXExpressionNode - The AST node with an unnecessary JSX expression */ function reportUnnecessaryCurly(JSXExpressionNode) { context.report({ diff --git a/lib/rules/jsx-curly-spacing.js b/lib/rules/jsx-curly-spacing.js index f1395e5d07..3feee2bc9b 100644 --- a/lib/rules/jsx-curly-spacing.js +++ b/lib/rules/jsx-curly-spacing.js @@ -183,6 +183,7 @@ module.exports = { * Reports that there shouldn't be a newline after the first token * @param {ASTNode} node - The node to report in the event of an error. * @param {Token} token - The token to use for the report. + * @param {string} spacing * @returns {void} */ function reportNoBeginningNewline(node, token, spacing) { @@ -201,6 +202,7 @@ module.exports = { * Reports that there shouldn't be a newline before the last token * @param {ASTNode} node - The node to report in the event of an error. * @param {Token} token - The token to use for the report. + * @param {string} spacing * @returns {void} */ function reportNoEndingNewline(node, token, spacing) { diff --git a/lib/rules/jsx-indent-props.js b/lib/rules/jsx-indent-props.js index 55844bb8c3..c77444310d 100644 --- a/lib/rules/jsx-indent-props.js +++ b/lib/rules/jsx-indent-props.js @@ -126,7 +126,6 @@ module.exports = { * Check indent for nodes list * @param {ASTNode[]} nodes list of node objects * @param {Number} indent needed indent - * @param {Boolean} excludeCommas skip comma on start of line */ function checkNodesIndent(nodes, indent) { nodes.forEach(node => { diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index d0f237ff45..4b133fc364 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -110,7 +110,7 @@ module.exports = { * @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 {Object} loc Error line and column location + * @param {Object} [loc] Error line and column location */ function report(node, needed, gotten, loc) { const msgContext = { @@ -141,8 +141,8 @@ 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 + * @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) { @@ -204,7 +204,7 @@ 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 {Boolean} [excludeCommas] skip comma on start of line */ function checkNodesIndent(node, indent, excludeCommas) { const nodeIndent = getNodeIndent(node, false, excludeCommas); diff --git a/lib/rules/jsx-sort-props.js b/lib/rules/jsx-sort-props.js index a0b83a4d06..1d627a2102 100644 --- a/lib/rules/jsx-sort-props.js +++ b/lib/rules/jsx-sort-props.js @@ -75,7 +75,7 @@ function contextCompare(a, b, options) { * Create an array of arrays where each subarray is composed of attributes * that are considered sortable. * @param {Array} attributes - * @return {Array} + * @return {Array>} */ function getGroupsOfSortableAttributes(attributes) { const sortableAttributeGroups = []; diff --git a/lib/rules/no-danger-with-children.js b/lib/rules/no-danger-with-children.js index d03546537c..57182c71ea 100644 --- a/lib/rules/no-danger-with-children.js +++ b/lib/rules/no-danger-with-children.js @@ -28,6 +28,7 @@ module.exports = { * Takes a ObjectExpression and returns the value of the prop if it has it * @param {object} node - ObjectExpression node * @param {string} propName - name of the prop to look for + * @param {any[]} seenProps */ function findObjectProp(node, propName, seenProps) { if (!node.properties) { diff --git a/lib/rules/static-property-placement.js b/lib/rules/static-property-placement.js index 19b3313f9b..2dc6ee5630 100644 --- a/lib/rules/static-property-placement.js +++ b/lib/rules/static-property-placement.js @@ -102,8 +102,8 @@ module.exports = { /** * Check if we should report this property node - * @param node - * @param expectedRule + * @param {ASTNode} node + * @param {string} expectedRule */ function reportNodeIncorrectlyPositioned(node, expectedRule) { // Detect if this node is an expected property declaration adn return the property name diff --git a/lib/rules/style-prop-object.js b/lib/rules/style-prop-object.js index 4a29d33d25..4b9f750be5 100644 --- a/lib/rules/style-prop-object.js +++ b/lib/rules/style-prop-object.js @@ -24,7 +24,7 @@ module.exports = { create: function(context) { /** - * @param {object} node An Identifier node + * @param {ASTNode} expression An Identifier node */ function isNonNullaryLiteral(expression) { return expression.type === 'Literal' && expression.value !== null; diff --git a/lib/util/Components.js b/lib/util/Components.js index 38459a0ffa..fa2f87cf8d 100644 --- a/lib/util/Components.js +++ b/lib/util/Components.js @@ -257,7 +257,7 @@ function componentRule(rule, context) { /** * Check if variable is destructured from pragma import * - * @param {variable} String The variable name to check + * @param {string} variable The variable name to check * @returns {Boolean} True if createElement is destructured from the pragma */ isDestructuredFromPragmaImport: function(variable) { @@ -350,7 +350,7 @@ function componentRule(rule, context) { * Check if the node is returning JSX * * @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} [strict] If true, in a ternary condition the node must return JSX in both cases * @returns {Boolean} True if the node is returning JSX, false if not */ isReturningJSX: function(ASTnode, strict) { @@ -412,7 +412,7 @@ function componentRule(rule, context) { * Check if the node is returning JSX or null * * @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} [strict] If true, in a ternary condition the node must return JSX in both cases * @returns {Boolean} True if the node is returning JSX or null, false if not */ isReturningJSXOrNull(ASTNode, strict) { diff --git a/lib/util/annotations.js b/lib/util/annotations.js index 47f53fe56c..9586cec8c9 100644 --- a/lib/util/annotations.js +++ b/lib/util/annotations.js @@ -8,6 +8,7 @@ /** * 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. */ function isAnnotatedFunctionPropsDeclaration(node, context) { diff --git a/lib/util/ast.js b/lib/util/ast.js index 530c889e7f..746bdb9ade 100644 --- a/lib/util/ast.js +++ b/lib/util/ast.js @@ -6,7 +6,7 @@ /** * Find a return statment in the current node * - * @param {ASTNode} ASTnode The AST node being checked + * @param {ASTNode} node The AST node being checked */ function findReturnStatement(node) { if ( @@ -114,7 +114,7 @@ function isNodeFirstInLine(context, node) { /** * Checks if the node is a function or arrow function expression. - * @param {Object} context The node to check + * @param {ASTNode} node The node to check * @return {Boolean} true if it's a function-like expression */ function isFunctionLikeExpression(node) { @@ -123,7 +123,7 @@ function isFunctionLikeExpression(node) { /** * Checks if the node is a function. - * @param {Object} context The node to check + * @param {ASTNode} node The node to check * @return {Boolean} true if it's a function */ function isFunction(node) { @@ -132,7 +132,7 @@ function isFunction(node) { /** * Checks if the node is an arrow function. - * @param {Object} context The node to check + * @param {ASTNode} node The node to check * @return {Boolean} true if it's an arrow function */ function isArrowFunction(node) { @@ -141,7 +141,7 @@ function isArrowFunction(node) { /** * Checks if the node is a class. - * @param {Object} context The node to check + * @param {ASTNode} node The node to check * @return {Boolean} true if it's a class */ function isClass(node) { diff --git a/lib/util/defaultProps.js b/lib/util/defaultProps.js index 4b39c61c43..b7287e4b90 100644 --- a/lib/util/defaultProps.js +++ b/lib/util/defaultProps.js @@ -70,7 +70,7 @@ module.exports = function defaultPropsInstructions(context, components, utils) { /** * Adds defaultProps to the component passed in. * @param {ASTNode} component The component to add the defaultProps to. - * @param {String[]|String} defaultProps defaultProps to add to the component or the string "unresolved" + * @param {Object[]|'unresolved'} defaultProps defaultProps to add to the component or the string "unresolved" * if this component has defaultProps that can't be resolved. * @returns {void} */ diff --git a/lib/util/propTypes.js b/lib/util/propTypes.js index 8d47b2563b..9550f2adad 100644 --- a/lib/util/propTypes.js +++ b/lib/util/propTypes.js @@ -26,7 +26,7 @@ function isSuperTypeParameterPropsDeclaration(node) { /** * Removes quotes from around an identifier. - * @param {string} the identifier to strip + * @param {string} string the identifier to strip */ function stripQuotes(string) { return string.replace(/^\'|\'$/g, ''); @@ -34,6 +34,7 @@ function stripQuotes(string) { /** * Retrieve the name of a key node + * @param {Object} context The AST node with the key. * @param {ASTNode} node The AST node with the key. * @return {string} the name of the key */ @@ -51,6 +52,7 @@ function getKeyValue(context, node) { /** * Iterates through a properties node, like a customized forEach. + * @param {Object} context Array of properties to iterate. * @param {Object[]} properties Array of properties to iterate. * @param {Function} fn Function to call on each property, receives property key and property value. (key, value) => void @@ -236,6 +238,8 @@ 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 {ASTNode} parentName + * @param {Set} [seen] * @return {Object} The representation of the declaration, empty object means * the property is declared without the need for further analysis. */ @@ -325,6 +329,7 @@ module.exports = function propTypesInstructions(context, components, utils) { * Creates the representation of the React propTypes for the component. * The representation is used to verify nested used properties. * @param {ASTNode} value Node of the PropTypes for the desired property + * @param {string} parentName * @return {Object} The representation of the declaration, empty object means * the property is declared without the need for further analysis. */ @@ -443,7 +448,7 @@ module.exports = function propTypesInstructions(context, components, utils) { /** * Mark a prop type as declared * @param {ASTNode} node The AST node being checked. - * @param {propTypes} node The AST node containing the proptypes + * @param {ASTNode} propTypes The AST node containing the proptypes */ function markPropTypesAsDeclared(node, propTypes) { let componentNode = node; diff --git a/lib/util/props.js b/lib/util/props.js index 66f6042fff..f8b7171b30 100644 --- a/lib/util/props.js +++ b/lib/util/props.js @@ -65,7 +65,7 @@ function isDefaultPropsDeclaration(node) { /** * Checks if we are declaring a display name - * @param {node} node The AST node being checked. + * @param {ASTNode} node The AST node being checked. * @returns {Boolean} True if we are declaring a display name, false if not. */ function isDisplayNameDeclaration(node) { diff --git a/lib/util/usedPropTypes.js b/lib/util/usedPropTypes.js index aea9f8093e..f36ab63e44 100755 --- a/lib/util/usedPropTypes.js +++ b/lib/util/usedPropTypes.js @@ -177,7 +177,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils) /** * Removes quotes from around an identifier. - * @param {string} the identifier to strip + * @param {string} string the identifier to strip */ function stripQuotes(string) { return string.replace(/^\'|\'$/g, ''); @@ -203,7 +203,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils) /** * Retrieve the name of a property node * @param {ASTNode} node The AST node with the property. - * @return {string} the name of the property or undefined if not found + * @return {string|undefined} the name of the property or undefined if not found */ function getPropertyName(node) { const isDirectProp = DIRECT_PROPS_REGEX.test(sourceCode.getText(node)); @@ -283,6 +283,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils) /** * Mark a prop type as used * @param {ASTNode} node The AST node being marked. + * @param {string[]} [parentNames] */ function markPropTypesAsUsed(node, parentNames) { parentNames = parentNames || []; diff --git a/lib/util/variable.js b/lib/util/variable.js index 30137c8364..73b761c164 100644 --- a/lib/util/variable.js +++ b/lib/util/variable.js @@ -7,7 +7,7 @@ /** * Search a particular variable in a list * @param {Array} variables The variables list. - * @param {Array} name The name of the variable to search. + * @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) { @@ -17,7 +17,7 @@ function findVariable(variables, name) { /** * Find and return a particular variable in a list * @param {Array} variables The variables list. - * @param {Array} name The name of the variable to search. + * @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) {