From da398e401c6c7272a76c4513f9424a8a55b4f4a0 Mon Sep 17 00:00:00 2001 From: Steven Tsao Date: Mon, 18 Nov 2019 21:51:10 -0800 Subject: [PATCH] Fix unnecessary backslashes --- lib/rules/no-get-with-default.js | 6 +++--- tests/lib/rules/no-get-with-default.js | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/rules/no-get-with-default.js b/lib/rules/no-get-with-default.js index fe10304450..92e9946f42 100644 --- a/lib/rules/no-get-with-default.js +++ b/lib/rules/no-get-with-default.js @@ -4,15 +4,15 @@ const types = require('../utils/types'); function makeErrorMessageForGetWithDefault(property, isImportedGetWithDefault) { return isImportedGetWithDefault - ? "Use \`||\` or the ternary operator instead of \`getWithDefault()\`." - : "Use \`this.property || defaultValue\` or the \`this.property === undefined ? defaultValue : this.property\` instead of \`getWithDefault(this.property, defaultValue)\`."; + ? 'Use `||` or the ternary operator instead of `getWithDefault()`.' + : 'Use `this.property || defaultValue` or the `this.property === undefined ? defaultValue : this.property` instead of `getWithDefault(this.property, defaultValue)`.'; } module.exports = { meta: { type: 'suggestion', docs: { - description: 'Use the \`||\` operator instead of \`getWithDefault\` for more expected behaviors', + description: 'Use the `||` operator instead of `getWithDefault` for more expected behaviors', category: 'Best Practices', recommended: false, octane: true, diff --git a/tests/lib/rules/no-get-with-default.js b/tests/lib/rules/no-get-with-default.js index f8eea35f99..0c10ad0efb 100644 --- a/tests/lib/rules/no-get-with-default.js +++ b/tests/lib/rules/no-get-with-default.js @@ -20,7 +20,8 @@ ruleTester.run('no-get-with-default', rule, { code: "const test = this.getWithDefault('key', []);", errors: [ { - message: "Use `this.property || defaultValue` or the `this.property === undefined ? defaultValue : this.property` instead of `getWithDefault(this.property, defaultValue)`.", + message: + 'Use `this.property || defaultValue` or the `this.property === undefined ? defaultValue : this.property` instead of `getWithDefault(this.property, defaultValue)`.', type: 'CallExpression', }, ], @@ -30,7 +31,7 @@ ruleTester.run('no-get-with-default', rule, { code: "const test = getWithDefault(this, 'key', []);", errors: [ { - message: "Use \`||\` or the ternary operator instead of \`getWithDefault()\`.", + message: 'Use `||` or the ternary operator instead of `getWithDefault()`.', type: 'CallExpression', }, ],