question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

False positive by lines-around-comment for JSDoc

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.2.0
  • Node Version: v8.9.4
  • npm Version: 5.6.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Configuration
{
    "env": {
        "browser": true,
        "es6": true,
        "greasemonkey": true
    },
    "extends": "eslint:recommended",
    "globals": {
        "min": false
    },
    "rules": {
        "lines-around-comment": [
            "error", {
                "afterBlockComment": true
            }
        ]
    }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

/**
 * Converts an array-like object to an Array.
 * @param {Object} collection - The collection to be converted.
 * @returns {Object[]} The resulting array.
 */
function toArray(collection) {
    return Array.prototype.slice.call(collection);
}

toArray([]);
eslint scripts/**/*

What did you expect to happen?

Not throw an error.

What actually happened? Please include the actual, raw output from ESLint.

...scripts/Main/main.js
  1:1  error  Expected line after comment  lines-around-comment

✖ 1 problem (1 error, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

I think that it should make an exception for JSDoc. Meaning that /** */ is not actually a block comment, /* * */ is a block comment.

The current workaround is to use "ignorePattern": "\\*".

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
revoltercommented, Dec 20, 2018

This is still an issue.

0reactions
kaicataldocommented, Dec 22, 2018

Given that JSDoc support has been deprecated, JSDoc comments won’t have any special meaning to ESLint core rules going forward. If ignorePattern doesn’t solve the issue reported here, do you mind making a new issue proposing an enhancement that might?

Read more comments on GitHub >

github_iconTop Results From Across the Web

require-throws : false positive in async function #722 - GitHub
Expected behavior Do not report require-throws when a throw is added in an async function (because the function returns a rejected promise).
Read more >
False Positive Missing JSDoc @return on class components
I am using eslint with the google style guide for a project, but it throws jsdoc errors for class components regardless of whether...
Read more >
Command-line arguments to JSDoc
Displays JSDoc's version number, then exits. --verbose, Log detailed information to the console as JSDoc runs. Defaults to false . -X , ...
Read more >
About JSDoc plugins
The jsdocCommentFound event is fired whenever a JSDoc comment is found. ... any of the following options; the default value for each option...
Read more >
Use JSDoc: @type
@param {...number} num A positive or negative number */ function sum(num) { var i=0, n=arguments.length, t=0; for (; i<n; i++) { t +=...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found