Skip to content

Commit c27907f

Browse files
#1143: Fix some spell-check errors
1 parent 4a6ca26 commit c27907f

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed

packages/core/src/lib/object_factory.js

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@ const prefixMatcher = /^_?(\d+-)?/;
1414
*
1515
* Before changing functionalities of the pattern object please read the following pull requests
1616
* to get more details about the behavior of the folder structure
17+
* https://patternlab.io/docs/overview-of-patterns/#heading-deeper-nesting
1718
* https://github.com/pattern-lab/patternlab-node/pull/992
1819
* https://github.com/pattern-lab/patternlab-node/pull/1016
1920
* https://github.com/pattern-lab/patternlab-node/pull/1143
2021
*
21-
* @param {String} relPath relative directory
22+
* @param {string} relPath relative directory
2223
* @param {Object} jsonFileData The JSON used to render values in the pattern.
23-
* @param {Patternlab} patternlab The actual patternlab instance
24-
* @param {Boolean} isUnsubRun specifies if the pattern needs to be removed from its subfolder
24+
* @param {Patternlab} patternlab The actual pattern lab instance
25+
* @param {boolean} isPromoteToFlatPatternRun specifies if the pattern needs to be removed from its deep nesting folder
2526
*/
26-
const Pattern = function(relPath, jsonFileData, patternlab, isUnsubRun) {
27+
const Pattern = function(
28+
relPath,
29+
jsonFileData,
30+
patternlab,
31+
isPromoteToFlatPatternRun
32+
) {
2733
this.relPath = path.normalize(relPath); // '00-atoms/00-global/00-colors.mustache'
2834

2935
/**
@@ -32,13 +38,17 @@ const Pattern = function(relPath, jsonFileData, patternlab, isUnsubRun) {
3238
*/
3339
const pathObj = path.parse(this.relPath);
3440

35-
const info = this.getPatternInfo(pathObj, patternlab, isUnsubRun);
41+
const info = this.getPatternInfo(
42+
pathObj,
43+
patternlab,
44+
isPromoteToFlatPatternRun
45+
);
3646

3747
this.fileName = pathObj.name; // '00-colors'
3848
this.subdir = pathObj.dir; // '00-atoms/00-global'
3949
this.fileExtension = pathObj.ext; // '.mustache'
4050

41-
// TODO: Remove if when droping ordering by prefix and keep else code
51+
// TODO: Remove if when dropping ordering by prefix and keep else code
4252
if (info.patternHasOwnDir) {
4353
// Since there is still the requirement of having the numbers provided for sorting
4454
// this will be required to keep the folder prefix and the variant name
@@ -80,7 +90,7 @@ const Pattern = function(relPath, jsonFileData, patternlab, isUnsubRun) {
8090
// the joined pattern group and subgroup directory
8191
this.flatPatternPath = info.shortNotation; // '00-atoms-00-global'
8292

83-
// calculated path from the root of the public directory to the generated
93+
// Calculated path from the root of the public directory to the generated
8494
// (rendered!) html file for this pattern, to be shown in the iframe
8595
this.patternLink = patternlab
8696
? this.getPatternLink(patternlab, 'rendered')
@@ -128,7 +138,7 @@ const Pattern = function(relPath, jsonFileData, patternlab, isUnsubRun) {
128138
this.compileState = null;
129139

130140
/**
131-
* Timestamp in milliseconds when the pattern template or auxilary file (e.g. json) were modified.
141+
* Timestamp in milliseconds when the pattern template or auxiliary file (e.g. json) were modified.
132142
* If multiple files are affected, this is the timestamp of the most recent change.
133143
*
134144
* @see {@link pattern}
@@ -175,8 +185,8 @@ Pattern.prototype = {
175185
* Should look something like '00-atoms-00-global-00-colors/00-atoms-00-global-00-colors.html'
176186
*
177187
* @param {Patternlab} patternlab Current patternlab instance
178-
* @param {String} suffixType File suffix
179-
* @param {String} customfileExtension Custom extension
188+
* @param {string} suffixType File suffix
189+
* @param {string} customfileExtension Custom extension
180190
*/
181191
getPatternLink: function(patternlab, suffixType, customfileExtension) {
182192
// if no suffixType is provided, we default to rendered
@@ -216,8 +226,8 @@ Pattern.prototype = {
216226
return this.engine.findListItems(this);
217227
},
218228

219-
findPartial: function(partialString) {
220-
return this.engine.findPartial(partialString);
229+
findPartial: function(partialstring) {
230+
return this.engine.findPartial(partialstring);
221231
},
222232

223233
/**
@@ -235,7 +245,7 @@ Pattern.prototype = {
235245
} else if (level >= 1) {
236246
return '';
237247
} else {
238-
// Im Not quite shure about that but its better than empty node
248+
// I'm not quite sure about that but its better than empty node
239249
// TODO: verify
240250
return 'root';
241251
}
@@ -248,7 +258,7 @@ Pattern.prototype = {
248258
*
249259
* @param {Patternlab} patternlab Current patternlab instance
250260
*/
251-
resetSubbing: function(patternlab) {
261+
promoteFromDirectoryToFlatPattern: function(patternlab) {
252262
const p = new Pattern(this.relPath, this.jsonFileData, patternlab, true);
253263
// Only reset the specific fields, not everything
254264
Object.assign(this, {
@@ -266,17 +276,18 @@ Pattern.prototype = {
266276
},
267277

268278
/**
269-
* Info contains information about pattern structure if it is a nested pattern
270-
* or if it just a subfolder structure. Its just used for internal purposes.
271-
* Remember every pattern infomarion based on "this.*" will be used by other functions
279+
* The "info" object contains information about pattern structure if it is
280+
* a nested pattern or if it just a sub folder structure. It's just used for
281+
* internal purposes. Remember every pattern information based on "this.*"
282+
* will be used by other functions
272283
*
273-
* @param pathObj path.parse() object containing usefull path information
284+
* @param pathObj path.parse() object containing useful path information
274285
*/
275-
getPatternInfo: (pathObj, patternlab, isUnsubRun) => {
286+
getPatternInfo: (pathObj, patternlab, isPromoteToFlatPatternRun) => {
276287
const info = {
277-
// 00-colors(.mustache) is subfolder in 00-atoms-/00-global/00-colors
288+
// 00-colors(.mustache) is deeply nested in 00-atoms-/00-global/00-colors
278289
patternlab: patternlab,
279-
patternHasOwnDir: !isUnsubRun
290+
patternHasOwnDir: !isPromoteToFlatPatternRun
280291
? path.basename(pathObj.dir).replace(prefixMatcher, '') ===
281292
pathObj.name.replace(prefixMatcher, '') ||
282293
path.basename(pathObj.dir).replace(prefixMatcher, '') ===
@@ -333,7 +344,7 @@ Pattern.createEmpty = function(customProps, patternlab) {
333344
};
334345

335346
/**
336-
* factory: creates an Pattern object on-demand from a hash; the hash accepts
347+
* factory: creates a Pattern object on-demand from a hash; the hash accepts
337348
* parameters that replace the positional parameters that the Pattern
338349
* constructor takes.
339350
*/

packages/core/src/lib/readDocumentation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ module.exports = function(pattern, patternlab) {
6060
!markdownObject.subfolder
6161
) {
6262
// Reset to pattern without own pattern-directory
63-
pattern.resetSubbing(patternlab);
63+
pattern.promoteFromDirectoryToFlatPattern(patternlab);
6464
}
6565
} else {
6666
logger.warning(`error processing markdown for ${pattern.patternPartial}`);

packages/core/src/lib/ui_builder.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ const ui_builder = function() {
263263
patternPath: pattern.patternLink,
264264
name: pattern.name,
265265
isDocPattern: false,
266-
order: Number(pattern.order) || 0, // Failsave is someone entered a string
266+
order: Number(pattern.order) || 0, // Failsafe is someone entered a string
267267
};
268268
}
269269

@@ -355,7 +355,7 @@ const ui_builder = function() {
355355
aOrder = Number.MAX_SAFE_INTEGER;
356356
}
357357

358-
// alwasy return a docPattern first
358+
// always return a docPattern first
359359
if (a.isDocPattern && !b.isDocPattern) {
360360
return -1;
361361
}
@@ -395,7 +395,7 @@ const ui_builder = function() {
395395
* Returns an object representing how the front end styleguide and navigation is structured
396396
* @param patternlab - global data store
397397
* @param uikit - the current uikit being built
398-
* @returns ptterns grouped by type -> subtype like atoms -> global -> pattern, pattern, pattern
398+
* @returns patterns grouped by type -> subtype like atoms -> global -> pattern, pattern, pattern
399399
*/
400400
function groupPatterns(patternlab, uikit) {
401401
const groupedPatterns = {
@@ -463,7 +463,7 @@ const ui_builder = function() {
463463
* Search all flat patterns of a specific pattern type
464464
*
465465
* @param {Patternlab} patternlab Current patternlab instance
466-
* @param {String} patternType indicator which patterns to search for
466+
* @param {string} patternType indicator which patterns to search for
467467
*/
468468
function getFlatPatternItems(patternlab, patternType) {
469469
const patterns = _.filter(
@@ -617,7 +617,7 @@ const ui_builder = function() {
617617
);
618618

619619
/**
620-
* View all pages for goups
620+
* View all pages for groups
621621
*/
622622
return Promise.all(subTypePromises)
623623
.then(() => {

packages/core/test/object_factory_tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ tap.test('test Pattern with own-directory gets resetted as expected', function(
153153
test
154154
) {
155155
var p = new Pattern('00-atoms/00-button/button.mustache', { d: 123 }, pl);
156-
p.resetSubbing(pl);
156+
p.promoteFromDirectoryToFlatPattern(pl);
157157

158158
test.equals(p.relPath, path.join('00-atoms', '00-button', 'button.mustache'));
159159
test.equals(p.name, '00-atoms-00-button-button');

0 commit comments

Comments
 (0)