Skip to content

Commit

Permalink
Update pull-request-template.md
Browse files Browse the repository at this point in the history
  • Loading branch information
admin-xspace authored Nov 5, 2024
1 parent 93ddda0 commit 899a2f6
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion .github/pull-request-template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,65 @@
<!--
/**
* @import {Root as HastRoot} from 'hast'
* @import {Root as MdastRoot} from 'mdast'
* @import {Plugin} from 'unified'
*/

/**
* @typedef Options
* Configuration (optional).
* @property {boolean | null | undefined} [someField]
* Some option (optional).
*/

// To type options:
/** @type {Plugin<[(Options | null | undefined)?]>} */
export function myPluginAcceptingOptions(options) {
const settings = options || {}
// `settings` is now `Options`.
}

// To type a plugin that works on a certain tree, without options:
/** @type {Plugin<[], MdastRoot>} */
export function myRemarkPlugin() {
return function (tree, file) {
// `tree` is `MdastRoot`.
}
}

// To type a plugin that transforms one tree into another:
/** @type {Plugin<[], MdastRoot, HastRoot>} */
export function remarkRehype() {
return function (tree) {
// `tree` is `MdastRoot`.
// Result must be `HastRoot`.
}
}

// To type a plugin that defines a parser:
/** @type {Plugin<[], string, MdastRoot>} */
export function remarkParse(options) {}

// To type a plugin that defines a compiler:
/** @type {Plugin<[], HastRoot, string>} */
export function rehypeStringify(options) {}type Transformer<
Input extends Node = Node,
Output extends Node = Input
> = (
tree: Input,
file: VFile,
next: TransformCallback<Output>
) =>
| Promise<Output | undefined>
| Output
| Error
| undefinedinterface Settings {}declare module 'unified' {
interface Settings {
bullet: '*' | '+' | '-'
// …
}
}

export {} // You may not need this, but it makes sure the file is a module.[**@unifiedjs**](https://github.com/unifiedjs)https://github.com/unifiedjs<!--
Please check the needed checkboxes ([ ] -> [x]). Leave the
comments as they are, they won’t show on GitHub.
We are excited about pull requests, but please try to limit the scope, provide
Expand Down

0 comments on commit 899a2f6

Please sign in to comment.