WordPress/gutenberg

ESLint plugin: Relax the rule for @since in JSDoc

Open

#20 859 ouverte le 13 mars 2020

Voir sur GitHub
 (0 commentaires) (1 réaction) (0 assignés)JavaScript (3 893 forks)batch import
Good First IssueNeeds Dev[Status] In Progress[Tool] ESLint plugin[Type] Enhancement

Métriques du dépôt

Stars
 (9 607 stars)
Métriques de merge PR
 (Merge moyen 12j 18h) (509 PRs mergées en 30 j)

Description

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.

Guide contributeur