From 1e679fdafbc843d503962e588ae0e22cb159cd8e Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Tue, 9 Apr 2024 17:52:07 +0200 Subject: [PATCH] refactor: typescript 5 + eslint 9 + antfu eslint --- .eslintrc.js | 97 - .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/workflows/pr-title.yml | 2 +- .github/workflows/release-notes.yml | 2 +- .github/workflows/test-nuxt3.yml | 2 +- .github/workflows/test-svelte4.yml | 2 +- .github/workflows/test-vue3.yml | 3 +- .github/workflows/test.yml | 2 +- .stackblitz/codeflow.json | 2 +- .vscode/settings.json | 35 +- CODE_OF_CONDUCT.md | 1 - CONTRIBUTING.md | 1 - README.md | 10 +- docs/.vitepress/theme/index.js | 2 +- .../visual-regression-testing/lost-pixel.md | 4 +- .../visual-regression-testing/percy.md | 1 - docs/examples/vue3/controlled-stories.md | 12 +- docs/examples/vue3/single-stories.md | 1 - docs/examples/vue3/variant-stories.md | 16 +- docs/guide/config.md | 10 +- docs/guide/index.md | 6 +- docs/guide/plugins/development.md | 10 +- docs/guide/svelte3/hierarchy.md | 8 +- docs/guide/svelte3/stories.md | 2 +- docs/guide/vue2/app-setup.md | 4 +- docs/guide/vue2/controls.md | 2 +- docs/guide/vue2/hierarchy.md | 8 +- docs/guide/vue2/stories.md | 4 +- docs/guide/vue2/wrapper.md | 6 +- docs/guide/vue3/app-setup.md | 4 +- docs/guide/vue3/hierarchy.md | 8 +- docs/guide/vue3/stories.md | 4 +- docs/guide/vue3/wrapper.md | 6 +- docs/package.json | 2 +- docs/reference/config.md | 1 - docs/reference/plugin-api.md | 1 - docs/reference/vue3/story.md | 8 +- docs/reference/vue3/variant.md | 7 +- eslint.config.mjs | 25 + .../nuxt3/components/AutoImport.story.vue | 1 - .../nuxt3/components/BaseButton.story.vue | 2 +- examples/nuxt3/components/BaseButtonLink.vue | 25 +- examples/nuxt3/cypress.config.mjs | 2 +- examples/nuxt3/package.json | 2 +- examples/svelte4/cypress.config.mjs | 2 +- examples/svelte4/package.json | 2 +- examples/svelte4/tsconfig.json | 38 +- examples/sveltekit/package.json | 4 +- examples/sveltekit/src/app.d.ts | 12 +- examples/sveltekit/src/hooks.server.ts | 36 +- examples/sveltekit/src/lib/form.ts | 140 +- examples/sveltekit/src/routes/+page.ts | 2 +- examples/sveltekit/src/routes/about/+page.ts | 8 +- .../src/routes/todos/+page.server.ts | 88 +- examples/sveltekit/src/routes/todos/api.ts | 26 +- examples/sveltekit/svelte.config.js | 20 +- examples/sveltekit/tsconfig.json | 30 +- examples/sveltekit/vite.config.ts | 1 - examples/vue2/src/BaseButton.story.vue | 1 - examples/vue2/src/CodeGen.story.vue | 27 +- examples/vue3-percy/package.json | 4 +- examples/vue3-screenshot/package.json | 4 +- examples/vue3-themed/package.json | 2 +- examples/vue3-themed/src/BaseButton.story.vue | 2 +- examples/vue3-themed/src/Serialize.story.vue | 2 +- examples/vue3-vuetify/package.json | 4 +- examples/vue3/cypress-parallel.mjs | 23 +- examples/vue3/cypress.config.mjs | 2 +- examples/vue3/cypress/plugins/index.js | 4 +- examples/vue3/package.json | 4 +- examples/vue3/postcss.config.cjs | 18 +- examples/vue3/src/LongFile1.story.md | 4 +- examples/vue3/src/LongFile2.story.md | 8 +- .../src/components/AutoStateProps.story.vue | 2 +- .../vue3/src/components/BaseButton.story.vue | 2 +- .../vue3/src/components/CodeGen.story.vue | 25 +- .../vue3/src/components/ColorButton.story.vue | 2 +- .../src/components/ComplexParameter.story.vue | 2 +- .../vue3/src/components/ComplexParameter.vue | 6 +- .../vue3/src/components/Controls.story.vue | 2 +- examples/vue3/src/components/Docs.story.vue | 1 - .../vue3/src/components/EventButton.story.vue | 4 +- examples/vue3/src/components/EventButton.vue | 2 +- .../src/components/EventButtonGrid.story.vue | 4 +- .../components/HandWrittenSource.story.vue | 2 +- .../src/components/LottieAnimation.story.vue | 1 + .../vue3/src/components/Serialize.story.vue | 2 +- examples/vue3/src/components/State.story.vue | 4 +- .../vue3/src/components/StateOption.story.vue | 2 +- .../vue3/src/components/StateSetup2.story.vue | 2 +- .../vue3/src/components/WrapperGlobal.vue | 8 +- examples/vue3/tailwind.config.cjs | 1 + examples/vue3/tsconfig.json | 38 +- examples/vue3/vite.config.ts | 6 +- netlify.toml | 10 +- package.json | 26 +- packages/histoire-app/package.json | 6 +- packages/histoire-app/scripts/copy.mjs | 2 +- .../histoire-app/scripts/watchAndCopy.mjs | 8 +- packages/histoire-app/src/app/App.vue | 12 +- packages/histoire-app/src/app/api.ts | 2 +- .../src/app/components/HomeView.vue | 7 +- .../src/app/components/app/AppHeader.vue | 2 +- .../src/app/components/app/AppLogo.vue | 6 +- .../src/app/components/app/Breadcrumb.vue | 8 +- .../src/app/components/app/MobileOverlay.vue | 2 +- .../src/app/components/base/BaseCheckbox.vue | 5 +- .../src/app/components/base/BaseIcon.vue | 4 +- .../components/base/BaseKeyboardShortcut.vue | 2 +- .../src/app/components/base/BaseListItem.vue | 4 +- .../app/components/base/BaseListItemLink.vue | 6 +- .../app/components/base/BaseOverflowMenu.vue | 8 +- .../src/app/components/base/BaseSelect.vue | 9 +- .../src/app/components/base/BaseSplitPane.vue | 34 +- .../app/components/command/CommandPrompts.vue | 11 +- .../command/CommandPromptsModal.vue | 3 +- .../app/components/command/PromptSelect.vue | 10 +- .../src/app/components/command/PromptText.vue | 7 +- .../panel/ControlsComponentPropItem.vue | 2 +- .../panel/ControlsComponentProps.vue | 2 +- .../panel/ControlsComponentState.vue | 2 +- .../src/app/components/panel/PaneTabs.vue | 2 +- .../src/app/components/panel/StatePresets.vue | 23 +- .../app/components/panel/StoryControls.vue | 4 +- .../src/app/components/panel/StoryDocs.vue | 52 +- .../src/app/components/panel/StoryEvent.vue | 4 +- .../src/app/components/panel/StoryEvents.vue | 4 +- .../app/components/panel/StorySourceCode.vue | 16 +- .../src/app/components/search/SearchItem.vue | 7 +- .../components/search/SearchItemContent.vue | 6 +- .../src/app/components/search/SearchModal.vue | 3 +- .../src/app/components/search/SearchPane.vue | 36 +- .../app/components/search/search-docs-data.ts | 4 +- .../components/search/search-title-data.ts | 4 +- .../components/story/GenericMountStory.vue | 2 +- .../components/story/GenericRenderStory.vue | 5 +- .../story/StoryResponsivePreview.vue | 27 +- .../app/components/story/StoryVariantGrid.vue | 17 +- .../components/story/StoryVariantGridItem.vue | 14 +- .../components/story/StoryVariantListItem.vue | 5 +- .../components/story/StoryVariantSingle.vue | 6 +- .../story/StoryVariantSinglePreviewNative.vue | 4 +- .../story/StoryVariantSinglePreviewRemote.vue | 20 +- .../src/app/components/story/StoryView.vue | 8 +- .../src/app/components/story/StoryViewer.vue | 5 +- .../app/components/toolbar/ToolbarNewTab.vue | 2 +- .../src/app/components/tree/StoryGroup.vue | 8 +- .../src/app/components/tree/StoryList.vue | 2 +- .../app/components/tree/StoryListFolder.vue | 8 +- .../src/app/components/tree/StoryListItem.vue | 6 +- packages/histoire-app/src/app/index.ts | 5 +- packages/histoire-app/src/app/plugin.ts | 7 +- packages/histoire-app/src/app/router.ts | 4 +- packages/histoire-app/src/app/sandbox.ts | 23 +- .../histoire-app/src/app/stores/command.ts | 7 +- .../histoire-app/src/app/stores/events.ts | 8 +- .../histoire-app/src/app/stores/folder.ts | 16 +- packages/histoire-app/src/app/stores/story.ts | 8 +- packages/histoire-app/src/app/types.ts | 4 +- .../histoire-app/src/app/util/commands.ts | 9 +- packages/histoire-app/src/app/util/dark.ts | 4 +- packages/histoire-app/src/app/util/docs.ts | 10 +- packages/histoire-app/src/app/util/events.ts | 7 +- .../histoire-app/src/app/util/keyboard.ts | 17 +- packages/histoire-app/src/app/util/mapping.ts | 13 +- .../src/app/util/open-in-editor.ts | 2 +- .../src/app/util/preview-settings.ts | 6 +- packages/histoire-app/src/app/util/sandbox.ts | 5 +- packages/histoire-app/src/app/util/scroll.ts | 9 +- packages/histoire-app/src/app/util/select.ts | 9 +- packages/histoire-app/src/app/util/state.ts | 11 +- packages/histoire-app/src/app/util/tooltip.ts | 4 +- packages/histoire-app/src/app/util/variant.ts | 5 +- packages/histoire-app/src/shim.d.ts | 6 - packages/histoire-app/src/virtual.d.ts | 1 + packages/histoire-app/tailwind.config.cjs | 39 +- packages/histoire-app/tsconfig.json | 52 +- packages/histoire-app/vite.config.ts | 13 +- .../histoire-controls-stories/package.json | 4 +- packages/histoire-controls/package.json | 18 +- .../src/components/HstCopyIcon.vue | 2 +- .../src/components/HstWrapper.vue | 1 - .../src/components/button/HstButton.story.vue | 2 +- .../button/HstButtonGroup.story.vue | 4 +- .../src/components/button/HstButtonGroup.vue | 13 +- .../components/checkbox/HstCheckbox.spec.ts | 6 +- .../components/checkbox/HstCheckbox.story.vue | 2 +- .../src/components/checkbox/HstCheckbox.vue | 4 +- .../checkbox/HstCheckboxList.story.vue | 2 +- .../components/checkbox/HstCheckboxList.vue | 15 +- .../checkbox/HstSimpleCheckbox.story.vue | 2 +- .../components/checkbox/HstSimpleCheckbox.vue | 4 +- .../__snapshots__/HstCheckbox.spec.ts.snap | 4 + .../components/colorselect/HstColorSelect.vue | 5 +- .../design-tokens/HstColorShades.story.vue | 4 +- .../design-tokens/HstColorShades.vue | 4 +- .../design-tokens/HstTokenGrid.story.vue | 12 +- .../design-tokens/HstTokenList.story.vue | 46 +- .../src/components/json/HstJson.story.vue | 2 +- .../src/components/json/HstJson.vue | 27 +- .../src/components/number/HstNumber.story.vue | 2 +- .../src/components/number/HstNumber.vue | 16 +- .../src/components/radio/HstRadio.story.vue | 2 +- .../src/components/radio/HstRadio.vue | 12 +- .../src/components/select/CustomSelect.vue | 16 +- .../src/components/select/HstSelect.story.vue | 2 +- .../src/components/select/HstSelect.vue | 2 +- .../src/components/slider/HstSlider.vue | 6 +- .../src/components/text/HstText.story.vue | 2 +- .../components/textarea/HstTextarea.story.vue | 2 +- .../histoire-controls/tailwind.config.cjs | 2 +- packages/histoire-controls/tsconfig.json | 50 +- packages/histoire-controls/vite.config.ts | 16 +- packages/histoire-plugin-nuxt/package.json | 16 +- .../runtime/app-component.mjs | 2 +- .../runtime/components.mjs | 2 +- .../runtime/composables.mjs | 2 +- packages/histoire-plugin-nuxt/src/index.ts | 18 +- .../src/runtime/app-setup.ts | 16 +- packages/histoire-plugin-nuxt/tsconfig.json | 34 +- packages/histoire-plugin-percy/README.md | 1 - packages/histoire-plugin-percy/package.json | 12 +- packages/histoire-plugin-percy/src/index.ts | 24 +- packages/histoire-plugin-percy/tsconfig.json | 34 +- packages/histoire-plugin-screenshot/README.md | 2 - .../histoire-plugin-screenshot/package.json | 12 +- .../histoire-plugin-screenshot/src/index.ts | 8 +- .../histoire-plugin-screenshot/tsconfig.json | 34 +- packages/histoire-plugin-svelte/package.json | 20 +- .../src/client/index.ts | 2 +- .../src/client/mount.ts | 24 +- .../src/client/render.ts | 36 +- .../histoire-plugin-svelte/src/client/util.ts | 16 +- .../src/collect/index.ts | 11 +- .../src/commands/generate-story.client.ts | 6 +- .../src/commands/generate-story.server.ts | 8 +- .../histoire-plugin-svelte/src/helpers.ts | 4 +- .../histoire-plugin-svelte/src/index.node.ts | 6 +- .../src/util/list-components.ts | 2 +- .../tsconfig.build.json | 6 +- packages/histoire-plugin-svelte/tsconfig.json | 34 +- .../histoire-plugin-svelte/vite.config.ts | 7 +- packages/histoire-plugin-vue/client.d.ts | 1 - packages/histoire-plugin-vue/collect.d.ts | 1 - packages/histoire-plugin-vue/package.json | 14 +- .../src/client/app/MountStory.ts | 28 +- .../src/client/app/RenderStory.ts | 40 +- .../src/client/app/RouterLinkStub.ts | 5 +- .../src/client/app/Story.ts | 19 +- .../src/client/app/Variant.ts | 11 +- .../src/client/app/global-components.ts | 39 +- .../src/client/app/util.ts | 34 +- .../histoire-plugin-vue/src/client/codegen.ts | 126 +- .../src/client/server/Story.ts | 14 +- .../src/client/server/Variant.ts | 8 +- .../src/client/server/run.ts | 13 +- .../src/client/server/stub.ts | 2 +- .../src/commands/generate-story.client.ts | 6 +- .../src/commands/generate-story.server.ts | 8 +- packages/histoire-plugin-vue/src/helpers.ts | 2 +- .../histoire-plugin-vue/src/index.node.ts | 10 +- .../src/util/list-components.ts | 2 +- .../histoire-plugin-vue/tsconfig.build.json | 2 +- packages/histoire-plugin-vue/tsconfig.json | 34 +- packages/histoire-plugin-vue/vite.config.ts | 9 +- packages/histoire-plugin-vue2/package.json | 14 +- .../src/client/app/MountStory.ts | 22 +- .../src/client/app/RenderStory.ts | 42 +- .../src/client/app/RouterLinkStub.ts | 4 +- .../src/client/app/Story.ts | 20 +- .../src/client/app/Variant.ts | 12 +- .../src/client/app/global-components.ts | 39 +- .../src/client/app/util.ts | 34 +- .../src/client/codegen.ts | 90 +- .../src/client/server/Story.ts | 41 +- .../src/client/server/Variant.ts | 8 +- .../src/client/server/run.ts | 13 +- packages/histoire-plugin-vue2/src/index.ts | 6 +- packages/histoire-plugin-vue2/tsconfig.json | 34 +- packages/histoire-plugin-vue2/vite.config.ts | 9 +- packages/histoire-shared/package.json | 14 +- packages/histoire-shared/src/codegen/const.ts | 16 +- .../src/codegen/serialize-js.ts | 54 +- packages/histoire-shared/src/codegen/util.ts | 16 +- packages/histoire-shared/src/state.ts | 18 +- packages/histoire-shared/src/types/command.ts | 2 +- packages/histoire-shared/src/types/config.ts | 2 +- packages/histoire-shared/src/types/plugin.ts | 10 +- packages/histoire-shared/src/types/prompt.ts | 5 +- packages/histoire-shared/tsconfig.json | 42 +- packages/histoire-vendors/floating-vue.d.ts | 1 + packages/histoire-vendors/iconify.d.ts | 1 + packages/histoire-vendors/package.json | 8 +- packages/histoire-vendors/pinia.d.ts | 1 + packages/histoire-vendors/rollup.config.mjs | 10 +- packages/histoire-vendors/scroll.d.ts | 1 + .../src/client/b-floating-vue.ts | 2 + .../histoire-vendors/src/client/b-scroll.ts | 2 + packages/histoire-vendors/tsconfig.json | 34 +- packages/histoire-vendors/vue-router.d.ts | 1 + packages/histoire-vendors/vue-use.d.ts | 1 + packages/histoire-vendors/vue.d.ts | 1 + packages/histoire/client.d.ts | 10 +- packages/histoire/client.js | 4 +- packages/histoire/package.json | 12 +- packages/histoire/plugin.d.ts | 4 +- packages/histoire/plugin.js | 4 +- .../src/node/__tests__/markdown.spec.ts | 20 +- .../histoire/src/node/__tests__/tree.spec.ts | 12 +- packages/histoire/src/node/alias.ts | 2 +- packages/histoire/src/node/bin.ts | 2 +- packages/histoire/src/node/build-serialize.ts | 14 +- packages/histoire/src/node/build.ts | 32 +- .../node/builtin-plugins/pinceau-tokens.ts | 18 +- .../node/builtin-plugins/tailwind-tokens.ts | 17 +- .../vanilla-support/MountStory.ts | 13 +- .../vanilla-support/RenderStory.ts | 19 +- .../builtin-plugins/vanilla-support/client.ts | 2 +- .../vanilla-support/collect.ts | 5 +- .../builtin-plugins/vanilla-support/plugin.ts | 6 +- .../builtin-plugins/vanilla-support/types.ts | 4 +- packages/histoire/src/node/collect/index.ts | 22 +- packages/histoire/src/node/collect/run.ts | 2 +- packages/histoire/src/node/collect/worker.ts | 10 +- packages/histoire/src/node/colors.ts | 10 +- packages/histoire/src/node/commands/build.ts | 2 +- packages/histoire/src/node/commands/dev.ts | 6 +- .../histoire/src/node/commands/preview.ts | 2 +- packages/histoire/src/node/config.ts | 46 +- packages/histoire/src/node/context.ts | 11 +- packages/histoire/src/node/dom/env.ts | 18 +- packages/histoire/src/node/dom/util.ts | 26 +- packages/histoire/src/node/load.ts | 11 +- packages/histoire/src/node/markdown.ts | 38 +- packages/histoire/src/node/plugin.ts | 37 +- packages/histoire/src/node/preview.ts | 10 +- packages/histoire/src/node/search.ts | 18 +- packages/histoire/src/node/server.ts | 25 +- packages/histoire/src/node/stories.ts | 24 +- packages/histoire/src/node/tree.ts | 35 +- packages/histoire/src/node/util/find-up.ts | 4 +- packages/histoire/src/node/util/log.ts | 5 +- packages/histoire/src/node/util/slugify.ts | 4 +- packages/histoire/src/node/util/vendors.ts | 2 +- .../histoire/src/node/virtual/markdown.ts | 2 +- .../src/node/virtual/resolved-commands.ts | 7 +- .../src/node/virtual/resolved-config.ts | 2 +- .../resolved-generated-global-setup.ts | 7 +- .../virtual/resolved-generated-setup-code.ts | 2 +- .../node/virtual/resolved-markdown-files.ts | 2 +- .../src/node/virtual/resolved-stories.ts | 4 +- .../resolved-support-plugins-client.ts | 2 +- .../resolved-support-plugins-collect.ts | 2 +- .../src/node/virtual/resolved-theme.ts | 2 +- .../histoire/src/node/virtual/story-source.ts | 5 +- packages/histoire/src/node/virtual/story.ts | 2 +- .../histoire/src/node/virtual/vite-plugin.ts | 264 +- packages/histoire/src/node/vite.ts | 63 +- packages/histoire/tsconfig.json | 38 +- pnpm-lock.yaml | 2332 +++++++++-------- pnpm-workspace.yaml | 2 +- tailwind.config.cjs | 15 +- 362 files changed, 3629 insertions(+), 3261 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 4d7e7109..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,97 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - }, - extends: [ - 'plugin:vue/vue3-recommended', - '@vue/standard', - '@vue/typescript/recommended', - ], - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 2020, - }, - globals: { - name: 'off', - defineExpose: false, - __HISTOIRE_DEV__: false, - }, - rules: { - 'vue/html-closing-bracket-newline': [ - 'error', - { - singleline: 'never', - multiline: 'always', - }, - ], - 'no-var': ['error'], - '@typescript-eslint/member-delimiter-style': [ - 'error', - { - multiline: { - delimiter: 'none', - }, - singleline: { - delimiter: 'comma', - }, - }, - ], - '@typescript-eslint/ban-ts-comment': 'warn', - '@typescript-eslint/no-use-before-define': 'off', - 'comma-dangle': ['error', 'always-multiline'], - 'vue/no-multiple-template-root': 'off', - indent: 'off', - '@typescript-eslint/indent': ['error', 2], - 'no-use-before-define': 'off', - quotes: ['error', 'single', { allowTemplateLiterals: true }], - 'vue/multi-word-component-names': 'warn', - '@typescript-eslint/type-annotation-spacing': ['error'], - 'func-call-spacing': 'off', - '@typescript-eslint/func-call-spacing': ['error'], - '@typescript-eslint/no-empty-interface': 'off', - }, - overrides: [ - { - files: ['*.vue'], - rules: { - 'import/first': 'off', - }, - globals: { - defineProps: false, - defineEmits: false, - }, - }, - { - files: ['**/cypress/**'], - extends: [ - 'plugin:cypress/recommended', - ], - rules: { - 'cypress/unsafe-to-chain-command': 'off', - }, - }, - { - files: ['packages/histoire-vendors/*.d.ts'], - rules: { - 'import/export': 'off', - }, - }, - { - files: ['packages/histoire-vendors/src/**/*.ts'], - rules: { - 'import/no-named-default': 'off', - }, - }, - ], - ignorePatterns: [ - 'node_modules/', - 'dist/', - 'histoire-dist/', - 'generated/', - '!.*', - '.nuxt/', - '.output/', - 'examples/sveltekit', - ], -} diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 4babd320..07968d7c 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,4 +5,4 @@ contact_links: about: Use GitHub discussions for message-board style questions and discussions. - name: Discord Chat url: https://discord.gg/KpCnT72rJk - about: Ask questions and discuss with other Histoire users in real time. \ No newline at end of file + about: Ask questions and discuss with other Histoire users in real time. diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 4efa9e79..e8d7ba56 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -1,4 +1,4 @@ -name: "Check PR title" +name: Check PR title on: pull_request_target: diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 13aa2f52..a965d944 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -3,7 +3,7 @@ name: Create release on: push: tags: - - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 workflow_dispatch: jobs: diff --git a/.github/workflows/test-nuxt3.yml b/.github/workflows/test-nuxt3.yml index 847bb01d..141000ac 100644 --- a/.github/workflows/test-nuxt3.yml +++ b/.github/workflows/test-nuxt3.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests working-directory: ${{env.dir}} run: pnpm run ci - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test-svelte4.yml b/.github/workflows/test-svelte4.yml index a726d67b..c06732e8 100644 --- a/.github/workflows/test-svelte4.yml +++ b/.github/workflows/test-svelte4.yml @@ -62,7 +62,7 @@ jobs: - name: Run tests working-directory: ${{env.dir}} run: pnpm run ci - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test-vue3.yml b/.github/workflows/test-vue3.yml index 8a857e33..d947433a 100644 --- a/.github/workflows/test-vue3.yml +++ b/.github/workflows/test-vue3.yml @@ -67,7 +67,6 @@ jobs: # ./packages/*/dist # retention-days: 1 - test: runs-on: ubuntu-latest name: Test @@ -128,7 +127,7 @@ jobs: # the number of containers in the job matrix TOTAL_RUNNERS: 5 THIS_RUNNER: ${{ matrix.containers }} - + - uses: actions/upload-artifact@v2 if: failure() with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8de609f4..a2dc6490 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: uses: pnpm/action-setup@v2.2.4 with: version: 8.10.5 - + - name: Get pnpm store directory id: pnpm-cache run: | diff --git a/.stackblitz/codeflow.json b/.stackblitz/codeflow.json index 629d282f..7e7ff5a1 100644 --- a/.stackblitz/codeflow.json +++ b/.stackblitz/codeflow.json @@ -10,4 +10,4 @@ "@histoire/plugin-screenshot": "./packages/historie-plugin-screenshot" } } -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 6bde09ed..5dc87280 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,6 +2,35 @@ "tailwindCSS.experimental.configFile": { "tailwind.config.cjs": "docs/**", "packages/histoire-app/tailwind.config.cjs": "packages/histoire-app/**", - "packages/histoire-controls/tailwind.config.cjs": "packages/histoire-controls/**", - } -} \ No newline at end of file + "packages/histoire-controls/tailwind.config.cjs": "packages/histoire-controls/**" + }, + + // Enable the ESlint flat config support + "eslint.experimental.useFlatConfig": true, + + // Disable the default formatter, use eslint instead + "editor.formatOnSave": false, + + // Auto fix + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml", + "gql", + "graphql" + ] +} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9094add0..b8b53426 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,3 @@ - # Contributor Covenant Code of Conduct ## Our Pledge diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00247b15..ef8cd473 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,7 +150,6 @@ pnpm run test:dev - Make sure tests pass! - - Commit messages must follow the [commit message convention](./.github/commit-convention.md) so that changelogs can be automatically generated. + {{ state }} diff --git a/docs/reference/vue3/variant.md b/docs/reference/vue3/variant.md index c057607a..fe28442e 100644 --- a/docs/reference/vue3/variant.md +++ b/docs/reference/vue3/variant.md @@ -48,10 +48,10 @@ Function that returns the intial state. ```vue @@ -83,7 +83,7 @@ It receives a payload object as parameter with the following properties: ```vue @@ -212,6 +212,7 @@ Props: diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..f1e998ae --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +import antfu from '@antfu/eslint-config' + +export default antfu({ + ignores: [ + '**/histoire-dist/', + '**/generated/', + '**/public/', + '**/.svelte-kit/', + ], +}, { + rules: { + 'curly': ['error', 'multi-line', 'consistent'], + 'antfu/if-newline': 'off', + 'antfu/no-import-dist': 'off', + 'node/prefer-global/process': 'off', + 'no-console': 'warn', + 'ts/no-use-before-define': 'warn', + 'vue/define-macros-order': 'off', // Bugged + }, +}, { + files: ['**/*.vue'], + rules: { + 'import/first': 'off', + }, +}) diff --git a/examples/nuxt3/components/AutoImport.story.vue b/examples/nuxt3/components/AutoImport.story.vue index 063980a3..f1874d95 100644 --- a/examples/nuxt3/components/AutoImport.story.vue +++ b/examples/nuxt3/components/AutoImport.story.vue @@ -1,5 +1,4 @@ + - - diff --git a/packages/histoire-controls/src/components/select/HstSelect.story.vue b/packages/histoire-controls/src/components/select/HstSelect.story.vue index f946a8af..dac2a3fe 100644 --- a/packages/histoire-controls/src/components/select/HstSelect.story.vue +++ b/packages/histoire-controls/src/components/select/HstSelect.story.vue @@ -16,7 +16,7 @@ const objectOptions = Object.keys(options).map(key => ({ const numberOptions = [0, 1, 2, 3, 4, 5] -function initState () { +function initState() { return { label: 'My really long label', select: 'crash-bandicoot', diff --git a/packages/histoire-controls/src/components/select/HstSelect.vue b/packages/histoire-controls/src/components/select/HstSelect.vue index 806d854a..32c806dc 100644 --- a/packages/histoire-controls/src/components/select/HstSelect.vue +++ b/packages/histoire-controls/src/components/select/HstSelect.vue @@ -6,8 +6,8 @@ export default {