Skip to content

Commit 9e3ffc6

Browse files
committed
chore: code optimizations
that are mentioned by the github pipeline as well
1 parent a5a5166 commit 9e3ffc6

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

Diff for: packages/core/src/lib/compose.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ module.exports = async function (pattern, patternlab) {
205205
);
206206

207207
// Allows serializing the compile state
208-
patternlab.graph.node(
209-
pattern
210-
).compileState = pattern.compileState = CompileState.CLEAN;
208+
patternlab.graph.node(pattern).compileState =
209+
pattern.compileState = CompileState.CLEAN;
211210
logger.info('Built pattern: ' + pattern.patternPartial);
212211
}
213212
);

Diff for: packages/core/src/lib/expandPartials.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,11 @@ module.exports = function (currentPattern, patternlab) {
6464
`within ${currentPattern.patternPartial}, replacing extendedTemplate partial ${foundPartial} with ${cleanPartialPattern.patternPartial}'s extendedTemplate`
6565
);
6666

67-
currentPattern.extendedTemplate = currentPattern.extendedTemplate.replace(
68-
foundPartial,
69-
cleanPartialPattern.extendedTemplate
70-
);
67+
currentPattern.extendedTemplate =
68+
currentPattern.extendedTemplate.replace(
69+
foundPartial,
70+
cleanPartialPattern.extendedTemplate
71+
);
7172

7273
// update the extendedTemplate in the partials object in case this
7374
// pattern is consumed later

Diff for: packages/core/src/lib/loadPattern.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ module.exports = function (relPath, patternlab) {
133133
currentPattern.template = fs.readFileSync(templatePath, 'utf8');
134134

135135
//find any stylemodifiers that may be in the current pattern
136-
currentPattern.stylePartials = currentPattern.findPartialsWithStyleModifiers();
136+
currentPattern.stylePartials =
137+
currentPattern.findPartialsWithStyleModifiers();
137138

138139
//find any pattern parameters that may be in the current pattern
139-
currentPattern.parameteredPartials = currentPattern.findPartialsWithPatternParameters();
140+
currentPattern.parameteredPartials =
141+
currentPattern.findPartialsWithPatternParameters();
140142

141143
[
142144
templatePath,

Diff for: packages/core/src/lib/object_factory.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,14 @@ Pattern.prototype = {
381381
.map((o, i) => {
382382
if (i === 0) {
383383
// TODO: Remove when prefix gets deprecated
384-
info.patternGroupOrder = Pattern.prototype.setPatternOrderDataForInfo(
385-
o
386-
);
384+
info.patternGroupOrder =
385+
Pattern.prototype.setPatternOrderDataForInfo(o);
387386
}
388387

389388
if (i === 1) {
390389
// TODO: Remove when prefix gets deprecated
391-
info.patternSubgroupOrder = Pattern.prototype.setPatternOrderDataForInfo(
392-
o
393-
);
390+
info.patternSubgroupOrder =
391+
Pattern.prototype.setPatternOrderDataForInfo(o);
394392
}
395393

396394
return o.replace(prefixMatcher, '');

Diff for: packages/core/src/lib/pattern_engines.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ const PatternEngines = Object.create({
248248
}
249249

250250
// not a hidden pattern, let's dig deeper
251-
const supportedPatternFileExtensions = PatternEngines.getSupportedFileExtensions();
251+
const supportedPatternFileExtensions =
252+
PatternEngines.getSupportedFileExtensions();
252253
return (
253254
supportedPatternFileExtensions.lastIndexOf(extension) !== -1 ||
254255
PatternEngines.isPseudoPatternJSON(filename)

Diff for: packages/core/src/lib/ui_builder.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,8 @@ const ui_builder = function () {
402402
] = {};
403403
groupedPatterns.patternGroups[pattern.patternGroup][
404404
pattern.patternSubgroup
405-
][
406-
'viewall-' + pattern.patternGroup + '-' + pattern.patternSubgroup
407-
] = injectDocumentationBlock(pattern, patternlab, true);
405+
]['viewall-' + pattern.patternGroup + '-' + pattern.patternSubgroup] =
406+
injectDocumentationBlock(pattern, patternlab, true);
408407

409408
addToViewAllPaths(patternlab, pattern);
410409
addPatternSubgroupItem(patternlab, pattern, true);
@@ -588,9 +587,8 @@ const ui_builder = function () {
588587
`Omitting ${patternGroupName}/${patternName} from building a viewall page because its patternSubgroup is specified in styleguideExcludes.`
589588
);
590589
} else {
591-
styleguideGroupedPatterns = styleguideGroupedPatterns.concat(
592-
subgroupPatterns
593-
);
590+
styleguideGroupedPatterns =
591+
styleguideGroupedPatterns.concat(subgroupPatterns);
594592
}
595593

596594
groupedPatterns = groupedPatterns.concat(subgroupPatterns);

0 commit comments

Comments
 (0)