Skip to content

Commit

Permalink
Merge pull request #612 from 43081j/lint-help
Browse files Browse the repository at this point in the history
cli: escape chalk parentheses
  • Loading branch information
aomarks committed Aug 28, 2018
2 parents c64bfa1 + 6fe0320 commit bf6b449
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

<!-- ## Unreleased -->
<!-- Add new, unreleased items here. -->
## Unreleased
* Fix an issue where we were passing lint rule help text through chalk
with unescaped chalk-specific syntax, causing chalk parsing errors.

## v1.8.0 [08-15-2018]
* Fix a case where the CustomElementsEs5Adapter script was not added to the
Expand Down
10 changes: 9 additions & 1 deletion packages/cli/src/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,15 @@ export class LintCommand implements Command {
content: collectionsDocs.join('\n\n'),
raw: true
},
{header: 'Lint Rules', content: rulesDocs.join('\n\n'), raw: true}
{
header: 'Lint Rules',
// Here we replace special characters with chalk's escape
// syntax (`\$&`) to avoid chalk trying to re-process our input.
// This is needed because chalk supports a form of `{var}`
// interpolation.
content: rulesDocs.join('\n\n').replace(/[{}\\]/g, '\\$&'),
raw: true
}
];
}

Expand Down

0 comments on commit bf6b449

Please sign in to comment.