WordPress/gutenberg

ESLint plugin: Relax the rule for @since in JSDoc

Open

#20.859 aperta il 13 mar 2020

Vedi su GitHub
 (0 commenti) (1 reazione) (0 assegnatari)JavaScript (3893 fork)batch import
Good First IssueNeeds Dev[Status] In Progress[Tool] ESLint plugin[Type] Enhancement

Metriche repository

Star
 (9607 star)
Metriche merge PR
 (Merge medio 12g 18h) (509 PR mergiate in 30 g)

Descrizione

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.

Guida contributor