Skip to content

Commit e3927a3

Browse files
committed
[Refactor] clean up some of the jsdocs
1 parent 4d99f6e commit e3927a3

38 files changed

+155
-155
lines changed

lib/rules/boolean-prop-naming.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ module.exports = {
128128
/**
129129
* Checks if prop is declared in flow way
130130
* @param {Object} prop Property object, single prop type declaration
131-
* @returns {Boolean}
131+
* @returns {boolean}
132132
*/
133133
function flowCheck(prop) {
134134
return (
@@ -141,7 +141,7 @@ module.exports = {
141141
/**
142142
* Checks if prop is declared in regular way
143143
* @param {Object} prop Property object, single prop type declaration
144-
* @returns {Boolean}
144+
* @returns {boolean}
145145
*/
146146
function regularCheck(prop) {
147147
const propKey = getPropKey(prop);
@@ -165,7 +165,7 @@ module.exports = {
165165
/**
166166
* Checks if prop is nested
167167
* @param {Object} prop Property object, single prop type declaration
168-
* @returns {Boolean}
168+
* @returns {boolean}
169169
*/
170170
function nestedPropTypes(prop) {
171171
return (

lib/rules/display-name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ module.exports = {
7373
/**
7474
* Checks if React.forwardRef is nested inside React.memo
7575
* @param {ASTNode} node The AST node being checked.
76-
* @returns {Boolean} True if React.forwardRef is nested inside React.memo, false if not.
76+
* @returns {boolean} True if React.forwardRef is nested inside React.memo, false if not.
7777
*/
7878
function isNestedMemo(node) {
7979
const argumentIsCallExpression = node.arguments && node.arguments[0] && node.arguments[0].type === 'CallExpression';
@@ -111,7 +111,7 @@ module.exports = {
111111
/**
112112
* Checks if the component have a name set by the transpiler
113113
* @param {ASTNode} node The AST node being checked.
114-
* @returns {Boolean} True if component has a name, false if not.
114+
* @returns {boolean} True if component has a name, false if not.
115115
*/
116116
function hasTranspilerName(node) {
117117
const namedObjectAssignment = (

lib/rules/jsx-closing-bracket-location.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ module.exports = {
100100
/**
101101
* Get expected location for the closing bracket
102102
* @param {Object} tokens Locations of the opening bracket, closing bracket and last prop
103-
* @return {String} Expected location for the closing bracket
103+
* @return {string} Expected location for the closing bracket
104104
*/
105105
function getExpectedLocation(tokens) {
106106
let location;
@@ -121,7 +121,7 @@ module.exports = {
121121
* Get the correct 0-indexed column for the closing bracket, given the
122122
* expected location.
123123
* @param {Object} tokens Locations of the opening bracket, closing bracket and last prop
124-
* @param {String} expectedLocation Expected location for the closing bracket
124+
* @param {string} expectedLocation Expected location for the closing bracket
125125
* @return {?Number} The correct column for the closing bracket, or null
126126
*/
127127
function getCorrectColumn(tokens, expectedLocation) {
@@ -140,8 +140,8 @@ module.exports = {
140140
/**
141141
* Check if the closing bracket is correctly located
142142
* @param {Object} tokens Locations of the opening bracket, closing bracket and last prop
143-
* @param {String} expectedLocation Expected location for the closing bracket
144-
* @return {Boolean} True if the closing bracket is correctly located, false if not
143+
* @param {string} expectedLocation Expected location for the closing bracket
144+
* @return {boolean} True if the closing bracket is correctly located, false if not
145145
*/
146146
function hasCorrectLocation(tokens, expectedLocation) {
147147
switch (expectedLocation) {
@@ -163,9 +163,9 @@ module.exports = {
163163
/**
164164
* Get the characters used for indentation on the line to be matched
165165
* @param {Object} tokens Locations of the opening bracket, closing bracket and last prop
166-
* @param {String} expectedLocation Expected location for the closing bracket
167-
* @param {Number} [correctColumn] Expected column for the closing bracket. Default to 0
168-
* @return {String} The characters used for indentation
166+
* @param {string} expectedLocation Expected location for the closing bracket
167+
* @param {number} [correctColumn] Expected column for the closing bracket. Default to 0
168+
* @return {string} The characters used for indentation
169169
*/
170170
function getIndentation(tokens, expectedLocation, correctColumn) {
171171
const newColumn = correctColumn || 0;
@@ -235,7 +235,7 @@ module.exports = {
235235
* Get an unique ID for a given JSXOpeningElement
236236
*
237237
* @param {ASTNode} node The AST node being checked.
238-
* @returns {String} Unique ID (based on its range)
238+
* @returns {string} Unique ID (based on its range)
239239
*/
240240
function getOpeningElementId(node) {
241241
return node.range.join(':');

lib/rules/jsx-indent-props.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ module.exports = {
116116
/**
117117
* Reports a given indent violation and properly pluralizes the message
118118
* @param {ASTNode} node Node violating the indent rule
119-
* @param {Number} needed Expected indentation character count
120-
* @param {Number} gotten Indentation character count in the actual node/code
119+
* @param {number} needed Expected indentation character count
120+
* @param {number} gotten Indentation character count in the actual node/code
121121
*/
122122
function report(node, needed, gotten) {
123123
const msgContext = {
@@ -141,7 +141,7 @@ module.exports = {
141141
/**
142142
* Get node indent
143143
* @param {ASTNode} node Node to examine
144-
* @return {Number} Indent
144+
* @return {number} Indent
145145
*/
146146
function getNodeIndent(node) {
147147
let src = getText(context, node, node.loc.start.column + extraColumnStart);
@@ -173,7 +173,7 @@ module.exports = {
173173
/**
174174
* Check indent for nodes list
175175
* @param {ASTNode[]} nodes list of node objects
176-
* @param {Number} indent needed indent
176+
* @param {number} indent needed indent
177177
*/
178178
function checkNodesIndent(nodes, indent) {
179179
let nestedIndent = indent;

lib/rules/jsx-indent.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module.exports = {
105105
/**
106106
* Responsible for fixing the indentation issue fix
107107
* @param {ASTNode} node Node violating the indent rule
108-
* @param {Number} needed Expected indentation character count
108+
* @param {number} needed Expected indentation character count
109109
* @returns {Function} function to be executed by the fixer
110110
* @private
111111
*/
@@ -146,8 +146,8 @@ module.exports = {
146146
/**
147147
* Reports a given indent violation and properly pluralizes the message
148148
* @param {ASTNode} node Node violating the indent rule
149-
* @param {Number} needed Expected indentation character count
150-
* @param {Number} gotten Indentation character count in the actual node/code
149+
* @param {number} needed Expected indentation character count
150+
* @param {number} gotten Indentation character count in the actual node/code
151151
* @param {Object} [loc] Error line and column location
152152
*/
153153
function report(node, needed, gotten, loc) {
@@ -168,9 +168,9 @@ module.exports = {
168168
/**
169169
* Get node indent
170170
* @param {ASTNode} node Node to examine
171-
* @param {Boolean} [byLastLine] get indent of node's last line
172-
* @param {Boolean} [excludeCommas] skip comma on start of line
173-
* @return {Number} Indent
171+
* @param {boolean} [byLastLine] get indent of node's last line
172+
* @param {boolean} [excludeCommas] skip comma on start of line
173+
* @return {number} Indent
174174
*/
175175
function getNodeIndent(node, byLastLine, excludeCommas) {
176176
let src = getText(context, node, node.loc.start.column + extraColumnStart);
@@ -197,7 +197,7 @@ module.exports = {
197197
/**
198198
* Check if the node is the right member of a logical expression
199199
* @param {ASTNode} node The node to check
200-
* @return {Boolean} true if its the case, false if not
200+
* @return {boolean} true if its the case, false if not
201201
*/
202202
function isRightInLogicalExp(node) {
203203
return (
@@ -212,7 +212,7 @@ module.exports = {
212212
/**
213213
* Check if the node is the alternate member of a conditional expression
214214
* @param {ASTNode} node The node to check
215-
* @return {Boolean} true if its the case, false if not
215+
* @return {boolean} true if its the case, false if not
216216
*/
217217
function isAlternateInConditionalExp(node) {
218218
return (
@@ -227,7 +227,7 @@ module.exports = {
227227
/**
228228
* Check if the node is within a DoExpression block but not the first expression (which need to be indented)
229229
* @param {ASTNode} node The node to check
230-
* @return {Boolean} true if its the case, false if not
230+
* @return {boolean} true if its the case, false if not
231231
*/
232232
function isSecondOrSubsequentExpWithinDoExp(node) {
233233
/*
@@ -298,8 +298,8 @@ module.exports = {
298298
/**
299299
* Check indent for nodes list
300300
* @param {ASTNode} node The node to check
301-
* @param {Number} indent needed indent
302-
* @param {Boolean} [excludeCommas] skip comma on start of line
301+
* @param {number} indent needed indent
302+
* @param {boolean} [excludeCommas] skip comma on start of line
303303
*/
304304
function checkNodesIndent(node, indent, excludeCommas) {
305305
const nodeIndent = getNodeIndent(node, false, excludeCommas);
@@ -318,7 +318,7 @@ module.exports = {
318318
/**
319319
* Check indent for Literal Node or JSXText Node
320320
* @param {ASTNode} node The node to check
321-
* @param {Number} indent needed indent
321+
* @param {number} indent needed indent
322322
*/
323323
function checkLiteralNodeIndent(node, indent) {
324324
const value = node.value;

lib/rules/jsx-no-target-blank.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function hasDynamicLink(node, linkAttributes) {
7070
* Get the string(s) from a value
7171
* @param {ASTNode} value The AST node being checked.
7272
* @param {ASTNode} targetValue The AST node being checked.
73-
* @returns {String | String[] | null} The string value, or null if not a string.
73+
* @returns {string | string[] | null} The string value, or null if not a string.
7474
*/
7575
function getStringFromValue(value, targetValue) {
7676
if (value) {

lib/rules/jsx-sort-default-props.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module.exports = {
5757
/**
5858
* Get properties name
5959
* @param {Object} node - Property.
60-
* @returns {String} Property name.
60+
* @returns {string} Property name.
6161
*/
6262
function getPropertyName(node) {
6363
if (node.key || ['MethodDefinition', 'Property'].indexOf(node.type) !== -1) {
@@ -78,7 +78,7 @@ module.exports = {
7878
/**
7979
* Checks if the Identifier node passed in looks like a defaultProps declaration.
8080
* @param {ASTNode} node The node to check. Must be an Identifier node.
81-
* @returns {Boolean} `true` if the node is a defaultProps declaration, `false` if not
81+
* @returns {boolean} `true` if the node is a defaultProps declaration, `false` if not
8282
*/
8383
function isDefaultPropsDeclaration(node) {
8484
const propName = getPropertyName(node);

lib/rules/jsx-sort-props.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ function generateFixerFunction(node, context, reservedList) {
276276
/**
277277
* Checks if the `reservedFirst` option is valid
278278
* @param {Object} context The context of the rule
279-
* @param {Boolean|Array<String>} reservedFirst The `reservedFirst` option
280-
* @return {Function|undefined} If an error is detected, a function to generate the error message, otherwise, `undefined`
279+
* @param {boolean | string[]} reservedFirst The `reservedFirst` option
280+
* @return {Function | undefined} If an error is detected, a function to generate the error message, otherwise, `undefined`
281281
*/
282282
// eslint-disable-next-line consistent-return
283283
function validateReservedFirstConfig(context, reservedFirst) {

lib/rules/no-children-prop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const report = require('../util/report');
1717
* Checks if the node is a createElement call with a props literal.
1818
* @param {ASTNode} node - The AST node being checked.
1919
* @param {Context} context - The AST node being checked.
20-
* @returns {Boolean} - True if node is a createElement call with a props
20+
* @returns {boolean} - True if node is a createElement call with a props
2121
* object literal, False if not.
2222
*/
2323
function isCreateElementWithProps(node, context) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module.exports = {
8585
/**
8686
* Checks to see if a node is a line break
8787
* @param {ASTNode} node The AST node being checked
88-
* @returns {Boolean} True if node is a line break, false if not
88+
* @returns {boolean} True if node is a line break, false if not
8989
*/
9090
function isLineBreak(node) {
9191
const isLiteral = node.type === 'Literal' || node.type === 'JSXText';

0 commit comments

Comments
 (0)