Skip to content

Commit 731bbb5

Browse files
BPScottnot-an-aardvark
authored andcommittedJul 6, 2018
Fix: Add representation for \r to showInvisibles (#100)
1 parent 977aa77 commit 731bbb5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed
 

‎eslint-plugin-prettier.js

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ function showInvisibles(str) {
100100
case '\t':
101101
ret += '↹'; // Left Arrow To Bar Over Right Arrow To Bar, \u21b9
102102
break;
103+
case '\r':
104+
ret += '␍'; // Carriage Return Symbol, \u240D
105+
break;
103106
default:
104107
ret += str[i];
105108
break;

‎test/prettier.js

+9
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ vueRuleTester.run('prettier', rule, {
110110
]
111111
});
112112

113+
describe('showInvisibles', () => {
114+
it('shows invisibles', () => {
115+
assert.equal(
116+
eslintPluginPrettier.showInvisibles('1 2\n3\t4\r5'),
117+
'1·2⏎3↹4␍5'
118+
);
119+
});
120+
});
121+
113122
describe('generateDifferences', () => {
114123
it('operation: insert', () => {
115124
const differences = eslintPluginPrettier.generateDifferences(

0 commit comments

Comments
 (0)
Please sign in to comment.