Repository: ember-cli/eslint-plugin-ember
Pull request #585 (2019-11-10 20:19:02)

Minor cleanup to `use-brace-expansion` rule


Patch:
diff --git a/lib/rules/use-brace-expansion.js b/lib/rules/use-brace-expansion.js
index f704cad2..6969176f 100644
--- a/lib/rules/use-brace-expansion.js
+++ b/lib/rules/use-brace-expansion.js
@@ -7,6 +7,8 @@ const ember = require('../utils/ember');
 // General rule - Use brace expansion
 //------------------------------------------------------------------------------
 
+const ERROR_MESSAGE = 'Use brace expansion';
+
 module.exports = {
   meta: {
     docs: {
@@ -19,11 +21,11 @@ module.exports = {
     fixable: null, // or "code" or "whitespace"
   },
 
-  create(context) {
-    const message = 'Use brace expansion';
+  ERROR_MESSAGE,
 
+  create(context) {
     function report(node) {
-      context.report(node, message);
+      context.report(node, ERROR_MESSAGE);
     }
 
     return {


Test patch:
diff --git a/tests/lib/rules/use-brace-expansion.js b/tests/lib/rules/use-brace-expansion.js
index 03d5d275..fe2c7a81 100644
--- a/tests/lib/rules/use-brace-expansion.js
+++ b/tests/lib/rules/use-brace-expansion.js
@@ -5,6 +5,8 @@
 const rule = require('../../../lib/rules/use-brace-expansion');
 const RuleTester = require('eslint').RuleTester;
 
+const { ERROR_MESSAGE } = rule;
+
 // ------------------------------------------------------------------------------
 // Tests
 // ------------------------------------------------------------------------------
@@ -30,7 +32,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -39,7 +42,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -48,7 +52,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -57,7 +62,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -66,7 +72,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -75,7 +82,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },
@@ -84,7 +92,8 @@ eslintTester.run('use-brace-expansion', rule, {
       output: null,
       errors: [
         {
-          message: 'Use brace expansion',
+          message: ERROR_MESSAGE,
+          type: 'CallExpression',
         },
       ],
     },