Skip to content
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
8 changes: 4 additions & 4 deletions packages/rstack/src/fmt/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const logFmtResult = (result: FmtRunResult, mode: FmtMode, cwd: string): void =>
logger.success(displayPath);
} else if (file.status === 'different') {
differentCount++;
logger[mode === 'check' ? 'warn' : 'log'](displayPath);
logger[mode === 'check' ? 'error' : 'log'](displayPath);
} else if (file.status === 'error') {
errorCount++;
logger.error(`${displayPath}: ${String(file.error)}`);
Expand All @@ -107,9 +107,9 @@ const logFmtResult = (result: FmtRunResult, mode: FmtMode, cwd: string): void =>

if (differentCount > 0) {
const files = differentCount === 1 ? 'file' : 'files';
logger.warn(
`Code style issues found in ${differentCount} ${files}. Run rs fmt --write to fix.`,
);
const count = color.bold(color.red(differentCount));
const writeCommand = color.cyan('rs fmt --write');
logger.error(`Code style issues found in ${count} ${files}. Run ${writeCommand} to fix.`);
} else if (errorCount === 0) {
logger.success('All matched files are correctly formatted.');
}
Expand Down
4 changes: 2 additions & 2 deletions packages/rstack/tests/cli/fmt/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ test('checks formatting without writing files', () => {

expect(result.status).toBe(1);
expect(result.stdout).toBe('start Checking formatting...\n');
expect(result.stderr).toContain('warn index.ts');
expect(result.stderr).toContain('error index.ts');
expect(result.stderr).toContain(
'warn Code style issues found in 1 file. Run rs fmt --write to fix.',
'error Code style issues found in 1 file. Run rs fmt --write to fix.',
);
expect(readProjectFile('index.ts')).toBe(source);

Expand Down