WordPress/gutenberg

ESLint plugin: Relax the rule for @since in JSDoc

Open

#20,859 创建于 2020年3月13日

在 GitHub 查看
 (0 评论) (1 反应) (0 负责人)JavaScript (3,893 fork)batch import
Good First IssueNeeds Dev[Status] In Progress[Tool] ESLint plugin[Type] Enhancement

仓库指标

Star
 (9,607 star)
PR 合并指标
 (平均合并 12天 18小时) (30 天内合并 509 个 PR)

描述

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

When increasing the severity of eslint-plugin-jsdoc to error (#20427), we found that the rule for @since doesn't allow explanation after version number.

// It's an error below.
/**
* @since 8.8.8 An awesome change
*/

But it's a frequently-used pattern in WordPress projects like this. So, we had to disable check-value option in eslint-plugin-jsdoc.

And there's even a documentation for @since for PHP developers.

But this makes us manually check if the version number follows the semver format.

// Below lines are false positives
/**
* @since 3.14
* @since version 7
* @since 6.7.x
*/

Describe the solution you'd like

Create an eslint rule that checks the format below:

@since <required semver> [optional description]

Describe alternatives you've considered

  • I thought about adding this to eslint-plugin-jsdoc. But I think adding description after version number is more of WordPress convention than widely-used one. So, I think it should be implemented in this project rather than eslint-plugin-jsdoc.

贡献者指南