-
-
Notifications
You must be signed in to change notification settings - Fork 163
Empty docblocks are added above functions on lint #372
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
ESLint unfortunately does not provide a means of selectively disabling rules for fixing; one apparently needs to specify a separate config for fixing (where the fixing config, in this case, would omit/disable the @gajus and @golopot, what do you think of a It'd be nice if eslint offered an easier way, e.g., while loading a config, be able to disable specific rules within that config dynamically on the command line, but I received no feedback, at least on this comment on a related issue: eslint/eslint#11747 (comment) . |
I am probably misunderstanding something. If the intention is to have jsdoc block for every function, then To me this particular issue sounds like it is more about strictness of |
I am seeing the issue as the fact that projects will probably not want to go to the trouble of dynamically generating their config files (so that they could, for example, enable A related problem as I see it is that projects may differ in what they consider to be a reasonable fix. I would personally find the automatic addition of comment blocks to be useful, especially if starting with a project which had many items to be commented--it would also serve as a visual reminder of the need to document and an invitation to do so more quickly. As discussed in #47, there may be other fixers which might be desired by some projects, but not others; for example, stripping bad param names might be seen as useful for removing stale param info by some projects, or a risk for removing mere bad spellings by another. |
This rule being as fixable is not very useful for us. Especially if it tries to fix it even when it is reported as warning. Rule configuration: 'jsdoc/require-jsdoc': ['warn', {
publicOnly: true,
require: {
ArrowFunctionExpression: true,
ClassDeclaration: true,
ClassExpression: true,
FunctionDeclaration: true,
FunctionExpression: true,
MethodDefinition: true
}
}] This is what happens in our codebase when this rule is turned on: module.exports = {
set(key, value, ttl, callback) {
// code
}
}; After: module.exports = {
set/**
*
*//**
*
*//**
*
*//**
*
*//**
*
*/
(key, value, ttl, callback) {
// code
}
}; Having this kind of result unfortunately makes this rule pretty much useless for us. It would be great if the autofix could be turned off for this rule as I only want to see warnings about functions without JSDoc comments. Any idea how to accomplish that? Currently the most viable option for just reporting the warnings without fixing is to use the deprecated ESLint rule |
@carlrannaberg : I think this might related to problems in the stringifier of |
Btw, @carlrannaberg, not sure if the issue was fixed by #524, but I am no longer seeing the recursive issue mentioned in #372 (comment) |
@gajus , @golopot : I really hope we can at least keep the addition of empty jsdoc blocks as an option, as I find them very useful not only for saving a little time in data input but also for being a visual reminder of the need to document (and if one doesn't want empty descriptions to get past linting, one can use However, as another request has been made to disable such a fixer (#594 ) I can make a PR to avoid the fixer, adding a |
…ill avoid fixer; fixes gajus#372
…ill avoid fixer; fixes gajus#372
…ill avoid fixer; fixes gajus#372
🎉 This issue has been resolved in version 28.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Note that the new |
hey @brettz9 any chance you have an example with the particularly interested in getting this to work with type parameters I've got something liek interface PluginAPI {
/** */
readonly apiVersion: '1.0.0';
/** */
readonly command: string;
/** */
readonly viewport: ViewportAPI;
closePlugin(message?: string): void; and can't get the linter to report these empty comment block using the contexts
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Whoops, sorry! I forgot that we use 'jsdoc/require-description': ['error', {
contexts: ['TSPropertySignature']
}] |
you are my life saver. appreciate your time!! |
My pleasure! (Btw, I've hidden our comments, though they can still be seen, to avoid confusing people with the mistaken info I initially offered.) |
When I run the linter at adds empty docblocks above every function that doesn't already have a docblock. I assume this is part of the auto fixing but this messes doc coverage reports by incorrectly reporting that a function is documented when it is not.
Is there a way to disable the behavior of auto adding empty doc blocks?
The text was updated successfully, but these errors were encountered: