Skip to content

Commit

Permalink
fix: address unrelated eslint errors from PL core
Browse files Browse the repository at this point in the history
  • Loading branch information
sghoweri committed Jul 17, 2019
1 parent 3c890c3 commit 6ada00d
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 60 deletions.
8 changes: 2 additions & 6 deletions packages/core/src/lib/annotation_exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ const annotations_exporter = function(pl) {
);
} catch (ex) {
logger.debug(
`annotations.js file missing from ${
paths.source.annotations
}. This may be expected if you do not use annotations or are using markdown.`
`annotations.js file missing from ${paths.source.annotations}. This may be expected if you do not use annotations or are using markdown.`
);
return [];
}
Expand All @@ -39,9 +37,7 @@ const annotations_exporter = function(pl) {
return oldAnnotationsJSON.comments;
} catch (ex) {
logger.error(
`There was an error parsing JSON for ${
paths.source.annotations
}annotations.js`
`There was an error parsing JSON for ${paths.source.annotations}annotations.js`
);
return [];
}
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/lib/buildPatterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ module.exports = (deletePatternDir, patternlab, additionalData) => {
}
//render all patterns last, so lineageR works
const allPatternsPromise = patternsToBuild.map(pattern =>
compose(pattern, patternlab)
compose(
pattern,
patternlab
)
);
//copy non-pattern files like JavaScript
const allJS = patternsToBuild.map(pattern => {
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/lib/expandPartials.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ module.exports = function(currentPattern, patternlab) {

//this is what we came here for
logger.debug(
`within ${
currentPattern.patternPartial
}, replacing extendedTemplate partial ${foundPartial} with ${
cleanPartialPattern.patternPartial
}'s extendedTemplate`
`within ${currentPattern.patternPartial}, replacing extendedTemplate partial ${foundPartial} with ${cleanPartialPattern.patternPartial}'s extendedTemplate`
);

currentPattern.extendedTemplate = currentPattern.extendedTemplate.replace(
Expand Down
8 changes: 1 addition & 7 deletions packages/core/src/lib/lineage_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,7 @@ const lineage_hunter = function() {
? '<<blank>>'
: lineageRPattern.patternState;
logger.info(
`Found a lower common denominator pattern state: ${
pattern.patternState
} on ${
pattern.patternPartial
}. Setting reverse lineage pattern ${
lineageRPattern.patternPartial
} from ${oldState}`
`Found a lower common denominator pattern state: ${pattern.patternState} on ${pattern.patternPartial}. Setting reverse lineage pattern ${lineageRPattern.patternPartial} from ${oldState}`
);

lineageRPattern.patternState = pattern.patternState;
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/list_item_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const list_item_hunter = function() {
return matches.reduce((previousMatchPromise, liMatchStart) => {
return previousMatchPromise.then(() => {
logger.debug(
`found listItem of size ${liMatchStart} inside ${
pattern.patternPartial
}`
`found listItem of size ${liMatchStart} inside ${pattern.patternPartial}`
);

//we found a listitem match
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/loadPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,14 @@ module.exports = function(relPath, patternlab) {

if (listItemsData) {
logger.debug(
`found pattern-specific listitems data for ${
currentPattern.patternPartial
}`
`found pattern-specific listitems data for ${currentPattern.patternPartial}`
);
currentPattern.listitems = listItemsData;
buildListItems(currentPattern);
}
} catch (err) {
logger.warning(
`There was an error parsing sibling listitem JSON for ${
currentPattern.relPath
}`
`There was an error parsing sibling listitem JSON for ${currentPattern.relPath}`
);
logger.warning(err);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/loaduikits.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ module.exports = patternlab => {

if (!configEntry) {
logger.warning(
`Could not find uikit with name uikit-${
kit.name
} defined within patternlab-config.json, or it is not enabled.`
`Could not find uikit with name uikit-${kit.name} defined within patternlab-config.json, or it is not enabled.`
);
return;
}
Expand Down
6 changes: 2 additions & 4 deletions packages/core/src/lib/markModifiedPatterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ module.exports = function(lastModified, patternlab) {
array.forEach(func);
}
};
const modifiedOrNot = _.groupBy(
patternlab.patterns,
p =>
changes_hunter.needsRebuild(lastModified, p) ? 'modified' : 'notModified'
const modifiedOrNot = _.groupBy(patternlab.patterns, p =>
changes_hunter.needsRebuild(lastModified, p) ? 'modified' : 'notModified'
);

// For all unmodified patterns load their rendered template output
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/lib/object_factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ const Pattern = function(relPath, data, patternlab) {
// (rendered!) html file for this pattern, to be shown in the iframe
this.patternLink = this.patternSectionSubtype
? `$${this.name}/index.html`
: patternlab ? this.getPatternLink(patternlab, 'rendered') : null;
: patternlab
? this.getPatternLink(patternlab, 'rendered')
: null;

// The canonical "key" by which this pattern is known. This is the callable
// name of the pattern. UPDATE: this.key is now known as this.patternPartial
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/patternlab.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ module.exports = class PatternLab {
if (typeof patternlab.config.paths.source.patternlabFiles === 'string') {
logger.warning('');
logger.warning(
`Configuration key [paths.source.patternlabFiles] inside patternlab-config.json was found as the string '${
patternlab.config.paths.source.patternlabFiles
}'`
`Configuration key [paths.source.patternlabFiles] inside patternlab-config.json was found as the string '${patternlab.config.paths.source.patternlabFiles}'`
);
logger.warning(
'Since Pattern Lab Node Core 3.0.0 this key is an object. Suggest you update this key following this issue: https://github.com/pattern-lab/patternlab-node/issues/683.'
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/processMetaPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ module.exports = function(fileName, metaType, patternlab) {
})
.catch(reason => {
logger.warning(
`Could not find the user-editable template ${fileName}, currently configured to be at ${
patternlab.config.paths.source.meta
}. Your configured path may be incorrect (check paths.source.meta in your config file), the file may have been deleted, or it may have been left in the wrong place during a migration or update.`
`Could not find the user-editable template ${fileName}, currently configured to be at ${patternlab.config.paths.source.meta}. Your configured path may be incorrect (check paths.source.meta in your config file), the file may have been deleted, or it may have been left in the wrong place during a migration or update.`
);
logger.warning(reason);
});
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/pseudopattern_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function(
);
} catch (err) {
logger.warning(
`There was an error parsing pseudopattern JSON for ${
currentPattern.relPath
}`
`There was an error parsing pseudopattern JSON for ${currentPattern.relPath}`
);
logger.warning(err);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/readDocumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ module.exports = function(pattern, patternlab) {
// do nothing when file not found
if (err.code !== 'ENOENT') {
logger.warning(
`'there was an error setting pattern keys after markdown parsing of the companion file for pattern ${
pattern.patternPartial
}`
`'there was an error setting pattern keys after markdown parsing of the companion file for pattern ${pattern.patternPartial}`
);
logger.warning(err);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ const server = patternlab => {
setTimeout(() => {
try {
liveServer.start(liveServerConfig);
resolveMsg = `Pattern Lab is being served from http://127.0.0.1:${
liveServerConfig.port
}`;
resolveMsg = `Pattern Lab is being served from http://127.0.0.1:${liveServerConfig.port}`;
logger.info(resolveMsg);
} catch (e) {
const err = `Pattern Lab serve failed to start: ${e}`;
Expand Down
8 changes: 2 additions & 6 deletions packages/core/src/lib/starterkit_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,12 @@ const starterkit_manager = function(config) {
if (kitPathDirExists) {
if (clean) {
logger.info(
`Deleting contents of ${
paths.source.root
} prior to starterkit load.`
`Deleting contents of ${paths.source.root} prior to starterkit load.`
);
fs.emptyDirSync(paths.source.root);
} else {
logger.info(
`Overwriting contents of ${
paths.source.root
} during starterkit load.`
`Overwriting contents of ${paths.source.root} during starterkit load.`
);
}

Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/lib/watchPatternLabFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ const watchPatternLabFiles = (
});

logger.info(
`Pattern Lab is watching for changes to files under ${
assetDirectories.source.root
}`
`Pattern Lab is watching for changes to files under ${assetDirectories.source.root}`
);
return Promise.resolve();
};
Expand Down

0 comments on commit 6ada00d

Please sign in to comment.