Lint a directory full of Noddity posts to verify that they will render.
CLI
noddity-linter "./content/" ""
noddity-linter [--useIndex=true] noddityRootPath [glob pattern]
If any files have errors, logs hopefully-useful things to stdout and returns a non-zero exit code.
Programmatic
const lintPromise =
noddityRoot
- the path to the root Noddity directorypattern
- a string to be passed to glob to match posts to be tested. Defaults to**/*.m?(m)d
data
- to be passed to validate-noddity-post to render the posts with. Defaults to{}
template
- I actually can't think of a reason why you'd need to override this for linting purposes, but here we areuseIndex
: iffalse
, will infer an index of all posts instead of looking for anindex.json
file in the directory. Defaults totrue
Returns a promise that resolves to an array with one object element per post checked. The object has a filePath
property describing the path of the file checked, and an optional error
property if there were any issues found while trying to render the file.