Skip to content

feat(lint): check descriptions of static members#29569

Open
caugner wants to merge 2 commits intomainfrom
29537-require-description-for-static-api-members
Open

feat(lint): check descriptions of static members#29569
caugner wants to merge 2 commits intomainfrom
29537-require-description-for-static-api-members

Conversation

@caugner
Copy link
Copy Markdown
Contributor

@caugner caugner commented Apr 29, 2026

Summary

Extend descriptions linter to check static members.

Test results and supporting details

Related issues

Fixes #29537.

@caugner caugner requested a review from a team as a code owner April 29, 2026 12:19
@caugner caugner requested a review from LeoMcA April 29, 2026 12:19
@github-actions github-actions Bot added infra Infrastructure issues (npm, GitHub Actions, releases) of this project data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API linter Issues or pull requests regarding the tests / linter of the JSON files. size:l [PR only] 101-1000 LoC changed labels Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

Tip: Review these changes grouped by change (recommended for most PRs), or grouped by feature (for large PRs).

Copy link
Copy Markdown
Member

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit:

ruleName: 'static',
path,
actual,
expected: methodForm,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps?

Suggested change
expected: methodForm,
expected: `"${methodForm}" or "${propertyForm}"`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected value is used by the fixer to set the description, so this is probably not what we want. But I've pinged Florian above to see how we handle this ambiguity.

@caugner caugner force-pushed the 29537-require-description-for-static-api-members branch from 6758f7b to daf8af1 Compare May 4, 2026 16:23
Comment on lines +82 to +85
} else if (featureName.endsWith('_static')) {
const memberName = featureName.slice(0, -'_static'.length);
const methodForm = `\`${memberName}()\` static method`;
const propertyForm = `\`${memberName}\` static property`;
Copy link
Copy Markdown
Contributor Author

@caugner caugner May 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Elchi3 The Static API members guidelines only give an example of a static method, but there are 7 occurrences of _static being used for properties.

Should we update the guidelines to require the _static_property suffix for static properties? There is currently only 1 occurrence.

Edit: Otherwise this lint error won't be fixable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update the guidelines to require the _static_property suffix for static properties? There is currently only 1 occurrence.

Yes, I think this rule should apply to all members (methods and properties).
(another reason why type tags would help us, I guess :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. Which of these rules should apply?

  1. _static for both methods and properties
  2. _static for methods, _static_property for properties
  3. _static_method for methods, _static_property for properties

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I got confused.

This is the way: 1. _static for both methods and properties

See also #16613 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API infra Infrastructure issues (npm, GitHub Actions, releases) of this project linter Issues or pull requests regarding the tests / linter of the JSON files. size:l [PR only] 101-1000 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend description linter for static API members

4 participants