@kitschpatrol/eslint-config 3.0.2 → 3.0.4
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/readme.md +1 -1
package/bin/cli.js
CHANGED
|
@@ -44,11 +44,11 @@ ${s}`,i=`${s||""}${i}
|
|
|
44
44
|
--print-config, -p <path> Print the effective configuration at a certain path.`;break}case"help":break;case"version":break;default:console.error(`Unknown command name in generateHelpText: ${n}`)}return r+=`
|
|
45
45
|
--help, -h Print this help info.`,r+=`
|
|
46
46
|
--version, -v Print the package version.
|
|
47
|
-
`,r}function _p(e){return Object.keys(e).reduce((t,r)=>{let n={};switch(r){case"init":{n={shortFlag:"i",type:"boolean"};break}case"check":{n={aliases:["lint",""],shortFlag:"l",type:"boolean"};break}case"fix":{n={shortFlag:"f",type:"boolean"};break}case"printConfig":{n={shortFlag:"p",type:"boolean"};break}case"help":{n={
|
|
47
|
+
`,r}function _p(e){return Object.keys(e).reduce((t,r)=>{let n={};switch(r){case"init":{n={shortFlag:"i",type:"boolean"};break}case"check":{n={aliases:["lint",""],shortFlag:"l",type:"boolean"};break}case"fix":{n={shortFlag:"f",type:"boolean"};break}case"printConfig":{n={shortFlag:"p",type:"boolean"};break}case"help":{n={type:"boolean"};break}case"version":{n={type:"boolean"};break}default:console.error(`Unknown command name: ${r}`)}return t[r]=n,t},{})}async function Pp(e){let t=[];return new Promise((r,n)=>{e.on("data",i=>t.push(Buffer.from(i))),e.on("error",i=>{n(i)}),e.on("end",()=>{r(Buffer.concat(t).toString("utf8"))})})}async function as(e,t,r=[]){let n=new Ap,i=await Er(n,t,r);if(n.end(),i!==0)return e.write(`Error printing config.
|
|
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===void 0?l.write(`
|
|
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(`This command requires options. Run ${e} --help for valid commands.
|
|
52
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}"
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -13,7 +13,7 @@ To use just this ESLint config in isolation:
|
|
|
13
13
|
1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
pnpm dlx @kitschpatrol/repo-config
|
|
16
|
+
pnpm dlx @kitschpatrol/repo-config --init
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
2. Add the package:
|