Repository: eslint/eslint
Pull request #11220 (2018-12-29 10:12:46)

Upgrade: eslint-plugin-eslint-plugin@2.0.1
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**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:

<!--
    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 (https://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)**
upgrade eslint-plugin-eslint-plugin@2.0.1, it mainly added a new rule: require-meta-type.

**Is there anything you'd like reviewers to focus on?**
thoughts on the types of internal rules?




Patch:
diff --git a/.eslintrc.js b/.eslintrc.js
index 22332c389..780368769 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -21,6 +21,7 @@ module.exports = {
         "eslint-plugin/prefer-output-null": "error",
         "eslint-plugin/prefer-placeholders": "error",
         "eslint-plugin/report-message-format": ["error", "[^a-z].*\\.$"],
+        "eslint-plugin/require-meta-type": "error",
         "eslint-plugin/test-case-property-ordering": "error",
         "eslint-plugin/test-case-shorthand-strings": "error",
         "rulesdir/multiline-comment-style": "error"
diff --git a/lib/rules/block-spacing.js b/lib/rules/block-spacing.js
index 6496f8596..864bfc0c5 100644
--- a/lib/rules/block-spacing.js
+++ b/lib/rules/block-spacing.js
@@ -29,8 +29,8 @@ module.exports = {
         ],
 
         messages: {
-            missing: "Requires a space {{location}} '{{token}}'",
-            extra: "Unexpected space(s) {{location}} '{{token}}'"
+            missing: "Requires a space {{location}} '{{token}}'.",
+            extra: "Unexpected space(s) {{location}} '{{token}}'."
         }
     },
 
diff --git a/lib/rules/capitalized-comments.js b/lib/rules/capitalized-comments.js
index 86427ba7a..7947833b2 100644
--- a/lib/rules/capitalized-comments.js
+++ b/lib/rules/capitalized-comments.js
@@ -137,8 +137,8 @@ module.exports = {
         ],
 
         messages: {
-            unexpectedLowercaseComment: "Comments should not begin with a lowercase character",
-            unexpectedUppercaseComment: "Comments should not begin with an uppercase character"
+            unexpectedLowercaseComment: "Comments should not begin with a lowercase character.",
+            unexpectedUppercaseComment: "Comments should not begin with an uppercase character."
         }
     },
 
diff --git a/lib/rules/func-name-matching.js b/lib/rules/func-name-matching.js
index f14c998dc..5560c6920 100644
--- a/lib/rules/func-name-matching.js
+++ b/lib/rules/func-name-matching.js
@@ -92,10 +92,10 @@ module.exports = {
         },
 
         messages: {
-            matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`",
-            matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`",
-            notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`",
-            notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`"
+            matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`.",
+            matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`.",
+            notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`.",
+            notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`."
         }
     },
 
diff --git a/lib/rules/max-classes-per-file.js b/lib/rules/max-classes-per-file.js
index 3193a731c..ae7be904f 100644
--- a/lib/rules/max-classes-per-file.js
+++ b/lib/rules/max-classes-per-file.js
@@ -32,7 +32,7 @@ module.exports = {
         ],
 
         messages: {
-            maximumExceeded: "Number of classes per file must not exceed {{ max }}"
+            maximumExceeded: "Number of classes per file must not exceed {{ max }}."
         }
     },
     create(context) {
diff --git a/lib/rules/no-param-reassign.js b/lib/rules/no-param-reassign.js
index 243bb6412..349345c14 100644
--- a/lib/rules/no-param-reassign.js
+++ b/lib/rules/no-param-reassign.js
@@ -107,6 +107,14 @@ module.exports = {
 
                         break;
 
+                    // EXCLUDES: e.g. (foo ? a : b).c = bar;
+                    case "ConditionalExpression":
+                        if (parent.test === node) {
+                            return false;
+                        }
+
+                        break;
+
                     // no default
                 }
 
diff --git a/lib/rules/prefer-object-spread.js b/lib/rules/prefer-object-spread.js
index a8dac696b..4d724339d 100644
--- a/lib/rules/prefer-object-spread.js
+++ b/lib/rules/prefer-object-spread.js
@@ -226,8 +226,8 @@ module.exports = {
         fixable: "code",
 
         messages: {
-            useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`",
-            useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`"
+            useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`.",
+            useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`."
         }
     },
 
diff --git a/package.json b/package.json
index bf356703e..9860ef9c6 100644
--- a/package.json
+++ b/package.json
@@ -86,7 +86,7 @@
     "coveralls": "^3.0.1",
     "dateformat": "^3.0.3",
     "ejs": "^2.6.1",
-    "eslint-plugin-eslint-plugin": "^1.4.1",
+    "eslint-plugin-eslint-plugin": "^2.0.1",
     "eslint-plugin-node": "^8.0.0",
     "eslint-plugin-rulesdir": "^0.1.0",
     "eslint-release": "^1.2.0",
diff --git a/tools/internal-rules/consistent-docs-description.js b/tools/internal-rules/consistent-docs-description.js
index b56c641a3..b3ee52241 100644
--- a/tools/internal-rules/consistent-docs-description.js
+++ b/tools/internal-rules/consistent-docs-description.js
@@ -115,7 +115,7 @@ module.exports = {
             category: "Internal",
             recommended: false
         },
-
+        type: "suggestion",
         schema: []
     },
 
