-
-
Notifications
You must be signed in to change notification settings - Fork 163
Enabling require-jsdoc for class methods causes weird formatting when automatically fixing. #524
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
Comments
Thank you for the report. I tried to reproduce a test case using the following (the test case needs to be complete, valid JS): class User {
async updatePassword(password, repeat) {
}
} ...and using the same parserOptions and I also tried it outside of our testing suite and found no issues. There is a separate issue with Please ensure the config you are using is limited to the config you have indicated above and that there is an exact reproducible test case. (Not doubting this is a real issue, but just need to get it boiled down a bit further so we can reproduce.) Thanks! |
I think I have a conflicting issue some place. I just made a test node project with just the jsdoc plugin enabled and with that test case and it properly formatted the JS Doc. If I copy that exact same eslintrc config into my actual project, it fails to format it properly. Not sure whats going on there but I'll update this when I find whats causing the issue. |
I've seemed to fix the problem, without knowing exactly what was the issue. I ended up completely reinstalling NodeJS and now saving that same file with the same configuration works. Still makes no sense that it was working in some projects and not others using the exact same config files but I wont complain that its working now. I'm going to close this as it wasn't an issue with jsdoc plugin. |
No worries. It was an issue before the latest fix, so maybe your environment was somehow using an old version. In any case, let us know if you find it recurring and can replicate. You might also see #526 and the fact that there is now a new bugfix release, as there were problems with exported named variables if you are using any of those. |
Had the same problem, had to update/reinstall node to get this fixed. |
I turned on jsdoc/require-jsdoc and enabled it for both MethodDefinition and ClassDeclaration. I am using the eslint addon for Atom and when I save my file it tries to fix any class method without a jsdoc but it does not format it properly. This also occurs when I eslint it from the command line and pass in the --fix command so its not just an issue with how the Atom plugin is behaving. Here is an example (with function bodies removed for sake of readability):
Original:
ESlint fix for require-jsdoc:
Expected:
As you can see its trying to fix it by putting the JS doc comment in between the method name and its parameters. Its also for some reason adding a ton of comment blocks instead of just one. Since it doesnt fix the issue, everytime I save the file or run --fix it adds more empty comment blocks. Here is my .eslintrc.json:
The text was updated successfully, but these errors were encountered: