Permalink
Browse files

Fix: Make `target` optional for `formatter` calls

Made target optional to match actual call patterns in the code.
Type-change only. Aligns type-validation with existing behavior.

Previously we'd fail further down in the file on the `target.replace`
call, catch the error, and give an error message that the file couldn't
be saved.
  • Loading branch information...
antross authored and alrra committed Oct 13, 2018
1 parent a7754bc commit a64e60f6bc60705d7e6b3a92d323d554bfbb105c
@@ -34,7 +34,7 @@ const startRow = 5;
*/
export default class ExcelFormatter implements IFormatter {
public async format(messages: Array<Problem>, target: string) {
public async format(messages: Array<Problem>, target = '') {
if (messages.length === 0) {
return;
}
@@ -86,7 +86,7 @@ export default class HTMLFormatter implements IFormatter {
}
/** Format the problems grouped by `resource` name and sorted by line and column number */
public async format(problems: Array<Problem>, target: string, options: FormatterOptions = {}) {
public async format(problems: Array<Problem>, target = '', options: FormatterOptions = {}) {
debug('Formatting results');
@@ -357,7 +357,7 @@ export default async (actions: CLIOptions): Promise<boolean> => {
});
};
const print = async (reports: Array<Problem>, target: string, scanTime: number, date: string): Promise<void> => {
const print = async (reports: Array<Problem>, target?: string, scanTime?: number, date?: string): Promise<void> => {
const formatterOptions: FormatterOptions = {
config: userConfig || undefined,
date,
@@ -19,5 +19,5 @@ export interface IFormatterConstructor {
/** A format function that will output the results obtained by hint */
export interface IFormatter {
format(problems: Array<Problem>, target: string, options: FormatterOptions): void;
format(problems: Array<Problem>, target?: string, options?: FormatterOptions): void;
}

0 comments on commit a64e60f

Please sign in to comment.