diff --git a/tools/internal-rules/consistent-docs-url.js b/tools/internal-rules/consistent-docs-url.js
index 8e6652fc4..4d1344116 100644
--- a/tools/internal-rules/consistent-docs-url.js
+++ b/tools/internal-rules/consistent-docs-url.js
@@ -94,7 +94,7 @@ module.exports = {
             category: "Internal",
             recommended: false
         },
-
+        type: "suggestion",
         schema: []
     },
 
diff --git a/tools/internal-rules/consistent-meta-messages.js b/tools/internal-rules/consistent-meta-messages.js
index 43711c6ec..24facb189 100644
--- a/tools/internal-rules/consistent-meta-messages.js
+++ b/tools/internal-rules/consistent-meta-messages.js
@@ -65,8 +65,9 @@ module.exports = {
             recommended: false
         },
         schema: [],
+        type: "suggestion",
         messages: {
-            expectedMessages: "Expected `meta.messages` property"
+            expectedMessages: "Expected `meta.messages` property."
         }
     },
 
diff --git a/tools/internal-rules/no-invalid-meta.js b/tools/internal-rules/no-invalid-meta.js
index c0a9bc907..973b2a480 100644
--- a/tools/internal-rules/no-invalid-meta.js
+++ b/tools/internal-rules/no-invalid-meta.js
@@ -161,7 +161,7 @@ module.exports = {
             category: "Internal",
             recommended: false
         },
-
+        type: "problem",
         schema: []
     },
 


Test patch:
diff --git a/tests/lib/rules/no-param-reassign.js b/tests/lib/rules/no-param-reassign.js
index 5d009c338..40156f481 100644
--- a/tests/lib/rules/no-param-reassign.js
+++ b/tests/lib/rules/no-param-reassign.js
@@ -32,6 +32,8 @@ ruleTester.run("no-param-reassign", rule, {
         { code: "function foo(a) { bar(a.b).c = 0; }", options: [{ props: true }] },
         { code: "function foo(a) { data[a.b] = 0; }", options: [{ props: true }] },
         { code: "function foo(a) { +a.b; }", options: [{ props: true }] },
+        { code: "function foo(a) { (a ? [] : [])[0] = 1; }", options: [{ props: true }] },
+        { code: "function foo(a) { (a.b ? [] : [])[0] = 1; }", options: [{ props: true }] },
         { code: "function foo(a) { a.b = 0; }", options: [{ props: true, ignorePropertyModificationsFor: ["a"] }] },
         { code: "function foo(a) { ++a.b; }", options: [{ props: true, ignorePropertyModificationsFor: ["a"] }] },
         { code: "function foo(a) { delete a.b; }", options: [{ props: true, ignorePropertyModificationsFor: ["a"] }] },
@@ -87,6 +89,11 @@ ruleTester.run("no-param-reassign", rule, {
             options: [{ props: true }],
             errors: [{ message: "Assignment to property of function parameter 'bar'." }]
         },
+        {
+            code: "function foo(bar) { (bar ? bar : [])[0] = 1; }",
+            options: [{ props: true }],
+            errors: [{ message: "Assignment to property of function parameter 'bar'." }]
+        },
         {
             code: "function foo(bar) { [bar.a] = []; }",
             options: [{ props: true }],