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

enforceExistence is not working with ES2015 exports #159

Closed
AlexanderZeilmann opened this issue Sep 29, 2015 · 6 comments
Closed

enforceExistence is not working with ES2015 exports #159

AlexanderZeilmann opened this issue Sep 29, 2015 · 6 comments

Comments

@AlexanderZeilmann
Copy link
Contributor

With "enforceExistence": true and the following function

/**
 * A square method
 *
 * @param  {number} n  - The numbe to be squared
 * @return {number} The square of the number
 */
export default function square (n) {
  return n * n;
}

I get the following error (using jscs 2.2.0, jscs-doc 1.2.0)

->jscs test.js --verbose
jsDoc: Expect valid jsdoc-block definition at test.js :
     5 | * @return {number} The square of the number
     6 | */
     7 |export default function square (n) {
-----------------------^
     8 |  return n * n;
     9 |}


1 code style error found.

The error does not occur when using jscs 2.2.0, jscs-doc 1.1.0.

With the following snippet everything is working

/**
 * A square method
 *
 * @param  {number} n  - The numbe to be squared
 * @return {number} The square of the number
 */
function square (n) {
  return n * n;
}
@lovedota
Copy link

@zxqfox When will we have a new release for it. i am using jscs 2.2.1, and i face a same problem too. Thanks !

@AlexanderZeilmann
Copy link
Contributor Author

Wow, that was quick, thanks :-)

But this fix only considers ExportDefaultDeclarations and not ExportNamedDeclarations, right? So,

/**
 * A square method
 *
 * @param  {number} n  - The numbe to be squared
 * @return {number} The square of the number
 */
export function square (n) {
  return n * n;
}

will still fail.

I should have included that in my initial report :-|

@lovedota
Copy link

@alawatthe Thanks for you posting. I have the same problem ! Now i need to switch back to version 2.1.1 and it works !

@qfox
Copy link
Member

qfox commented Sep 30, 2015

Oh, right. Will add tests for these cases and fix them if needed. ;-) Thanks for reports!

@lovedota If you need to update jsdoc plugin — just install more freshy jscs-jsdoc version than bundled in jscs (e.g. npm i jscs-dev/jscs-jsdoc for master branch).

@qfox qfox reopened this Sep 30, 2015
@qfox
Copy link
Member

qfox commented Sep 30, 2015

What about:

export default () => {
};

?

@AlexanderZeilmann
Copy link
Contributor Author

LGTM, thank you :-)

@qfox qfox closed this as completed in 739ed3f Dec 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants