Skip to content

Commit

Permalink
Add support for null as input in types
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jan 3, 2023
1 parent 8058792 commit 501f668
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
56 changes: 28 additions & 28 deletions lib/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,17 @@
* An entry on some character which is unsafe in certain contexts.
* @property {string} character
* The single character.
* @property {string | Array<string> | undefined} [inConstruct]
* @property {string | Array<string> | null | undefined} [inConstruct]
* Constructs where this is bad.
* @property {string | Array<string> | undefined} [notInConstruct]
* @property {string | Array<string> | null | undefined} [notInConstruct]
* Constructs where this is fine.
* @property {string | undefined} [after]
* @property {string | null | undefined} [after]
* Conditional character before.
* @property {string | undefined} [before]
* @property {string | null | undefined} [before]
* Conditional character after (can’t be used together with `atBreak`).
* @property {boolean | undefined} [atBreak]
* @property {boolean | null | undefined} [atBreak]
* Conditionally, at a break (can’t be used together with `before`).
* @property {RegExp | undefined} [_compiled]
* @property {RegExp | null | undefined} [_compiled]
* The unsafe pattern (this whole object) compiled as a regex.
*
* This is internal and must not be defined.
Expand All @@ -156,9 +156,9 @@
/**
* @typedef Options
* Configuration (optional).
* @property {'-' | '*' | '+' | undefined} [bullet='*']
* @property {'-' | '*' | '+' | null | undefined} [bullet='*']
* Marker to use for bullets of items in unordered lists.
* @property {'-' | '*' | '+' | undefined} [bulletOther]
* @property {'-' | '*' | '+' | null | undefined} [bulletOther]
* Marker to use in certain cases where the primary bullet doesn’t work.
*
* There are three cases where the primary bullet can’t be used:
Expand All @@ -181,9 +181,9 @@
* To solve for both, we instead inject an empty comment between the two
* lists: `* a\n<!---->\n* b`, but if `bulletOther` is given explicitly,
* it will be used instead
* @property {'.' | ')' | undefined} [bulletOrdered='.']
* @property {'.' | ')' | null | undefined} [bulletOrdered='.']
* Marker to use for bullets of items in ordered lists.
* @property {'.' | ')' | undefined} [bulletOrderedOther]
* @property {'.' | ')' | null | undefined} [bulletOrderedOther]
* Marker to use in certain cases where the primary bullet for ordered items
* doesn’t work.
*
Expand All @@ -195,49 +195,49 @@
* To solve for both, we instead inject an empty comment between the two
* lists: `1. a\n<!---->\n1. b`, but if `bulletOrderedOther` is given
* explicitly, it will be used instead
* @property {boolean | undefined} [closeAtx=false]
* @property {boolean | null | undefined} [closeAtx=false]
* Whether to add the same number of number signs (`#`) at the end of an ATX
* heading as the opening sequence.
* @property {'_' | '*' | undefined} [emphasis='*']
* @property {'_' | '*' | null | undefined} [emphasis='*']
* Marker to use for emphasis.
* @property {'~' | '`' | undefined} [fence='`']
* @property {'~' | '`' | null | undefined} [fence='`']
* Marker to use for fenced code.
* @property {boolean | undefined} [fences=false]
* @property {boolean | null | undefined} [fences=false]
* Whether to use fenced code always.
*
* The default is to use fenced code if there is a language defined, if the
* code is empty, or if it starts or ends in blank lines.
* @property {boolean | undefined} [incrementListMarker=true]
* @property {boolean | null | undefined} [incrementListMarker=true]
* Whether to increment the counter of ordered lists items.
* @property {'tab' | 'one' | 'mixed' | undefined} [listItemIndent='tab']
* @property {'tab' | 'one' | 'mixed' | null | undefined} [listItemIndent='tab']
* How to indent the content of list items.
*
* Either with the size of the bullet plus one space (when `'one'`), a tab
* stop (`'tab'`), or depending on the item and its parent list (`'mixed'`,
* uses `'one'` if the item and list are tight and `'tab'` otherwise).
* @property {'"' | "'" | undefined} [quote='"']
* @property {'"' | "'" | null | undefined} [quote='"']
* Marker to use for titles.
* @property {boolean | undefined} [resourceLink=false]
* @property {boolean | null | undefined} [resourceLink=false]
* Whether to always use resource links.
*
* The default is to use autolinks (`<https://example.com>`) when possible
* and resource links (`[text](url)`) otherwise.
* @property {'-' | '_' | '*' | undefined} [rule='*']
* @property {'-' | '_' | '*' | null | undefined} [rule='*']
* Marker to use for thematic breaks.
* @property {number | undefined} [ruleRepetition=3]
* @property {number | null | undefined} [ruleRepetition=3]
* Number of markers to use for thematic breaks.
* @property {boolean | undefined} [ruleSpaces=false]
* @property {boolean | null | undefined} [ruleSpaces=false]
* Whether to add spaces between markers in thematic breaks.
* @property {boolean | undefined} [setext=false]
* @property {boolean | null | undefined} [setext=false]
* Whether to use setext headings when possible.
*
* The default is to always use ATX headings (`# heading`) instead of setext
* headings (`heading\n=======`).
* Setext headings can’t be used for empty headings or headings with a rank
* of three or more.
* @property {'_' | '*' | undefined} [strong='*']
* @property {'_' | '*' | null | undefined} [strong='*']
* Marker to use for strong.
* @property {boolean | undefined} [tightDefinitions=false]
* @property {boolean | null | undefined} [tightDefinitions=false]
* Whether to join definitions without a blank line.
*
* The default is to add blank lines between any flow (“block”) construct.
Expand All @@ -250,23 +250,23 @@
* }
* }
* ```
* @property {Handlers | undefined} [handlers={}]
* @property {Handlers | null | undefined} [handlers={}]
* Object mapping node types to custom handlers.
*
* Useful for syntax extensions.
* This option is a bit advanced.
* It’s recommended to look at the code in `lib/handle/` in
* `mdast-util-to-markdown` for examples.
* @property {Array<Join> | undefined} [join=[]]
* @property {Array<Join> | null | undefined} [join=[]]
* List of functions used to determine what to place between two flow nodes.
* @property {Array<Unsafe> | undefined} [unsafe=[]]
* @property {Array<Unsafe> | null | undefined} [unsafe=[]]
* List of extra patterns to escape.
*
* Useful for syntax extensions.
* This option is quite advanced.
* It’s recommended to look at the code in `lib/unsafe.js` in
* `mdast-util-to-markdown` for examples.
* @property {Array<Options> | undefined} [extensions=[]]
* @property {Array<Options> | null | undefined} [extensions=[]]
* List of extensions to include.
*
* Each `ToMarkdownExtension` is an object with the same interface as
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-bullet-ordered-other.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {checkBulletOrdered} from './check-bullet-ordered.js'

/**
* @param {Context} context
* @returns {Exclude<Options['bulletOrdered'], undefined>}
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
*/
export function checkBulletOrderedOther(context) {
const bulletOrdered = checkBulletOrdered(context)
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-bullet-ordered.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['bulletOrdered'], undefined>}
* @returns {Exclude<Options['bulletOrdered'], null | undefined>}
*/
export function checkBulletOrdered(context) {
const marker = context.options.bulletOrdered || '.'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-bullet-other.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {checkBullet} from './check-bullet.js'

/**
* @param {Context} context
* @returns {Exclude<Options['bullet'], undefined>}
* @returns {Exclude<Options['bullet'], null | undefined>}
*/
export function checkBulletOther(context) {
const bullet = checkBullet(context)
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['bullet'], undefined>}
* @returns {Exclude<Options['bullet'], null | undefined>}
*/
export function checkBullet(context) {
const marker = context.options.bullet || '*'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-emphasis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['emphasis'], undefined>}
* @returns {Exclude<Options['emphasis'], null | undefined>}
*/
export function checkEmphasis(context) {
const marker = context.options.emphasis || '*'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-fence.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['fence'], undefined>}
* @returns {Exclude<Options['fence'], null | undefined>}
*/
export function checkFence(context) {
const marker = context.options.fence || '`'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-list-item-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['listItemIndent'], undefined>}
* @returns {Exclude<Options['listItemIndent'], null | undefined>}
*/
export function checkListItemIndent(context) {
const style = context.options.listItemIndent || 'tab'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['quote'], undefined>}
* @returns {Exclude<Options['quote'], null | undefined>}
*/
export function checkQuote(context) {
const marker = context.options.quote || '"'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-rule-repetition.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['ruleRepetition'], undefined>}
* @returns {Exclude<Options['ruleRepetition'], null | undefined>}
*/
export function checkRuleRepetition(context) {
const repetition = context.options.ruleRepetition || 3
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['rule'], undefined>}
* @returns {Exclude<Options['rule'], null | undefined>}
*/
export function checkRule(context) {
const marker = context.options.rule || '*'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/check-strong.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* @param {Context} context
* @returns {Exclude<Options['strong'], undefined>}
* @returns {Exclude<Options['strong'], null | undefined>}
*/
export function checkStrong(context) {
const marker = context.options.strong || '*'
Expand Down

0 comments on commit 501f668

Please sign in to comment.