diff --git a/eslint-plugin-prettier.js b/eslint-plugin-prettier.js index 9a1b2fdd..56c23ecd 100644 --- a/eslint-plugin-prettier.js +++ b/eslint-plugin-prettier.js @@ -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; diff --git a/test/prettier.js b/test/prettier.js index a0d5b09f..0837628d 100644 --- a/test/prettier.js +++ b/test/prettier.js @@ -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(