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

Eslint rule for JSDoc alignment #24984

Closed
renatho opened this issue Sep 1, 2020 · 5 comments · Fixed by #25300
Closed

Eslint rule for JSDoc alignment #24984

renatho opened this issue Sep 1, 2020 · 5 comments · Fixed by #25300
Labels
[Tool] ESLint plugin /packages/eslint-plugin [Type] Build Tooling Issues or PRs related to build tooling

Comments

@renatho
Copy link
Contributor

renatho commented Sep 1, 2020

Is your feature request related to a problem? Please describe.

Currently, there is no Eslint plugin for check JSDoc alignment (at least I didn't find one in my researches 😁), as recommended in the WordPress standards.

Describe the solution you'd like

We created a new plugin to check JSDoc alignments (eslint-plugin-jsdoc-alignment). As it can be useful by WordPress community in general, @nerrad gave a good idea to add it to the @wordpress/eslint-plugin. So, before proceeding, it'd be good to discuss the approach to be used for that.

Things to consider:

  • It can be very helpful to the WordPress community, as it checks a WordPress standard not covered currently by @wordpress/eslint-plugin.
  • It can also be used by other projects (without WordPress) that want to use JSDoc with the lines aligned.
  • This plugin was designed to be used along with eslint-plugin-jsdoc because it checks only the alignment between the lines.

Describe alternatives you've considered

  1. We could add it to the eslint-plugin/configs installing the current package. In some moment we can also open a new PR for eslint-plugin-jsdoc and when they accept, we could uninstall the package and just update the configuration to use the new rule from eslint-plugin-jsdoc.
  2. We could migrate the rule to eslint-plugin/rules and add to the eslint-plugin/configs. I particularly don't like that, because it makes the plugin restrict only to eslint-plugin.
  3. We could migrate the eslint-plugin-jsdoc-alignment to be a Gutenberg package (we could also make it for the other current Gutenberg generic rules), and install it in the eslint-plugin/configs. So devs that want use only some specific rule, can install it separately.

IMHO, the option 1 looks the more "organized", looking to the future with the contribution being accepted by eslint-plugin-jsdoc. It doesn't exclude the option to transform the other Gutenberg generic rules to Gutenberg packages.

@nerrad nerrad added [Tool] ESLint plugin /packages/eslint-plugin [Type] Build Tooling Issues or PRs related to build tooling labels Sep 1, 2020
@nerrad
Copy link
Contributor

nerrad commented Sep 1, 2020

I lean towards option 1 as well assuming the pr is created for the upstream project. Otherwise, if this is something WP specific and/or it doesn't look like the upstream repo will accept, I think it would be good to add a custom rule in the @wordpress/eslint-plugin package.

@adamsilverstein
Copy link
Member

We discussed this a bit in the Core JavaScript office hours today. Agreement was the best next step is to try to contribute this as a new rule to the eslint-plugin-jsdoc package.

@adamsilverstein
Copy link
Member

@aduth left a follow up comment pointing out this prettier plugin that might be able to enforce alignment for us: https://www.npmjs.com/package/prettier-plugin-jsdoc

@renatho
Copy link
Contributor Author

renatho commented Sep 11, 2020

@aduth left a follow up comment pointing out this prettier plugin that might be able to enforce alignment for us: https://www.npmjs.com/package/prettier-plugin-jsdoc

Cool! Thank you for the suggestion! I tried install it in the Sensei LMS repo, but trying to reformat all code, some errors happened. I created a note here to dig into that in the future. =)

@renatho
Copy link
Contributor Author

renatho commented Sep 11, 2020

If someone is interested in follow, I created a PR gajus/eslint-plugin-jsdoc#636 for the eslint-plugin-jsdoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] ESLint plugin /packages/eslint-plugin [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants