Skip to content

Commit a157a28

Browse files
committed
refactor(style): Run codebase through prettier
1 parent b8e3e11 commit a157a28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2141
-1351
lines changed

core/index.js

Lines changed: 181 additions & 126 deletions
Large diffs are not rendered by default.

core/lib/addPattern.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
"use strict";
1+
'use strict';
22

33
const _ = require('lodash');
44

55
const logger = require('./log');
66

7-
module.exports = function (pattern, patternlab) {
7+
module.exports = function(pattern, patternlab) {
88
//add the link to the global object
99
if (!patternlab.data.link) {
1010
patternlab.data.link = {};
1111
}
12-
patternlab.data.link[pattern.patternPartial] = '/patterns/' + pattern.patternLink;
12+
patternlab.data.link[pattern.patternPartial] =
13+
'/patterns/' + pattern.patternLink;
1314

1415
//only push to array if the array doesn't contain this pattern
1516
var isNew = true;
@@ -18,20 +19,21 @@ module.exports = function (pattern, patternlab) {
1819
if (pattern.relPath === patternlab.patterns[i].relPath) {
1920
//if relPath already exists, overwrite that element
2021
patternlab.patterns[i] = pattern;
21-
patternlab.partials[pattern.patternPartial] = pattern.extendedTemplate || pattern.template;
22+
patternlab.partials[pattern.patternPartial] =
23+
pattern.extendedTemplate || pattern.template;
2224
isNew = false;
2325
break;
2426
}
2527
}
2628

2729
// if the pattern is new, we must register it with various data structures!
2830
if (isNew) {
29-
3031
logger.debug(`found new pattern ${pattern.patternPartial}`);
3132

3233
// do global registration
3334
if (pattern.isPattern) {
34-
patternlab.partials[pattern.patternPartial] = pattern.extendedTemplate || pattern.template;
35+
patternlab.partials[pattern.patternPartial] =
36+
pattern.extendedTemplate || pattern.template;
3537

3638
// do plugin-specific registration
3739
pattern.registerPartial();
@@ -40,7 +42,11 @@ module.exports = function (pattern, patternlab) {
4042
}
4143

4244
//patterns sorted by name so the patterntype and patternsubtype is adhered to for menu building
43-
patternlab.patterns.splice(_.sortedIndexBy(patternlab.patterns, pattern, 'name'), 0, pattern);
45+
patternlab.patterns.splice(
46+
_.sortedIndexBy(patternlab.patterns, pattern, 'name'),
47+
0,
48+
pattern
49+
);
4450
patternlab.graph.add(pattern);
4551
}
4652
};

core/lib/annotation_exporter.js

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const _ = require('lodash');
66
const mp = require('./markdown_parser');
77
const logger = require('./log');
88

9-
const annotations_exporter = function (pl) {
10-
9+
const annotations_exporter = function(pl) {
1110
const paths = pl.config.paths;
1211
let oldAnnotations;
1312

@@ -18,9 +17,16 @@ const annotations_exporter = function (pl) {
1817
function parseAnnotationsJS() {
1918
//attempt to read the file
2019
try {
21-
oldAnnotations = fs.readFileSync(path.resolve(paths.source.annotations, 'annotations.js'), 'utf8');
20+
oldAnnotations = fs.readFileSync(
21+
path.resolve(paths.source.annotations, 'annotations.js'),
22+
'utf8'
23+
);
2224
} catch (ex) {
23-
logger.debug(`annotations.js file missing from ${paths.source.annotations}. This may be expected if you do not use annotations or are using markdown.`);
25+
logger.debug(
26+
`annotations.js file missing from ${
27+
paths.source.annotations
28+
}. This may be expected if you do not use annotations or are using markdown.`
29+
);
2430
return [];
2531
}
2632

@@ -31,7 +37,11 @@ const annotations_exporter = function (pl) {
3137
try {
3238
var oldAnnotationsJSON = JSON.parse(oldAnnotations);
3339
} catch (ex) {
34-
logger.error(`There was an error parsing JSON for ${paths.source.annotations}annotations.js`);
40+
logger.error(
41+
`There was an error parsing JSON for ${
42+
paths.source.annotations
43+
}annotations.js`
44+
);
3545
return [];
3646
}
3747
return oldAnnotationsJSON.comments;
@@ -62,13 +72,16 @@ const annotations_exporter = function (pl) {
6272
//let annotations = annotations;
6373
const markdown_parser = parser;
6474

65-
return function (filePath) {
75+
return function(filePath) {
6676
const annotationsMD = fs.readFileSync(path.resolve(filePath), 'utf8');
6777

68-
//take the annotation snippets and split them on our custom delimiter
78+
//take the annotation snippets and split them on our custom delimiter
6979
const annotationsYAML = annotationsMD.split('~*~');
7080
for (let i = 0; i < annotationsYAML.length; i++) {
71-
const annotation = buildAnnotationMD(annotationsYAML[i], markdown_parser);
81+
const annotation = buildAnnotationMD(
82+
annotationsYAML[i],
83+
markdown_parser
84+
);
7285
annotations.push(annotation);
7386
}
7487
return false;
@@ -101,17 +114,16 @@ const annotations_exporter = function (pl) {
101114
}
102115

103116
return {
104-
gather: function () {
117+
gather: function() {
105118
return gatherAnnotations();
106119
},
107-
gatherJS: function () {
120+
gatherJS: function() {
108121
return parseAnnotationsJS();
109122
},
110-
gatherMD: function () {
123+
gatherMD: function() {
111124
return parseAnnotationsMD();
112-
}
125+
},
113126
};
114-
115127
};
116128

117129
module.exports = annotations_exporter;

0 commit comments

Comments
 (0)