@eslint/config-inspector
Version:
A visual tool for inspecting and understanding your ESLint flat configs
2 lines (1 loc) • 6.77 kB
JavaScript
import{j as V,a0 as L,N as D,a9 as z,a3 as I,Q as O,J as t,g as l,d as e,X as c,F as u,i as y,Y as i,O as f,e as x,aa as G,h as F,P as U,f as T,B as j,y as J,c as K,K as k,W as m,G as N,k as v}from"./CpdG7ysU.js";import{C as S,_ as $,a as A}from"./kRSJCsry.js";import{_ as M}from"./PXMiJN0M.js";const P=["open"],Q={block:""},W={class:"absolute right-[calc(100%+10px)] top-1.5","text-right":"","color-muted":"","font-mono":"","lt-lg:hidden":""},X={flex:"~ gap-2 items-start wrap items-center","cursor-pointer":"","select-none":"","bg-hover":"",px2:"",py2:"","text-sm":"","font-mono":""},Y={flex:"","flex-auto":"","flex-col":"","gap-3":"","md:flex-row":""},q={"flex-auto":"",flex:"~ gap-2 items-center"},H={key:2,"color-muted":""},Z={flex:"~ gap-2 items-start wrap"},ee={"aria-hidden":"true","data-a11y-skip":"","pointer-events-none":"",absolute:"","right-2":"","top-2":"","text-right":"","text-5em":"","font-mono":"",op5:""},te={key:0,flex:"~ col gap-4","of-auto":"",px4:"",py4:""},oe={flex:"~ gap-2 items-center"},ne={flex:"~ col gap-1",ml6:"","mt--2":""},le={badge:"","text-start":""},ie={key:0,"max-h":"50vh","min-w-100":""},se={flex:"~ items-center gap-2",p3:""},ae=["onClick"],re={p3:"",border:"t base"},ue={flex:"~ gap-2 items-start"},de={flex:"~ col gap-2"},pe={flex:"~ gap-2 items-center wrap"},fe={flex:"~ gap-1 wrap",ml6:"","mt--2":""},ge={flex:"~ gap-2 items-center"},me={flex:"~ col gap-1",ml7:"","mt--2":""},ve=V({__name:"FileGroupItem",props:j({index:{},group:{}},{open:{default:!0},openModifiers:{}}),emits:["update:open"],setup(s){const d=s;function _(p){return d.group.globs.some(n=>J(n,p))}const b=L(s,"open"),o=D(b.value);if(!o.value){const p=z(()=>{b.value&&(o.value=!0,p())})}const a=K(()=>{if(d.group.configs.length===1)return{type:"config",config:d.group.configs[0]};if(d.group.globs.length<=2)return{type:"glob",globs:d.group.globs}}),h=I();function w(p){h.push(`/configs?index=${p+1}`)}return(p,n)=>{const B=O("VDropdown");return t(),l("details",{class:"flat-config-item",open:b.value,border:"~ base rounded-lg",relative:"",onToggle:n[0]||(n[0]=r=>b.value=r.target.open)},[e("summary",Q,[e("div",W," #"+c(s.index+1),1),e("div",X,[n[3]||(n[3]=e("div",{class:"[details[open]_&]:rotate-90","i-ph-caret-right":"","color-muted":"",transition:""},null,-1)),e("div",Y,[e("span",q,[a.value?.type==="config"?(t(),l(u,{key:0},[n[1]||(n[1]=e("span",{"color-muted":""},"Config",-1)),y(i(S),{badge:"",name:a.value.config.name,index:a.value.config.index},null,8,["name","index"])],64)):a.value?.type==="glob"?(t(),l(u,{key:1},[n[2]||(n[2]=e("span",{"color-muted":""},"Globs",-1)),(t(!0),l(u,null,f(a.value.globs,(r,g)=>(t(),x($,{key:g,glob:r},null,8,["glob"]))),128))],64)):(t(),l("span",H," Files group #"+c(s.index+1),1))]),e("div",Z,[y(M,{icon:"i-ph-files-duotone",number:s.group.files?.length||0,color:"text-yellow5",title:"Files"},null,8,["number"]),y(M,{icon:"i-ph-stack-duotone",number:s.group.configs.length,color:"text-blue5 dark:text-blue4",title:"Configs","mr-2":""},null,8,["number"])])])])]),e("div",ee," #"+c(s.index+1),1),o.value?(t(),l("div",te,[e("div",oe,[n[4]||(n[4]=e("div",{"i-ph-stack-duotone":"","flex-none":""},null,-1)),e("div",null,"Configs Specific to the Files ("+c(s.group.configs.length)+")",1)]),e("div",ne,[(t(!0),l(u,null,f(s.group.configs,(r,g)=>(t(),l("div",{key:g,"font-mono":"",flex:"~ gap-2"},[y(B,null,{popper:G(({shown:E})=>[E?(t(),l("div",ie,[e("div",se,[e("button",{"btn-action-sm":"",title:"Copy",onClick:C=>w(r.index)},[...n[5]||(n[5]=[e("div",{"i-ph-stack-duotone":""},null,-1),F(" Go to this config ",-1)])],8,ae),U(p.$slots,"popup-actions")]),e("div",re,[e("div",ue,[n[7]||(n[7]=e("div",{"i-ph-file-magnifying-glass-duotone":"",my1:"","flex-none":"","color-muted":""},null,-1)),e("div",de,[n[6]||(n[6]=e("div",{"color-muted":""}," Applies to files matching ",-1)),e("div",pe,[(t(!0),l(u,null,f(r.files,(C,R)=>(t(),x($,{key:R,glob:C,active:_(C)},null,8,["glob","active"]))),128))])])])])])):T("",!0)]),default:G(()=>[e("button",le,[y(i(S),{name:r.name,index:g},null,8,["name","index"])])]),_:2},1024)]))),128))]),n[9]||(n[9]=e("div",{flex:"~ gap-2 items-center"},[e("div",{"i-ph-file-magnifying-glass-duotone":"","flex-none":""}),e("div",null,"Matched Globs")],-1)),e("div",fe,[(t(!0),l(u,null,f(s.group.globs,(r,g)=>(t(),x($,{key:g,glob:r},null,8,["glob"]))),128))]),e("div",ge,[n[8]||(n[8]=e("div",{"i-ph-files-duotone":"","flex-none":""},null,-1)),e("div",null,"Matched Local Files ("+c(s.group.files.length)+")",1)]),e("div",me,[(t(!0),l(u,null,f(s.group.files,r=>(t(),x(A,{key:r,"font-mono":"",filepath:r},null,8,["filepath"]))),128))])])):T("",!0)],40,P)}}}),ce={key:0,flex:"~ col gap-4",my4:""},xe={flex:"~ gap-2 items-center"},be={border:"~ base rounded",flex:"~ inline"},he={key:0,flex:"~ gap-2 col"},ye={key:1},ke={flex:"~ gap-2 items-center"},_e={flex:"~ col gap-1",py4:"","font-mono":""},we={key:1},Te=V({__name:"files",setup(s){function d(){v.value=v.value.map(()=>!0)}function _(){v.value=v.value.map(()=>!1)}return(b,o)=>i(k).filesResolved?(t(),l("div",ce,[o[7]||(o[7]=e("div",{"color-muted":""},[F(" This tab shows the preview for files match from the workspace. This feature is "),e("span",{"text-warning-700":"","dark:text-warning-300":""},"experimental"),F(" and may not be 100% accurate. ")],-1)),e("div",xe,[e("div",be,[e("button",{class:N(i(m).viewFilesTab==="list"?"btn-action-active":""),"btn-action":"","border-none":"",onClick:o[0]||(o[0]=a=>i(m).viewFilesTab="list")},[...o[2]||(o[2]=[e("div",{"i-ph-files-duotone":""},null,-1),e("span",null,"List",-1)])],2),o[4]||(o[4]=e("div",{border:"l base"},null,-1)),e("button",{class:N(i(m).viewFilesTab==="group"?"btn-action-active":""),"btn-action":"","border-none":"",onClick:o[1]||(o[1]=a=>i(m).viewFilesTab="group")},[...o[3]||(o[3]=[e("div",{"i-ph-rows-duotone":""},null,-1),e("span",null,"File Groups",-1)])],2)]),o[5]||(o[5]=e("div",{"flex-auto":""},null,-1)),i(m).viewFilesTab==="group"?(t(),l(u,{key:0},[e("button",{"btn-action":"",px3:"",onClick:d}," Expand All "),e("button",{"btn-action":"",px3:"",onClick:_}," Collapse All ")],64)):T("",!0)]),i(m).viewFilesTab==="group"?(t(),l("div",he,[(t(!0),l(u,null,f(i(k).filesResolved.groups,(a,h)=>(t(),x(ve,{key:a.id,open:i(v)[h],"onUpdate:open":w=>i(v)[h]=w,group:a,index:h},null,8,["open","onUpdate:open","group","index"]))),128))])):(t(),l("div",ye,[e("div",ke,[o[6]||(o[6]=e("div",{"i-ph-files-duotone":"","flex-none":""},null,-1)),e("div",null,"Matched Local Files ("+c(i(k).filesResolved.list.length)+")",1)]),e("div",_e,[(t(!0),l(u,null,f(i(k).filesResolved.list,a=>(t(),x(A,{key:a,filepath:a},null,8,["filepath"]))),128))])]))])):(t(),l("div",we,[...o[8]||(o[8]=[e("div",{p3:"","color-muted":"",italic:""}," No matched files found in the workspace. ",-1)])]))}});export{Te as default};