Skip to content

Commit

Permalink
chore: fiddle with console reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jun 22, 2024
1 parent e47a734 commit 4fe2a2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
15 changes: 8 additions & 7 deletions packages/plugin-default/src/reporter/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const ConsoleReporter: ReporterDef<ConsoleReporterContext> = {
)
.map(([ruleName]) => ruleName).length;

// TODO: I don't love how this looks
const planLintText = `${bold('lint')} using ${plural(
'rule',
enabledRuleCount,
Expand All @@ -149,16 +150,16 @@ export const ConsoleReporter: ReporterDef<ConsoleReporterContext> = {
'script',
opts.script.length,
true,
)}}`;
)}`;

const planOperation =
opts.lint && !isEmpty(opts.script)
? `will ${planLintText} and ${scriptLintText}`
? `${planLintText} and ${scriptLintText}`
: opts.lint
? `will ${planLintText}`
: `will ${scriptLintText}`;
? planLintText
: scriptLintText;

let msg = `Plan: ${planOperation} in `;
let msg = `${italic('Plan:')} ${planOperation} in `;
if (workspaceInfo.length > 1) {
msg += plural('workspace', workspaceInfo.length, true);
} else {
Expand Down Expand Up @@ -245,10 +246,10 @@ export const ConsoleReporter: ReporterDef<ConsoleReporterContext> = {
}
},
onSmokeFailed({spinner}) {
spinner.fail('🤮 Maurice!');
spinner.fail('Maurice! 🤮');
},
onSmokeOk({spinner}) {
spinner.succeed('💖 Lovey-dovey!');
spinner.succeed('Lovey-dovey! 💖');
},
onLingered(_, {directories: dirs}) {
console.error(
Expand Down
14 changes: 4 additions & 10 deletions packages/plugin-default/src/rules/exports-inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export class ExportsInspector<Schema extends Rule.RuleDefSchemaValue> {

const missing = await this.isFileMissing(absPath);
if (missing) {
this.addIssue(`Filepath ${relPath} unreadable at field ${fullName}`);
this.addIssue(`${relPath} unreadable at field ${fullName}`);
return;
}

Expand All @@ -250,25 +250,19 @@ export class ExportsInspector<Schema extends Rule.RuleDefSchemaValue> {
switch (key) {
case CONDITIONAL_EXPORT_IMPORT: {
if (await this.conditionalExportIsNotModule(absPath)) {
this.addIssue(
`Filepath ${relPath} is not a ES module at field ${fullName}`,
);
this.addIssue(`${relPath} is not a ES module at field ${fullName}`);
}
break;
}
case CONDITIONAL_EXPORT_REQUIRE: {
if (await this.conditionalExportIsNotScript(absPath)) {
this.addIssue(
`Filepath ${relPath} is not a CJS script at field ${fullName}`,
);
this.addIssue(`${relPath} is not a CJS script at field ${fullName}`);
}
break;
}
case CONDITIONAL_EXPORT_TYPES: {
if (this.conditionalExportIsNotTsDeclaration(absPath)) {
this.addIssue(
`Filepath ${relPath} is not a .d.ts file at field ${fullName}`,
);
this.addIssue(`${relPath} is not a .d.ts file at field ${fullName}`);
}
break;
}
Expand Down

0 comments on commit 4fe2a2b

Please sign in to comment.