Skip to content

Commit

Permalink
Fix: Add representation for \r to showInvisibles (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
BPScott authored and not-an-aardvark committed Jul 6, 2018
1 parent 977aa77 commit 731bbb5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions eslint-plugin-prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ function showInvisibles(str) {
case '\t':
ret += '↹'; // Left Arrow To Bar Over Right Arrow To Bar, \u21b9
break;
case '\r':
ret += '␍'; // Carriage Return Symbol, \u240D
break;
default:
ret += str[i];
break;
Expand Down
9 changes: 9 additions & 0 deletions test/prettier.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ vueRuleTester.run('prettier', rule, {
]
});

describe('showInvisibles', () => {
it('shows invisibles', () => {
assert.equal(
eslintPluginPrettier.showInvisibles('1 2\n3\t4\r5'),
'1·2⏎3↹4␍5'
);
});
});

describe('generateDifferences', () => {
it('operation: insert', () => {
const differences = eslintPluginPrettier.generateDifferences(
Expand Down

0 comments on commit 731bbb5

Please sign in to comment.