Skip to content

Commit

Permalink
feat: add support carriage return
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Harvey committed Nov 17, 2016
1 parent 29a17a8 commit d537d85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/typeColonSpacing/reporter.js
Expand Up @@ -22,7 +22,7 @@ export default (direction, context, {always, allowLineBreak}) => {

const charAfter = context.getSourceCode().getText(colon, 0, 1).slice(1);

if (allowLineBreak && (charAfter === '\n' || charAfter === '\r\n')) {
if (allowLineBreak && RegExp(/(\n|\r)+/).test(charAfter)) {
spaces = 1;
} else {
spaces = getSpaces(direction, colon, context);
Expand Down
6 changes: 6 additions & 0 deletions tests/rules/assertions/spaceAfterTypeColon.js
Expand Up @@ -124,6 +124,12 @@ const ARROW_FUNCTION_PARAMS = {
options: ['always', {
allowLineBreak: true
}]
},
{
code: '(foo:\r\n { a: string, b: number }) => {}',
options: ['always', {
allowLineBreak: true
}]
}
]
};
Expand Down

0 comments on commit d537d85

Please sign in to comment.