-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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: Replace Vue.extend with defineComponent in design system (no-changelog) #5918
feat: Replace Vue.extend with defineComponent in design system (no-changelog) #5918
Conversation
Great PR! Please pay attention to the following items before merging: Files matching
Files matching
Files matching
Files matching
Make sure to check off this list before asking for review. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #5918 +/- ##
==========================================
+ Coverage 17.55% 17.70% +0.15%
==========================================
Files 2498 2520 +22
Lines 114353 114668 +315
Branches 17866 17869 +3
==========================================
+ Hits 20074 20302 +228
- Misses 93687 93771 +84
- Partials 592 595 +3
... and 65 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
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.
typecheck
returns Found 141 errors in 44 files
on this branch but Found 94 errors in 36 files
on master
. Is this expected?
methods: { | ||
onClick(event: MouseEvent) { | ||
onClick(event: MouseEvent): void { |
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.
I wouldn't add it when inferrable.
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.
LGTM! All very minor comments so feel free to ignore.
The increase in typecheck errors is expected due to two reasons
Would it make sense to ignore type errors on spec files temporarily and add
typecheck
to any regular checks we do ondesign-system
? I fixed all the type errors a while ago - it'd be nice to prevent them from accumulating again.
Added a task for fixing errors and adding typecheck to CI, but will likely be done after we update testing-library: https://linear.app/n8n/issue/N8N-6318/fix-design-system-typecheck-issues-and-add-typecheck-to-ci
@@ -30,16 +30,17 @@ | |||
</template> | |||
|
|||
<script lang="ts"> | |||
import 'vue'; | |||
import mixins from 'vue-typed-mixins'; | |||
/* eslint-disable vue/no-unused-components */ |
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.
We're not using ElSelect
and ElOption
though.
@@ -87,7 +86,7 @@ export default mixins(Locale).extend({ | |||
return false; | |||
} | |||
|
|||
if (this.ignoreIds && this.ignoreIds.includes(user.id)) { | |||
if ((this.ignoreIds as string[])?.includes(user.id)) { |
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.
Why is inference not working here? And if we're asserting it's string[]
, then ?
should not be needed.
@@ -1,4 +1,4 @@ | |||
import Vue from 'vue'; | |||
import { PluginObject } from 'vue'; |
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.
import { PluginObject } from 'vue'; | |
import type { PluginObject } from 'vue'; |
@@ -97,4 +97,4 @@ export default { | |||
app.component('n8n-resize-wrapper', N8nResizeWrapper); | |||
app.component('n8n-recycle-scroller', N8nRecycleScroller); | |||
}, | |||
}; | |||
} as PluginObject<{}>; |
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.
Can we type this instead of asserting?
@@ -0,0 +1,4 @@ | |||
declare module 'markdown-it-task-lists' { | |||
import { PluginSimple } from 'markdown-it'; |
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.
import { PluginSimple } from 'markdown-it'; | |
import type { PluginSimple } from 'markdown-it'; |
default() { | ||
return [[]]; | ||
}, | ||
default: () => [[]], |
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.
- Re: this comment,
FormBox
,UserSelect
,DraggableTarget
,ResourceLocator
still use method syntax for array default. - Maybe we should update all the
type: Array
with a prop type assertion. Or later if too many.
The increase in
I've gone through most of the non-spec files and fixed the types. Can you check the changes out? |
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.
LGTM! All very minor comments so feel free to ignore.
The increase in typecheck errors is expected due to two reasons
Would it make sense to ignore type errors on spec files temporarily and add typecheck
to any regular checks we do on design-system
? I fixed all the type errors a while ago - it'd be nice to prevent them from accumulating again.
@@ -56,7 +56,7 @@ import { Menu as ElMenu } from 'element-ui'; | |||
import N8nMenuItem from '../N8nMenuItem'; | |||
|
|||
import { defineComponent, PropType } from 'vue'; | |||
import { IMenuItem } from '../../types'; | |||
import { IMenuItem, RouteObject } from '../../types'; |
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.
type import
@@ -74,7 +74,7 @@ | |||
import { Submenu as ElSubmenu, MenuItem as ElMenuItem } from 'element-ui'; | |||
import N8nTooltip from '../N8nTooltip'; | |||
import N8nIcon from '../N8nIcon'; | |||
import { IMenuItem } from '../../types'; | |||
import { IMenuItem, RouteObject } from '../../types'; |
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.
type import
import { defineComponent } from 'vue'; | ||
import { defineComponent, PropType } from 'vue'; | ||
|
||
export interface IRadioOption { |
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.
I think we want to move away from the I-
prefix.
required: true, | ||
}, | ||
}, | ||
created() { | ||
const setColors = () => { | ||
(this.colors as string[]).forEach((color: string) => { | ||
this.colors.forEach((color: string) => { |
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.
string
is inferrable here
}, | ||
}, | ||
created() { | ||
const setValues = () => { | ||
(this.variables as string[]).forEach((variable: string) => { | ||
this.variables.forEach((variable: string) => { |
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.
string
is inferrable here
FYI to automate type imports: #5951 |
✅ All Cypress E2E specs passed |
* master: (62 commits) fix(editor): Redirect to home page after saving data on SAML onboarding page (no-changelog) (#5961) feat: Replace Vue.extend with defineComponent in design system (no-changelog) (#5918) feat(MySQL Node): Overhaul fix(OpenAI Node): Update models to only show those supported (#5805) ci: Add test for wait node (no-changelog) (#5414) fix(Github Trigger Node): Remove content_reference event (#5830) ci: Validate load options methods in nodes-base (no-changelog) (#5862) ci: Use `--chown=node:node` in COPY commands in the custom docker image (no-changelog) (#5913) 🚀 Release 0.224.0 (#5957) fix(NocoDB Node): Fix for updating or deleting rows with not default primary keys fix(HTTP Request Node): Show detailed error message in the UI again (#5959) ci: Prevent skipping of E2E fail job (no-changelog) (#5958) ci: Fix E2E tests on master (no-changelog) (#5960) refactor(core): Use injectable classes for db repositories (part-1) (no-changelog) (#5953) fix(core): Validate customData keys and values (#5920) (no-changelog) feat(editor): Add user activation survey (#5677) fix(editor): Update vite legacy-plugin browser target (no-changelog) (#5952) docs: Fix typo in AWS S3 and S3 nodes for parent folder key (#5933) fix(core): Update xml2js to address CVE-2023-0842 (#5948) fix(Code Node): Update vm2 to address CVE-2023-29017 (#5947) ... # Conflicts: # packages/workflow/src/Interfaces.ts
…rce-mapper-ui * feature/resource-mapping-component: (62 commits) fix(editor): Redirect to home page after saving data on SAML onboarding page (no-changelog) (#5961) feat: Replace Vue.extend with defineComponent in design system (no-changelog) (#5918) feat(MySQL Node): Overhaul fix(OpenAI Node): Update models to only show those supported (#5805) ci: Add test for wait node (no-changelog) (#5414) fix(Github Trigger Node): Remove content_reference event (#5830) ci: Validate load options methods in nodes-base (no-changelog) (#5862) ci: Use `--chown=node:node` in COPY commands in the custom docker image (no-changelog) (#5913) 🚀 Release 0.224.0 (#5957) fix(NocoDB Node): Fix for updating or deleting rows with not default primary keys fix(HTTP Request Node): Show detailed error message in the UI again (#5959) ci: Prevent skipping of E2E fail job (no-changelog) (#5958) ci: Fix E2E tests on master (no-changelog) (#5960) refactor(core): Use injectable classes for db repositories (part-1) (no-changelog) (#5953) fix(core): Validate customData keys and values (#5920) (no-changelog) feat(editor): Add user activation survey (#5677) fix(editor): Update vite legacy-plugin browser target (no-changelog) (#5952) docs: Fix typo in AWS S3 and S3 nodes for parent folder key (#5933) fix(core): Update xml2js to address CVE-2023-0842 (#5948) fix(Code Node): Update vm2 to address CVE-2023-29017 (#5947) ... # Conflicts: # packages/workflow/src/Interfaces.ts
…angelog) (n8n-io#5918) * refactor: replace new Vue() with custom event bus (no-changelog) * fix: export types from design system main * fix: update component types * fix: update form inputs event bus * refactor: replace global Vue references in design-system * refactor: update prop types * feat: improve types * fix: further type improvements * fix: further types improvements * fix: further type improvements * test: fix test snapshots * test: fix snapshot * chore: fix linting issues * test: fix personalization modal snapshot
Github issue / Community forum post (link here to close automatically):