mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
refactor(diagnostics): simplify some conditionals (#402)
- reduce the complexity of the code by decreasing the amount of nesting - note that `print` returns `void` anyway, so calling it within the `return` statement doesn't change anything - and this is within a `void` `forEach` at that too
This commit is contained in:
parent
bbed47e16a
commit
c37dbf6ee9
@ -34,13 +34,11 @@ export function printDiagnostics(context: IContext, diagnostics: IDiagnostics[],
|
||||
const type = diagnostic.type + " ";
|
||||
|
||||
if (pretty)
|
||||
print.call(context, `${diagnostic.formatted}`);
|
||||
else
|
||||
{
|
||||
if (diagnostic.fileLine !== undefined)
|
||||
print.call(context, `${diagnostic.fileLine}: ${type}${category} TS${diagnostic.code}: ${color(diagnostic.flatMessage)}`);
|
||||
else
|
||||
print.call(context, `${type}${category} TS${diagnostic.code}: ${color(diagnostic.flatMessage)}`);
|
||||
}
|
||||
return print.call(context, `${diagnostic.formatted}`);
|
||||
|
||||
if (diagnostic.fileLine !== undefined)
|
||||
return print.call(context, `${diagnostic.fileLine}: ${type}${category} TS${diagnostic.code}: ${color(diagnostic.flatMessage)}`);
|
||||
|
||||
return print.call(context, `${type}${category} TS${diagnostic.code}: ${color(diagnostic.flatMessage)}`);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user