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

Ability to selectively disable / enable in IDE #157

Closed
turadg opened this issue Mar 26, 2022 · 6 comments
Closed

Ability to selectively disable / enable in IDE #157

turadg opened this issue Mar 26, 2022 · 6 comments

Comments

@turadg
Copy link

turadg commented Mar 26, 2022

I'm trying to adopt this in a monorepo one package at a time. The docs say that to "ignore some type of files remove "prettier-plugin-jsdoc" from plugins or add empty plugins".

I've tried both and Prettier's autoloader still enables it. For example, with this minimal config it still runs this jsdoc plugin,

  {
    "plugins": []
  }

I wonder if that advice was for an older version of Prettier. Can anyone confirm these instructions in the README work for them?

In Prettier 2.6 plugins will be autoloaded, which can be disabled, but once they're loaded it's not clear to me that Prettier supports disabling them. For the IDE case I need the plugin to be loaded so the paths that use it can be formatted and there's no way to "unload" it for the other paths.

@hosseinmd
Copy link
Owner

This seems to be a prettier bug. However, for solving this, you can add on documented option jsdocParser:false to prettier config

@hosseinmd
Copy link
Owner

This seems to be a prettier bug. However, for solving this, you can add not documented option jsdocParser:false to prettier config

@turadg
Copy link
Author

turadg commented Mar 26, 2022

you can add on documented option jsdocParser:false

That'd be great! However it doesn't appear to be working (at least with Prettier 2.6.0).

With this testfile.js:

/**
 * For example, if the stored keys are:
 * bar
 * baz
 * foocount
 * foopriority
 * joober
 * plugh.3
 * plugh.47
 * plugh.8
 * zot
 */

This config:

{
  "plugins": ["prettier-plugin-jsdoc"],
  "jsdocParser": false
}

Yields for prettier testfile.js

[warn] Ignored unknown option { jsdocParser: false }.
/**
 * For example, if the stored keys are: bar baz foocount foopriority joober
 * plugh.3 plugh.47 plugh.8 zot
 */

Doing a little debugging, the jsdocParser option is never included in the options dictionary in the maybeOptions passed into getParser. I suppose Prettier omits options that aren't reported.

Would you be willing to add a global option for to enable the plugin that defaults to true?

hosseinmd added a commit that referenced this issue Mar 30, 2022
@hosseinmd
Copy link
Owner

Fixed v0.3.34

@DaniGuardiola
Copy link

DaniGuardiola commented Aug 10, 2023

This is still happening to me in v0.4.2 (can't upgrade to v1+ yet because we're still on Prettier <v3).

Edit: I realize that the "fixed" comment refers to the setting not working rather than the Prettier bug. The setting does work for us. Out of curiosity, does anyone know if this has been fixed in Prettier v3, or if there's an issue to track it?

@hosseinmd
Copy link
Owner

{
"prettier": "^3.0.0",
"prettier-plugin-jsdoc":"^1.0.1"
}

I tested with this config, but I didn't face with problem again.

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

No branches or pull requests

3 participants