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

🏗 Use eslint-plugin-jsdoc instead of the built in valid-jsdoc #15294

Merged
merged 2 commits into from May 15, 2018
Merged

🏗 Use eslint-plugin-jsdoc instead of the built in valid-jsdoc #15294

merged 2 commits into from May 15, 2018

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented May 15, 2018

The valid-jsdoc rule built in to eslint (we started using it in #15256) has a few problems:

This PR does the following:

  • Mitigates the problems above by using eslint-plugin-jsdoc, which is more sophisticated than the built in valid-jsdoc. See https://github.com/gajus/eslint-plugin-jsdoc
  • Fixes the case where eslint was being executed on an empty glob when there are no .js files in the PR / commit being tested.

Fixes #15293
Fixes #15295
Fixes #15296
Partial fix for #15255
Follow up to #15256

@rsimha rsimha self-assigned this May 15, 2018
@rsimha
Copy link
Contributor Author

rsimha commented May 15, 2018

#15293

Before:

[22:00:29] /Users/rsimha/src/amphtml/src/video-interface.js
   33:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
   40:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
   49:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
   55:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
   61:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
  105:3  error  JSDoc syntax error                                        valid-jsdoc
  116:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
  127:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
  153:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
  451:1  error  JSDoc syntax error                                        valid-jsdoc

✖ 10 problems (10 errors, 0 warnings)

After:

[21:57:02] SUCCESS: No linter warnings or errors.

@rsimha
Copy link
Contributor Author

rsimha commented May 15, 2018

/to @alanorozco @jridgewell

@rsimha
Copy link
Contributor Author

rsimha commented May 15, 2018

#15295, #15296

Before:

[22:22:53] /Users/rsimha/src/amphtml/src/service/video-manager-impl.js
    75:3  error  JSDoc syntax error                                        valid-jsdoc
    78:3  error  Unexpected @return tag; function has no return statement  valid-jsdoc
    86:3  error  JSDoc syntax error                                        valid-jsdoc
   120:3  error  JSDoc syntax error                                        valid-jsdoc
   147:5  error  Missing JSDoc @returns for function                       valid-jsdoc
   179:3  error  Missing JSDoc for parameter 'entry'                       valid-jsdoc
   234:3  error  JSDoc syntax error                                        valid-jsdoc
   297:3  error  JSDoc syntax error                                        valid-jsdoc
   340:3  error  JSDoc syntax error                                        valid-jsdoc
   351:3  error  JSDoc syntax error                                        valid-jsdoc
   359:3  error  JSDoc syntax error                                        valid-jsdoc
   435:5  error  Missing JSDoc @returns for function                       valid-jsdoc
   532:3  error  Missing JSDoc @returns for function                       valid-jsdoc
   903:3  error  JSDoc syntax error                                        valid-jsdoc
   931:3  error  JSDoc syntax error                                        valid-jsdoc
   980:3  error  JSDoc syntax error                                        valid-jsdoc
  1150:3  error  Missing JSDoc @returns for function                       valid-jsdoc
  1177:3  error  Missing JSDoc @returns for function                       valid-jsdoc
  1182:3  error  Missing JSDoc @returns for function                       valid-jsdoc
  1219:3  error  Missing JSDoc @returns for function                       valid-jsdoc
  1290:1  error  JSDoc syntax error                                        valid-jsdoc

✖ 21 problems (21 errors, 0 warnings)

After:

[22:24:40] /Users/rsimha/src/amphtml/src/service/video-manager-impl.js
  179:3  error  Missing JSDoc @param "entry" declaration         jsdoc/require-param
  199:3  error  Missing JSDoc @param "video" declaration         jsdoc/require-param
  226:3  error  Missing JSDoc @param "videoElement" declaration  jsdoc/require-param
  334:3  error  Missing JSDoc @param "videoElement" declaration  jsdoc/require-param
  532:3  error  Invalid JSDoc tag name "retun"                   jsdoc/check-tag-names
  877:3  error  Invalid JSDoc tag name "package"                 jsdoc/check-tag-names
  966:1  error  Invalid JSDoc tag name "restricted"              jsdoc/check-tag-names

✖ 7 problems (7 errors, 0 warnings)

@rsimha rsimha merged commit f35a628 into ampproject:master May 15, 2018
@rsimha rsimha deleted the 2018-05-14-JSDocPlugin branch May 15, 2018 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants