Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: fix and add more examples for new-cap rule (fixes #12874) #14725

Merged
merged 5 commits into from Jun 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions docs/rules/new-cap.md
Expand Up @@ -135,15 +135,31 @@ 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();
mdjermanovic marked this conversation as resolved.
Show resolved Hide resolved
```

Examples of additional **correct** code for this rule with the `{ "capIsNewExceptionPattern": "^Foo" }` option:

```js
/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "^Foo" }]*/

var x = Foo(42)
snitin315 marked this conversation as resolved.
Show resolved Hide resolved
```

### properties

Examples of **incorrect** code for this rule with the default `{ "properties": true }` option:
Expand Down