WordPress/gutenberg

ESLint plugin: Relax the rule for @since in JSDoc

Open

#20.859 aberto em 13 de mar. de 2020

Ver no GitHub
 (0 comments) (1 reaction) (0 assignees)JavaScript (3.893 forks)batch import
Good First IssueNeeds Dev[Status] In Progress[Tool] ESLint plugin[Type] Enhancement

Métricas do repositório

Stars
 (9.607 stars)
Métricas de merge de PR
 (Mesclagem média 12d 18h) (509 fundiu PRs em 30d)

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.

Guia do colaborador