Skip to content

Commit

Permalink
Fix unnecessary backslashes
Browse files Browse the repository at this point in the history
  • Loading branch information
steventsao committed Nov 19, 2019
1 parent cc80588 commit da398e4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/rules/no-get-with-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions tests/lib/rules/no-get-with-default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
],
Expand All @@ -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',
},
],
Expand Down

0 comments on commit da398e4

Please sign in to comment.