Skip to content

linter: jsdoc/require-returns false positive if anything before @returns uses one single quote #13776

@yunarch

Description

@yunarch

What version of Oxlint are you using?

1.15.0

What command did you run?

oxlint

What does your .oxlintrc.json config file look like?

{
  "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
  "plugins": ["jsdoc"],
  "rules": {
    "jsdoc/require-returns": "error"
  }
}

What happened?

It looks like the JSDoc parser/checker breaks when a single quote (') is used inside a comment.

For example, this works fine:

/**
 * Test description.
 * 
 * @returns false
 */
function test() {
  return false;
}

But this fails and it shouldn't.

/**
 * Test description, this shouldn't lint error.
 * 
 * @returns false
 */
function test() {
  return false;
}

If I remove the single quote or replace it with another character (for example, a typographic apostrophe ), the error goes away. It also disappears if I use two single quotes (e.g., shouldn''t). However, these are not acceptable solutions. A single quote (') should be valid grammar character for English contractions and should be supported correctly inside JSDoc comments.

Expected Behavior

  • JSDoc should allow normal English contractions like shouldn't without breaking the parser if used before @returns

Actual Behavior

  • Using a single quote (or a single double quote) inside a JSDoc block causes the parser/checker to lint an error:
Missing JSDoc `@returns` declaration for function.
help: Add `@returns` tag to the JSDoc comment.oxc[eslint-plugin-jsdoc(require-returns)](https://oxc.rs/docs/guide/usage/linter/rules/jsdoc/require-returns.html)

It only breaks if the single (') or (") is used before the @returns tag, inside that tag or after works.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions