-
Notifications
You must be signed in to change notification settings - Fork 66
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
Fix: make all option properties optional #106
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -5,31 +5,31 @@ export type CollectionConfig = { | |||
/** | ||||
* - One or more glob patterns to match files to a collection | ||||
*/ | ||||
pattern: string | string[]; | ||||
pattern?: string | string[] | null; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The root change I want to correct is the ability for Proof it's optional: Line 129 in 362c20c
I think the rest of the properties are optional as well, as I see them all given defaults. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah good catch. I need to check if having the null makes sense. Also, currently developing new major and had to make quite some breaking changes: main...release/2.x. |
||||
/** | ||||
* - A key to sort by (e.g. `date`,`title`, ..) or a custom sort function | ||||
*/ | ||||
sortBy: string | ((a: any, b: any) => 0 | 1 | -1); | ||||
sortBy?: string | ((a: any, b: any) => 0 | 1 | -1); | ||||
/** | ||||
* - Limit the amount of items in a collection to `limit` | ||||
*/ | ||||
limit: number; | ||||
limit?: number; | ||||
/** | ||||
* - Adds `next` and `previous` keys to file metadata of matched files | ||||
*/ | ||||
refer: boolean; | ||||
refer?: boolean; | ||||
/** | ||||
* - Whether to invert the sorting function results (asc/descending) | ||||
*/ | ||||
reverse: boolean; | ||||
reverse?: boolean; | ||||
/** | ||||
* - A function that gets a `Metalsmith.File` as first argument and returns `true` for every file to include in the collection | ||||
*/ | ||||
filterBy: Function; | ||||
filterBy?: Function; | ||||
/** | ||||
* - An object with metadata to attach to the collection, or a `json`/`yaml`filepath string to load data from (relative to `Metalsmith.directory`) | ||||
*/ | ||||
metadata: any | string; | ||||
metadata?: any | string | null; | ||||
}; | ||||
/** | ||||
* Add `collections` of files to the global metadata as a sorted array. | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
null
s are because the default options use them:collections/src/index.js
Line 38 in 362c20c