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

feat(no-this-in-before-router-enter): create rule #1506

Conversation

przemyslawjanpietrzak
Copy link
Contributor

@przemyslawjanpietrzak przemyslawjanpietrzak commented Jun 2, 2021

close #1417

@przemyslawjanpietrzak przemyslawjanpietrzak force-pushed the feat/no-this-in-before-route-enter branch 5 times, most recently from c283697 to 683c70a Compare June 2, 2021 20:27
@przemyslawjanpietrzak przemyslawjanpietrzak marked this pull request as ready for review June 2, 2021 20:37
## Rule Details

Bad:
```js
Copy link
Member

Choose a reason for hiding this comment

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

Should be html or vue.


## Rule Details

Bad:
Copy link
Member

Choose a reason for hiding this comment

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

Use <eslint-code-block> like any other docs to build your docs for online demos. You can try it locally with the npm run docs:watch command.

> This rule prevents usage this in the "beforeRouteEnter" because this is undefined there. https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards

## Rule Details

Copy link
Member

@ota-meshi ota-meshi Jun 3, 2021

Choose a reason for hiding this comment

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

Could you write a description of the rule here? Documents should automatically update their headers and footers with the npm run update command.

docs/rules/no-this-in-before-route-enter.md Outdated Show resolved Hide resolved
Comment on lines 57 to 60
## When Not To Use It

Give a short description of when it would be appropriate to turn off this rule.

Copy link
Member

Choose a reason for hiding this comment

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

If there is no content, delete it.

Suggested change
## When Not To Use It
Give a short description of when it would be appropriate to turn off this rule.

filename: 'ValidComponent.vue',
errors: [
{
message: rule.errorMessage
Copy link
Member

Choose a reason for hiding this comment

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

Would you test the location of the error, including line and column? Also, test the message as text.

przemyslawjanpietrzak and others added 6 commits June 4, 2021 12:14
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
Update lib/rules/no-this-in-before-route-enter.js

Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>

Update docs/rules/no-this-in-before-route-enter.md

Co-authored-by: Yosuke Ota <otameshiyo23@gmail.com>
…yslawjanpietrzak/eslint-plugin-vue into feat/no-this-in-before-route-enter
@przemyslawjanpietrzak
Copy link
Contributor Author

@ota-meshi I applied all of your suggestions. Thanks a lot for for it, it is my first PR so it was very helpful.

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your contribution!
I would like to include this rule in the next release.

@ota-meshi ota-meshi merged commit 76f835a into vuejs:master Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule for this usage in beforeRouteEnter
2 participants