@jsse/eslint-config 0.9.2 → 0.9.3
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/CHANGELOG.md +11 -0
- package/dist/cli.js +1 -1
- package/dist/fixable-rules-map-Cdv6wg6P.d.ts +488 -0
- package/dist/fixable.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +417 -374
- package/dist/{fixable-rules-map-CCZ-PRHv.d.ts → rule-types-DKF8Uy8X.d.ts} +188 -621
- package/dist/rule-types.d.ts +2 -0
- package/dist/rule-types.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @jsse/eslint-config
|
|
2
2
|
|
|
3
|
+
## 0.9.3
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Update lint defaults for JSDoc and TypeScript.
|
|
7
|
+
|
|
8
|
+
- Configure `jsdoc/tag-lines` to only remove trailing empty JSDoc lines.
|
|
9
|
+
- Tighten TypeScript assertions, unused expression handling, and useless
|
|
10
|
+
constructor checks with TypeScript-aware rules.
|
|
11
|
+
- Reuse shared plugin exports in the plugin registry to avoid duplicate package
|
|
12
|
+
imports.
|
|
13
|
+
|
|
3
14
|
## 0.9.2
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/cli.js
CHANGED
|
@@ -1145,7 +1145,7 @@ ${n?` \$completionArgs += @(${n})
|
|
|
1145
1145
|
`),n.kind===`literal`){let e=n.description==null?``:$(k(n.description,{colors:!1})),t=$(n.text);yield`${t}\t${t}\t${e}`}else{let e=Da(n.extensions),t=n.includeHidden?`1`:`0`,r=n.description==null?``:$(k(n.description,{colors:!1})),i=Ea(n.pattern??``);yield`__FILE__:${n.type}:${e}:${i}:${t}\t[file]\t${r}`}t++}}};function Na(...e){let t={[Gn]:!0};return Xr(...e,t)}const Pa=typeof SuppressedError==`function`?SuppressedError:(()=>{class e extends Error{error;suppressed;constructor(e,t,n){super(n),this.name=`SuppressedError`,this.error=e,this.suppressed=t}}return e})();function Fa(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function Ia(e,t,n){if(!t)return e;if(!(n!=null&&n.size===0&&typeof e==`object`&&e)&&!(n!=null&&n.size>0&&typeof e==`object`&&e&&!Fa(e)&&!Array.isArray(e))){if(n!=null&&n.size>0&&typeof e==`object`&&e&&(Fa(e)||Array.isArray(e))){let t=e=>{let t=n.get(e);if(t!==void 0)return t;if(typeof e==`string`){let t=Number(e);if(Number.isInteger(t))return n.get(t)}else if(typeof e==`number`)return n.get(String(e))},r=Reflect.ownKeys(e),i=!1;for(let e of r)if(t(e)!==void 0){i=!0;break}if(i){let n=Array.isArray(e),i=!0;for(let a of r){if(n&&a===`length`)continue;let r=Object.getOwnPropertyDescriptor(e,a);if(r!=null&&`value`in r&&t(a)===void 0){i=!1;break}}if(i)return;let a=n?Array(e.length):Object.create(Object.getPrototypeOf(e));for(let n of r){let r=Object.getOwnPropertyDescriptor(e,n);if(r==null)continue;let i=t(n);`value`in r&&i!==void 0?i===null?Object.defineProperty(a,n,{...r,value:void 0}):Object.defineProperty(a,n,{...r,value:Ia(r.value,!0,i)}):Object.defineProperty(a,n,r)}return a}return}if(!(typeof e!=`object`||!e))return e}}function La(e,t){return t.length>0&&t.length===e.length&&t.every((t,n)=>t===e[n])}function Ra(e,t,n){return{remainingArgs:t.slice(n),consumedCount:e.length-t.length+n}}function za(e){return{usage:e.usage,phase:`parse`,path:[],commandPath:[],trace:Ct()}}function Ba(e){return e?.commandPath??[]}function Va(e,t){let n=R();return{...e,phase:`complete`,dependencyRuntime:n,dependencyRegistry:n.registry,commandPath:Ba(t.exec)??e.commandPath,trace:t.exec?.trace??t.trace??e.trace}}function Ha(e,t,n=`complete`){let r=g(e.initialState),i=za(e),a=Dt({buffer:t,state:e.initialState,optionsTerminated:!1},i);do{let n=e.parse(a);if(!n.success){let e=Ra(t,a.buffer,n.consumed);return{kind:`failure`,error:n.error,remainingArgs:e.remainingArgs,consumedCount:e.consumedCount,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}let r=a.buffer;if(a=n.next,La(r,a.buffer)){let e=Ra(t,r,n.consumed.length);return{kind:`failure`,error:w`Unexpected option or argument: ${a.buffer[0]}.`,remainingArgs:e.remainingArgs,consumedCount:e.consumedCount,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}}while(a.buffer.length>0);if(n===`parse-only`)return{kind:`success`,value:void 0};let o=e.complete(a.state,Va(i,a));return o.success?{kind:`success`,value:r?h(o.value):o.value}:{kind:`failure`,error:o.error,remainingArgs:[],consumedCount:t.length,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}async function Ua(e,t,n=`complete`){let r=g(e.initialState),i=za(e),a=Dt({buffer:t,state:e.initialState,optionsTerminated:!1},i);do{let n=await e.parse(a);if(!n.success){let e=Ra(t,a.buffer,n.consumed);return{kind:`failure`,error:n.error,remainingArgs:e.remainingArgs,consumedCount:e.consumedCount,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}let r=a.buffer;if(a=n.next,La(r,a.buffer)){let e=Ra(t,r,n.consumed.length);return{kind:`failure`,error:w`Unexpected option or argument: ${a.buffer[0]}.`,remainingArgs:e.remainingArgs,consumedCount:e.consumedCount,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}}while(a.buffer.length>0);if(n===`parse-only`)return{kind:`success`,value:void 0};let o=await e.complete(a.state,Va(i,a));return o.success?{kind:`success`,value:r?h(o.value):o.value}:{kind:`failure`,error:o.error,remainingArgs:[],consumedCount:t.length,optionsTerminated:a.optionsTerminated,commandPath:Ba(a.exec)}}function Wa(e,t){let n={usage:e.usage,phase:`parse`,path:[],commandPath:[],trace:Ct()},r=R();return{...n,phase:`complete`,dependencyRuntime:r,dependencyRegistry:r.registry,commandPath:Ba(t.exec),trace:t.exec?.trace??t.trace??n.trace}}function Ga(e,t){let n={usage:e.usage,phase:`parse`,path:[],commandPath:[],trace:Ct()};return Dt({buffer:t,state:e.initialState,optionsTerminated:!1},n)}function Ka(e,t){let n=Ga(e,t);do{let t=e.parse(n);if(!t.success)return K(e,n.state,Wa(e,n));let r=n.buffer;if(n=t.next,La(r,n.buffer))return K(e,n.state,Wa(e,n))}while(n.buffer.length>0);return K(e,n.state,Wa(e,n))}async function qa(e,t){let n=Ga(e,t);do{let t=await e.parse(n);if(!t.success)return await K(e,n.state,Wa(e,n));let r=n.buffer;if(n=t.next,La(r,n.buffer))return await K(e,n.state,Wa(e,n))}while(n.buffer.length>0);return await K(e,n.state,Wa(e,n))}function Ja(e){let[,t,...n]=e;return t==null?void 0:[t,...n]}function Ya(e,t){let n=null,r=null;if(e){let t=e.names??[`help`],r=Hi(da(Gi({metavar:`COMMAND`}),{description:w`Command name to show help for.`})),i=Ja(t);n=Ca(t[0],r,{description:w`Show help information.`,...i==null?{}:{[Kn]:i},hidden:e.hidden})}return t&&(r=ua(...t.names??[`--help`],{description:w`Show help information.`,hidden:t.hidden})),{helpCommand:n,helpOption:r}}function Xa(e,t){let n=null,r=null;if(e){let t=e.names??[`version`],r=di({}),i=Ja(t);n=Ca(t[0],r,{description:w`Show version information.`,...i==null?{}:{[Kn]:i},hidden:e.hidden})}return t&&(r=ua(...t.names??[`--version`],{description:w`Show version information.`,hidden:t.hidden})),{versionCommand:n,versionOption:r}}const Za=Symbol(`@optique/core/facade/meta`);function Qa(e,t,n,r){let i=null,a=null,o=[];for(let e in t)o.length>0&&o.push(T(`, `)),o.push(O(e));let s=di({shell:zi(da(Gi({metavar:`SHELL`}),{description:w`Shell type (${o}). Generate completion script when used alone, or provide completions when followed by arguments.`})),args:Hi(da(Gi({metavar:`ARG`}),{description:w`Command line arguments for completion suggestions (used by shell integration; you usually don't need to provide this).`}))});if(n){let t=n.names??[`completion`],r=t[0],a={brief:w`Generate shell completion script or provide completions.`,description:w`Generate shell completion script or provide completions.`,footer:w`Examples:${le()} Bash: ${ce(`eval "$(${e} ${r} bash)"`)}${le()} zsh: ${ce(`eval "$(${e} ${r} zsh)"`)}${le()} fish: ${ce(`eval "$(${e} ${r} fish)"`)}${le()} PowerShell: ${ce(`${e} ${r} pwsh > ${e}-completion.ps1; . ./${e}-completion.ps1`)}${le()} Nushell: ${ce(`${e} ${r} nu | save ${e}-completion.nu; source ./${e}-completion.nu`)}`},o=Ja(t);i=Ca(t[0],s,{...a,...o==null?{}:{[Kn]:o},hidden:n.hidden})}if(r){let e=r.names??[`--completion`],t=[];for(let n of e)t.push(la(n,Gi({metavar:`SHELL`}),{description:w`Generate shell completion script.`,hidden:r.hidden}));a=di({shell:t.length===1?t[0]:Xr(...t),args:Vi(Hi(da(Gi({metavar:`ARG`}),{description:w`Command line arguments for completion suggestions (used by shell integration; you usually don't need to provide this).`})),[])})}return{completionCommand:i,completionOption:a}}function $a(e){return{mode:`sync`,$valueType:[],$stateType:[],priority:200,usage:e.usage,leadingNames:e.leadingNames,acceptingAnyToken:!1,initialState:null,parse:()=>({success:!1,error:w`Documentation-only meta option.`,consumed:0}),complete:e=>({success:!0,value:e}),suggest:function*(){},getDocFragments:(t,n)=>e.getDocFragments({kind:`available`,state:e.initialState},n)}}function eo(e,t,n,r,i){let a=[];if(t.helpOption){let e=$a(t.helpOption),n=i?.helpOptionGroup?pi(i.helpOptionGroup,e):e;a.push(n)}if(n.versionOption){let e=$a(n.versionOption),t=i?.versionOptionGroup?pi(i.versionOptionGroup,e):e;a.push(t)}if(n.versionCommand){let e=di({[Za]:Z(!0),help:Z(!1),version:Z(!0),completion:Z(!1),result:n.versionCommand,helpFlag:t.helpOption?zi(t.helpOption):Z(!1)});a.push(i?.versionCommandGroup?pi(i.versionCommandGroup,e):e)}if(r.completionCommand){let e=di({[Za]:Z(!0),help:Z(!1),version:Z(!1),completion:Z(!0),completionData:r.completionCommand,helpFlag:t.helpOption?zi(t.helpOption):Z(!1)});a.push(i?.completionCommandGroup?pi(i.completionCommandGroup,e):e)}if(t.helpCommand){let e=di({[Za]:Z(!0),help:Z(!0),version:Z(!1),completion:Z(!1),commands:t.helpCommand});a.push(i?.helpCommandGroup?pi(i.helpCommandGroup,e):e)}a.push(di({[Za]:Z(!0),help:Z(!1),version:Z(!1),completion:Z(!1),result:e}));let o=a.length-1;if(a.length===1)return a[0];let s=Na(...a),c=s.usage[0];if(c?.type===`exclusive`&&o>0){let e=[...c.terms],[r]=e.splice(o,1),i=+!!t.helpOption+ +!!n.versionOption;e.splice(i,0,r),s={...s,usage:[{...c,terms:e}]}}return s}function to(e,t,n,r,i){let a;for(let o=0;o<e.length;o++){let s=e[o];n.includes(s)?a={index:o,kind:`help`}:r.includes(s)&&(a={index:o,kind:`version`});let c=i.find(e=>s.startsWith(e+`=`));if(c!=null)return{lastHelpVersion:a,completion:{index:o,shell:s.slice(c.length+1),args:t.slice(o+1)}};if(i.includes(s)){let n=e[o+1]??``;return{lastHelpVersion:a,completion:{index:o,shell:n,args:n===``?[]:t.slice(o+2)}}}}return{lastHelpVersion:a}}function no(e,t,n){let r=[...e];for(let e=0;e<n;e++){let n=t[e];n.startsWith(`-`)||r.push(n)}return r}function ro(e,t,n,r,i,a,o){if(e.remainingArgs.length<1)return{type:`error`,error:e.error};let s=e.consumedCount>0,c=e.remainingArgs[0];if(!s&&o.includes(c)){let n=e.remainingArgs[1];return t.includes(n)?{type:`help`,commands:[c]}:{type:`completion`,source:`command`,shell:n??``,args:e.remainingArgs.slice(2)}}let{lastHelpVersion:l,completion:u}=to(e.optionsTerminated?[]:(()=>{let t=e.remainingArgs.indexOf(`--`);return t>=0?e.remainingArgs.slice(0,t):e.remainingArgs})(),e.remainingArgs,t,r,a);if(!s&&i.includes(c)){let n=e.remainingArgs[1];if(t.includes(n))return{type:`help`,commands:[c]};let r=u?.index===1;return n==null||r||l?.index===1&&l.kind===`version`?{type:`version`}:{type:`error`,error:e.error}}let d;!s&&n.includes(c)&&(d={index:0,kind:`help`});let f=l==null?d:d==null||l.index>=d.index?l:d;return f?.kind===`help`?f===d?{type:`help`,commands:e.remainingArgs.slice(1)}:{type:`help`,commands:no(e.commandPath,e.remainingArgs,f.index),preferUserCommandDocs:e.commandPath.length>0}:f?.kind===`version`?{type:`version`}:u==null?{type:`error`,error:e.error}:{type:`completion`,source:`option`,shell:u.shell,commandPath:e.commandPath,args:u.args}}function io(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h=[]){let g=e[0]||``,_=e.slice(1),v=e=>s(e),y=e=>o(e);if(!g){if(a(`Error: Missing shell name for completion.
|
|
1146
1146
|
`),r){let e=Bt(r,[p?f??`--completion`:d??`completion`]);e&&a(Ue(t,e,{colors:l,maxWidth:u,sectionOrder:m}))}return P(n.mode,()=>{let e=v(1);if(e instanceof Promise)throw new Do(`Synchronous parser returned async result.`);return e},async()=>v(1))}let b=c[g];if(!b){let e=[];for(let t in c)e.length>0&&e.push(T(`, `)),e.push(O(t));return a(k(w`Error: Unsupported shell ${g}. Available shells: ${e}.`,{colors:l,quotes:!l})),P(n.mode,()=>{let e=v(1);if(e instanceof Promise)throw new Do(`Synchronous parser returned async result.`);return e},async()=>v(1))}if(_.length===0){let e=p?f??`--completion`:d??`completion`;return i(b.generateScript(t,[e,g])),P(n.mode,()=>{let e=y(0);if(e instanceof Promise)throw new Do(`Synchronous parser returned async result.`);return e},async()=>y(0))}return P(n.mode,()=>{let e=oo(n,_,h),t=ao(e.suggestions,_,h,e.argumentContext);for(let e of b.encodeSuggestions(t))i(e);let r=y(0);if(r instanceof Promise)throw new Do(`Synchronous parser returned async result.`);return r},async()=>{let e=await so(n,_,h);for(let t of b.encodeSuggestions(ao(e.suggestions,_,h,e.argumentContext)))i(t);return y(0)})}function ao(e,t,n,r){if(n.length===0)return e;let i=t.at(-1)??``;if(r.optionsTerminated||r.completingOptionValue||r.completedRootOption||!(i===``||i.startsWith(`--`)||i.startsWith(`-`)||i.startsWith(`/`)||i.startsWith(`+`)))return e;let a=new Set(e.flatMap(e=>e.kind===`literal`?[e.text]:[])),o=[...e];for(let e of n)i===`-`&&e.text.startsWith(`--`)||i!==``&&!e.text.startsWith(i)||a.has(e.text)||(o.push(e),a.add(e.text));return o}function oo(e,t,n){let r=t.at(-1)??``,i=mo(e,t.slice(0,-1));for(;i.buffer.length>0;){let t=e.parse(i);if(t instanceof Promise)throw new Do(`Synchronous parser returned async result.`);if(!t.success){let a=ho(t,i,e,n);return{suggestions:Array.from(e.suggest(lo(e,i),r)),argumentContext:a}}let a=i.buffer;if(i=t.next,go(a,i.buffer))return{suggestions:[],argumentContext:co(i)}}return{suggestions:Array.from(e.suggest(lo(e,i),r)),argumentContext:co(i)}}async function so(e,t,n){let r=t.at(-1)??``,i=mo(e,t.slice(0,-1));for(;i.buffer.length>0;){let t=await e.parse(i);if(!t.success){let a=ho(t,i,e,n),o=[],s=await uo(e,i);for await(let t of e.suggest(s,r))o.push(t);return{suggestions:o,argumentContext:a}}let a=i.buffer;if(i=t.next,go(a,i.buffer))return{suggestions:[],argumentContext:co(i)}}let a=[],o=await uo(e,i);for await(let t of e.suggest(o,r))a.push(t);return{suggestions:a,argumentContext:co(i)}}function co(e){return{completingOptionValue:!1,completedRootOption:!1,optionsTerminated:e.optionsTerminated}}function lo(e,t){let n=R(),r=po(e,t.state,t.exec?.path??[]);return r.length>0&&ln(r,n),fo(t,n)}async function uo(e,t){let n=R(),r=po(e,t.state,t.exec?.path??[]);return r.length>0&&await fn(r,n),fo(t,n)}function fo(e,t){return{...e,dependencyRegistry:t.registry,exec:e.exec?{...e.exec,dependencyRuntime:t,dependencyRegistry:t.registry}:void 0}}function po(e,t,n){return typeof e.getSuggestRuntimeNodes==`function`?e.getSuggestRuntimeNodes(t,n):e.dependencyMetadata?.source==null?[]:[{path:n,parser:e,state:t}]}function mo(e,t){return Dt({buffer:t,state:e.initialState,optionsTerminated:!1},{usage:e.usage,phase:`suggest`,path:[],trace:Ct()})}function ho(e,t,n,r){let i=_o(n.usage,t.exec?.commandPath??[],e.consumed>0,n.leadingNames),a=t.buffer[0];return{completingOptionValue:(e.consumed===0||e.consumed===1)&&i.has(a),completedRootOption:e.consumed===0&&xo(a,r),optionsTerminated:t.optionsTerminated}}function go(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function _o(e,t,n,r){let i={value:new Set,flag:new Set};if(t.length===0)return vo(e,i,r),i.value;bo(e,t,i,!1,n);let a=new Set(i.value);for(let e of i.flag)a.delete(e);return a}function vo(e,t,n){for(let r of e)yo(r,t,n)}function yo(e,t,n){switch(e.type){case`option`:for(let r of e.names)n.has(r)&&(e.metavar==null?t.flag.add(r):t.value.add(r));return;case`optional`:case`multiple`:case`sequence`:vo(e.terms,t,n);return;case`exclusive`:for(let r of e.terms)vo(r,t,n);return;case`argument`:case`command`:case`literal`:case`passthrough`:case`ellipsis`:return}}function bo(e,t,n,r,i){if(t.length===0){So(e,n,!1);return}let[a,...o]=t;for(let s=0;s<e.length;s++){let c=e[s];if(c.type===`command`&&c.name===a){let t=e.slice(s+1);o.length===0?So(t,n,!r&&i):bo(t,o,n,r,i)}else if(c.type===`exclusive`)for(let e of c.terms)bo(e,t,n,!0,i);else(c.type===`optional`||c.type===`multiple`||c.type===`sequence`)&&bo(c.terms,t,n,r,i)}}function xo(e,t){return e!=null&&t.some(t=>e===t.text||e.startsWith(`${t.text}=`))}function So(e,t,n){for(let r of e)if(Co(r,t,n))return}function Co(e,t,n){switch(e.type){case`command`:return!n;case`option`:if(e.metavar!=null)for(let n of e.names)t.value.add(n);else for(let n of e.names)t.flag.add(n);return!1;case`optional`:case`multiple`:case`sequence`:return So(e.terms,t,n),!1;case`exclusive`:for(let n of e.terms)So(n,t,!1);return!1;case`argument`:case`literal`:case`passthrough`:case`ellipsis`:return!1}}function wo(e,t,n,r){let i=[];return e!=null&&!M(e.hidden)&&i.push(...t.map(e=>({kind:`literal`,text:e}))),n!=null&&!M(n.hidden)&&i.push(...r.map(e=>({kind:`literal`,text:e}))),i}function To(e){if(typeof e!=`string`)throw TypeError(`Expected version value to be a string, but got ${Array.isArray(e)?`array`:typeof e}.`);if(e===``)throw TypeError(`Version value must not be empty.`);if(/[\x00-\x1f\x7f]/.test(e))throw TypeError(`Version value must not contain control characters.`);return e}function Eo(e,t,n,r){let i=typeof t!=`string`,a,o,s,c;if(i){let r=e;a=r.parser,o=r.metadata.name,s=t,c=n??{},c={...c,brief:c.brief??r.metadata.brief,description:c.description??r.metadata.description,examples:c.examples??r.metadata.examples,author:c.author??r.metadata.author,bugs:c.bugs??r.metadata.bugs,footer:c.footer??r.metadata.footer}}else a=e,o=t,s=n,c=r??{};_e(o);let{colors:l,maxWidth:u,showDefault:d,showChoices:f,sectionOrder:p,aboveError:m=`usage`,onError:h=()=>{throw new Do(`Failed to parse command line arguments.`)},stderr:g=console.error,stdout:_=console.log,brief:v,description:y,examples:b,author:ee,bugs:te,footer:ne}=c,re=e=>e===!0?{}:e,x=re(c.help?.command),S=re(c.help?.option),ie=c.help?.onShow??(()=>({})),ae=re(c.version?.command),C=re(c.version?.option),T=c.version?To(c.version.value):void 0,oe=c.version?.onShow??(()=>({})),D=re(c.completion?.command),O=re(c.completion?.option),se=c.completion?.onShow??(()=>({})),ce=e=>se(e),le=e=>h(e);S?.names&&pe(S.names,`Help option`),x?.names&&me(x.names,`Help command`),C?.names&&pe(C.names,`Version option`),ae?.names&&me(ae.names,`Version command`),O?.names&&pe(O.names,`Completion option`),D?.names&&me(D.names,`Completion command`);let ue=S?.names??[`--help`],de=x?.names??[`help`],fe=C?.names??[`--version`],A=ae?.names??[`version`],ge=D?.names??[`completion`],ve=O?.names??[`--completion`],ye=wo(S,ue,C,fe),j=[];c.help&&S&&j.push([`option`,`help option`,ue]),c.help&&x&&j.push([`command`,`help command`,de]),c.version&&C&&j.push([`option`,`version option`,fe]),c.version&&ae&&j.push([`command`,`version command`,A]),c.completion&&O&&j.push([`option`,`completion option`,ve,!0]),c.completion&&D&&j.push([`command`,`completion command`,ge]),he(j);let be={bash:Oa,fish:Aa,nu:ja,pwsh:Ma,zsh:ka},M=c.completion?.shells?{...be,...c.completion.shells}:be,xe=c.help?Ya(x,S):{helpCommand:null,helpOption:null},Se=c.version?Xa(ae,C):{versionCommand:null,versionOption:null},N=c.completion?Qa(o,M,D,O):{completionCommand:null,completionOption:null},Ce=!c.help&&!c.version&&!c.completion?a:eo(a,xe,Se,N,{helpCommandGroup:x?.group,helpOptionGroup:S?.group,versionCommandGroup:ae?.group,versionOptionGroup:C?.group,completionCommandGroup:D?.group,completionOptionGroup:O?.group}),Te=e=>{switch(e.type){case`success`:return e.value;case`version`:return _(T),oe(0);case`completion`:return io([e.shell,...e.commandPath??[],...e.args],o,a,e.source===`command`?N.completionCommand:N.completionOption,_,g,ce,le,M,l,u,ge[0],ve[0],e.source===`option`,p,ye);case`help`:{let t,n,r=x!=null,i=ae!=null,s=D!=null,c=S!=null,m=C!=null,re=O!=null,T=e.commands[0];if(T!=null&&!e.preferUserCommandDocs&&ge.includes(T)&&s&&N.completionCommand)t=N.completionCommand,n=t;else if(T!=null&&!e.preferUserCommandDocs&&de.includes(T)&&r&&xe.helpCommand)t=xe.helpCommand,n=t;else if(T!=null&&!e.preferUserCommandDocs&&A.includes(T)&&i&&Se.versionCommand)t=Se.versionCommand,n=t;else{let o=[a],l={},u=[],d=(e,t)=>{t?(l[t]??=[]).push(e):u.push(e)};r&&xe.helpCommand&&d(xe.helpCommand,x?.group),i&&Se.versionCommand&&d(Se.versionCommand,ae?.group),s&&N.completionCommand&&d(N.completionCommand,D?.group),o.push(...u);for(let[e,t]of Object.entries(l))t.length===1?o.push(pi(e,t[0])):o.push(pi(e,Xr(...t)));let f={},p=[],h=(e,t)=>{t?(f[t]??=[]).push(e):p.push(e)};c&&xe.helpOption&&h(xe.helpOption,S?.group),m&&Se.versionOption&&h(Se.versionOption,C?.group),re&&N.completionOption&&h(N.completionOption,O?.group),o.push(...p);for(let[e,t]of Object.entries(f))t.length===1?o.push(pi(e,t[0])):o.push(pi(e,Xr(...t)));t=o.length===1?o[0]:Na(...o),n=e.commands.length>0?a:t}let oe=e=>{g(`Usage: ${Oo(we(o,Ce.usage,{colors:l,maxWidth:u==null?void 0:u-7,expandCommands:!0}),7)}`);let t=k(e,{colors:l,quotes:!l});return g(`Error: ${t}`),h(1)},se=t=>{if(t!=null){let n=T!=null&&ge.includes(T)||T!=null&&de.includes(T)||T!=null&&A.includes(T),r=e.commands.length>0,i=!r,a=!n&&!r,s={...t,brief:a?v??t.brief:t.brief,description:a?y??t.description:t.description,examples:i&&!n?b??t.examples:void 0,author:i&&!n?ee??t.author:void 0,bugs:i&&!n?te??t.bugs:void 0,footer:a?ne??t.footer:t.footer??ne};_(Ue(o,s,{colors:l,maxWidth:u,showDefault:d,showChoices:f,sectionOrder:p}))}return ie(0)};if(e.commands.length>0){let r={buffer:[...e.commands],optionsTerminated:!1,state:t.initialState,usage:t.usage},i=e=>e.success?e.consumed.length<1?w`Unexpected option or subcommand: ${E(r.buffer[0])}.`:(r={...r,buffer:e.next.buffer,optionsTerminated:e.next.optionsTerminated,state:e.next.state,usage:e.next.usage??r.usage},r.buffer.length>0?`continue`:null):e.error,a=`continue`;for(;a===`continue`;){let o=t.parse(r);if(o instanceof Promise)return o.then(async a=>{let o=i(a);for(;o===`continue`;){let e=t.parse(r),n=e instanceof Promise?await e:e;o=i(n)}if(o!=null)return oe(o);let s=Bt(n,e.commands);return s instanceof Promise?s.then(se):se(s)});a=i(o)}if(a!=null)return oe(a)}let ce=Bt(n,e.commands);return ce instanceof Promise?ce.then(se):se(ce)}case`error`:{let t=(t,n)=>{let r=n;if(r===`help`)if(t==null)r=`usage`;else{let e={...t,brief:v??t.brief,description:y??t.description,examples:b??t.examples,author:ee??t.author,bugs:te??t.bugs,footer:ne??t.footer};g(Ue(o,e,{colors:l,maxWidth:u,showDefault:d,showChoices:f}))}r===`usage`&&g(`Usage: ${Oo(we(o,Ce.usage,{colors:l,maxWidth:u==null?void 0:u-7,expandCommands:!0}),7)}`);let i=k(e.error,{colors:l,quotes:!l});return g(`Error: ${i}`),h(1)};if(m===`help`){let e=Bt(s.length<1?Ce:a,s);return e instanceof Promise?e.then(e=>t(e,m)):t(e,m)}return t(void 0,m)}default:throw new Do(`Unexpected parse result type`)}},Ee=a.mode;return P(Ee,()=>{let e=Ha(a,s),t=e.kind===`success`?{type:`success`,value:e.value}:ro(e,S?[...ue]:[],x?[...de]:[],C?[...fe]:[],ae?[...A]:[],O?[...ve]:[],D?[...ge]:[]),n=Te(t);if(n instanceof Promise)throw new Do(`Synchronous parser returned async result.`);return n},async()=>{let e=await Ua(a,s),t=e.kind===`success`?{type:`success`,value:e.value}:ro(e,S?[...ue]:[],x?[...de]:[],C?[...fe]:[],ae?[...A]:[],O?[...ve]:[],D?[...ge]:[]),n=Te(t);return n instanceof Promise?await n:n})}var Do=class extends Error{constructor(e){super(e),this.name=`RunParserError`}};function Oo(e,t){return e.split(`
|
|
1147
1147
|
`).join(`
|
|
1148
|
-
`+` `.repeat(t))}function ko(e){return e.type===`help`||e.type===`version`||e.type===`completion`}function Ao(e,t){let n=e=>e===!0?{}:e,r=n(t.help?.option),i=n(t.help?.command),a=n(t.version?.option),o=n(t.version?.command),s=n(t.completion?.option),c=n(t.completion?.command);return ro(e,r?[...r.names??[`--help`]]:[],i?[...i.names??[`help`]]:[],a?[...a.names??[`--version`]]:[],o?[...o.names??[`version`]]:[],s?[...s.names??[`--completion`]]:[],c?[...c.names??[`completion`]]:[])}function jo(e,t){return t&&(e.help!=null||e.version!=null||e.completion!=null)}async function Mo(e,t,n){let r=await Ua(e,t,`parse-only`);return r.kind===`success`?!1:ko(Ao(r,n))}function No(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n];for(let e of Object.getOwnPropertySymbols(r))t[e]=r[e]}return t}function Po(e){for(let t of e){let e=t.phase;if(e!==`single-pass`&&e!==`two-pass`)throw TypeError(`Context ${String(t.id)} must declare phase as "single-pass" or "two-pass".`)}}async function Fo(e,t){let n=[],r;for(let i of e){let e={phase:`phase1`},a=i.getAnnotations(e,t),o=a instanceof Promise?await a:a,s=i.getInternalAnnotations?.(e,o),c=s==null?o:No([o,s]);n.push(c),r==null?i.phase===`two-pass`&&(r=[...n]):r.push(c)}return{annotations:No(n),needsTwoPhase:r!=null,snapshots:r??[]}}async function Io(e,t,n,r,i,a){let o=[],s=Ia(n,i,a);for(let n=0;n<e.length;n++){let i=e[n];if(i.phase===`single-pass`){o.push(t[n]);continue}let a={phase:`phase2`,parsed:s},c=i.getAnnotations(a,r),l=c instanceof Promise?await c:c,u=i.getInternalAnnotations?.(a,l),d=u==null?l:No([l,u]);o.push(d)}return{annotations:No(o)}}async function Lo(e){let t=[];for(let n of e)try{Symbol.asyncDispose in n&&typeof n[Symbol.asyncDispose]==`function`?await n[Symbol.asyncDispose]():Symbol.dispose in n&&typeof n[Symbol.dispose]==`function`&&n[Symbol.dispose]()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Failed to dispose one or more source contexts.`)}async function Ro(e,t,n,r,i){ye(n),Po(n);let a=i.contextOptions,{annotations:o,needsTwoPhase:s,snapshots:c}=await Fo(n,a);if(jo(i,s)){let n=Bo(e,o);if(await Mo(n,r,i))return e.mode===`async`?Eo(n,t,r,i):Promise.resolve(Eo(n,t,r,i))}let l=Bo(e,o);if(!s)return e.mode===`async`?Eo(l,t,r,i):Promise.resolve(Eo(l,t,r,i));let u=await P(e.mode,()=>Ka(l,r),()=>qa(l,r));if(u==null){let n=Bo(e,o);return e.mode===`async`?Eo(n,t,r,i):Promise.resolve(Eo(n,t,r,i))}let{annotations:d}=await Io(n,c,u.value,a,u.deferred,u.deferredKeys),f=Bo(e,d);return e.mode===`async`?Eo(f,t,r,i):Promise.resolve(Eo(f,t,r,i))}async function zo(e,t,n,r){let i=r?.args??[];if(n.length===0)return e.mode===`async`?Eo(e,t,i,r):Promise.resolve(Eo(e,t,i,r));let a,o,s=!1;try{a=await Ro(e,t,n,i,r)}catch(e){s=!0,o=e}try{await Lo(n)}catch(e){throw s?new Pa(e,o,`An error was suppressed during context disposal.`):e}if(s)throw o;return a}function Bo(e,t){let n=m(e.initialState,t),r={...Object.getOwnPropertyDescriptors(e)},i=r.initialState;return r.initialState=i==null?{value:n,writable:!0,enumerable:!0,configurable:!0}:`get`in i||`set`in i?{value:n,writable:!0,enumerable:i.enumerable??!0,configurable:i.configurable??!0}:{value:n,writable:i.writable??!0,enumerable:i.enumerable??!0,configurable:i.configurable??!0},Object.create(Object.getPrototypeOf(e),r)}function Vo(e){return{brief:e.brief,description:e.description,examples:e.examples,author:e.author,bugs:e.bugs,footer:e.footer}}function Ho(e,t){return`parser`in e&&`metadata`in e?{parser:e.parser,options:t.programName==null?{...t,programName:e.metadata.name}:t,programMetadata:Vo(e.metadata)}:{parser:e,options:t}}function Uo(e,t={}){return Go(e,t)}function Wo(e,t){let i=e.programName??r.basename(n.argv[1]??`cli`),a=e.args??n.argv.slice(2),o=e.stdout??(e=>{n.stdout.write(`${e}\n`)}),s=e.stderr??(e=>{n.stderr.write(`${e}\n`)}),c=e.onExit??(e=>n.exit(e)),l=e.colors??n.stdout.isTTY,u=e.maxWidth??n.stdout.columns,d=e.showDefault,f=e.showChoices,p=e.sectionOrder,m=e.help,h=e.version,g=e.completion,_=e.aboveError??`usage`,v=e.errorExitCode??1,y=e.brief??t?.brief,b=e.description??t?.description,ee=e.examples??t?.examples,te=e.author??t?.author,ne=e.bugs??t?.bugs,re=e.footer??t?.footer,x=()=>c(0);return{programName:i,args:a,coreOptions:{stderr:s,stdout:o,colors:l,maxWidth:u,showDefault:d,showChoices:f,sectionOrder:p,help:(()=>{if(m){if(typeof m==`string`)switch(m){case`command`:return{command:!0,onShow:x};case`option`:return{option:!0,onShow:x};case`both`:return{command:!0,option:!0,onShow:x}}return{...m,onShow:x}}})(),version:(()=>{if(h)return typeof h==`string`?{value:h,option:!0,onShow:x}:{...h,onShow:x}})(),completion:(()=>{if(g){if(typeof g==`string`)switch(g){case`command`:return{command:!0,onShow:x};case`option`:return{option:!0,onShow:x};case`both`:return{command:!0,option:!0,onShow:x}}return{...g,onShow:x}}})(),aboveError:_,brief:y,description:b,examples:ee,author:te,bugs:ne,footer:re,onError(){return c(v)}}}}function Go(e,t={}){let n=Ho(e,t),{parser:r,programMetadata:i}=n;t=n.options;let a=t.contexts;if(a&&a.length>0){let{programName:e,args:n,coreOptions:o}=Wo(t,i);return zo(r,e,a,{...o,contextOptions:t.contextOptions,args:n})}let{programName:o,args:s,coreOptions:c}=Wo(t,i);return Eo(r,o,s,c)}const Ko=`0.9.
|
|
1148
|
+
`+` `.repeat(t))}function ko(e){return e.type===`help`||e.type===`version`||e.type===`completion`}function Ao(e,t){let n=e=>e===!0?{}:e,r=n(t.help?.option),i=n(t.help?.command),a=n(t.version?.option),o=n(t.version?.command),s=n(t.completion?.option),c=n(t.completion?.command);return ro(e,r?[...r.names??[`--help`]]:[],i?[...i.names??[`help`]]:[],a?[...a.names??[`--version`]]:[],o?[...o.names??[`version`]]:[],s?[...s.names??[`--completion`]]:[],c?[...c.names??[`completion`]]:[])}function jo(e,t){return t&&(e.help!=null||e.version!=null||e.completion!=null)}async function Mo(e,t,n){let r=await Ua(e,t,`parse-only`);return r.kind===`success`?!1:ko(Ao(r,n))}function No(e){let t={};for(let n=e.length-1;n>=0;n--){let r=e[n];for(let e of Object.getOwnPropertySymbols(r))t[e]=r[e]}return t}function Po(e){for(let t of e){let e=t.phase;if(e!==`single-pass`&&e!==`two-pass`)throw TypeError(`Context ${String(t.id)} must declare phase as "single-pass" or "two-pass".`)}}async function Fo(e,t){let n=[],r;for(let i of e){let e={phase:`phase1`},a=i.getAnnotations(e,t),o=a instanceof Promise?await a:a,s=i.getInternalAnnotations?.(e,o),c=s==null?o:No([o,s]);n.push(c),r==null?i.phase===`two-pass`&&(r=[...n]):r.push(c)}return{annotations:No(n),needsTwoPhase:r!=null,snapshots:r??[]}}async function Io(e,t,n,r,i,a){let o=[],s=Ia(n,i,a);for(let n=0;n<e.length;n++){let i=e[n];if(i.phase===`single-pass`){o.push(t[n]);continue}let a={phase:`phase2`,parsed:s},c=i.getAnnotations(a,r),l=c instanceof Promise?await c:c,u=i.getInternalAnnotations?.(a,l),d=u==null?l:No([l,u]);o.push(d)}return{annotations:No(o)}}async function Lo(e){let t=[];for(let n of e)try{Symbol.asyncDispose in n&&typeof n[Symbol.asyncDispose]==`function`?await n[Symbol.asyncDispose]():Symbol.dispose in n&&typeof n[Symbol.dispose]==`function`&&n[Symbol.dispose]()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Failed to dispose one or more source contexts.`)}async function Ro(e,t,n,r,i){ye(n),Po(n);let a=i.contextOptions,{annotations:o,needsTwoPhase:s,snapshots:c}=await Fo(n,a);if(jo(i,s)){let n=Bo(e,o);if(await Mo(n,r,i))return e.mode===`async`?Eo(n,t,r,i):Promise.resolve(Eo(n,t,r,i))}let l=Bo(e,o);if(!s)return e.mode===`async`?Eo(l,t,r,i):Promise.resolve(Eo(l,t,r,i));let u=await P(e.mode,()=>Ka(l,r),()=>qa(l,r));if(u==null){let n=Bo(e,o);return e.mode===`async`?Eo(n,t,r,i):Promise.resolve(Eo(n,t,r,i))}let{annotations:d}=await Io(n,c,u.value,a,u.deferred,u.deferredKeys),f=Bo(e,d);return e.mode===`async`?Eo(f,t,r,i):Promise.resolve(Eo(f,t,r,i))}async function zo(e,t,n,r){let i=r?.args??[];if(n.length===0)return e.mode===`async`?Eo(e,t,i,r):Promise.resolve(Eo(e,t,i,r));let a,o,s=!1;try{a=await Ro(e,t,n,i,r)}catch(e){s=!0,o=e}try{await Lo(n)}catch(e){throw s?new Pa(e,o,`An error was suppressed during context disposal.`):e}if(s)throw o;return a}function Bo(e,t){let n=m(e.initialState,t),r={...Object.getOwnPropertyDescriptors(e)},i=r.initialState;return r.initialState=i==null?{value:n,writable:!0,enumerable:!0,configurable:!0}:`get`in i||`set`in i?{value:n,writable:!0,enumerable:i.enumerable??!0,configurable:i.configurable??!0}:{value:n,writable:i.writable??!0,enumerable:i.enumerable??!0,configurable:i.configurable??!0},Object.create(Object.getPrototypeOf(e),r)}function Vo(e){return{brief:e.brief,description:e.description,examples:e.examples,author:e.author,bugs:e.bugs,footer:e.footer}}function Ho(e,t){return`parser`in e&&`metadata`in e?{parser:e.parser,options:t.programName==null?{...t,programName:e.metadata.name}:t,programMetadata:Vo(e.metadata)}:{parser:e,options:t}}function Uo(e,t={}){return Go(e,t)}function Wo(e,t){let i=e.programName??r.basename(n.argv[1]??`cli`),a=e.args??n.argv.slice(2),o=e.stdout??(e=>{n.stdout.write(`${e}\n`)}),s=e.stderr??(e=>{n.stderr.write(`${e}\n`)}),c=e.onExit??(e=>n.exit(e)),l=e.colors??n.stdout.isTTY,u=e.maxWidth??n.stdout.columns,d=e.showDefault,f=e.showChoices,p=e.sectionOrder,m=e.help,h=e.version,g=e.completion,_=e.aboveError??`usage`,v=e.errorExitCode??1,y=e.brief??t?.brief,b=e.description??t?.description,ee=e.examples??t?.examples,te=e.author??t?.author,ne=e.bugs??t?.bugs,re=e.footer??t?.footer,x=()=>c(0);return{programName:i,args:a,coreOptions:{stderr:s,stdout:o,colors:l,maxWidth:u,showDefault:d,showChoices:f,sectionOrder:p,help:(()=>{if(m){if(typeof m==`string`)switch(m){case`command`:return{command:!0,onShow:x};case`option`:return{option:!0,onShow:x};case`both`:return{command:!0,option:!0,onShow:x}}return{...m,onShow:x}}})(),version:(()=>{if(h)return typeof h==`string`?{value:h,option:!0,onShow:x}:{...h,onShow:x}})(),completion:(()=>{if(g){if(typeof g==`string`)switch(g){case`command`:return{command:!0,onShow:x};case`option`:return{option:!0,onShow:x};case`both`:return{command:!0,option:!0,onShow:x}}return{...g,onShow:x}}})(),aboveError:_,brief:y,description:b,examples:ee,author:te,bugs:ne,footer:re,onError(){return c(v)}}}}function Go(e,t={}){let n=Ho(e,t),{parser:r,programMetadata:i}=n;t=n.options;let a=t.contexts;if(a&&a.length>0){let{programName:e,args:n,coreOptions:o}=Wo(t,i);return zo(r,e,a,{...o,contextOptions:t.contextOptions,args:n})}let{programName:o,args:s,coreOptions:c}=Wo(t,i);return Eo(r,o,s,c)}const Ko=`0.9.3`,qo=[`DEBUG`,`JSSE_DEBUG`,`JSSEDEBUG`].some(e=>{let t=n.env[e];return[`1`,`true`,`t`,`on`,`yes`,`y`].includes(t??``)}),Jo=di({debug:la(`-d`,`--debug`,{description:w`Print parsed command options.`})}),Yo=Ca(`init`,di({action:Z(`init`),filepath:zi(la(`-p`,`--filepath`,Gi({metavar:`FILEPATH`}),{description:w`Path to the ESLint config file to create.`})),force:la(`-f`,`--force`,{description:w`Overwrite an existing ESLint config file.`})}),{brief:w`Create an ESLint config file.`}),Xo=Ca(`dev`,di({action:Z(`dev`)}),{brief:w`cli-dev`});function Zo(){console.log(`cli-dev`)}const Qo=fi(Jo,Yr(Yo,Xo));async function $o(n){if(console.log(`init`),!e.existsSync(`package.json`)){let e=`package.json not found`;throw console.warn(e),Error(e)}let r=await t.readFile(`package.json`,`utf8`),i=JSON.parse(r).type===`module`,a=n.filepath??(i?`eslint.config.js`:`eslint.config.mjs`);if(e.existsSync(a)){let e=`${a} already exists`;if(console.warn(e),!n.force)throw Error(e)}await t.writeFile(a,`// @ts-check
|
|
1149
1149
|
import jsse from "@jsse/eslint-config";
|
|
1150
1150
|
|
|
1151
1151
|
export default jsse(
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
import { A as E18eRules, C as JsoncRules, M as CommandRules, N as BuiltinRules, O as EslintReactRules, P as AntfuRules, S as MarkdownRules, T as JavascriptRules, _ as PnpmRules, a as VitestRules, c as TypescriptRules, h as ReactHooksRules, i as YmlRules, j as DeMorganRules, m as ReactRefreshRules, o as UnusedImportsRules, s as UnicornRules, t as AllRules, u as StylisticRules, w as JsdocRules, x as NRules, y as NodeTestRules } from "./rule-types-DKF8Uy8X.js";
|
|
2
|
+
import { ParserOptions } from "@typescript-eslint/parser";
|
|
3
|
+
import { Linter } from "eslint";
|
|
4
|
+
|
|
5
|
+
//#region node_modules/.pnpm/eslint-config-flat-gitignore@2.3.0_eslint@10.6.0_jiti@2.7.0_/node_modules/eslint-config-flat-gitignore/dist/index.d.mts
|
|
6
|
+
interface FlatGitignoreOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Name of the configuration.
|
|
9
|
+
* @default 'gitignore'
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Path to `.gitignore` files, or files with compatible formats like `.eslintignore`.
|
|
14
|
+
* @default ['.gitignore'] // or findUpSync('.gitignore')
|
|
15
|
+
*/
|
|
16
|
+
files?: string | string[];
|
|
17
|
+
/**
|
|
18
|
+
* Path to `.gitmodules` file.
|
|
19
|
+
* @default ['.gitmodules'] // or findUpSync('.gitmodules')
|
|
20
|
+
*/
|
|
21
|
+
filesGitModules?: string | string[];
|
|
22
|
+
/**
|
|
23
|
+
* Throw an error if gitignore file not found.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
strict?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Mark the current working directory as the root directory,
|
|
29
|
+
* disable searching for `.gitignore` files in parent directories.
|
|
30
|
+
*
|
|
31
|
+
* This option is not effective when `files` is explicitly specified.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
root?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Current working directory.
|
|
37
|
+
* Used to resolve relative paths.
|
|
38
|
+
* @default process.cwd()
|
|
39
|
+
*/
|
|
40
|
+
cwd?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Also include recursive `.gitignore` files under `cwd`.
|
|
43
|
+
*
|
|
44
|
+
* This option is useful for monorepos or projects that keep
|
|
45
|
+
* per-folder `.gitignore` files.
|
|
46
|
+
*
|
|
47
|
+
* Pass `{ skipDirs: ['name'] }` to skip directory names while
|
|
48
|
+
* scanning recursively. `skipDirs` matches by directory name at
|
|
49
|
+
* any depth (not by path), and is applied in addition to `.git`
|
|
50
|
+
* and `node_modules`.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
recursive?: boolean | {
|
|
54
|
+
skipDirs: string[];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/types.d.ts
|
|
59
|
+
type RulesRecord = Linter.RulesRecord & AllRules;
|
|
60
|
+
type Config = Omit<Linter.Config<Linter.RulesRecord & AllRules>, "plugins"> & {
|
|
61
|
+
/**
|
|
62
|
+
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
|
|
63
|
+
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
64
|
+
*/
|
|
65
|
+
plugins?: Record<string, any>;
|
|
66
|
+
};
|
|
67
|
+
type TypescriptConfigRules = TypescriptRules & BuiltinRules;
|
|
68
|
+
type Awaitable<T> = T | Promise<T>;
|
|
69
|
+
type RuleName = keyof AllRules;
|
|
70
|
+
type TypedFlatConfigItemWithId = Config & {
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
type OptionsComponentExts = {
|
|
74
|
+
/**
|
|
75
|
+
* Additional extensions for components.
|
|
76
|
+
* @example ['vue']
|
|
77
|
+
* @default []
|
|
78
|
+
*/
|
|
79
|
+
componentExts?: string[];
|
|
80
|
+
};
|
|
81
|
+
type EslintConfigFnAsync<T = undefined> = (options?: T) => Promise<TypedFlatConfigItemWithId[]>;
|
|
82
|
+
type EslintConfigFnSync<T = undefined> = (options?: T) => TypedFlatConfigItemWithId[];
|
|
83
|
+
type EslintConfigFn<T = undefined> = EslintConfigFnAsync<T> | EslintConfigFnSync<T>;
|
|
84
|
+
type OptionsFiles = {
|
|
85
|
+
/**
|
|
86
|
+
* Override the `files` option to provide custom globs.
|
|
87
|
+
*/
|
|
88
|
+
files?: string[];
|
|
89
|
+
};
|
|
90
|
+
type OptionsTypeScriptParserOptions = {
|
|
91
|
+
/**
|
|
92
|
+
* Additional parser options for TypeScript.
|
|
93
|
+
*/
|
|
94
|
+
parserOptions?: Partial<ParserOptions>;
|
|
95
|
+
/**
|
|
96
|
+
* Flag to use `projectService` for type-aware linting.
|
|
97
|
+
*
|
|
98
|
+
* If `true` use fancy new `projectService` for type-aware linting.
|
|
99
|
+
* If `false` use classic `project` configuration.
|
|
100
|
+
*
|
|
101
|
+
* When omitted, this is auto-detected: `projectService` is used only
|
|
102
|
+
* when `tsconfig` is exactly `"tsconfig.json"` (or `["tsconfig.json"]`);
|
|
103
|
+
* any other `tsconfig` value falls back to classic `project` mode.
|
|
104
|
+
* @default auto-detected from `tsconfig`
|
|
105
|
+
*/
|
|
106
|
+
useProjectService?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Glob patterns for files that should be type aware.
|
|
109
|
+
* @default ['**\/*.{ts,tsx}']
|
|
110
|
+
*/
|
|
111
|
+
filesTypeAware?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* Glob patterns for files that should not be type aware.
|
|
114
|
+
* @default ['**\/*.md\/**']
|
|
115
|
+
*/
|
|
116
|
+
ignoresTypeAware?: string[];
|
|
117
|
+
};
|
|
118
|
+
type TypescriptPreset = "all" | "base" | "disable-type-checked" | "eslint-recommended" | "recommended" | "recommended-type-checked" | "recommended-type-checked-only" | "strict" | "strict-type-checked" | "strict-type-checked-only" | "stylistic" | "stylistic-type-checked" | "stylistic-type-checked-only";
|
|
119
|
+
type OptionsTypeScriptWithTypes = {
|
|
120
|
+
/**
|
|
121
|
+
* When this options is provided, type aware rules will be enabled.
|
|
122
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
123
|
+
*/
|
|
124
|
+
tsconfig?: string | string[];
|
|
125
|
+
/**
|
|
126
|
+
* Override only type-aware rules.
|
|
127
|
+
*/
|
|
128
|
+
overridesTypeAware?: Config["rules"];
|
|
129
|
+
/**
|
|
130
|
+
* Override TypeScript rules.
|
|
131
|
+
*/
|
|
132
|
+
overrides?: TypescriptConfigRules;
|
|
133
|
+
/**
|
|
134
|
+
* TypeScript ESLint preset or presets to use as the base ruleset.
|
|
135
|
+
*
|
|
136
|
+
* Preset names match the kebab-case TypeScript ESLint config names.
|
|
137
|
+
* @default "recommended-type-checked" when type-aware, otherwise "recommended"
|
|
138
|
+
*/
|
|
139
|
+
presets?: TypescriptPreset | TypescriptPreset[];
|
|
140
|
+
/**
|
|
141
|
+
* strict vs recommended configs, cannot be used with presets
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
strict?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* typeAware
|
|
147
|
+
*/
|
|
148
|
+
typeAware?: boolean;
|
|
149
|
+
};
|
|
150
|
+
type OptionsTypescript = OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & {
|
|
151
|
+
typedefs?: "type" | "interface";
|
|
152
|
+
};
|
|
153
|
+
type OptionsStylistic = {
|
|
154
|
+
stylistic?: boolean | StylisticConfig;
|
|
155
|
+
};
|
|
156
|
+
type StylisticConfig = {
|
|
157
|
+
indent?: number | "tab";
|
|
158
|
+
quotes?: "single" | "double";
|
|
159
|
+
jsx?: boolean;
|
|
160
|
+
overrides?: StylisticRules;
|
|
161
|
+
};
|
|
162
|
+
type OptionsIsInEditor = {
|
|
163
|
+
isInEditor?: boolean;
|
|
164
|
+
};
|
|
165
|
+
type OptionsAntfu = {
|
|
166
|
+
topLevelFunction?: "error" | "off";
|
|
167
|
+
overrides?: AntfuRules;
|
|
168
|
+
};
|
|
169
|
+
type OptionsCommand = {
|
|
170
|
+
overrides?: CommandRules;
|
|
171
|
+
};
|
|
172
|
+
type OptionsDeMorgan = {
|
|
173
|
+
overrides?: DeMorganRules;
|
|
174
|
+
};
|
|
175
|
+
type OptionsE18e = {
|
|
176
|
+
modernization?: boolean;
|
|
177
|
+
moduleReplacements?: boolean;
|
|
178
|
+
performanceImprovements?: boolean;
|
|
179
|
+
overrides?: E18eRules;
|
|
180
|
+
};
|
|
181
|
+
type OptionsJavascript = {
|
|
182
|
+
overrides?: JavascriptRules;
|
|
183
|
+
};
|
|
184
|
+
type OptionsJsdoc = {
|
|
185
|
+
overrides?: JsdocRules;
|
|
186
|
+
};
|
|
187
|
+
type OptionsJsonc = OptionsStylistic & {
|
|
188
|
+
overrides?: JsoncRules;
|
|
189
|
+
};
|
|
190
|
+
type OptionsMarkdown = OptionsComponentExts & {
|
|
191
|
+
overrides?: MarkdownRules;
|
|
192
|
+
};
|
|
193
|
+
type OptionsN = {
|
|
194
|
+
overrides?: NRules;
|
|
195
|
+
};
|
|
196
|
+
type OptionsNodeTest = {
|
|
197
|
+
/**
|
|
198
|
+
* Files to include for node-test rules.
|
|
199
|
+
*
|
|
200
|
+
* Defaults to `GLOB_TESTS`
|
|
201
|
+
*/
|
|
202
|
+
files?: string[];
|
|
203
|
+
/**
|
|
204
|
+
* eslint-node-test preset to use as the base ruleset.
|
|
205
|
+
* @default "recommended"
|
|
206
|
+
*/
|
|
207
|
+
preset?: "recommended" | "unopinionated" | "all";
|
|
208
|
+
/**
|
|
209
|
+
* Override eslint-node-test rules after applying the preset.
|
|
210
|
+
*/
|
|
211
|
+
overrides?: NodeTestRules;
|
|
212
|
+
};
|
|
213
|
+
type OptionsPnpm = {
|
|
214
|
+
overrides?: PnpmRules;
|
|
215
|
+
};
|
|
216
|
+
type ReactHooksPreset = "recommended" | "recommended-latest";
|
|
217
|
+
type ReactPreset = "recommended" | "recommended-type-checked" | "recommended-typescript" | "strict" | "strict-type-checked" | "strict-typescript";
|
|
218
|
+
type OptionsReactConfig = {
|
|
219
|
+
/**
|
|
220
|
+
* Enable eslint-plugin-react-hooks rules or select its preset.
|
|
221
|
+
* @default "recommended"
|
|
222
|
+
*/
|
|
223
|
+
hooks?: boolean | ReactHooksPreset;
|
|
224
|
+
/**
|
|
225
|
+
* Enable eslint-plugin-react-refresh rules.
|
|
226
|
+
* @default true
|
|
227
|
+
*/
|
|
228
|
+
refresh?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Use `refresh` instead.
|
|
231
|
+
* @deprecated
|
|
232
|
+
*/
|
|
233
|
+
reactRefresh?: boolean;
|
|
234
|
+
overrides?: EslintReactRules & ReactHooksRules & ReactRefreshRules;
|
|
235
|
+
/**
|
|
236
|
+
* `@eslint-react/eslint-plugin` preset to use as the base ruleset.
|
|
237
|
+
*
|
|
238
|
+
* Preset names match the kebab-case `@eslint-react` config names.
|
|
239
|
+
* @default "recommended"
|
|
240
|
+
*/
|
|
241
|
+
preset?: ReactPreset;
|
|
242
|
+
};
|
|
243
|
+
type OptionsSortTsconfig = {
|
|
244
|
+
extendTsconfigGlobs?: string[];
|
|
245
|
+
};
|
|
246
|
+
type OptionsUnicorn = {
|
|
247
|
+
/**
|
|
248
|
+
* Unicorn preset to use as the base ruleset.
|
|
249
|
+
* @default "recommended"
|
|
250
|
+
*/
|
|
251
|
+
preset?: "recommended" | "unopinionated" | "all";
|
|
252
|
+
/**
|
|
253
|
+
* Override Unicorn rules after applying the preset and built-in rules.
|
|
254
|
+
*/
|
|
255
|
+
overrides?: UnicornRules;
|
|
256
|
+
};
|
|
257
|
+
type OptionsUnusedImports = OptionsIsInEditor & {
|
|
258
|
+
/**
|
|
259
|
+
* Override eslint-plugin-unused-imports rules after applying built-in rules.
|
|
260
|
+
*/
|
|
261
|
+
overrides?: UnusedImportsRules;
|
|
262
|
+
};
|
|
263
|
+
type OptionsVitest = {
|
|
264
|
+
overrides?: VitestRules;
|
|
265
|
+
};
|
|
266
|
+
type OptionsYaml = OptionsFiles & OptionsStylistic & {
|
|
267
|
+
overrides?: YmlRules;
|
|
268
|
+
};
|
|
269
|
+
type OptionsConfigs = {
|
|
270
|
+
/**
|
|
271
|
+
* Enable eslint-plugin-antfu.
|
|
272
|
+
* @default true
|
|
273
|
+
*/
|
|
274
|
+
antfu?: boolean | OptionsAntfu;
|
|
275
|
+
/**
|
|
276
|
+
* Enable `eslint-plugin-command`
|
|
277
|
+
* @default true
|
|
278
|
+
*/
|
|
279
|
+
command?: boolean | OptionsCommand;
|
|
280
|
+
/**
|
|
281
|
+
* Enable eslint-plugin-de-morgan.
|
|
282
|
+
* @default true
|
|
283
|
+
*/
|
|
284
|
+
demorgan?: boolean | OptionsDeMorgan;
|
|
285
|
+
/**
|
|
286
|
+
* Enable @e18e/eslint-plugin.
|
|
287
|
+
* @default true
|
|
288
|
+
*/
|
|
289
|
+
e18e?: boolean | OptionsE18e;
|
|
290
|
+
/**
|
|
291
|
+
* Configure JavaScript rules.
|
|
292
|
+
*/
|
|
293
|
+
javascript?: OptionsJavascript;
|
|
294
|
+
/**
|
|
295
|
+
* Enable eslint-plugin-jsdoc.
|
|
296
|
+
* @default true
|
|
297
|
+
*/
|
|
298
|
+
jsdoc?: boolean | OptionsJsdoc;
|
|
299
|
+
/**
|
|
300
|
+
* Enable eslint-plugin-n (Node.js rules).
|
|
301
|
+
* @default true
|
|
302
|
+
*/
|
|
303
|
+
n?: boolean | OptionsN;
|
|
304
|
+
/**
|
|
305
|
+
* Enable `eslint-node-test` (Node.js built-in test runner rules).
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
nodeTest?: boolean | OptionsNodeTest;
|
|
309
|
+
/**
|
|
310
|
+
* Enable eslint-plugin-pnpm.
|
|
311
|
+
* @default false
|
|
312
|
+
*/
|
|
313
|
+
pnpm?: boolean | OptionsPnpm;
|
|
314
|
+
/**
|
|
315
|
+
* Enable TypeScript support.
|
|
316
|
+
*
|
|
317
|
+
* Passing an object to enable TypeScript Language Server support.
|
|
318
|
+
* @default auto-detect based on the dependencies
|
|
319
|
+
*/
|
|
320
|
+
typescript?: boolean | OptionsTypescript;
|
|
321
|
+
/**
|
|
322
|
+
* Enable eslint-plugin-unicorn.
|
|
323
|
+
* @default true
|
|
324
|
+
*/
|
|
325
|
+
unicorn?: boolean | OptionsUnicorn;
|
|
326
|
+
/**
|
|
327
|
+
* Enable eslint-plugin-unused-imports.
|
|
328
|
+
* @default true
|
|
329
|
+
*/
|
|
330
|
+
unusedImports?: boolean | OptionsUnusedImports;
|
|
331
|
+
react?: boolean | OptionsReactConfig;
|
|
332
|
+
/**
|
|
333
|
+
* Enable regexp plugin
|
|
334
|
+
* @default true
|
|
335
|
+
*/
|
|
336
|
+
regexp?: boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Enable `@vitest/eslint-plugin` (Vitest rules).
|
|
339
|
+
* @default auto-detect based on the dependencies
|
|
340
|
+
*/
|
|
341
|
+
vitest?: boolean | OptionsVitest;
|
|
342
|
+
/**
|
|
343
|
+
* Enable JSONC support.
|
|
344
|
+
* @default true
|
|
345
|
+
*/
|
|
346
|
+
jsonc?: boolean | OptionsJsonc;
|
|
347
|
+
/**
|
|
348
|
+
* Enable YAML support.
|
|
349
|
+
* @default false
|
|
350
|
+
*/
|
|
351
|
+
yaml?: boolean | OptionsYaml;
|
|
352
|
+
/**
|
|
353
|
+
* Enable Markdown support.
|
|
354
|
+
* @default false
|
|
355
|
+
*/
|
|
356
|
+
markdown?: boolean | OptionsMarkdown;
|
|
357
|
+
/**
|
|
358
|
+
* Enable stylistic rules.
|
|
359
|
+
* @default true
|
|
360
|
+
*/
|
|
361
|
+
stylistic?: boolean | StylisticConfig;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Deprecated options that are still supported
|
|
365
|
+
*/
|
|
366
|
+
type OptionsDeprecated = {
|
|
367
|
+
/**
|
|
368
|
+
* Enable `eslint-plugin-react-refresh` rules.
|
|
369
|
+
* @default true
|
|
370
|
+
* @deprecated use `react.refresh` instead
|
|
371
|
+
*/
|
|
372
|
+
reactRefresh?: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Enable Tailwind CSS support.
|
|
375
|
+
*
|
|
376
|
+
* Passing an object to configure the options.
|
|
377
|
+
* Tailwind support is currently disabled; passing this option only logs a warning.
|
|
378
|
+
* @deprecated deprecated tw support
|
|
379
|
+
* @default false
|
|
380
|
+
*/
|
|
381
|
+
tailwind?: boolean | {
|
|
382
|
+
overrides?: Record<string, unknown>;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
type OptionsConfig = OptionsComponentExts & OptionsTypeScriptParserOptions & OptionsConfigs & OptionsDeprecated & {
|
|
386
|
+
/**
|
|
387
|
+
* Enable debug mode.
|
|
388
|
+
*/
|
|
389
|
+
debug?: boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Enable configuration diagnostics.
|
|
392
|
+
* @default true
|
|
393
|
+
*/
|
|
394
|
+
diagnostics?: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Enable reporting of unused disable directives.
|
|
397
|
+
* @default true
|
|
398
|
+
*/
|
|
399
|
+
reportUnusedDisableDirectives?: boolean;
|
|
400
|
+
/**
|
|
401
|
+
* Array of rules to turn off.
|
|
402
|
+
*/
|
|
403
|
+
off?: RuleName[] | Set<RuleName>;
|
|
404
|
+
/**
|
|
405
|
+
* Enable fast mode.
|
|
406
|
+
*
|
|
407
|
+
* This will disable some rules to speed up linting.
|
|
408
|
+
*/
|
|
409
|
+
fast?: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Enable Prettier config rules to disable conflicting ESLint rules
|
|
412
|
+
*
|
|
413
|
+
* THIS DOES NOT ENABLE PRETTIER FORMATTING. YOU DO THAT, BUT I
|
|
414
|
+
* RECOMMEND USING PRETTIER TO FORMAT AND NOT THE ESLint PRETTIER
|
|
415
|
+
* PLUGIN!.
|
|
416
|
+
*/
|
|
417
|
+
prettier?: boolean;
|
|
418
|
+
/**
|
|
419
|
+
* The prefix for the name of the config item.
|
|
420
|
+
* @default "jsse"
|
|
421
|
+
*/
|
|
422
|
+
rootId?: string;
|
|
423
|
+
/**
|
|
424
|
+
* Optional function to run before the final config is returned.
|
|
425
|
+
*/
|
|
426
|
+
preReturn?: (configs: Config[]) => Config[] | Awaitable<Config[]>;
|
|
427
|
+
/**
|
|
428
|
+
* Enable gitignore support.
|
|
429
|
+
*
|
|
430
|
+
* Passing an object to configure the options.
|
|
431
|
+
* @see https://github.com/antfu/eslint-config-flat-gitignore
|
|
432
|
+
* @default true
|
|
433
|
+
*/
|
|
434
|
+
gitignore?: boolean | FlatGitignoreOptions;
|
|
435
|
+
/**
|
|
436
|
+
* Enable sorting of package.json files.
|
|
437
|
+
* @default true
|
|
438
|
+
*/
|
|
439
|
+
sortPackageJson?: boolean;
|
|
440
|
+
/**
|
|
441
|
+
* Enable sorting of tsconfig.json files.
|
|
442
|
+
* @default true
|
|
443
|
+
*/
|
|
444
|
+
sortTsconfig?: boolean | OptionsSortTsconfig;
|
|
445
|
+
/**
|
|
446
|
+
* Enable sorting of geojson files.
|
|
447
|
+
* @default false
|
|
448
|
+
*/
|
|
449
|
+
sortGeojson?: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Enable import/export sorting via perfectionist.
|
|
452
|
+
* @default false
|
|
453
|
+
*/
|
|
454
|
+
sortImports?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* The prefix for the name of the config item
|
|
457
|
+
* @default "@typescript-eslint"
|
|
458
|
+
*/
|
|
459
|
+
tsPrefix?: string;
|
|
460
|
+
/**
|
|
461
|
+
* Glob patterns for ADDITIONAL tsconfig files to lint (aka sort)
|
|
462
|
+
*
|
|
463
|
+
* Has nothing to do with `@typescript-eslint/parser` or `typescript-eslint/eslint-plugin`
|
|
464
|
+
* @default ['tsconfig.json', 'tsconfig.*.json']
|
|
465
|
+
*/
|
|
466
|
+
extendTsconfigLintGlobs?: string[];
|
|
467
|
+
/**
|
|
468
|
+
* Forcibly disable type aware rules
|
|
469
|
+
*/
|
|
470
|
+
typeAware?: boolean;
|
|
471
|
+
/**
|
|
472
|
+
* Enable JSX related rules.
|
|
473
|
+
*
|
|
474
|
+
* Currently only stylistic rules are included.
|
|
475
|
+
* @default true
|
|
476
|
+
*/
|
|
477
|
+
jsx?: boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Control to disable some rules in editors.
|
|
480
|
+
* @default auto-detect based on the process.env
|
|
481
|
+
*/
|
|
482
|
+
isInEditor?: boolean;
|
|
483
|
+
};
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/_generated/fixable-rules-map.d.ts
|
|
486
|
+
declare const FIXABLE_RULES_MAP: Record<string, RuleName[]>;
|
|
487
|
+
//#endregion
|
|
488
|
+
export { OptionsConfig as a, RuleName as c, TypescriptPreset as d, EslintConfigFn as i, RulesRecord as l, Awaitable as n, ReactHooksPreset as o, Config as r, ReactPreset as s, FIXABLE_RULES_MAP as t, TypedFlatConfigItemWithId as u };
|