From 55c201eb21e3d50c76386994e3d4602a0414ae55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 25 Nov 2022 10:51:51 +0100 Subject: [PATCH] refactor: Improve typings for element-ui imports (no-changelog) (#4678) * convert all stories to typescript * stricter typing for element-ui imports --- packages/design-system/.eslintrc.js | 4 +- packages/design-system/.gitignore | 1 + packages/design-system/.storybook/main.js | 2 +- packages/design-system/.storybook/preview.js | 6 ++ packages/design-system/package.json | 2 +- .../N8nActionDropdown/ActionDropdown.vue | 16 +++-- ...gle.stories.js => ActionToggle.stories.ts} | 0 .../N8nActionToggle/ActionToggle.vue | 25 ++++--- .../{Avatar.stories.js => Avatar.stories.ts} | 0 .../{Badge.stories.js => Badge.stories.ts} | 0 ...{BlockUi.stories.js => BlockUi.stories.ts} | 0 .../src/components/N8nCheckbox/Checkbox.vue | 4 +- ...{FormBox.stories.js => FormBox.stories.ts} | 0 ...mInput.stories.js => FormInput.stories.ts} | 0 ...nputs.stories.js => FormInputs.stories.ts} | 0 ...{Heading.stories.js => Heading.stories.ts} | 0 .../{Icon.stories.js => Icon.stories.ts} | 0 .../src/components/N8nInput/Input.vue | 4 +- ...Label.stories.js => InputLabel.stories.ts} | 0 ...mber.stories.js => InputNumber.stories.ts} | 0 .../components/N8nInputNumber/InputNumber.vue | 7 +- .../{Link.stories.js => Link.stories.ts} | 0 ...{Loading.stories.js => Loading.stories.ts} | 0 .../src/components/N8nLoading/Loading.vue | 7 +- ...arkdown.stories.js => Markdown.stories.ts} | 0 .../src/components/N8nMenu/Menu.vue | 4 +- .../N8nMenuItem/MenuItem.stories.ts | 4 +- .../src/components/N8nMenuItem/MenuItem.vue | 7 +- .../src/components/N8nOption/Option.vue | 7 +- ...{Popover.stories.js => Popover.stories.ts} | 0 .../src/components/N8nPopover/Popover.vue | 7 +- ...ons.stories.js => RadioButtons.stories.ts} | 0 ...er.stories.js => ResizeWrapper.stories.ts} | 0 .../src/components/N8nSelect/Select.vue | 4 +- ...{Spinner.stories.js => Spinner.stories.ts} | 0 .../{Sticky.stories.js => Sticky.stories.ts} | 0 .../{Tabs.stories.js => Tabs.stories.ts} | 0 .../N8nTag/{Tag.stories.js => Tag.stories.ts} | 0 .../{Tags.stories.js => Tags.stories.ts} | 0 .../{Text.stories.js => Text.stories.ts} | 0 ...{Tooltip.stories.js => Tooltip.stories.ts} | 0 .../src/components/N8nTooltip/Tooltip.vue | 4 +- ...serInfo.stories.js => UserInfo.stories.ts} | 0 ...elect.stories.js => UserSelect.stories.ts} | 0 .../components/N8nUserSelect/UserSelect.vue | 9 ++- ...rsList.stories.js => UsersList.stories.ts} | 0 packages/design-system/src/main.js | 16 +---- .../src/plugins/elementUIComponents.ts | 65 ------------------- .../design-system/src/shims-element-ui.d.ts | 41 ------------ .../ExecutionsView/ExecutionPreview.vue | 3 +- packages/editor-ui/src/plugins/components.ts | 9 +-- packages/editor-ui/src/shims-element-ui.d.ts | 41 ------------ pnpm-lock.yaml | 8 +-- 53 files changed, 75 insertions(+), 232 deletions(-) rename packages/design-system/src/components/N8nActionToggle/{ActionToggle.stories.js => ActionToggle.stories.ts} (100%) rename packages/design-system/src/components/N8nAvatar/{Avatar.stories.js => Avatar.stories.ts} (100%) rename packages/design-system/src/components/N8nBadge/{Badge.stories.js => Badge.stories.ts} (100%) rename packages/design-system/src/components/N8nBlockUi/{BlockUi.stories.js => BlockUi.stories.ts} (100%) rename packages/design-system/src/components/N8nFormBox/{FormBox.stories.js => FormBox.stories.ts} (100%) rename packages/design-system/src/components/N8nFormInput/{FormInput.stories.js => FormInput.stories.ts} (100%) rename packages/design-system/src/components/N8nFormInputs/{FormInputs.stories.js => FormInputs.stories.ts} (100%) rename packages/design-system/src/components/N8nHeading/{Heading.stories.js => Heading.stories.ts} (100%) rename packages/design-system/src/components/N8nIcon/{Icon.stories.js => Icon.stories.ts} (100%) rename packages/design-system/src/components/N8nInputLabel/{InputLabel.stories.js => InputLabel.stories.ts} (100%) rename packages/design-system/src/components/N8nInputNumber/{InputNumber.stories.js => InputNumber.stories.ts} (100%) rename packages/design-system/src/components/N8nLink/{Link.stories.js => Link.stories.ts} (100%) rename packages/design-system/src/components/N8nLoading/{Loading.stories.js => Loading.stories.ts} (100%) rename packages/design-system/src/components/N8nMarkdown/{Markdown.stories.js => Markdown.stories.ts} (100%) rename packages/design-system/src/components/N8nPopover/{Popover.stories.js => Popover.stories.ts} (100%) rename packages/design-system/src/components/N8nRadioButtons/{RadioButtons.stories.js => RadioButtons.stories.ts} (100%) rename packages/design-system/src/components/N8nResizeWrapper/{ResizeWrapper.stories.js => ResizeWrapper.stories.ts} (100%) rename packages/design-system/src/components/N8nSpinner/{Spinner.stories.js => Spinner.stories.ts} (100%) rename packages/design-system/src/components/N8nSticky/{Sticky.stories.js => Sticky.stories.ts} (100%) rename packages/design-system/src/components/N8nTabs/{Tabs.stories.js => Tabs.stories.ts} (100%) rename packages/design-system/src/components/N8nTag/{Tag.stories.js => Tag.stories.ts} (100%) rename packages/design-system/src/components/N8nTags/{Tags.stories.js => Tags.stories.ts} (100%) rename packages/design-system/src/components/N8nText/{Text.stories.js => Text.stories.ts} (100%) rename packages/design-system/src/components/N8nTooltip/{Tooltip.stories.js => Tooltip.stories.ts} (100%) rename packages/design-system/src/components/N8nUserInfo/{UserInfo.stories.js => UserInfo.stories.ts} (100%) rename packages/design-system/src/components/N8nUserSelect/{UserSelect.stories.js => UserSelect.stories.ts} (100%) rename packages/design-system/src/components/N8nUsersList/{UsersList.stories.js => UsersList.stories.ts} (100%) delete mode 100644 packages/design-system/src/plugins/elementUIComponents.ts delete mode 100644 packages/design-system/src/shims-element-ui.d.ts delete mode 100644 packages/editor-ui/src/shims-element-ui.d.ts diff --git a/packages/design-system/.eslintrc.js b/packages/design-system/.eslintrc.js index 59cd103069..99933f5d65 100644 --- a/packages/design-system/.eslintrc.js +++ b/packages/design-system/.eslintrc.js @@ -24,13 +24,13 @@ module.exports = { overrides: [ { - files: ['src/**/*.stories.{js,ts}'], + files: ['src/**/*.stories.ts'], rules: { 'import/no-extraneous-dependencies': ['error', { devDependencies: true }], }, }, { - files: ['src/**/*.stories.{js,ts}', 'src/**/*.vue', 'src/**/*.spec.ts'], + files: ['src/**/*.stories.ts', 'src/**/*.vue', 'src/**/*.spec.ts'], rules: { '@typescript-eslint/naming-convention': [ 'warn', diff --git a/packages/design-system/.gitignore b/packages/design-system/.gitignore index 8db271232f..728ede7e79 100644 --- a/packages/design-system/.gitignore +++ b/packages/design-system/.gitignore @@ -1,2 +1,3 @@ coverage storybook-static +**/*.stories.js diff --git a/packages/design-system/.storybook/main.js b/packages/design-system/.storybook/main.js index e4413680bc..f11d0b2cd9 100644 --- a/packages/design-system/.storybook/main.js +++ b/packages/design-system/.storybook/main.js @@ -4,7 +4,7 @@ const path = require('path'); * @type {import('@storybook/core-common').StorybookConfig} */ module.exports = { - stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|ts)'], + stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.ts'], addons: [ '@storybook/addon-links', '@storybook/addon-essentials', diff --git a/packages/design-system/.storybook/preview.js b/packages/design-system/.storybook/preview.js index 3c85a33dba..be5e60d537 100644 --- a/packages/design-system/.storybook/preview.js +++ b/packages/design-system/.storybook/preview.js @@ -1,11 +1,17 @@ import './font-awesome-icons'; import './storybook.scss'; +import ElementUI from 'element-ui'; import lang from 'element-ui/lib/locale/lang/en'; import locale from 'element-ui/lib/locale'; +import designSystemComponents from '../src/plugins/n8nComponents'; + import Vue from 'vue'; +Vue.use(ElementUI); +Vue.use(designSystemComponents); + locale.use(lang); // https://github.com/storybookjs/storybook/issues/6153 diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 5e2af41df2..39eee7b272 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -74,7 +74,7 @@ "webpack": "^4.46.0" }, "dependencies": { - "element-ui": "~2.15.7", + "element-ui": "~2.15.12", "sanitize-html": "2.7.0", "vue2-boring-avatars": "0.3.4" } diff --git a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue index 6dd046009f..b87ea83b1c 100644 --- a/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue +++ b/packages/design-system/src/components/N8nActionDropdown/ActionDropdown.vue @@ -26,7 +26,7 @@ }" > - + {{ item.label }} @@ -41,9 +41,11 @@ diff --git a/packages/design-system/src/components/N8nLink/Link.stories.js b/packages/design-system/src/components/N8nLink/Link.stories.ts similarity index 100% rename from packages/design-system/src/components/N8nLink/Link.stories.js rename to packages/design-system/src/components/N8nLink/Link.stories.ts diff --git a/packages/design-system/src/components/N8nLoading/Loading.stories.js b/packages/design-system/src/components/N8nLoading/Loading.stories.ts similarity index 100% rename from packages/design-system/src/components/N8nLoading/Loading.stories.js rename to packages/design-system/src/components/N8nLoading/Loading.stories.ts diff --git a/packages/design-system/src/components/N8nLoading/Loading.vue b/packages/design-system/src/components/N8nLoading/Loading.vue index 0821dba20a..57625b2f00 100644 --- a/packages/design-system/src/components/N8nLoading/Loading.vue +++ b/packages/design-system/src/components/N8nLoading/Loading.vue @@ -36,16 +36,15 @@ diff --git a/packages/design-system/src/components/N8nPopover/Popover.stories.js b/packages/design-system/src/components/N8nPopover/Popover.stories.ts similarity index 100% rename from packages/design-system/src/components/N8nPopover/Popover.stories.js rename to packages/design-system/src/components/N8nPopover/Popover.stories.ts diff --git a/packages/design-system/src/components/N8nPopover/Popover.vue b/packages/design-system/src/components/N8nPopover/Popover.vue index 77f598f250..b85cad06e7 100644 --- a/packages/design-system/src/components/N8nPopover/Popover.vue +++ b/packages/design-system/src/components/N8nPopover/Popover.vue @@ -1,7 +1,4 @@ diff --git a/packages/design-system/src/components/N8nRadioButtons/RadioButtons.stories.js b/packages/design-system/src/components/N8nRadioButtons/RadioButtons.stories.ts similarity index 100% rename from packages/design-system/src/components/N8nRadioButtons/RadioButtons.stories.js rename to packages/design-system/src/components/N8nRadioButtons/RadioButtons.stories.ts diff --git a/packages/design-system/src/components/N8nResizeWrapper/ResizeWrapper.stories.js b/packages/design-system/src/components/N8nResizeWrapper/ResizeWrapper.stories.ts similarity index 100% rename from packages/design-system/src/components/N8nResizeWrapper/ResizeWrapper.stories.js rename to packages/design-system/src/components/N8nResizeWrapper/ResizeWrapper.stories.ts diff --git a/packages/design-system/src/components/N8nSelect/Select.vue b/packages/design-system/src/components/N8nSelect/Select.vue index fd94a816f3..b8fd63924e 100644 --- a/packages/design-system/src/components/N8nSelect/Select.vue +++ b/packages/design-system/src/components/N8nSelect/Select.vue @@ -32,7 +32,7 @@