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

Missing custom formatter type in d.ts #68

Merged
merged 2 commits into from
Jul 29, 2016

Conversation

GiedriusGrabauskas
Copy link
Contributor

@GiedriusGrabauskas GiedriusGrabauskas commented Jul 21, 2016

Code sample:

import * as Lint from "tslint/lib/lint";
import tslint from "gulp-tslint";

// Custom formatter class
export class Formatter extends Lint.Formatters.AbstractFormatter {
    public format(failures: Lint.RuleFailure[]): string {
        var failuresJSON = failures.map((failure: Lint.RuleFailure) => failure.toJson());
        return JSON.stringify(failuresJSON);
    }
}


gulp.task("tslint", () =>
    gulp.src("source.ts")
        .pipe(tslint({
            formatter: Formatter  // Custom formatter
        }))
        .pipe(tslint.report())
);

@@ -1,6 +1,6 @@
export interface PluginOptions {
configuration?: any;
formatter?: string;
formatter?: string | any;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the type be string | Function - or even a more strictly defined function type?

@GiedriusGrabauskas
Copy link
Contributor Author

Changed any to Function.

@panuhorsmalahti
Copy link
Owner

Can you explain how the formatter option would work with a Function in tslint?

https://github.com/palantir/tslint/blob/master/src/lint.ts#L51

@GiedriusGrabauskas
Copy link
Contributor Author

Waiting for response: palantir/tslint#1427

@GiedriusGrabauskas
Copy link
Contributor Author

Pull request (palantir/tslint#1443) was merged.

@panuhorsmalahti panuhorsmalahti merged commit cc2391d into panuhorsmalahti:master Jul 29, 2016
@panuhorsmalahti
Copy link
Owner

Thanks 👍

@GiedriusGrabauskas GiedriusGrabauskas deleted the patch-1 branch July 29, 2016 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants