Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Add jsdoc type annotation to sample rule #15085

Merged
merged 1 commit into from Oct 9, 2021
Merged

Conversation

bmish
Copy link
Sponsor Member

@bmish bmish commented Sep 20, 2021

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[X] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

Updates the first rule example in the Working with Rules website documentation page.

There are some exciting benefits to adding a jsdoc type annotation to the exported object in rule files.

The type annotation is supported by VSCode/Webstorm/other code editors. It uses the TypeScript declaration so code editors can provide hints/information/autocomplete about rule structure/fields even when only using JavaScript.

133895350-a19d0daf-593e-44b9-835f-bebf8b6a3d30

https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#type

Idea from: eslint/generator-eslint#113

Is there anything you'd like reviewers to focus on?

I have only updated the first rule example. I figured it wouldn't be worth updating every rule example. Should we update any other examples? Should we add a small section about this instead?

@eslint-github-bot eslint-github-bot bot added the triage An ESLint team member will look at this issue soon label Sep 20, 2021
@mdjermanovic mdjermanovic added documentation Relates to ESLint's documentation evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Sep 24, 2021
@nzakas nzakas merged commit 3da1509 into master Oct 9, 2021
@nzakas nzakas deleted the bmish-type-jsdoc-rule branch October 9, 2021 00:35
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Apr 8, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants