-
Notifications
You must be signed in to change notification settings - Fork 116
refactor: fix eslint warnings in .vue files #1036
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
Conversation
2e845c1 to
2d506c6
Compare
|
Added lang="ts" to some more components. There are 17 errors left. Most are lang="ts", but adding lang="ts" obviously makes that one error turn into seven. |
df83867 to
010a2dd
Compare
| const page = ref({}); | ||
| const page = ref<CmsPage | null>(null); | ||
| // eslint-disable-next-line consistent-return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still required? maybe add return value instead of suppressing linter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://nuxtjs.org/docs/directory-structure/middleware/#named-middleware
Given the example above I don't think there's anything to return. If I add just return the linter will complain about "useless return"
packages/theme/pages/Page.vue
Outdated
| // eslint-disable-next-line prefer-destructuring | ||
| const page : CmsPage = this.page; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // eslint-disable-next-line prefer-destructuring | |
| const page : CmsPage = this.page; | |
| const { page }: CmsPage = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, there is something wrong with this type if you destruct the value, is the page really CmsPage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoided destructuring with type assertion by using a solution from nuxt/typescript (link in commit message)
f182734 (#1036)
010a2dd to
f182734
Compare
Continued fixes of eslint, but this time in .vue files.
Turned out that a huge amount of .vue errors were in a file that contained some SVG tags.
AFter this PR, there are 30 errors left - most are about missing lang="ts"