Skip to content

Commit b7d1c53

Browse files
committed
Fix linting errors
1 parent de3a433 commit b7d1c53

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

packages/webdoc-cli/src/load-tutorials/load-tutorials.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function loadTutorials(tutorialsDir?: string): Tutorial[] {
8080
// Tutorials can be part of the doc-tree!
8181
tutorials.push(createTutorialDoc(
8282
fileName,
83-
path.join('tutorials', relativePath
83+
path.join("tutorials", relativePath
8484
.replace(".html", "")
8585
.replace(".htm", "")
8686
.replace(".md", "")),

packages/webdoc-cli/src/load-tutorials/morph-tutorials.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type TutorialReference = string;
1111
type TutorialConfigurator = {
1212
"title": ?string,
1313
"kind"?: "category",
14-
"children": TutorialConfigurator[] | {
14+
"children": TutorialReference[] | {
1515
[id: string]: TutorialConfigurator
1616
}
1717
};
@@ -63,8 +63,6 @@ export function morphTutorials(
6363
// after they were declared.
6464
rootTutorials = rootTutorials.filter((tutorial) => !nestedTutorials.has(tutorial.name));
6565

66-
console.log(rootTutorials.map((t) => t.name))
67-
6866
return rootTutorials;
6967
}
7068

@@ -81,7 +79,7 @@ function resolveConfigurator(
8179

8280
if (Array.isArray(configurator.children)) {
8381
configurator.children.forEach((childRef) => {
84-
nestedTutorials.add((childRef: any));
82+
nestedTutorials.add(childRef);
8583
tdoc.members.push(tutorialDoc((childRef: any)));
8684
});
8785
} else {

packages/webdoc-default-template/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,4 +325,4 @@ function outTutorials(
325325
}
326326

327327
docTree.tutorials.forEach(out);
328-
}
328+
}

packages/webdoc-template-library/src/TemplateRenderer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class TemplateRenderer {
175175
console.error(this.cache[filePath].source
176176
.split("\n")
177177
.map((line, i) => `${i}: ${line}`)
178-
.join('\n'));
178+
.join("\n"));
179179
throw e;
180180
}
181181

@@ -188,8 +188,8 @@ export class TemplateRenderer {
188188
* This method automaticaly applies layout if set.
189189
*
190190
* @param {string} filePath - file path of the template
191-
* @param {object} data - dictionary of all the variables & their values used in the template. For the
192-
* layout, this is deep merged with {@link TemplateRenderer#data}.
191+
* @param {object} data - dictionary of all the variables & their values used in the template.
192+
* For the layout, this is deep merged with {@link TemplateRenderer#data}.
193193
* @return {string} Rendered template.
194194
*/
195195
render(filePath: string, data: any) {
@@ -202,10 +202,12 @@ export class TemplateRenderer {
202202

203203
// apply layout
204204
if (this.layout) {
205-
const templateData = Array.isArray(data) ? [...data] : { ...data };
205+
const templateData = Array.isArray(data) ? [...data] : {...data};
206206

207207
for (const key in this.data) {
208-
templateData[key] = merge({}, this.data[key], templateData[key] || {});
208+
if ("key" in this.data) {
209+
templateData[key] = merge({}, this.data[key], templateData[key] || {});
210+
}
209211
}
210212

211213
templateData.content = content;

0 commit comments

Comments
 (0)