Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: escape chalk parentheses #612

Merged
merged 2 commits into from
Aug 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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