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

Fix: Replaced explanation of option object; corrected first example f… #13037

Closed
wants to merge 1 commit into from
Closed

Fix: Replaced explanation of option object; corrected first example f… #13037

wants to merge 1 commit into from

Conversation

jordanmoore753
Copy link

@jordanmoore753 jordanmoore753 commented Mar 12, 2020

…or capIsNewExceptionPattern; included additional correct case (fixes #12874)

Prerequisites checklist

  • [X ] I have read the contributing guidelines.
  • The team has reached consensus on the changes proposed in this pull request. If not, I understand that the evaluation process will begin with this pull request and won't be merged until the team has reached consensus.

What is the purpose of this pull request? (put an "X" next to an item)

[X ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

I corrected the first correct example for the capIsNewExceptionPattern section, in addition to adding a second correct example. I also updated the Options section at the top with a more descriptive summary of what the option object can be used for.

Is there anything you'd like reviewers to focus on?

…or capIsNewExceptionPattern; included additional correct case (fixes #12874)
@jsf-clabot
Copy link

jsf-clabot commented Mar 12, 2020

CLA assistant check
All committers have signed the CLA.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Mar 12, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Mar 18, 2020
Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I left a couple of notes.

@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule has an object option

I think the previous version was correct. "object option" means that the option is an object. In some other rules options are strings, numbers, etc..

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

This might be confusing at this point because this rule doesn't apply only to member expressions (object.property). It also works with "simple" function/constructor calls where it's on an identifier, e.g., f() or new C().

Maybe we should revert this here, and provide a similar explanation in the ### capIsNewExceptionPattern section.


var friend = person.Acquaintance();
var bestFriend = person.Friend();
```
Examples of additional **correct** code for this rule with the `{ "capIsNewExceptionPattern": "\.Bar$" }` option:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a blank line after ```, this produces the linting error.

@@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

```js
/*eslint new-cap: ["error", { "capIsNewExceptionPattern": "\.Bar$" }]*/

foo.Bar(); // Lint-Free!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for // Lint-Free!, this is already an example of correct code.

Also, can we please add a similar example for newIsCapExceptionPattern?

@nzakas
Copy link
Member

nzakas commented Mar 31, 2020

@jordanmoore753 are you still working on this?

@jordanmoore753
Copy link
Author

Hi @nzakas! Yes I'm still on this, sorry for the delay. I've had a lot of work lately and haven't had the chance to address this. I'll work on it this week.

@nzakas
Copy link
Member

nzakas commented Apr 1, 2020

No worries, the world is crazy at the moment. Just didn’t want to hand this off if you were still going to work on it.

@nzakas
Copy link
Member

nzakas commented Jun 11, 2020

@jordanmoore753 just one more check to see if you're still working on this. We completely understand if you can't finish this up, we'd just like to know if we should get someone else to finish this up. Thanks!

@mdjermanovic
Copy link
Member

Closing due to inactivity and in favor of #14725.

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 20, 2021
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion documentation Relates to ESLint's documentation rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

new cap: option capIsNewExceptionPattern is not behaving as documented
4 participants