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

cleanup(angular): migrate angular to picocolors #29444

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion packages/angular/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
"rules": {
"no-restricted-imports": [
"error",
{
"name": "chalk",
"message": "Please use `picocolors` in place of `chalk` for rendering terminal colors"
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
Expand Down
1 change: 0 additions & 1 deletion packages/angular/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@schematics",
"@phenomnomnominal/tsquery",
"@typescript-eslint/",
"chalk",
"ignore",
"minimatch",
"rxjs-for-await",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"dependencies": {
"@phenomnomnominal/tsquery": "~5.0.1",
"@typescript-eslint/type-utils": "^8.0.0",
"chalk": "^4.1.0",
"picocolors": "^1.1.0",
"magic-string": "~0.30.2",
"minimatch": "9.0.3",
"semver": "^7.5.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk = require('chalk');
import * as pc from 'picocolors';
import {
arrayToString,
getProjectValidationResultMessage,
Expand Down Expand Up @@ -48,10 +48,10 @@ describe('getProjectValidationResultMessage', () => {
},
]);

expect(message).toBe(`${chalk.bold(`Validation results`)}:
expect(message).toBe(`${pc.bold(`Validation results`)}:

- Simple error message with hint
${chalk.dim(chalk.italic(` Some hint message`))}
${pc.dim(pc.italic(` Some hint message`))}

- Simple error message without hint

Expand All @@ -60,7 +60,7 @@ describe('getProjectValidationResultMessage', () => {
- First error message
- Second error message
- Third error message
${chalk.dim(chalk.italic(` - Some hint message`))}
${pc.dim(pc.italic(` - Some hint message`))}

- Message group without hint:
- Errors:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk = require('chalk');
import * as pc from 'picocolors';
import type { ValidationError } from './types';

export function arrayToString(array: string[]): string {
Expand All @@ -18,7 +18,7 @@ export function arrayToString(array: string[]): string {
export function getProjectValidationResultMessage(
validationResult: ValidationError[]
): string {
return `${chalk.bold('Validation results')}:
return `${pc.bold('Validation results')}:

${validationResult
.map((error) => getValidationErrorText(error))
Expand All @@ -31,12 +31,12 @@ function getValidationErrorText({
hint,
}: ValidationError): string {
let lines = message
? [`- ${message}`, ...(hint ? [chalk.dim(chalk.italic(` ${hint}`))] : [])]
? [`- ${message}`, ...(hint ? [pc.dim(pc.italic(` ${hint}`))] : [])]
: [
`- ${messageGroup.title}:`,
' - Errors:',
...messageGroup.messages.map((message) => ` - ${message}`),
...(hint ? [chalk.dim(chalk.italic(` - ${hint}`))] : []),
...(hint ? [pc.dim(pc.italic(` - ${hint}`))] : []),
];

return lines.join('\n ');
Expand Down
Loading