Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
add autofix eofline
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasjunies, Richard committed Apr 24, 2016
1 parent ba0ec29 commit 7289287
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tslint-server/src/tslintAutoFix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ export interface TsLintAutoFix {
}
export let tsLintAutoFixes: TsLintAutoFix[] = [];


/**
* AutoFix rules are all in this file
* each autoFix should support the interface TsLintAutoFix and added in this.tsLintAutoFixes
*
* the key to map tsLint problem and autofix rules is => tsLintMessage
*/
let autoFix: TsLintAutoFix;
autoFix = {
tsLintCode: "one-line",
Expand Down Expand Up @@ -58,7 +63,6 @@ autoFix = {
autoFixMessage: "Replace 4 spaces by 1 tab",
autoFix: (codeBefore: string): string => {
let codeAfter = " ";
// console.log( `indent: before[${codeBefore}]-[${codeAfter}]` );
return codeAfter;
}
};
Expand All @@ -70,7 +74,17 @@ autoFix = {
autoFixMessage: "Replace 1 tab by 4 spaces",
autoFix: (codeBefore: string): string => {
let codeAfter = " ";
// console.log( `indent: before[${codeBefore}]-[${codeAfter}]` );
return codeAfter;
}
};
this.tsLintAutoFixes.push(autoFix);

autoFix = {
tsLintCode: "eofline",
tsLintMessage: "file should end with a newline",
autoFixMessage: "add new line",
autoFix: (codeBefore: string): string => {
let codeAfter = "\n";
return codeAfter;
}
};
Expand Down

0 comments on commit 7289287

Please sign in to comment.