From 4454867c365c589d04ba7a351e689d512f91f616 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 11 Apr 2023 20:29:53 +0200 Subject: [PATCH] chore(docs): lint Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- docs/components/Repl.vue | 4 +++- .../SnappableConnectionLine.vue | 7 +++++-- docs/components/examples/custom-node/App.vue | 16 ++++++++++++---- docs/components/examples/stress/utils.js | 4 +++- .../examples/transition/TransitionEdge.vue | 4 +++- docs/components/home/flows/Basic.vue | 3 ++- docs/components/home/flows/Intro.vue | 11 ++++++++--- docs/src/.vitepress/plugins/changelog.ts | 4 +++- .../.vitepress/plugins/vercel-web-vitals-api.ts | 3 ++- 9 files changed, 41 insertions(+), 15 deletions(-) diff --git a/docs/components/Repl.vue b/docs/components/Repl.vue index c8d116e9..513e0351 100644 --- a/docs/components/Repl.vue +++ b/docs/components/Repl.vue @@ -7,7 +7,9 @@ export default defineComponent({ props: ['example'], setup(props) { return () => { - if (!isClient) return null + if (!isClient) { + return null + } return h(Suspense, h(DocsRepl, props)) } diff --git a/docs/components/examples/connection-radius/SnappableConnectionLine.vue b/docs/components/examples/connection-radius/SnappableConnectionLine.vue index 8f29ca45..553a7641 100644 --- a/docs/components/examples/connection-radius/SnappableConnectionLine.vue +++ b/docs/components/examples/connection-radius/SnappableConnectionLine.vue @@ -69,7 +69,9 @@ watch([() => props.targetY, () => props.targetX], (_, __, onCleanup) => { }, ) - if (!closestNode.node) return + if (!closestNode.node) { + return + } canSnap.value = closestNode.distance < SNAP_DISTANCE @@ -92,8 +94,9 @@ watch([() => props.targetY, () => props.targetX], (_, __, onCleanup) => { }, edges.value, ) - ) + ) { return + } if (closestHandle) { const el = document.querySelector(`[data-handleid='${closestHandle.id}']`) diff --git a/docs/components/examples/custom-node/App.vue b/docs/components/examples/custom-node/App.vue index 74e214e7..f1ad2348 100644 --- a/docs/components/examples/custom-node/App.vue +++ b/docs/components/examples/custom-node/App.vue @@ -19,14 +19,22 @@ const connectionLineStyle = { stroke: '#fff' } // minimap stroke color functions function nodeStroke(n) { - if (n.type === 'input') return '#0041d0' - if (n.type === 'custom') return presets.sumi - if (n.type === 'output') return '#ff0072' + if (n.type === 'input') { + return '#0041d0' + } + if (n.type === 'custom') { + return presets.sumi + } + if (n.type === 'output') { + return '#ff0072' + } return '#eee' } function nodeColor(n) { - if (n.type === 'custom') return bgColor.value + if (n.type === 'custom') { + return bgColor.value + } return '#fff' } diff --git a/docs/components/examples/stress/utils.js b/docs/components/examples/stress/utils.js index 60a7869b..db3d0763 100644 --- a/docs/components/examples/stress/utils.js +++ b/docs/components/examples/stress/utils.js @@ -22,7 +22,9 @@ export function getElements(xElements = 10, yElements = 10) { source: recentNodeId.toString(), target: nodeId.toString(), style: (edge) => { - if (!edge.sourceNode.selected && !edge.targetNode.selected) return + if (!edge.sourceNode.selected && !edge.targetNode.selected) { + return + } return { stroke: '#10b981', strokeWidth: 3 } }, }) diff --git a/docs/components/examples/transition/TransitionEdge.vue b/docs/components/examples/transition/TransitionEdge.vue index f724f1f7..483edf4b 100644 --- a/docs/components/examples/transition/TransitionEdge.vue +++ b/docs/components/examples/transition/TransitionEdge.vue @@ -118,7 +118,9 @@ onNodeDoubleClick(({ node }) => { stopHandle = watchDebounced( output, (next) => { - if (!showDot.value) return + if (!showDot.value) { + return + } const nextLength = curve.value.getTotalLength() diff --git a/docs/components/home/flows/Basic.vue b/docs/components/home/flows/Basic.vue index 8c7838cf..c9ddae92 100644 --- a/docs/components/home/flows/Basic.vue +++ b/docs/components/home/flows/Basic.vue @@ -10,10 +10,11 @@ const emit = defineEmits(['pane']) const getNodeClass: ClassFunc = (el) => { const classes = ['font-semibold', '!border-2', 'transition-colors', 'duration-300', 'ease-in-out'] - if (el.selected) + if (el.selected) { classes.push( ...['!border-green-500/80', '!shadow-md', '!shadow-green-500/50', '!bg-green-100/80 dark:(!bg-white)', '!text-gray-700'], ) + } return classes.join(' ') } diff --git a/docs/components/home/flows/Intro.vue b/docs/components/home/flows/Intro.vue index c29cb9d9..0d4b9276 100644 --- a/docs/components/home/flows/Intro.vue +++ b/docs/components/home/flows/Intro.vue @@ -75,13 +75,18 @@ const clicks = ref(0) const disabled = ref(false) const confettiColors = Object.values(colors).flatMap((color) => { - if (typeof color === 'string') return color - else return Object.values(color).flatMap((c) => c) + if (typeof color === 'string') { + return color + } else { + return Object.values(color).flatMap((c) => c) + } }) onNodeClick(async ({ node }) => { if (node.id === 'intro') { - if (disabled.value) return + if (disabled.value) { + return + } animatedBackground.value = !animatedBackground.value diff --git a/docs/src/.vitepress/plugins/changelog.ts b/docs/src/.vitepress/plugins/changelog.ts index 95272609..325a5354 100644 --- a/docs/src/.vitepress/plugins/changelog.ts +++ b/docs/src/.vitepress/plugins/changelog.ts @@ -10,7 +10,9 @@ const skip = ['node_modules', 'dist', 'turbo'] const getAllFiles = function (dirPath: string, needle?: string, arrayOfFiles: ChangelogFile[] = [], pkgName?: string) { readdirSync(dirPath).forEach((file) => { - if (skip.includes(file)) return + if (skip.includes(file)) { + return + } if (statSync(`${dirPath}/${file}`).isDirectory()) { getAllFiles(`${dirPath}/${file}`, needle, arrayOfFiles, file) diff --git a/docs/src/.vitepress/plugins/vercel-web-vitals-api.ts b/docs/src/.vitepress/plugins/vercel-web-vitals-api.ts index f16b83a5..04813990 100644 --- a/docs/src/.vitepress/plugins/vercel-web-vitals-api.ts +++ b/docs/src/.vitepress/plugins/vercel-web-vitals-api.ts @@ -31,13 +31,14 @@ function sendToAnalytics(metric, options) { }) if (navigator.sendBeacon) { navigator.sendBeacon(vitalsUrl, blob) - } else + } else { fetch(vitalsUrl, { body: blob, method: 'POST', credentials: 'omit', keepalive: true, }) + } } export function webVitals(options) {