From b0af5647e2b84ab3f03a916ff57773572fa79e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ya=C3=ABl=20Guilloux?= Date: Tue, 28 May 2024 02:33:52 +0200 Subject: [PATCH] feat(repo): move to antfu eslint config ; fix all errors ; cleanup --- .eslintignore | 3 - .eslintrc | 55 - .github/ISSUE_TEMPLATE/bug-report.yml | 4 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/reproduire/needs-reproduction.md | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/reproduire-close.yml | 6 +- .github/workflows/reproduire.yml | 2 +- .github/workflows/targets.yml | 2 +- docs/components/content/Hero.vue | 4 +- docs/components/content/PresetSection.vue | 12 +- .../content/examples/MotionComponent.vue | 8 +- .../content/examples/MotionGroupComponent.vue | 4 +- eslint.config.js | 26 + netlify.toml | 16 +- package.json | 29 +- playgrounds/vite-ssg/package.json | 8 +- playgrounds/vite/package.json | 10 +- playgrounds/vite/src/App.vue | 16 +- playgrounds/vite/src/components/CodeBlock.vue | 8 +- playgrounds/vite/src/components/DemoBox.vue | 4 +- playgrounds/vite/src/demos/Editor.vue | 2 +- playgrounds/vite/src/demos/Sandbox.vue | 2 +- playgrounds/vite/src/demos/Transitions.vue | 4 +- pnpm-lock.yaml | 1020 +---------------- pnpm-workspace.yaml | 8 +- src/directive/index.ts | 21 +- src/features/eventListeners.ts | 24 +- src/features/lifeCycleHooks.ts | 6 +- src/features/syncVariants.ts | 3 +- src/features/visibilityHooks.ts | 12 +- src/motionValue.ts | 13 +- src/nuxt/module.ts | 6 +- src/nuxt/runtime/templates/motion.d.ts | 5 +- src/nuxt/runtime/templates/motion.ts | 4 +- src/reactiveTransform.ts | 6 +- src/types/transitions.ts | 4 +- src/useElementStyle.ts | 6 +- src/useElementTransform.ts | 9 +- src/useMotionControls.ts | 26 +- src/useMotionFeatures.ts | 16 +- src/useMotionProperties.ts | 3 +- src/useMotionValues.ts | 14 +- src/useMotionVariants.ts | 7 +- src/usePermissiveTarget.ts | 3 +- src/useReducedMotion.ts | 2 - src/useSpring.ts | 2 +- src/utils/component.ts | 15 +- src/utils/defaults.ts | 3 +- src/utils/directive.ts | 13 +- src/utils/element.ts | 3 +- src/utils/slugify.ts | 12 +- src/utils/style.ts | 5 +- src/utils/subscription-manager.ts | 3 +- src/utils/transform-parser.ts | 18 +- src/utils/transform.ts | 6 +- src/utils/transition.ts | 66 +- tests/components.spec.ts | 8 +- tests/utils/index.ts | 3 +- tsconfig.json | 34 +- 60 files changed, 336 insertions(+), 1304 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index ecfda12f..00000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -coverage/ -dist/ -templates/ diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index ed44879a..00000000 --- a/.eslintrc +++ /dev/null @@ -1,55 +0,0 @@ -{ - "root": true, - "env": { - "browser": true, - "node": true - }, - "ignorePatterns": [ - "dist/**/*", - ".output/**/*", - ".nuxt/**/*", - "*.css", - "*.md" - ], - "extends": [ - "@nuxtjs/eslint-config-typescript", - "@antfu", - "plugin:prettier-vue/recommended", - "prettier" - ], - "settings": { - "import/ignore": [ - "vue" - ] - }, - "rules": { - "semi": "error", - "antfu/if-newline": 0, - "vue/static-class-names-order": "off", - "vue/multi-word-component-names": "off", - "vue/require-component-is": "off", - "vue/no-multiple-template-root": "off", - "vue/no-v-text-v-html-on-component": "off", - "@typescript-eslint/no-unused-vars": [ - "off" - ], - "@typescript-eslint/semi": [ - "error" - ], - "@typescript-eslint/comma-dangle": [ - "error" - ], - "comma-dangle": "error", - "no-unused-vars": 0, - "prettier-vue/prettier": [ - "error", - { - "printWidth": 180, - "semi": false, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "all" - } - ] - } -} diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 970fb0a8..818d5bc6 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,6 +1,6 @@ -name: "\U0001F41E Bug report" +name: 🐞 Bug report description: Report an issue with @vueuse/motion -labels: ['pending triage'] +labels: [pending triage] body: - type: textarea id: bug-env diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 917041d3..e18bc2f6 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -29,4 +29,4 @@ - [ ] I have linked an issue or discussion. - [ ] I have added tests (if possible). -- [ ] I have updated the documentation accordingly. \ No newline at end of file +- [ ] I have updated the documentation accordingly. diff --git a/.github/reproduire/needs-reproduction.md b/.github/reproduire/needs-reproduction.md index 023e403a..c8ada541 100644 --- a/.github/reproduire/needs-reproduction.md +++ b/.github/reproduire/needs-reproduction.md @@ -24,4 +24,4 @@ You might also find these other articles interesting and/or helpful: - [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required) - [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/minimal-reproducible-example) - \ No newline at end of file + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58088072..6c8d2448 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: with: node-version: ${{ matrix.node }} registry-url: https://registry.npmjs.org/ - cache: "pnpm" + cache: pnpm - name: Install dependencies run: pnpm install diff --git a/.github/workflows/reproduire-close.yml b/.github/workflows/reproduire-close.yml index d6e88991..8449e60f 100644 --- a/.github/workflows/reproduire-close.yml +++ b/.github/workflows/reproduire-close.yml @@ -14,11 +14,11 @@ jobs: - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0 with: days-before-stale: -1 # Issues and PR will never be flagged stale automatically. - stale-issue-label: 'needs reproduction' # Label that flags an issue as stale. - only-labels: 'needs reproduction' # Only process these issues + stale-issue-label: needs reproduction # Label that flags an issue as stale. + only-labels: needs reproduction # Only process these issues days-before-issue-close: 7 ignore-updates: true remove-stale-when-updated: false close-issue-message: This issue was closed because it was open for 7 days without a reproduction. close-issue-label: closed by bot - operations-per-run: 300 #default 30 \ No newline at end of file + operations-per-run: 300 # default 30 diff --git a/.github/workflows/reproduire.yml b/.github/workflows/reproduire.yml index 022fd8a9..fd7895b4 100644 --- a/.github/workflows/reproduire.yml +++ b/.github/workflows/reproduire.yml @@ -13,4 +13,4 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - uses: Hebilicious/reproduire@4b686ae9cbb72dad60f001d278b6e3b2ce40a9ac # v0.0.9-mp with: - label: needs reproduction \ No newline at end of file + label: needs reproduction diff --git a/.github/workflows/targets.yml b/.github/workflows/targets.yml index 4dbc70b9..5a4f0b9f 100644 --- a/.github/workflows/targets.yml +++ b/.github/workflows/targets.yml @@ -34,7 +34,7 @@ jobs: with: node-version: ${{ matrix.node }} registry-url: https://registry.npmjs.org/ - cache: "pnpm" + cache: pnpm - name: Install dependencies run: pnpm install diff --git a/docs/components/content/Hero.vue b/docs/components/content/Hero.vue index caf87ff2..4c917135 100644 --- a/docs/components/content/Hero.vue +++ b/docs/components/content/Hero.vue @@ -82,7 +82,9 @@ useMotion(sources, {
- Source + + Source +
diff --git a/docs/components/content/PresetSection.vue b/docs/components/content/PresetSection.vue index af72ec13..c4440c41 100644 --- a/docs/components/content/PresetSection.vue +++ b/docs/components/content/PresetSection.vue @@ -26,7 +26,8 @@ const replayInstance = useMotion(replayButton, { }) async function replay() { - if (isReplaying.value) return + if (isReplaying.value) + return isReplaying.value = true @@ -36,11 +37,14 @@ async function replay() { await apply(props.preset.initial) - if (props.preset.visible) await apply(props.preset.visible) + if (props.preset.visible) + await apply(props.preset.visible) - if (props.preset.visibleOnce) await apply(props.preset.visibleOnce) + if (props.preset.visibleOnce) + await apply(props.preset.visibleOnce) - if (props.preset.enter) await apply(props.preset.enter) + if (props.preset.enter) + await apply(props.preset.enter) replayInstance.set({ rotate: 0 }) diff --git a/docs/components/content/examples/MotionComponent.vue b/docs/components/content/examples/MotionComponent.vue index 4f3539b4..7032784b 100644 --- a/docs/components/content/examples/MotionComponent.vue +++ b/docs/components/content/examples/MotionComponent.vue @@ -2,9 +2,13 @@ diff --git a/docs/components/content/examples/MotionGroupComponent.vue b/docs/components/content/examples/MotionGroupComponent.vue index 7770df4d..53e72fb3 100644 --- a/docs/components/content/examples/MotionGroupComponent.vue +++ b/docs/components/content/examples/MotionGroupComponent.vue @@ -2,7 +2,9 @@ diff --git a/playgrounds/vite/src/demos/Sandbox.vue b/playgrounds/vite/src/demos/Sandbox.vue index 9c2642bf..2a58cc3f 100644 --- a/playgrounds/vite/src/demos/Sandbox.vue +++ b/playgrounds/vite/src/demos/Sandbox.vue @@ -1,5 +1,5 @@