Skip to content

Commit

Permalink
chore: support eslint flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
Diizzayy committed Nov 5, 2024
1 parent 7877ffa commit e43ceda
Show file tree
Hide file tree
Showing 15 changed files with 202 additions and 142 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintrc

This file was deleted.

28 changes: 24 additions & 4 deletions docs/components/Logo.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
<template>
<svg class="h-8" viewBox="0 0 818 97" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M103.24 80V58c0-5.92 3.84-10.24 9.36-10.24 5.04 0 8.4 3.84 8.4 9.36V80h9.84V55.04c0-9.44-5.92-16-15.04-16-5.76 0-10.32 2.48-12.56 6.88v-6.24H93.4V80h9.84Zm63.619-40.32v22c0 5.92-3.84 10.24-9.36 10.24-4.96 0-8.4-3.84-8.4-9.36V39.68h-9.76v24.96c0 9.44 5.92 16 14.96 16 5.76 0 10.32-2.48 12.56-6.88V80h9.84V39.68h-9.84Zm39.938 19.28 13.52-19.28h-10.8l-8 11.6-8.08-11.6h-10.72l13.44 19.28L181.597 80h10.48l9.44-13.44 9.44 13.44h10.4l-14.56-21.04Zm24.688-19.28h-7.92v8.24h7.92v18c0 8.96 5.76 14.08 14.56 14.08h6.48v-8.32h-5.36c-3.68 0-5.84-2.08-5.84-6.16v-17.6h11.2v-8.24h-11.2V27.52h-9.84v12.16Zm57.626 19.12v-8.4h-30.88v8.4h30.88Zm37.473-14.56c-2.32-3.12-6.72-5.2-11.76-5.2-12 0-19.04 8.48-19.04 20.8s7.04 20.8 19.2 20.8c5.04 0 9.68-2 11.68-5.12v5.76c0 4.24-2.8 7.2-6.72 7.2h-18.56v7.84h19.92c9.04 0 15.12-5.68 15.12-14.08V39.68h-9.84v4.56Zm-10.24 27.92c-6.56 0-10.8-4.88-10.8-12.32s4.24-12.32 10.8-12.32c6.64 0 10.96 4.88 10.96 12.32s-4.32 12.32-10.96 12.32Zm54.358-32.48h-4.72c-5.2 0-8.32 2-10.32 7.12v-7.12h-9.84V80h9.84V60.96c0-7.68 2.48-13.04 8.72-13.04h6.32v-8.24Zm20.973-.64c-10.48 0-17.28 6.24-17.76 14.24h8.8c.16-3.6 3.28-6.88 8.48-6.88 5.2 0 8.24 2.8 8.24 6.72 0 1.6-.96 2.72-2.96 2.72h-7.44c-9.04 0-15.12 4.88-15.12 12.72 0 6.96 5.44 12.08 13.44 12.08 5.76 0 10.4-2.64 12.08-6.64v6h9.68V54.08c0-9.12-7.2-15.04-17.44-15.04Zm-2 34.32c-3.68 0-6.24-2.08-6.24-5.2 0-3.52 2.8-5.84 6.96-5.84h9.04v.64c0 6.08-3.6 10.4-9.76 10.4Zm37.951 22.96V75.6c2.24 3.12 6.56 5.04 11.44 5.04 11.84 0 19.44-8.48 19.44-20.8s-7.12-20.8-18.72-20.8c-5.36 0-9.76 2.24-12.16 5.68v-5.04h-9.76v56.64h9.76Zm10.32-24.16c-6.64 0-10.96-4.88-10.96-12.32s4.32-12.32 10.96-12.32c6.48 0 10.8 4.88 10.8 12.32s-4.32 12.32-10.8 12.32ZM475.439 80V58c0-5.92 3.92-10.24 9.36-10.24 5.04 0 8.48 3.84 8.48 9.36V80h9.76V55.04c0-9.44-5.92-16-14.96-16-5.76 0-10.4 2.48-12.64 6.88V22.4h-9.76V80h9.76Zm74.879-40.32h-9.76v5.04c-2.4-3.44-6.72-5.68-12.08-5.68-11.68 0-18.8 8.48-18.8 20.8s7.6 20.8 19.52 20.8c4.88 0 9.12-1.92 11.36-5.04v20.72h9.76V39.68Zm-20 32.48c-6.56 0-10.88-4.88-10.88-12.32s4.32-12.32 10.88-12.32c6.56 0 10.88 4.88 10.88 12.32s-4.32 12.32-10.88 12.32Zm39.73 7.84V22.4h-9.76V80h9.76Zm39.688-21.2v-8.4h-30.88v8.4h30.88Zm26.593 21.84c10.4 0 18.24-6.32 19.52-15.12h-9.92c-.96 4-4.56 6.64-9.2 6.64-6.88 0-10.64-5.28-10.64-12.32s3.68-12.32 10.48-12.32c4.64 0 8.56 2.88 9.28 6.88h9.76c-.88-9.28-9.12-15.36-19.28-15.36-12.56 0-20.48 9.28-20.48 20.8 0 11.52 7.92 20.8 20.48 20.8ZM672.47 80V22.4h-9.76V80h9.76Zm9.048-46.64h10.56V22.4h-10.56v10.96ZM691.678 80V39.68h-9.84V80h9.84Zm36.591-13.44c-1.04 3.84-4.32 5.92-9.36 5.92-6.24 0-10.4-4.16-11.12-10.64h29.76c.08-.8.16-2 .16-3.36 0-9.6-6.08-19.44-19.6-19.44-13.2 0-19.76 10-19.76 20.64 0 10.56 7.36 20.96 20.56 20.96 9.92 0 17.44-5.52 18.96-14.08h-9.6Zm-10.16-20.16c5.84 0 9.36 3.84 9.76 8.96h-19.84c1.04-6.08 4.56-8.96 10.08-8.96ZM754.334 80V58c0-5.92 3.84-10.24 9.36-10.24 5.04 0 8.4 3.84 8.4 9.36V80h9.84V55.04c0-9.44-5.92-16-15.04-16-5.76 0-10.32 2.48-12.56 6.88v-6.24h-9.84V80h9.84Zm40.042-40.32h-7.92v8.24h7.92v18c0 8.96 5.76 14.08 14.56 14.08h6.48v-8.32h-5.36c-3.68 0-5.84-2.08-5.84-6.16v-17.6h11.2v-8.24h-11.2V27.52h-9.84v12.16Z" fill="currentColor" />
<g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 39.582a5.76 5.76 0 0 0 2.892 5.03c.305.202.691.323 1.027.429l.23.073h.126c.126.126.377.126.503.126h1.635a.965.965 0 0 0 .251-.063c.095-.031.189-.063.252-.063h.126a.973.973 0 0 0 .251-.063.97.97 0 0 1 .252-.062c2.137-.88 3.772-2.893 3.772-5.407 0-.189-.032-.346-.063-.503a2.445 2.445 0 0 1-.063-.503l23.64-13.58c.377-.126.754-.252 1.132-.252.377 0 .754 0 1.131.251l19.993 11.569c.755-1.76 1.887-3.27 3.395-4.275L39.862 20.343c-1.132-.629-2.39-1.006-3.773-1.006-1.257 0-2.64.377-3.772 1.006L8.048 34.3c-.63-.377-1.384-.503-2.264-.503C2.641 33.797 0 36.438 0 39.582Zm69.284 4.275c1.258-1.006 2.012-2.515 2.012-4.275 0-3.144-2.64-5.785-5.91-5.785-.628 0-1.257.126-1.76.252-.126.063-.22.094-.314.126a2.164 2.164 0 0 0-.315.126c0 .125-.125.125-.125.125a2.44 2.44 0 0 1-.24.103c-.108.041-.186.07-.263.149 0 .125-.126.125-.126.125-.377.252-.629.503-1.006.88a1.742 1.742 0 0 0-.189.252c-.063.094-.126.189-.188.252a5.517 5.517 0 0 0-1.132 3.395c0 2.64 1.76 4.778 4.15 5.532v26.03c0 .88-.378 1.634-1.132 2.011L43.13 84.472c1.132 1.383 1.76 3.27 1.76 5.155l20.622-11.82c2.263-1.383 3.772-3.898 3.772-6.664V43.857ZM41.872 89.879c0-.252 0-.377.126-.377v-.881c-.125-.125-.125-.125-.125-.251 0-.063-.032-.094-.063-.126-.032-.031-.063-.063-.063-.126-.073-.072-.103-.103-.116-.14-.01-.027-.01-.058-.01-.111 0 0-.126-.126-.126-.251-.125 0-.125-.126-.125-.126s-.126-.126-.126-.252c-.126 0-.126-.125-.126-.125-.063-.063-.094-.126-.126-.189a.654.654 0 0 0-.125-.189v-.125c-1.132-1.51-2.767-2.39-4.653-2.39-1.76 0-3.395.755-4.401 2.012L9.431 73.281a2.381 2.381 0 0 1-1.132-2.012V48.132c-.754.252-1.635.377-2.515.377-.88 0-1.886-.251-2.766-.502v23.262c0 2.766 1.383 5.281 3.772 6.664l23.891 13.832a5.705 5.705 0 0 0 5.407 3.898c2.892 0 5.156-2.138 5.659-4.778v-.126c.126-.251.126-.629.126-.88ZM52.21 43.732c0 .127 0 .127.127.381 0 .127 0 .254.254.127v20.943c0 .507-.38.888-.762 1.142L30.886 77.62c-.127.127-.127.127-.254.127H29.617c-.127-.127-.254-.127-.254-.127l-14.47-7.996c-.38-.254-.634-.635-.634-1.142V63.151c.127 0 .127-.127.127-.127l.127-.127.127-.127c0-.127.127-.127.127-.127 0-.127.127-.127.127-.127l5.711-2.792V43.986c.127-.127.127-.254.127-.254l.127-.127.127-.126c0-.127.127-.127.127-.127l.127-.127 10.154-5.585-.38-1.015c-.509-.381-.762-1.016-.762-1.65v-.127c0-.127 0-.381.127-.508.507-1.65 2.919-2.792 6.092-2.792 3.173 0 5.584 1.142 6.092 2.792.127.127.127.254.127.508v.127c0 .634-.254 1.142-.761 1.65l-.381 1.015 10.154 5.585.126.127c0 .127.127.127.127.127l.127.127c.127 0 .127.126.127.126Zm-17.515-5.33.254.507 1.142 2.539h.761l1.397-3.046c-.508.127-1.142.127-1.777.127s-1.27 0-1.777-.127Zm5.33-3.427c-.507-.254-1.65-.762-3.426-.762-1.904 0-3.046.508-3.427.762.508.254 1.65.761 3.427.761 1.904 0 3.046-.507 3.427-.761Zm-6.346 7.488-1.015-2.284-7.742 4.315 11.677 6.473 11.677-6.473-7.743-4.315-1.015 2.284c-.254 1.016-1.396 1.777-2.92 1.777-1.522 0-2.665-.761-2.919-1.777Zm1.524 10.916-11.804-6.6v12.946l11.804 6.6V53.378ZM16.925 67.847l11.804 6.6V72.67l-11.804-6.6v1.777Zm6.346-1.27 6.854 3.808 3.553-1.777-11.676-6.473-3.554 1.777 4.823 2.666Zm8.25 7.87 18.15-9.773v-17.77l-11.804 6.6v15.739c-.127 0-.127.127-.127.127-.127 0-.127.127-.127.127l-.127.127c0 .127-.127.127-.127.127 0 .127-.127.127-.127.127l-5.711 2.792v1.777Z" fill="url(#b)" /></g>
<svg
class="h-8"
viewBox="0 0 818 97"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M103.24 80V58c0-5.92 3.84-10.24 9.36-10.24 5.04 0 8.4 3.84 8.4 9.36V80h9.84V55.04c0-9.44-5.92-16-15.04-16-5.76 0-10.32 2.48-12.56 6.88v-6.24H93.4V80h9.84Zm63.619-40.32v22c0 5.92-3.84 10.24-9.36 10.24-4.96 0-8.4-3.84-8.4-9.36V39.68h-9.76v24.96c0 9.44 5.92 16 14.96 16 5.76 0 10.32-2.48 12.56-6.88V80h9.84V39.68h-9.84Zm39.938 19.28 13.52-19.28h-10.8l-8 11.6-8.08-11.6h-10.72l13.44 19.28L181.597 80h10.48l9.44-13.44 9.44 13.44h10.4l-14.56-21.04Zm24.688-19.28h-7.92v8.24h7.92v18c0 8.96 5.76 14.08 14.56 14.08h6.48v-8.32h-5.36c-3.68 0-5.84-2.08-5.84-6.16v-17.6h11.2v-8.24h-11.2V27.52h-9.84v12.16Zm57.626 19.12v-8.4h-30.88v8.4h30.88Zm37.473-14.56c-2.32-3.12-6.72-5.2-11.76-5.2-12 0-19.04 8.48-19.04 20.8s7.04 20.8 19.2 20.8c5.04 0 9.68-2 11.68-5.12v5.76c0 4.24-2.8 7.2-6.72 7.2h-18.56v7.84h19.92c9.04 0 15.12-5.68 15.12-14.08V39.68h-9.84v4.56Zm-10.24 27.92c-6.56 0-10.8-4.88-10.8-12.32s4.24-12.32 10.8-12.32c6.64 0 10.96 4.88 10.96 12.32s-4.32 12.32-10.96 12.32Zm54.358-32.48h-4.72c-5.2 0-8.32 2-10.32 7.12v-7.12h-9.84V80h9.84V60.96c0-7.68 2.48-13.04 8.72-13.04h6.32v-8.24Zm20.973-.64c-10.48 0-17.28 6.24-17.76 14.24h8.8c.16-3.6 3.28-6.88 8.48-6.88 5.2 0 8.24 2.8 8.24 6.72 0 1.6-.96 2.72-2.96 2.72h-7.44c-9.04 0-15.12 4.88-15.12 12.72 0 6.96 5.44 12.08 13.44 12.08 5.76 0 10.4-2.64 12.08-6.64v6h9.68V54.08c0-9.12-7.2-15.04-17.44-15.04Zm-2 34.32c-3.68 0-6.24-2.08-6.24-5.2 0-3.52 2.8-5.84 6.96-5.84h9.04v.64c0 6.08-3.6 10.4-9.76 10.4Zm37.951 22.96V75.6c2.24 3.12 6.56 5.04 11.44 5.04 11.84 0 19.44-8.48 19.44-20.8s-7.12-20.8-18.72-20.8c-5.36 0-9.76 2.24-12.16 5.68v-5.04h-9.76v56.64h9.76Zm10.32-24.16c-6.64 0-10.96-4.88-10.96-12.32s4.32-12.32 10.96-12.32c6.48 0 10.8 4.88 10.8 12.32s-4.32 12.32-10.8 12.32ZM475.439 80V58c0-5.92 3.92-10.24 9.36-10.24 5.04 0 8.48 3.84 8.48 9.36V80h9.76V55.04c0-9.44-5.92-16-14.96-16-5.76 0-10.4 2.48-12.64 6.88V22.4h-9.76V80h9.76Zm74.879-40.32h-9.76v5.04c-2.4-3.44-6.72-5.68-12.08-5.68-11.68 0-18.8 8.48-18.8 20.8s7.6 20.8 19.52 20.8c4.88 0 9.12-1.92 11.36-5.04v20.72h9.76V39.68Zm-20 32.48c-6.56 0-10.88-4.88-10.88-12.32s4.32-12.32 10.88-12.32c6.56 0 10.88 4.88 10.88 12.32s-4.32 12.32-10.88 12.32Zm39.73 7.84V22.4h-9.76V80h9.76Zm39.688-21.2v-8.4h-30.88v8.4h30.88Zm26.593 21.84c10.4 0 18.24-6.32 19.52-15.12h-9.92c-.96 4-4.56 6.64-9.2 6.64-6.88 0-10.64-5.28-10.64-12.32s3.68-12.32 10.48-12.32c4.64 0 8.56 2.88 9.28 6.88h9.76c-.88-9.28-9.12-15.36-19.28-15.36-12.56 0-20.48 9.28-20.48 20.8 0 11.52 7.92 20.8 20.48 20.8ZM672.47 80V22.4h-9.76V80h9.76Zm9.048-46.64h10.56V22.4h-10.56v10.96ZM691.678 80V39.68h-9.84V80h9.84Zm36.591-13.44c-1.04 3.84-4.32 5.92-9.36 5.92-6.24 0-10.4-4.16-11.12-10.64h29.76c.08-.8.16-2 .16-3.36 0-9.6-6.08-19.44-19.6-19.44-13.2 0-19.76 10-19.76 20.64 0 10.56 7.36 20.96 20.56 20.96 9.92 0 17.44-5.52 18.96-14.08h-9.6Zm-10.16-20.16c5.84 0 9.36 3.84 9.76 8.96h-19.84c1.04-6.08 4.56-8.96 10.08-8.96ZM754.334 80V58c0-5.92 3.84-10.24 9.36-10.24 5.04 0 8.4 3.84 8.4 9.36V80h9.84V55.04c0-9.44-5.92-16-15.04-16-5.76 0-10.32 2.48-12.56 6.88v-6.24h-9.84V80h9.84Zm40.042-40.32h-7.92v8.24h7.92v18c0 8.96 5.76 14.08 14.56 14.08h6.48v-8.32h-5.36c-3.68 0-5.84-2.08-5.84-6.16v-17.6h11.2v-8.24h-11.2V27.52h-9.84v12.16Z"
fill="currentColor"
/>
<g clip-path="url(#a)"><path
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 39.582a5.76 5.76 0 0 0 2.892 5.03c.305.202.691.323 1.027.429l.23.073h.126c.126.126.377.126.503.126h1.635a.965.965 0 0 0 .251-.063c.095-.031.189-.063.252-.063h.126a.973.973 0 0 0 .251-.063.97.97 0 0 1 .252-.062c2.137-.88 3.772-2.893 3.772-5.407 0-.189-.032-.346-.063-.503a2.445 2.445 0 0 1-.063-.503l23.64-13.58c.377-.126.754-.252 1.132-.252.377 0 .754 0 1.131.251l19.993 11.569c.755-1.76 1.887-3.27 3.395-4.275L39.862 20.343c-1.132-.629-2.39-1.006-3.773-1.006-1.257 0-2.64.377-3.772 1.006L8.048 34.3c-.63-.377-1.384-.503-2.264-.503C2.641 33.797 0 36.438 0 39.582Zm69.284 4.275c1.258-1.006 2.012-2.515 2.012-4.275 0-3.144-2.64-5.785-5.91-5.785-.628 0-1.257.126-1.76.252-.126.063-.22.094-.314.126a2.164 2.164 0 0 0-.315.126c0 .125-.125.125-.125.125a2.44 2.44 0 0 1-.24.103c-.108.041-.186.07-.263.149 0 .125-.126.125-.126.125-.377.252-.629.503-1.006.88a1.742 1.742 0 0 0-.189.252c-.063.094-.126.189-.188.252a5.517 5.517 0 0 0-1.132 3.395c0 2.64 1.76 4.778 4.15 5.532v26.03c0 .88-.378 1.634-1.132 2.011L43.13 84.472c1.132 1.383 1.76 3.27 1.76 5.155l20.622-11.82c2.263-1.383 3.772-3.898 3.772-6.664V43.857ZM41.872 89.879c0-.252 0-.377.126-.377v-.881c-.125-.125-.125-.125-.125-.251 0-.063-.032-.094-.063-.126-.032-.031-.063-.063-.063-.126-.073-.072-.103-.103-.116-.14-.01-.027-.01-.058-.01-.111 0 0-.126-.126-.126-.251-.125 0-.125-.126-.125-.126s-.126-.126-.126-.252c-.126 0-.126-.125-.126-.125-.063-.063-.094-.126-.126-.189a.654.654 0 0 0-.125-.189v-.125c-1.132-1.51-2.767-2.39-4.653-2.39-1.76 0-3.395.755-4.401 2.012L9.431 73.281a2.381 2.381 0 0 1-1.132-2.012V48.132c-.754.252-1.635.377-2.515.377-.88 0-1.886-.251-2.766-.502v23.262c0 2.766 1.383 5.281 3.772 6.664l23.891 13.832a5.705 5.705 0 0 0 5.407 3.898c2.892 0 5.156-2.138 5.659-4.778v-.126c.126-.251.126-.629.126-.88ZM52.21 43.732c0 .127 0 .127.127.381 0 .127 0 .254.254.127v20.943c0 .507-.38.888-.762 1.142L30.886 77.62c-.127.127-.127.127-.254.127H29.617c-.127-.127-.254-.127-.254-.127l-14.47-7.996c-.38-.254-.634-.635-.634-1.142V63.151c.127 0 .127-.127.127-.127l.127-.127.127-.127c0-.127.127-.127.127-.127 0-.127.127-.127.127-.127l5.711-2.792V43.986c.127-.127.127-.254.127-.254l.127-.127.127-.126c0-.127.127-.127.127-.127l.127-.127 10.154-5.585-.38-1.015c-.509-.381-.762-1.016-.762-1.65v-.127c0-.127 0-.381.127-.508.507-1.65 2.919-2.792 6.092-2.792 3.173 0 5.584 1.142 6.092 2.792.127.127.127.254.127.508v.127c0 .634-.254 1.142-.761 1.65l-.381 1.015 10.154 5.585.126.127c0 .127.127.127.127.127l.127.127c.127 0 .127.126.127.126Zm-17.515-5.33.254.507 1.142 2.539h.761l1.397-3.046c-.508.127-1.142.127-1.777.127s-1.27 0-1.777-.127Zm5.33-3.427c-.507-.254-1.65-.762-3.426-.762-1.904 0-3.046.508-3.427.762.508.254 1.65.761 3.427.761 1.904 0 3.046-.507 3.427-.761Zm-6.346 7.488-1.015-2.284-7.742 4.315 11.677 6.473 11.677-6.473-7.743-4.315-1.015 2.284c-.254 1.016-1.396 1.777-2.92 1.777-1.522 0-2.665-.761-2.919-1.777Zm1.524 10.916-11.804-6.6v12.946l11.804 6.6V53.378ZM16.925 67.847l11.804 6.6V72.67l-11.804-6.6v1.777Zm6.346-1.27 6.854 3.808 3.553-1.777-11.676-6.473-3.554 1.777 4.823 2.666Zm8.25 7.87 18.15-9.773v-17.77l-11.804 6.6v15.739c-.127 0-.127.127-.127.127-.127 0-.127.127-.127.127l-.127.127c0 .127-.127.127-.127.127 0 .127-.127.127-.127.127l-5.711 2.792v1.777Z"
fill="url(#b)"
/></g>
<defs><linearGradient
id="b"
x1="33.425"
y1="31.548"
x2="63.454"
y2="85.306"
gradientUnits="userSpaceOnUse"
><stop stop-color="#E535AB" /><stop offset="1" stop-color="#1BCBE2" /></linearGradient><clipPath id="a"><path fill="#fff" transform="translate(0 19)" d="M0 0h71.296v77H0z" /></clipPath></defs>
><stop stop-color="#E535AB" /><stop
offset="1"
stop-color="#1BCBE2"
/></linearGradient><clipPath id="a"><path
fill="#fff"
transform="translate(0 19)"
d="M0 0h71.296v77H0z"
/></clipPath></defs>
</svg>
</template>
28 changes: 28 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

export default createConfigForNuxt({
features: {
tooling: true,
stylistic: {
commaDangle: 'never',
quoteProps: 'as-needed'
},
nuxt: {
sortConfigKeys: false
}
},
dirs: {
src: [
'./playground'
]
}
})
.overrideRules({
'vue/multi-word-component-names': 'off',

'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',

'@stylistic/max-statements-per-line': 'off'
})
27 changes: 20 additions & 7 deletions examples/basic/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,32 @@

<p>Launch Count: {{ data?.launches.length || 0 }}</p>

<div v-if="!pending" class="launches mt-4">
<div v-for="(entry, i) in data?.launches" :key="entry.id">
<div v-if="entry?.links?.patch?.small" class="thumbnail">
<div
v-if="!pending"
class="launches mt-4"
>
<div
v-for="(entry, i) in data?.launches"
:key="entry.id"
>
<div
v-if="entry?.links?.patch?.small"
class="thumbnail"
>
<img
class="lazyload"
src="https://placehold.co/150"
:data-src="entry?.links.patch?.small"
:alt="entry.name || `Launch ${i}`"
/>
>
</div>

<div v-else>
<div class="thumbnail">
<img
src="https://placehold.co/150"
:alt="entry.name || `Launch ${i}`"
/>
>
</div>
</div>

Expand All @@ -34,7 +43,12 @@

<p v-if="entry.links?.article">
More info:
<a :href="entry.links?.article" target="_blank">Read Article</a>
<a
:href="entry.links?.article"
target="_blank"
>
Read Article
</a>
</p>
</div>
</div>
Expand All @@ -48,7 +62,6 @@ useHead({ script: [{ async: true, src: 'https://cdn.jsdelivr.net/npm/lazysizes@5
const { data, error, pending, refresh } = await useAsyncGql('launches', { limit: 10 })

if (error.value) {
// eslint-disable-next-line no-console
console.error(error.value)
}
</script>
Expand Down
3 changes: 1 addition & 2 deletions examples/starter/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<template>
<div>
</div>
<div />
</template>

<script setup lang="ts">
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"docs:dev": "nuxi dev docs",
"docs:generate": "nuxi generate docs",
"test": "pnpm dev:prepare && nuxi prepare examples/basic && nuxi prepare examples/multi-client && vitest run",
"lint": "eslint --ext .js,.ts,.vue .",
"lint:fix": "eslint --fix --ext .js,.ts,.vue ."
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@graphql-codegen/cli": "^5.0.3",
Expand Down
1 change: 0 additions & 1 deletion playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const { data, error, pending, refresh } = await useAsyncGql({
})
if (error.value) {
// eslint-disable-next-line no-console
console.error(error.value)
}
</script>
34 changes: 17 additions & 17 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fsp } from 'fs'
import { promises as fsp } from 'node:fs'
import { parse } from 'graphql'
import { upperFirst } from 'scule'
import type { Import } from 'unimport'
Expand All @@ -17,7 +17,7 @@ export interface GqlContext {
clientTypes?: Record<string, string[]>
}

export async function prepareContext (ctx: GqlContext, prefix: string) {
export async function prepareContext(ctx: GqlContext, prefix: string) {
if (ctx.clientDocs) { await prepareOperations(ctx) }

if (ctx.template) { prepareTemplate(ctx) }
Expand Down Expand Up @@ -56,25 +56,25 @@ export async function prepareContext (ctx: GqlContext, prefix: string) {
: ctx.clients!.map(client => `import { getSdk as ${client}GqlSdk } from '#gql/${client}'`)),
...Object.entries(ctx.clientTypes || {}).map(([k, v]) => genExport(`#gql/${k}`, v)),
'declare module \'#gql\' {',
` type GqlClients = '${ctx.clients?.join("' | '") || 'default'}'`,
` type GqlOps = '${Object.values(ctx.clientOps!).flat().join("' | '")}'`,
` const GqClientOps = ${JSON.stringify(ctx.clientOps)}`,
...(!ctx.codegen
? []
: [
' const GqlSdks = {',
...ctx.clients!.map(client => ` ${client}: ${client}GqlSdk,`),
' }',
...ctx.fns!.map(f => fnExp(f, true)),
` type GqlSdkFuncs = ${ctx.clients?.map(c => `ReturnType<typeof ${c}GqlSdk>`).join(' & ') || 'any'}`
]),
'}'
` type GqlClients = '${ctx.clients?.join('\' | \'') || 'default'}'`,
` type GqlOps = '${Object.values(ctx.clientOps!).flat().join('\' | \'')}'`,
` const GqClientOps = ${JSON.stringify(ctx.clientOps)}`,
...(!ctx.codegen
? []
: [
' const GqlSdks = {',
...ctx.clients!.map(client => ` ${client}: ${client}GqlSdk,`),
' }',
...ctx.fns!.map(f => fnExp(f, true)),
` type GqlSdkFuncs = ${ctx.clients?.map(c => `ReturnType<typeof ${c}GqlSdk>`).join(' & ') || 'any'}`
]),
'}'
].join('\n')

ctx.fnImports = ctx.fns.map((fn): Import => ({ from: '#gql', name: fnName(fn) }))
}

async function prepareOperations (ctx: GqlContext) {
async function prepareOperations(ctx: GqlContext) {
const scanDoc = async (doc: string, client: string) => {
const { definitions } = parse(await fsp.readFile(doc, 'utf8'))

Expand All @@ -99,7 +99,7 @@ async function prepareOperations (ctx: GqlContext) {
}
}

function prepareTemplate (ctx: GqlContext) {
function prepareTemplate(ctx: GqlContext) {
if (!ctx.codegen) { return }

ctx.clientTypes ||= {}
Expand Down
2 changes: 1 addition & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface GenerateOptions {
clientDocs?: Record<string, string[]>
}

function prepareConfig (options: GenerateOptions & GqlCodegen): CodegenConfig {
function prepareConfig(options: GenerateOptions & GqlCodegen): CodegenConfig {
const prepareSchema = (v: GqlClient<object>) => {
if (v.schema) {
v.schema = options.resolver?.resolve(v.schema)
Expand Down
Loading

0 comments on commit e43ceda

Please sign in to comment.