Skip to content

Commit

Permalink
Add files via upload (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser authored Nov 18, 2021
1 parent 5aeca34 commit 1528d24
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,16 @@ export const rules: Rule[] = [
'Removes extra spaces after every line.',
RuleType.SPACING,
(text: string, options = {}) => {
if (options['Two Space Linebreak'] === false) {
return text.replace(/[ \t]+$/gm, '');
} else {
text = text.replace(/(\S)[ \t]$/gm, '$1'); // one whitespace
text = text.replace(/(\S)[ \t]{3,}$/gm, '$1'); // three or more whitespaces
text = text.replace(/(\S)( ?\t\t? ?)$/gm, '$1'); // two whitespaces with at least one tab
return text;
}
return ignoreCodeBlocksAndYAML(text, (text) => {
if (options['Two Space Linebreak'] === false) {
return text.replace(/[ \t]+$/gm, '');
} else {
text = text.replace(/(\S)[ \t]$/gm, '$1'); // one whitespace
text = text.replace(/(\S)[ \t]{3,}$/gm, '$1'); // three or more whitespaces
text = text.replace(/(\S)( ?\t\t? ?)$/gm, '$1'); // two whitespaces with at least one tab
return text;
}
});
},
[
new Example(
Expand Down

0 comments on commit 1528d24

Please sign in to comment.