From 979d3787e7c37261c64063ed37891ec378c78ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Sat, 11 Jun 2022 19:44:19 +0200 Subject: [PATCH 1/2] Document default Config using JSDoc docstrings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Jaenisch --- src/defaultConfig.js | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/defaultConfig.js b/src/defaultConfig.js index cfbe1e627..4030a7e56 100644 --- a/src/defaultConfig.js +++ b/src/defaultConfig.js @@ -4,6 +4,52 @@ const slugFilter = require("./Filters/Slug"); const slugifyFilter = require("./Filters/Slugify"); const getCollectionItem = require("./Filters/GetCollectionItem"); +/** + * @module 11ty/eleventy/defaultConfig + */ + +/** + * @callback addFilter - Register a global filter. + * @param {string} name - Register a template filter by this name. + * @param {function} callback - The filter logic. + */ + +/** + * @typedef {Object} config + * @property {addFilter} addFilter - Register a new global filter. + */ + +/** + * @typedef {Object} defaultConfig + * @property {Array} templateFormats - An array of accepted template formats. + * @property {String} [pathPrefix='/'] - The directory under which all output files should be written to. + * @property {String} [markdownTemplateEngine='liquid'] - Template engine to process markdown files with. + * @property {String} [htmlTemplateEngine='liquid'] - Template engine to process html files with. + * @property {Boolean} [dataTemplateEngine=false] - Changed in v1.0 + * @property {String} [htmlOutputSuffix='-o'] + * @property {String} [jsDataFileSuffix='.11tydata'] - File suffix for jsData files. + * @property {Object} keys + * @property {String} [keys.package='pkg'] + * @property {String} [keys.layout='layout'] + * @property {String} [keys.permalink='permalink'] + * @property {String} [keys.permalinkRoot='permalinkBypassOutputDir'] + * @property {String} [keys.engineOverride='templateEngineOverride'] + * @property {String} [keys.computed='eleventyComputed'] + * @property {Object} dir + * @property {String} [dir.input='.'] + * @property {String} [dir.includes='_includes'] + * @property {String} [dir.data='_data'] + * @property {String} [dir.output='_site'] + * @deprecated handlebarsHelpers + * @deprecated nunjucksFilters + */ + +/** + * Default configuration object factory. + * + * @param {config} config - Eleventy configuration object. + * @returns {defaultConfig} + */ module.exports = function (config) { let templateConfig = this; From be6994cfdcc2af8cb7f7a77ef90574702d2970c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Fri, 17 Jun 2022 10:05:37 +0200 Subject: [PATCH 2/2] Get casing in type definition right MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Jaenisch --- src/defaultConfig.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/defaultConfig.js b/src/defaultConfig.js index 4030a7e56..4c9d32849 100644 --- a/src/defaultConfig.js +++ b/src/defaultConfig.js @@ -21,25 +21,25 @@ const getCollectionItem = require("./Filters/GetCollectionItem"); /** * @typedef {Object} defaultConfig - * @property {Array} templateFormats - An array of accepted template formats. - * @property {String} [pathPrefix='/'] - The directory under which all output files should be written to. - * @property {String} [markdownTemplateEngine='liquid'] - Template engine to process markdown files with. - * @property {String} [htmlTemplateEngine='liquid'] - Template engine to process html files with. - * @property {Boolean} [dataTemplateEngine=false] - Changed in v1.0 - * @property {String} [htmlOutputSuffix='-o'] - * @property {String} [jsDataFileSuffix='.11tydata'] - File suffix for jsData files. + * @property {Array} templateFormats - An array of accepted template formats. + * @property {string} [pathPrefix='/'] - The directory under which all output files should be written to. + * @property {string} [markdownTemplateEngine='liquid'] - Template engine to process markdown files with. + * @property {string} [htmlTemplateEngine='liquid'] - Template engine to process html files with. + * @property {boolean} [dataTemplateEngine=false] - Changed in v1.0 + * @property {string} [htmlOutputSuffix='-o'] + * @property {string} [jsDataFileSuffix='.11tydata'] - File suffix for jsData files. * @property {Object} keys - * @property {String} [keys.package='pkg'] - * @property {String} [keys.layout='layout'] - * @property {String} [keys.permalink='permalink'] - * @property {String} [keys.permalinkRoot='permalinkBypassOutputDir'] - * @property {String} [keys.engineOverride='templateEngineOverride'] - * @property {String} [keys.computed='eleventyComputed'] + * @property {string} [keys.package='pkg'] + * @property {string} [keys.layout='layout'] + * @property {string} [keys.permalink='permalink'] + * @property {string} [keys.permalinkRoot='permalinkBypassOutputDir'] + * @property {string} [keys.engineOverride='templateEngineOverride'] + * @property {string} [keys.computed='eleventyComputed'] * @property {Object} dir - * @property {String} [dir.input='.'] - * @property {String} [dir.includes='_includes'] - * @property {String} [dir.data='_data'] - * @property {String} [dir.output='_site'] + * @property {string} [dir.input='.'] + * @property {string} [dir.includes='_includes'] + * @property {string} [dir.data='_data'] + * @property {string} [dir.output='_site'] * @deprecated handlebarsHelpers * @deprecated nunjucksFilters */