Repository: eslint/eslint
Pull request #8464 (2017-04-15 06:23:21)

Chore: Do not use cache when testing
**What is the purpose of this pull request? (put an "X" next to item)**

[ ] Documentation update
[ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))
[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Chore

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (http://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**
This PR turns off caching when running tests. While this does speed multiple runs up, it can also lead to non-deterministic tests (i.e. it failed on Travis but passed locally for me!). Since we're actively changing the linter between runs, I feel like it might be best to remove this.

**Is there anything you'd like reviewers to focus on?**
Thoughts?



eslintbot: LGTM

Patch:
diff --git a/Makefile.js b/Makefile.js
index dd4baa847..976f27048 100644
--- a/Makefile.js
+++ b/Makefile.js
@@ -509,20 +509,10 @@ target.all = function() {
 
 target.lint = function() {
     let errors = 0,
-        makeFileCache = " ",
-        jsCache = " ",
-        testCache = " ",
         lastReturn;
 
-    // using the cache locally to speed up linting process
-    if (!process.env.TRAVIS) {
-        makeFileCache = " --cache --cache-file .cache/makefile_cache ";
-        jsCache = " --cache --cache-file .cache/js_cache ";
-        testCache = " --cache --cache-file .cache/test_cache ";
-    }
-
     echo("Validating Makefile.js");
-    lastReturn = exec(ESLINT + makeFileCache + MAKEFILE);
+    lastReturn = exec(`${ESLINT} ${MAKEFILE}`);
     if (lastReturn.code !== 0) {
         errors++;
     }
@@ -537,13 +527,13 @@ target.lint = function() {
     }
 
     echo("Validating JavaScript files");
-    lastReturn = exec(ESLINT + jsCache + JS_FILES);
+    lastReturn = exec(`${ESLINT} ${JS_FILES}`);
     if (lastReturn.code !== 0) {
         errors++;
     }
 
     echo("Validating JavaScript test files");
-    lastReturn = exec(`${ESLINT}${testCache}"tests/**/*.js"`);
+    lastReturn = exec(`${ESLINT} "tests/**/*.js"`);
     if (lastReturn.code !== 0) {
         errors++;
     }
diff --git a/lib/rules/no-unused-vars.js b/lib/rules/no-unused-vars.js
index 3ff9bc64f..3ed278d54 100644
--- a/lib/rules/no-unused-vars.js
+++ b/lib/rules/no-unused-vars.js
@@ -513,7 +513,7 @@ module.exports = {
                             }
 
                             // if "args" option is "after-used", skip all but the last parameter
-                            if (config.args === "after-used" && !isLastInNonIgnoredParameters(variable)) {
+                            if (config.args === "after-used" && astUtils.isFunction(def.name.parent) && !isLastInNonIgnoredParameters(variable)) {
                                 continue;
                             }
                         } else {


Test patch:
diff --git a/tests/lib/rules/no-unused-vars.js b/tests/lib/rules/no-unused-vars.js
index a966ebb10..e2ab90b8c 100644
--- a/tests/lib/rules/no-unused-vars.js
+++ b/tests/lib/rules/no-unused-vars.js
@@ -609,6 +609,54 @@ ruleTester.run("no-unused-vars", rule, {
         {
             code: "/*global\rfoo*/",
             errors: [{ message: "'foo' is defined but never used.", line: 2, column: 1 }]
+        },
+
+        // https://github.com/eslint/eslint/issues/8442
+        {
+            code: "(function ({ a }, b ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used."
+            ]
+        },
+        {
+            code: "(function ({ a }, { b, c } ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used.",
+                "'c' is defined but never used."
+            ]
+        },
+        {
+            code: "(function ({ a, b }, { c } ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used.",
+                "'c' is defined but never used."
+            ]
+        },
+        {
+            code: "(function ([ a ], b ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used."
+            ]
+        },
+        {
+            code: "(function ([ a ], [ b, c ] ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used.",
+                "'c' is defined but never used."
+            ]
+        },
+        {
+            code: "(function ([ a, b ], [ c ] ) { return b; })();",
+            parserOptions: { ecmaVersion: 2015 },
+            errors: [
+                "'a' is defined but never used.",
+                "'c' is defined but never used."
+            ]
         }
     ]
 });