From 44043ea5ec2ad0ccfac2ea7831af44d3b4bf5c07 Mon Sep 17 00:00:00 2001 From: jordanmoore753 Date: Thu, 12 Mar 2020 13:36:49 -0400 Subject: [PATCH] Fix: Replaced explanation of option object; corrected first example for capIsNewExceptionPattern; included additional correct case (fixes #12874) --- docs/rules/new-cap.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/rules/new-cap.md b/docs/rules/new-cap.md index 22ac57729dc..0d4bce69bc0 100644 --- a/docs/rules/new-cap.md +++ b/docs/rules/new-cap.md @@ -33,7 +33,7 @@ function foo(arg) { ## Options -This rule has an object option: +This rule has an object, `option`. This object can be used to define exceptions by property name, object name, or even both at the same time. Here are the properties one can define on the `option` object: * `"newIsCap": true` (default) requires all `new` operators to be called with uppercase-started functions. * `"newIsCap": false` allows `new` operators to be called with lowercase-started or uppercase-started functions. @@ -135,14 +135,21 @@ function foo(arg) { ### capIsNewExceptionPattern -Examples of additional **correct** code for this rule with the `{ "capIsNewExceptionPattern": "^Person\.." }` option: +Examples of additional **correct** code for this rule with the `{ "capIsNewExceptionPattern": "^person\.." }` option: ```js -/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Person\.." }]*/ +/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^person\.." }]*/ var friend = person.Acquaintance(); var bestFriend = person.Friend(); ``` +Examples of additional **correct** code for this rule with the `{ "capIsNewExceptionPattern": "\.Bar$" }` option: + +```js +/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "\.Bar$" }]*/ + +foo.Bar(); // Lint-Free! +``` ### properties