Skip to content

Commit a659b63

Browse files
authored
Merge pull request #2267 from golopot/fix-some-jsdoc-errors
[tests] check jsdoc using typescript with `--checkJs`
2 parents eb90ce6 + 3e7c1f6 commit a659b63

26 files changed

+121
-45
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,6 @@
168168
"no-plusplus": 0,
169169
"no-prototype-builtins": 2,
170170
"prefer-template": 2,
171-
"template-curly-spacing": [2, "never"],
171+
"template-curly-spacing": [2, "never"]
172172
}
173173
}

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-closing-bracket-location.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ module.exports = {
153153
* Get the characters used for indentation on the line to be matched
154154
* @param {Object} tokens Locations of the opening bracket, closing bracket and last prop
155155
* @param {String} expectedLocation Expected location for the closing bracket
156-
* @param {Number} correctColumn Expected column for the closing bracket
156+
* @param {Number} [correctColumn] Expected column for the closing bracket. Default to 0
157157
* @return {String} The characters used for indentation
158158
*/
159159
function getIndentation(tokens, expectedLocation, correctColumn) {
160+
correctColumn = correctColumn || 0;
160161
let indentation, spaces = [];
161162
switch (expectedLocation) {
162163
case 'props-aligned':

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ module.exports = {
156156
/**
157157
* Trims text of whitespace between two ranges
158158
* @param {Fixer} fixer - the eslint fixer object
159-
* @param {Location} fromLoc - the start location
160-
* @param {Location} toLoc - the end location
159+
* @param {number} fromLoc - the start location
160+
* @param {number} toLoc - the end location
161161
* @param {string} mode - either 'start' or 'end'
162162
* @param {string=} spacing - a spacing value that will optionally add a space to the removed text
163163
* @returns {Object|*|{range, text}}
@@ -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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ module.exports = {
5959

6060
const extraColumnStart = 0;
6161
let indentType = 'space';
62+
/** @type {number|'first'} */
6263
let indentSize = 4;
6364

6465
const sourceCode = context.getSourceCode();
@@ -126,7 +127,6 @@ module.exports = {
126127
* Check indent for nodes list
127128
* @param {ASTNode[]} nodes list of node objects
128129
* @param {Number} indent needed indent
129-
* @param {Boolean} excludeCommas skip comma on start of line
130130
*/
131131
function checkNodesIndent(nodes, indent) {
132132
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: 2 additions & 2 deletions
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 = [];
@@ -156,7 +156,7 @@ const generateFixerFunction = (node, context, reservedList) => {
156156
* Checks if the `reservedFirst` option is valid
157157
* @param {Object} context The context of the rule
158158
* @param {Boolean|Array<String>} reservedFirst The `reservedFirst` option
159-
* @return {?Function} If an error is detected, a function to generate the error message, otherwise, `undefined`
159+
* @return {Function|undefined} If an error is detected, a function to generate the error message, otherwise, `undefined`
160160
*/
161161
// eslint-disable-next-line consistent-return
162162
function validateReservedFirstConfig(context, reservedFirst) {

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 {string[]} seenProps
3132
*/
3233
function findObjectProp(node, propName, seenProps) {
3334
if (!node.properties) {

lib/rules/no-unknown-property.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ function isTagName(node) {
157157

158158
/**
159159
* Extracts the tag name for the JSXAttribute
160-
* @param {Object} node - JSXAttribute being tested.
161-
* @returns {String} tag name
160+
* @param {JSXAttribute} node - JSXAttribute being tested.
161+
* @returns {String|null} tag name
162162
*/
163163
function getTagName(node) {
164164
if (node && node.parent && node.parent.name && node.parent.name) {
@@ -193,7 +193,7 @@ function getStandardName(name) {
193193
if (SVGDOM_ATTRIBUTE_NAMES[name]) {
194194
return SVGDOM_ATTRIBUTE_NAMES[name];
195195
}
196-
let i;
196+
let i = -1;
197197
const found = DOM_PROPERTY_NAMES.some((element, index) => {
198198
i = index;
199199
return element.toLowerCase() === name;

0 commit comments

Comments
 (0)