Skip to content

Commit b189e12

Browse files
committed
[Chore]: fix some jsdoc errors
1 parent d1e79b9 commit b189e12

17 files changed

+36
-27
lines changed

lib/rules/destructuring-assignment.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ module.exports = {
127127
handleSFCUsage(node);
128128
}
129129
if (classComponent) {
130-
handleClassUsage(node, classComponent);
130+
handleClassUsage(node);
131131
}
132132
},
133133

lib/rules/jsx-curly-brace-presence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module.exports = {
110110

111111
/**
112112
* Report and fix an unnecessary curly brace violation on a node
113-
* @param {ASTNode} node - The AST node with an unnecessary JSX expression
113+
* @param {ASTNode} JSXExpressionNode - The AST node with an unnecessary JSX expression
114114
*/
115115
function reportUnnecessaryCurly(JSXExpressionNode) {
116116
context.report({

lib/rules/jsx-curly-spacing.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ module.exports = {
183183
* Reports that there shouldn't be a newline after the first token
184184
* @param {ASTNode} node - The node to report in the event of an error.
185185
* @param {Token} token - The token to use for the report.
186+
* @param {string} spacing
186187
* @returns {void}
187188
*/
188189
function reportNoBeginningNewline(node, token, spacing) {
@@ -201,6 +202,7 @@ module.exports = {
201202
* Reports that there shouldn't be a newline before the last token
202203
* @param {ASTNode} node - The node to report in the event of an error.
203204
* @param {Token} token - The token to use for the report.
205+
* @param {string} spacing
204206
* @returns {void}
205207
*/
206208
function reportNoEndingNewline(node, token, spacing) {

lib/rules/jsx-indent-props.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ module.exports = {
126126
* Check indent for nodes list
127127
* @param {ASTNode[]} nodes list of node objects
128128
* @param {Number} indent needed indent
129-
* @param {Boolean} excludeCommas skip comma on start of line
130129
*/
131130
function checkNodesIndent(nodes, indent) {
132131
nodes.forEach(node => {

lib/rules/jsx-indent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module.exports = {
110110
* @param {ASTNode} node Node violating the indent rule
111111
* @param {Number} needed Expected indentation character count
112112
* @param {Number} gotten Indentation character count in the actual node/code
113-
* @param {Object} loc Error line and column location
113+
* @param {Object} [loc] Error line and column location
114114
*/
115115
function report(node, needed, gotten, loc) {
116116
const msgContext = {
@@ -141,8 +141,8 @@ module.exports = {
141141
/**
142142
* Get node indent
143143
* @param {ASTNode} node Node to examine
144-
* @param {Boolean} byLastLine get indent of node's last line
145-
* @param {Boolean} excludeCommas skip comma on start of line
144+
* @param {Boolean} [byLastLine] get indent of node's last line
145+
* @param {Boolean} [excludeCommas] skip comma on start of line
146146
* @return {Number} Indent
147147
*/
148148
function getNodeIndent(node, byLastLine, excludeCommas) {
@@ -204,7 +204,7 @@ module.exports = {
204204
* Check indent for nodes list
205205
* @param {ASTNode} node The node to check
206206
* @param {Number} indent needed indent
207-
* @param {Boolean} excludeCommas skip comma on start of line
207+
* @param {Boolean} [excludeCommas] skip comma on start of line
208208
*/
209209
function checkNodesIndent(node, indent, excludeCommas) {
210210
const nodeIndent = getNodeIndent(node, false, excludeCommas);

lib/rules/jsx-sort-props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function contextCompare(a, b, options) {
7575
* Create an array of arrays where each subarray is composed of attributes
7676
* that are considered sortable.
7777
* @param {Array<JSXSpreadAttribute|JSXAttribute>} attributes
78-
* @return {Array<Array<JSXAttribute>}
78+
* @return {Array<Array<JSXAttribute>>}
7979
*/
8080
function getGroupsOfSortableAttributes(attributes) {
8181
const sortableAttributeGroups = [];

lib/rules/no-danger-with-children.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
* Takes a ObjectExpression and returns the value of the prop if it has it
2929
* @param {object} node - ObjectExpression node
3030
* @param {string} propName - name of the prop to look for
31+
* @param {any[]} seenProps
3132
*/
3233
function findObjectProp(node, propName, seenProps) {
3334
if (!node.properties) {

lib/rules/static-property-placement.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ module.exports = {
102102

103103
/**
104104
* Check if we should report this property node
105-
* @param node
106-
* @param expectedRule
105+
* @param {ASTNode} node
106+
* @param {string} expectedRule
107107
*/
108108
function reportNodeIncorrectlyPositioned(node, expectedRule) {
109109
// Detect if this node is an expected property declaration adn return the property name

lib/rules/style-prop-object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = {
2424

2525
create: function(context) {
2626
/**
27-
* @param {object} node An Identifier node
27+
* @param {ASTNode} expression An Identifier node
2828
*/
2929
function isNonNullaryLiteral(expression) {
3030
return expression.type === 'Literal' && expression.value !== null;

lib/util/Components.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ function componentRule(rule, context) {
257257
/**
258258
* Check if variable is destructured from pragma import
259259
*
260-
* @param {variable} String The variable name to check
260+
* @param {string} variable The variable name to check
261261
* @returns {Boolean} True if createElement is destructured from the pragma
262262
*/
263263
isDestructuredFromPragmaImport: function(variable) {
@@ -350,7 +350,7 @@ function componentRule(rule, context) {
350350
* Check if the node is returning JSX
351351
*
352352
* @param {ASTNode} ASTnode The AST node being checked
353-
* @param {Boolean} strict If true, in a ternary condition the node must return JSX in both cases
353+
* @param {Boolean} [strict] If true, in a ternary condition the node must return JSX in both cases
354354
* @returns {Boolean} True if the node is returning JSX, false if not
355355
*/
356356
isReturningJSX: function(ASTnode, strict) {
@@ -412,7 +412,7 @@ function componentRule(rule, context) {
412412
* Check if the node is returning JSX or null
413413
*
414414
* @param {ASTNode} ASTnode The AST node being checked
415-
* @param {Boolean} strict If true, in a ternary condition the node must return JSX in both cases
415+
* @param {Boolean} [strict] If true, in a ternary condition the node must return JSX in both cases
416416
* @returns {Boolean} True if the node is returning JSX or null, false if not
417417
*/
418418
isReturningJSXOrNull(ASTNode, strict) {

lib/util/annotations.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/**
99
* Checks if we are declaring a `props` argument with a flow type annotation.
1010
* @param {ASTNode} node The AST node being checked.
11+
* @param {Object} context
1112
* @returns {Boolean} True if the node is a type annotated props declaration, false if not.
1213
*/
1314
function isAnnotatedFunctionPropsDeclaration(node, context) {

lib/util/ast.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/**
77
* Find a return statment in the current node
88
*
9-
* @param {ASTNode} ASTnode The AST node being checked
9+
* @param {ASTNode} node The AST node being checked
1010
*/
1111
function findReturnStatement(node) {
1212
if (
@@ -114,7 +114,7 @@ function isNodeFirstInLine(context, node) {
114114

115115
/**
116116
* Checks if the node is a function or arrow function expression.
117-
* @param {Object} context The node to check
117+
* @param {ASTNode} node The node to check
118118
* @return {Boolean} true if it's a function-like expression
119119
*/
120120
function isFunctionLikeExpression(node) {
@@ -123,7 +123,7 @@ function isFunctionLikeExpression(node) {
123123

124124
/**
125125
* Checks if the node is a function.
126-
* @param {Object} context The node to check
126+
* @param {ASTNode} node The node to check
127127
* @return {Boolean} true if it's a function
128128
*/
129129
function isFunction(node) {
@@ -132,7 +132,7 @@ function isFunction(node) {
132132

133133
/**
134134
* Checks if the node is an arrow function.
135-
* @param {Object} context The node to check
135+
* @param {ASTNode} node The node to check
136136
* @return {Boolean} true if it's an arrow function
137137
*/
138138
function isArrowFunction(node) {
@@ -141,7 +141,7 @@ function isArrowFunction(node) {
141141

142142
/**
143143
* Checks if the node is a class.
144-
* @param {Object} context The node to check
144+
* @param {ASTNode} node The node to check
145145
* @return {Boolean} true if it's a class
146146
*/
147147
function isClass(node) {

lib/util/defaultProps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = function defaultPropsInstructions(context, components, utils) {
7070
/**
7171
* Adds defaultProps to the component passed in.
7272
* @param {ASTNode} component The component to add the defaultProps to.
73-
* @param {String[]|String} defaultProps defaultProps to add to the component or the string "unresolved"
73+
* @param {Object[]|'unresolved'} defaultProps defaultProps to add to the component or the string "unresolved"
7474
* if this component has defaultProps that can't be resolved.
7575
* @returns {void}
7676
*/

lib/util/propTypes.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ function isSuperTypeParameterPropsDeclaration(node) {
2626

2727
/**
2828
* Removes quotes from around an identifier.
29-
* @param {string} the identifier to strip
29+
* @param {string} string the identifier to strip
3030
*/
3131
function stripQuotes(string) {
3232
return string.replace(/^\'|\'$/g, '');
3333
}
3434

3535
/**
3636
* Retrieve the name of a key node
37+
* @param {Object} context The AST node with the key.
3738
* @param {ASTNode} node The AST node with the key.
3839
* @return {string} the name of the key
3940
*/
@@ -51,6 +52,7 @@ function getKeyValue(context, node) {
5152

5253
/**
5354
* Iterates through a properties node, like a customized forEach.
55+
* @param {Object} context Array of properties to iterate.
5456
* @param {Object[]} properties Array of properties to iterate.
5557
* @param {Function} fn Function to call on each property, receives property key
5658
and property value. (key, value) => void
@@ -236,6 +238,8 @@ module.exports = function propTypesInstructions(context, components, utils) {
236238
* Creates the representation of the React props type annotation for the component.
237239
* The representation is used to verify nested used properties.
238240
* @param {ASTNode} annotation Type annotation for the props class property.
241+
* @param {ASTNode} parentName
242+
* @param {Set<any>} [seen]
239243
* @return {Object} The representation of the declaration, empty object means
240244
* the property is declared without the need for further analysis.
241245
*/
@@ -325,6 +329,7 @@ module.exports = function propTypesInstructions(context, components, utils) {
325329
* Creates the representation of the React propTypes for the component.
326330
* The representation is used to verify nested used properties.
327331
* @param {ASTNode} value Node of the PropTypes for the desired property
332+
* @param {string} parentName
328333
* @return {Object} The representation of the declaration, empty object means
329334
* the property is declared without the need for further analysis.
330335
*/
@@ -443,7 +448,7 @@ module.exports = function propTypesInstructions(context, components, utils) {
443448
/**
444449
* Mark a prop type as declared
445450
* @param {ASTNode} node The AST node being checked.
446-
* @param {propTypes} node The AST node containing the proptypes
451+
* @param {ASTNode} propTypes The AST node containing the proptypes
447452
*/
448453
function markPropTypesAsDeclared(node, propTypes) {
449454
let componentNode = node;

lib/util/props.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function isDefaultPropsDeclaration(node) {
6565

6666
/**
6767
* Checks if we are declaring a display name
68-
* @param {node} node The AST node being checked.
68+
* @param {ASTNode} node The AST node being checked.
6969
* @returns {Boolean} True if we are declaring a display name, false if not.
7070
*/
7171
function isDisplayNameDeclaration(node) {

lib/util/usedPropTypes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
177177

178178
/**
179179
* Removes quotes from around an identifier.
180-
* @param {string} the identifier to strip
180+
* @param {string} string the identifier to strip
181181
*/
182182
function stripQuotes(string) {
183183
return string.replace(/^\'|\'$/g, '');
@@ -203,7 +203,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
203203
/**
204204
* Retrieve the name of a property node
205205
* @param {ASTNode} node The AST node with the property.
206-
* @return {string} the name of the property or undefined if not found
206+
* @return {string|undefined} the name of the property or undefined if not found
207207
*/
208208
function getPropertyName(node) {
209209
const isDirectProp = DIRECT_PROPS_REGEX.test(sourceCode.getText(node));
@@ -283,6 +283,7 @@ module.exports = function usedPropTypesInstructions(context, components, utils)
283283
/**
284284
* Mark a prop type as used
285285
* @param {ASTNode} node The AST node being marked.
286+
* @param {string[]} [parentNames]
286287
*/
287288
function markPropTypesAsUsed(node, parentNames) {
288289
parentNames = parentNames || [];

lib/util/variable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Search a particular variable in a list
99
* @param {Array} variables The variables list.
10-
* @param {Array} name The name of the variable to search.
10+
* @param {string} name The name of the variable to search.
1111
* @returns {Boolean} True if the variable was found, false if not.
1212
*/
1313
function findVariable(variables, name) {
@@ -17,7 +17,7 @@ function findVariable(variables, name) {
1717
/**
1818
* Find and return a particular variable in a list
1919
* @param {Array} variables The variables list.
20-
* @param {Array} name The name of the variable to search.
20+
* @param {string} name The name of the variable to search.
2121
* @returns {Object} Variable if the variable was found, null if not.
2222
*/
2323
function getVariable(variables, name) {

0 commit comments

Comments
 (0)