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

no-empty-blocks rule #1042

Closed
Dimava opened this issue Apr 21, 2023 · 2 comments · Fixed by #1044
Closed

no-empty-blocks rule #1042

Dimava opened this issue Apr 21, 2023 · 2 comments · Fixed by #1044

Comments

@Dimava
Copy link

Dimava commented Apr 21, 2023

Motivation

  1. I'm moving some JS code with types described as JSDoc into TS
    All those param types are being removed and become empty
    Making all the functions to have descriptions is not planned.
    Thus I need a way to cleanup empty code blocks.
  2. I'm working on https://github.com/Shinigami92/eslint-define-config
    Code generation sometimes causes empty JSDoc blocks to appear here and there.
    Some non-needed blocks like @minItems can also appear.

I am looking for an easy and straigntforward way to remove the blocks I don't need
First step would be removing unwanted tags by autofixer
Second step would be removing blocks which became empty by autofixer

Current behavior

The documentation is too long to read it completely
Nothing searchable there clearly states that it can be used to remove lines or blocks, other then builtin autofixers

Desired behavior

  • A rule that says that it bans empty blocks in its name
  • A rule that says that it bans certain tags in its name

Alternatives considered

I have spend an hour reading documentation, understood nothing on the case

@brettz9
Copy link
Collaborator

brettz9 commented Apr 22, 2023

The removal of empty tags is a nice idea for a rule.

check-tag-names can be used to block tags, either if you don't use definedTags with a rule and a tag isn't part of the official expected set, or if you blacklist tags you wish to block like this:

      settings: {
        jsdoc: {
          tagNamePreference: {
            todo: false,
          },
        },
      },

Although it is discussed under settings, it would be good to mention this explicitly under check-tag-names beyond just referring to the setting. A PR for an addition to check-tag-names would be welcome. I went ahead and prepared a PR.

@github-actions
Copy link

🎉 This issue has been resolved in version 43.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants