Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report errors (and quickfixes) for incorrect JSDoc #15852

Open
ghost opened this issue May 15, 2017 · 6 comments
Open

Report errors (and quickfixes) for incorrect JSDoc #15852

ghost opened this issue May 15, 2017 · 6 comments
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@ghost
Copy link

ghost commented May 15, 2017

TypeScript Version: nightly (2.4.0-dev.20170515)

Code

/**
 * @param abcdeg A parameter
 */
function f(abcdefg: number) {
    abcdeg;
}

Expected behavior:

Can fix spelling for either abcdeg.

Actual behavior:

Does not work in jsdoc.

@mhegazy mhegazy added Bug A bug in TypeScript and removed Bug A bug in TypeScript labels May 15, 2017
@mhegazy
Copy link
Contributor

mhegazy commented May 15, 2017

well.. that means it is an error to have this JSDoc.

if we report this, why not report other things in jsdoc as well.. like invalid tags @params instead of @param...

@mhegazy mhegazy added Suggestion An idea for TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation labels May 15, 2017
@mhegazy
Copy link
Contributor

mhegazy commented May 15, 2017

I think this is subsumed by #13371

@mhegazy
Copy link
Contributor

mhegazy commented May 15, 2017

closing in favor of #13371

@mhegazy mhegazy closed this as completed May 15, 2017
@sandersn sandersn reopened this May 30, 2017
@sandersn
Copy link
Member

Let's use this issue to track semantic errors for jsdoc. #13371 tracks syntactic errors.

There is still the open question of whether these errors (and associated quick fixes) should only be availble in js files with // @ts-check or in TS files as well.

@sandersn sandersn changed the title Fix spelling for identifier in JSDoc Report errors (and quickfixes) for incorrect JSDoc Jul 18, 2017
@brettz9
Copy link

brettz9 commented Jul 3, 2018

Might there be optional report of missing JSDoc @param and @return?

And how about detection of a mismatch between actual return and @return/@returns?

@ghost
Copy link
Author

ghost commented Jul 3, 2018

@brettz9 Enable "checkJs": true inside compilerOptions in your tsconfig.json and you should get an error if a @return tag is incorrect.

/** @return {number} */
function g() { return ""; } // Error

Enable "noImplicitAny": true (or better, "strict": true) and you will get an error if a @param tag is missing.

function f(x) {} // Error, 'x' is implicitly 'any'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: JSDoc Relates to JSDoc parsing and type generation In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants