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

Allow "@suppress" in closure mode without checking type #815

Closed
maribethb opened this issue Dec 17, 2021 · 2 comments
Closed

Allow "@suppress" in closure mode without checking type #815

maribethb opened this issue Dec 17, 2021 · 2 comments

Comments

@maribethb
Copy link

Motivation

Closure has the @suppress tag: https://github.com/google/closure-compiler/wiki/@suppress-annotations where the syntax is

/** @suppress {visibility} */

This might be the only tag I can think of where the thing inside the brackets isn't really a "type" per se, but they chose to put it inside brackets anyway. I would like to be able to use @suppress tags with minimal fuss.

It's listed as a valid tag in closure mode here: https://github.com/gajus/eslint-plugin-jsdoc#check-tag-names but I get errors with it (see below)

Current behavior

Using the @suppress {visibility} tag as above yields

warning  The type 'visibility' is undefined  jsdoc/no-undefined-types

with the jsdoc/no-undefined-types rule on and settings.jsdoc.mode set to closure.

Desired behavior

Ideally, validity/undefined checking for the suppress tag would be disabled automatically when in closure mode, or set to an allow list that matches closure's list of values.

Alternatives considered

I don't really want to maintain the list of closure's suppress values in my eslint config, though I realize that's probably safer. I would like to be able to turn off checking of the type value for the @suppress tag but

structuredTags: {
        'suppress': {'type': false},
      },

just gave me an error that @suppress was not allowed to have a type at all. A value like 'type': 'off' would also work, if you didn't want to build in support directly for the suppress tag. Or perhaps there is already a way to do this, but I couldn't find it. I tried messing around with namepath-defining etc and didn't get anywhere.

FWIW, I just updated from eslint v5->7 and eslint-plugin-jsdoc v22 -> 36 and got this for the first time. On version 22 this was not an issue for us. I would have done a binary search to find which version introduced this change, but filing this issue is the last thing I'm doing before going on vacation for 4 weeks and I didn't want to forget what I have so far.

Thanks for any feedback! I searched the issues and commit history for anything related to the @suppress tag but didn't find much.

@gajus
Copy link
Owner

gajus commented Dec 17, 2021

🎉 This issue has been resolved in version 37.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Dec 17, 2021
@brettz9
Copy link
Collaborator

brettz9 commented Dec 17, 2021

Thank you for the helpful report. I've liberalized things in 37.2.3 to avoid erring with @suppress in closure mode.

I filed #816 to add some sanity checking, however: requiring an expression of whitelisted curly bracketed types with such @suppress tags, and preventing any name portion after a curly bracketed type expression.

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