@kitschpatrol/eslint-config 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +2 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -48,8 +48,8 @@ ${s}`,i=`${s||""}${i}
|
|
|
48
48
|
`),i;try{let s=await Pp(n);return e.write(ht(JSON.parse(s))),e.write(`
|
|
49
49
|
`),0}catch(s){return e.write(`Error: ${s}
|
|
50
50
|
`),1}}async function Er(e,t,r=[]){if(t.command!==void 0&&typeof t.command=="string"){let n;try{let i=Cp(t.command,[...t.options??[],...r],{env:{FORCE_COLOR:"true"},stdin:"inherit"});i.stdout?.pipe(e,{end:!1}),i.stderr?.pipe(e,{end:!1}),await i,n=i.exitCode??1}catch(i){n=typeof i.exitCode=="number"?i.exitCode:1}return n}return e.write(`Error: Invalid optionCommand: ${JSON.stringify(t,void 0,2)}`),1}function os(e,t,r){e.length===0&&!t.defaultArguments&&(r.write(`Error: This command must be used with a file argument
|
|
51
|
-
`),process.exit(1))}async function ls(e,t,r,n){let i=ns({allowUnknownFlags:!1,booleanDefault:void 0,flags:_p(n),help:Ip(e,n),importMeta:import.meta}),{flags:s,input:o}=i,a=Object.keys(n).reduce((p,d)=>(s[d]&&(p[d]=n[d]),p),{}),l=xp(t,r);l.pipe(process.stdout),Object.keys(a).length===0&&n.check?
|
|
52
|
-
`)
|
|
51
|
+
`),process.exit(1))}async function ls(e,t,r,n){let i=ns({allowUnknownFlags:!1,booleanDefault:void 0,flags:_p(n),help:Ip(e,n),importMeta:import.meta}),{flags:s,input:o}=i,a=Object.keys(n).reduce((p,d)=>(s[d]&&(p[d]=n[d]),p),{}),l=xp(t,r);l.pipe(process.stdout),Object.keys(a).length===0&&(n.check===void 0?l.write(`No default check behavior implemented. Run ${e} --help for valid commands.
|
|
52
|
+
`):a.check=n.check);let u=0;for(let[p,d]of Object.entries(a))if(typeof d.command=="function"){os(o,d,l);let y=o.length===0?d.defaultArguments??[]:o,w=d.options??[];u+=await d.command(l,y,w)}else if(typeof d.command=="string")os(o,d,l),u+=await Er(l,d,o.length===0?d.defaultArguments:o);else switch(p){case"init":{let y=await yr();if(y===void 0){l.write("Error: The `--init` flag must be used in a directory with a package.json file\n"),u+=1;break}let w=await yr({cwd:Rp(import.meta.url)});if(w===void 0){l.write(`Error: The script being called was not in a package, weird.
|
|
53
53
|
`),u+=1;break}let b=vr.join(vr.dirname(w),"init/"),f=vr.dirname(y);l.write(`Copying initial configuration files from:
|
|
54
54
|
"${b}" \u2192 "${f}"
|
|
55
55
|
`);let c={command:"cp",options:["-Ri",`${b}`,`${f}`]};u+=await Er(l,c);break}case"check":{console.error("No default implementation for check"),u+=1;break}case"fix":{console.error("No default implementation for fix"),u+=1;break}case"printConfig":{let w=(o.length===0?d.defaultArguments??["."]:o)?.at(0),b=e.split("-").at(0);if(b===void 0){l.write(`Error: Could not find or parse config file for ${e}.
|