Skip to content

Commit

Permalink
fix(require-param-type): report column=1 (#875)
Browse files Browse the repository at this point in the history
* fix(`require-param-type`): report column=1

Source
```js
/**
 * @param {a xxx
 * @param {bc
 */
```

Before
```
  2:0   error  Missing JSDoc @param "" type     jsdoc/require-param-type
  3:0   error  Missing JSDoc @param "" type     jsdoc/require-param-type
```

After
```
  2:1   error  Missing JSDoc @param "" type     jsdoc/require-param-type
  3:1   error  Missing JSDoc @param "" type     jsdoc/require-param-type
```

Co-authored-by: Brett Zamir <[email protected]>
  • Loading branch information
chearon and brettz9 authored Apr 18, 2022
1 parent bd11409 commit 2f104f8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14867,6 +14867,13 @@ function quux (foo) {
}
// Message: Missing JSDoc @param "foo" type.

/**
* @param {a xxx
*/
function quux () {
}
// Message: Missing JSDoc @param "" type.

/**
* @param foo
*/
Expand Down
2 changes: 2 additions & 0 deletions src/iterateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,11 @@ const makeReport = (context, commentNode) => {

loc = {
end: {
column: 0,
line: lineNumber,
},
start: {
column: 0,
line: lineNumber,
},
};
Expand Down
22 changes: 22 additions & 0 deletions test/rules/assertions/requireParamType.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,28 @@ export default {
`,
errors: [
{
column: 1,
line: 3,
message: 'Missing JSDoc @param "foo" type.',
},
],
},
{
code: `
/**
* @param {a xxx
*/
function quux () {
}
`,
errors: [
{
column: 1,
line: 3,
message: 'Missing JSDoc @param "" type.',
},
],
},
{
code: `
/**
Expand All @@ -27,6 +44,7 @@ export default {
`,
errors: [
{
column: 1,
line: 3,
message: 'Missing JSDoc @param "foo" type.',
},
Expand All @@ -48,6 +66,7 @@ export default {
`,
errors: [
{
column: 1,
line: 4,
message: 'Missing JSDoc @param "foo" type.',
},
Expand All @@ -69,6 +88,7 @@ export default {
`,
errors: [
{
column: 1,
line: 4,
message: 'Missing JSDoc @param "foo" type.',
},
Expand All @@ -92,6 +112,7 @@ export default {
`,
errors: [
{
column: 1,
line: 3,
message: 'Missing JSDoc @arg "foo" type.',
},
Expand All @@ -115,6 +136,7 @@ export default {
`,
errors: [
{
column: 1,
line: 3,
message: 'Unexpected tag `@param`',
},
Expand Down

0 comments on commit 2f104f8

Please sign in to comment.