eslint-cli-bundle 2.0.1 → 3.0.0
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/LICENSE +22 -0
- package/README.md +9 -1
- package/dist/api.d.ts +3 -3
- package/dist/api.js +2 -2
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/eslint-C-fkO7XK.js +166 -0
- package/dist/{eslint-BYId4sVl.js → eslint-helpers-4m3QC9jt.js} +94 -259
- package/dist/eslint.js +10 -10
- package/dist/{jiti-LuDw_cZG.js → jiti-CaIpDikP.js} +3 -3
- package/dist/naming-BtEmRC_V.js +1 -0
- package/dist/rolldown-runtime-C7uQZ-1I.js +1 -0
- package/dist/shared/translate-cli-options.js +1 -0
- package/dist/{src-CBWp9Y5K.js → src-Bnjf7phB.js} +1 -1
- package/dist/types/config-helpers.d.ts +1473 -0
- package/dist/{types-BkIPfpy7.d.ts → types/core.d.ts} +3 -4
- package/dist/types/estree.d.ts +527 -0
- package/dist/types/plugin-kit.d.ts +1732 -0
- package/dist/worker.js +1 -0
- package/package.json +10 -9
- package/dist/rolldown-runtime-CN7XbDR5.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) silverwind
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
|
11
|
+
and/or other materials provided with the distribution.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
17
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
18
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
19
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
20
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
21
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
22
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
# eslint-cli-bundle
|
|
2
2
|
[](https://www.npmjs.org/package/eslint-cli-bundle) [](https://www.npmjs.org/package/eslint-cli-bundle) [](https://packagephobia.com/result?p=eslint-cli-bundle)
|
|
3
3
|
|
|
4
|
-
Bundled version of [`eslint`](https://github.com/eslint/eslint)
|
|
4
|
+
> Bundled version of [`eslint`](https://github.com/eslint/eslint)
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm dlx eslint-cli-bundle .
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
© [silverwind](https://github.com/silverwind), distributed under BSD licence
|
package/dist/api.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* SOFTWARE
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
import * as ESTree from "estree";
|
|
28
|
+
import * as ESTree from "./types/estree.js";
|
|
29
29
|
import type {
|
|
30
30
|
DeprecatedInfo,
|
|
31
31
|
LanguageOptions as GenericLanguageOptions,
|
|
@@ -69,12 +69,12 @@ import type {
|
|
|
69
69
|
SuggestedEdit,
|
|
70
70
|
ViolationReport,
|
|
71
71
|
MessagePlaceholderData,
|
|
72
|
-
} from "
|
|
72
|
+
} from "./types/core.js";
|
|
73
73
|
import type {
|
|
74
74
|
CustomRuleDefinitionType,
|
|
75
75
|
CustomRuleTypeDefinitions,
|
|
76
76
|
CustomRuleVisitorWithExit,
|
|
77
|
-
} from "
|
|
77
|
+
} from "./types/plugin-kit.js";
|
|
78
78
|
|
|
79
79
|
//------------------------------------------------------------------------------
|
|
80
80
|
// Exports
|
package/dist/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-C7uQZ-1I.js";import{a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,o as f,u as p}from"./eslint-helpers-4m3QC9jt.js";import{t as m}from"./eslint-C-fkO7XK.js";var h=/* @__PURE__ */ t(((e,t)=>{function n(e){return e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||typeof e==`object`&&e.constructor===Object||Array.isArray(e)}function r(e,t=/* @__PURE__ */ new Set){if(!n(e))return!1;if(typeof e==`object`&&e){if(t.has(e))return!1;for(let i in e)if(Object.hasOwn(e,i)&&(!n(e[i])||typeof e[i]==`object`&&e[i]!==null&&!r(e[i],/* @__PURE__ */ new Set([...t,e]))))return!1}return!0}t.exports={isSerializable:r}})),g=/* @__PURE__ */ t(((t,m)=>{let g=e(`node:assert`),{existsSync:_,readFileSync:v}=e(`node:fs`),y=e(`node:util`),b=e(`node:path`),x=a(),S=r(),{Config:C}=u(),{Linter:w,SourceCodeFixer:T}=n(),{interpolate:E,getPlaceholderMatcher:ee}=f(),te=l(),{isSerializable:ne}=h(),{FlatConfigArray:re}=i(),{defaultConfig:D,defaultRuleTesterConfig:ie}=d(),O=Symbol.for(`eslint.RuleTester.parser`),{ConfigArraySymbol:k}=o(),ae=c(),{SourceCode:A}=s(),j={rules:{}},M,N={rules:{}},oe=[`name`,`code`,`filename`,`options`,`before`,`after`,`errors`,`output`,`only`],P=/* @__PURE__ */ new Set([`message`,`messageId`,`data`,`line`,`column`,`endLine`,`endColumn`,`suggestions`]),se=`[${[...P].map(e=>`'${e}'`).join(`, `)}]`,F=/* @__PURE__ */ new Set([`desc`,`messageId`,`data`,`output`]),ce=`[${[...F].map(e=>`'${e}'`).join(`, `)}]`,I=[`applyInlineConfig`,`applyLanguageOptions`,`finalize`],le=new Map(I.map(e=>[e,/* @__PURE__ */ new WeakSet])),L=Function.call.bind(Object.hasOwnProperty);function ue(){return M||=p()({strictDefaults:!0}),M}function R(e){if(typeof e==`object`&&e){if(Array.isArray(e))return e.map(R);let t={};for(let n in e)n!==`parent`&&L(e,n)&&(t[n]=R(e[n]));return t}return e}function z(e,t=/* @__PURE__ */ new Set){if(typeof e==`object`&&e){if(t.has(e))return;if(t.add(e),Array.isArray(e))e.forEach(e=>{z(e,t)});else for(let n in e)n!==`parent`&&L(e,n)&&z(e[n],t);Object.freeze(e)}}function B(e){return typeof e==`string`?e.replace(/[\u0000-\u0009\u000b-\u001a]/gu,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,`0`)}`):``}function V(e,t){Object.defineProperties(t,{start:{get(){throw Error(`Use ${e}.range[0] instead of ${e}.start`)},configurable:!0,enumerable:!1},end:{get(){throw Error(`Use ${e}.range[1] instead of ${e}.end`)},configurable:!0,enumerable:!1}})}function H(e,t){S.traverse(e,{visitorKeys:t,enter:V.bind(null,`node`)}),e.tokens.forEach(V.bind(null,`token`)),e.comments.forEach(V.bind(null,`token`))}function de(e){return typeof e.parseForESLint==`function`?{[O]:e,parseForESLint(...t){let n=e.parseForESLint(...t);return H(n.ast,n.visitorKeys),n}}:{[O]:e,parse(...t){let n=e.parse(...t);return H(n),n}}}function fe(e,t){let n=t[e];return function(...t){let r=le.get(e);if(!r.has(this))return r.add(this),n.apply(this,t);throw Error(`\`SourceCode#${e}()\` cannot be called inside a rule.`)}}function U(e){let t=ee();return Array.from(e.matchAll(t),([,e])=>e.trim())}function W(e,t,n={}){let r=U(e);if(r.length===0)return[];let i=U(t),a=Object.keys(n);return r.filter(e=>i.includes(e)&&!a.includes(e))}let G="\n - If the rule has options, set `meta.schema` to an array or non-empty object to enable options validation.\n - If the rule doesn't have options, omit `meta.schema` to enforce that no options can be passed to the rule.\n - You can also set `meta.schema` to `false` to opt-out of options validation (not recommended).\n\n https://eslint.org/docs/latest/extend/custom-rules#options-schemas\n",pe=/* @__PURE__ */ new Set([`name`,`errors`,`output`]);function K(e){return e&&typeof e==`object`?e:{code:e}}function me(e,t,n={}){let r=typeof e==`number`,i=Array.isArray(e);!r&&!i&&(e===void 0?g.fail(`Did not specify errors for an invalid test of ${t}`):g.fail(`Invalid 'errors' property for invalid test of ${t}: expected a number or an array but got ${e===null?`null`:typeof e}`));let{requireMessage:a=!1,requireLocation:o=!1}=n;if(i){g.ok(e.length!==0,`Invalid cases must have at least one error`);for(let[t,n]of e.entries())if(typeof n==`string`||n instanceof RegExp)g.ok(a!==`messageId`&&!o,`errors[${t}] should be an object when 'assertionOptions.requireMessage' is 'messageId' or 'assertionOptions.requireLocation' is true.`);else if(typeof n==`object`&&n){for(let e of Object.keys(n))g.ok(P.has(e),`Invalid error property name '${e}'. Expected one of ${se}.`);a===`message`?g.ok(!L(n,`messageId`)&&L(n,`message`),`errors[${t}] should specify 'message' (and not 'messageId') when 'assertionOptions.requireMessage' is 'message'.`):a===`messageId`&&g.ok(!L(n,`message`)&&L(n,`messageId`),`errors[${t}] should specify 'messageId' (and not 'message') when 'assertionOptions.requireMessage' is 'messageId'.`),L(n,`message`)?(g.ok(!L(n,`messageId`),`errors[${t}] should not specify both 'message' and 'messageId'.`),g.ok(!L(n,`data`),`errors[${t}] should not specify both 'data' and 'message'.`)):g.ok(L(n,`messageId`),`errors[${t}] must specify either 'messageId' or 'message'.`)}else g.fail(`errors[${t}] must be a string, RegExp, or an object.`)}else g.ok(!a&&!o,`Invalid cases must have 'errors' value as an array`),g.ok(e>0,`Invalid cases must have 'error' value greater than 0`)}function q(e,t){if(!ne(e))return;let n=te(e,{replacer(t,n){return e!==this||!pe.has(t)?n:void 0}});g(!t.has(n),`detected duplicate test case`),t.add(n)}function he(e,t){g.ok(e&&typeof e==`object`&&typeof e.create==`function`,`Rule ${t} must be an object with a \`create\` method`)}function ge(e,t){g.ok(e&&typeof e==`object`,`Test Scenarios for rule ${t} : Could not find test scenario object`);let n=Array.isArray(e.valid),r=Array.isArray(e.invalid);g.ok(n,`Test Scenarios for rule ${t} is invalid: Could not find any valid test scenarios`),g.ok(r,`Test Scenarios for rule ${t} is invalid: Could not find any invalid test scenarios`)}function J(e){g.ok(typeof e.code==`string`,`Test case must specify a string value for 'code'`),e.name&&g.ok(typeof e.name==`string`,`Optional test case property 'name' must be a string`),L(e,`only`)&&g.ok(typeof e.only==`boolean`,`Optional test case property 'only' must be a boolean`),L(e,`filename`)&&g.ok(typeof e.filename==`string`,`Optional test case property 'filename' must be a string`),L(e,`options`)&&g.ok(Array.isArray(e.options),`Optional test case property 'options' must be an array`)}function _e(e,t){g.ok(e.errors===void 0,`Valid test case must not have 'errors' property`),g.ok(e.output===void 0,`Valid test case must not have 'output' property`),J(e),q(e,t)}function ve(e,t,n,r={}){J(e),me(e.errors,n,r),L(e,`output`)&&g.ok(e.output===null||typeof e.output==`string`,`Test property 'output', if specified, must be a string or null. If no autofix is expected, then omit the 'output' property or set it to null.`),q(e,t)}function Y(e=Y){let t={},n,{prepareStackTrace:r}=Error;return Error.prepareStackTrace=(e,[t])=>{n={sourceFile:t.getFileName()??`${t.getEvalOrigin()}, <anonymous>`,sourceLine:t.getLineNumber()??1,sourceColumn:t.getColumnNumber()??1}},Error.captureStackTrace(t,e),t.stack,Error.prepareStackTrace=r,n}function ye(e){let t=Y(e),n=null;return e=>{if(n===null){let{sourceFile:e,sourceLine:r,sourceColumn:i}=t;if(n={root:`${e}:${r}:${i}`},_(e)){let t=v(e,`utf8`).split(`
|
|
2
2
|
`).slice(r-1);t[0]=t[0].slice(Math.max(0,i-1)),t=t.map(e=>e.trim().replace(/\s*\/\/.*$(?<!,)/u,``));let a=t.findIndex(e=>/\bvalid\s*:/u.test(e)),o=t.findIndex(e=>/\binvalid\s*:/u.test(e));n.valid=`${e}:${r+a}`,n.invalid=`${e}:${r+o}`;let s=a<o?o:t.length,c=a<o?t.length:a,l=t.slice(a,s),u=t.slice(o,c),d=0,f=l.map((e,t)=>(/^(?:\w+\s*:\s*)?\{/u.test(e)&&d++,d>0?((e.endsWith(`}`)||e.endsWith(`},`))&&d--,d<=1&&e.includes(`code:`)?t:null):e.endsWith(`,`)?t:null)).filter(Boolean),p=u.map((e,t)=>e.trimStart().startsWith(`errors:`)?t:null).filter(Boolean);Object.assign(n,{"valid[0]":`${e}:${r+a}`},Object.fromEntries(f.map((t,n)=>[`valid[${n}]`,`${e}:${r+a+t}`])),Object.fromEntries(p.map((t,n)=>[`invalid[${n}]`,`${e}:${r+o+t}`]))),p.push(u.length);for(let t=0;t<p.length-1;t++){let i=p[t],a=p[t+1],s=u.slice(i,a),c=0,l=s.map((e,t)=>e.startsWith(`{`)||e.endsWith(`{`)?(c++,(e.endsWith(`}`)||e.endsWith(`},`))&&c--,c<=1?t:null):c>0?((e.endsWith(`}`)||e.endsWith(`},`))&&c--,null):e.endsWith(`,`)?t:null).filter(Boolean);Object.assign(n,Object.fromEntries(l.map((n,a)=>[`invalid[${t}].errors[${a}]`,`${e}:${r+o+i+n}`])))}}}return n[e]||`unknown source`}}let X=Symbol(`describe`),Z=Symbol(`it`),Q=Symbol(`itOnly`);function be(e,t){try{return t.call(this)}catch(e){throw e instanceof g.AssertionError&&(e.message+=` (${y.inspect(e.actual)} ${e.operator} ${y.inspect(e.expected)})`),e}}function xe(e,t){return t.call(this)}var $=class{constructor(e={}){this.testerConfig=[N,e,{rules:{"rule-tester/validate-ast":`error`}}],this.linter=new w({configType:`flat`})}static setDefaultConfig(e){if(typeof e!=`object`||!e)throw TypeError(`RuleTester.setDefaultConfig: config must be an object`);N=e,N.rules=N.rules||{}}static getDefaultConfig(){return N}static resetDefaultConfig(){N={rules:{...j.rules}}}static get describe(){return this[X]||(typeof describe==`function`?describe:xe)}static set describe(e){this[X]=e}static get it(){return this[Z]||(typeof it==`function`?it:be)}static set it(e){this[Z]=e}static only(e){return typeof e==`string`?{code:e,only:!0}:{...e,only:!0}}static get itOnly(){if(typeof this[Q]==`function`)return this[Q];if(typeof this[Z]==`function`&&typeof this[Z].only==`function`)return Function.bind.call(this[Z].only,this[Z]);if(typeof it==`function`&&typeof it.only==`function`)return Function.bind.call(it.only,it);throw typeof this[X]==`function`||typeof this[Z]==`function`?Error("Set `RuleTester.itOnly` to use `only` with a custom test framework.\nSee https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more."):Error(typeof it==`function`?"The current test framework does not support exclusive tests with `only`.":"To use `only`, use RuleTester with a test framework that provides `it.only()` like Mocha.")}static set itOnly(e){this[Q]=e}run(e,t,n){let r=this.testerConfig,i=this.linter,a=`rule-to-test/${e}`;he(t,e),ge(n,e);let o=ye(this.run),s=[{plugins:{"@":{parsers:{...D[0].plugins[`@`].parsers},rules:D[0].plugins[`@`].rules,languages:D[0].plugins[`@`].languages},"rule-to-test":{rules:{[e]:Object.assign({},t,{create(e){return z(e.options),z(e.settings),z(e.parserOptions),t.create(e)}})}}},language:D[0].language},...ie];function c(e,t){L(e,t)&&(g.strictEqual(typeof e[t],`function`,`Optional test case property '${t}' must be a function`),e[t]())}function l(n){let o=n.code,c=L(n,`filename`)?n.filename:void 0,l=L(n,`options`)?n.options:[],u={baseConfig:s};c&&(u.basePath=b.parse(c).root||void 0);let d=new re(r,u);d[k.finalizeConfig]=function(...e){let t=Object.getPrototypeOf(this)[k.finalizeConfig].apply(this,e);return t.language===ae&&(t.languageOptions.parser=de(t.languageOptions.parser)),t};let f,p,m,h={...n};for(let e of oe)delete h[e];d.push(h),d.push({rules:{[a]:[1,...l]}});let _;try{_=C.getRuleOptionsSchema(t)}catch(e){throw e.message+=G,e}if(_&&Object.keys(_).length===0)throw Error(`\`schema: {}\` is a no-op${G}`);if(d.push({plugins:{"rule-tester":{rules:{"validate-ast":{create(){return{Program(e){p=R(e)},"Program:exit"(e){m=e}}}}}}}}),_){let t=ue();if(t.validateSchema(_),t.errors){let n=t.errors.map(e=>`\t${e.dataPath[0]===`.`?e.dataPath.slice(1):e.dataPath}: ${e.message}`).join(`
|
|
3
3
|
`);throw Error([`Schema for rule ${e} is invalid:`,n])}try{t.compile(_)}catch(t){throw Error(`Schema for rule ${e} is invalid: ${t.message}`,{cause:t})}}try{d.normalizeSync(),d.getConfig(`test.js`)}catch(e){throw e.message=`ESLint configuration in rule-tester is invalid: ${e.message}`,e}let{applyLanguageOptions:v,applyInlineConfig:y,finalize:x}=A.prototype,S;try{I.forEach(e=>{A.prototype[e]=fe(e,A.prototype)}),S=i.verify(o,d,c)}finally{A.prototype.applyInlineConfig=y,A.prototype.applyLanguageOptions=v,A.prototype.finalize=x}let w=S.find(e=>e.fatal);if(g(!w,`A fatal parsing error occurred: ${w&&w.message}`),S.some(e=>e.fix)){f=T.applyFixes(o,S).output;let e=i.verify(f,d,c).find(e=>e.fatal);g(!e,[`A fatal parsing error occurred in autofix.`,`Error: ${e&&e.message}`,`Autofix output:`,f].join(`
|
|
4
4
|
`))}else f=o;return{messages:S,output:f,beforeAST:p,afterAST:R(m),configs:d,filename:c}}function u(e,t){x(e,t)||g.fail(`Rule should not modify AST.`)}function d(e){let t=l(e),n=t.messages;g.strictEqual(n.length,0,y.format(`Should have no errors but had %d: %s`,n.length,y.inspect(n))),u(t.beforeAST,t.afterAST)}function f(e,t){t instanceof RegExp?g.ok(t.test(e),`Expected '${e}' to match ${t}`):g.strictEqual(e,t)}function p(e){let{requireMessage:r=!1,requireLocation:o=!1,requireData:s=!1}=n.assertionOptions??{},c=L(t,`meta`)&&L(t.meta,`messages`),d=c?`[${Object.keys(t.meta.messages).map(e=>`'${e}'`).join(`, `)}]`:null;g.ok(c||r!==`messageId`,`Assertion options can not use 'requireMessage: "messageId"' if rule under test doesn't define 'meta.messages'.`);let p=l(e),m=p.messages;for(let e of m)if(L(e,`suggestions`)){let t=/* @__PURE__ */ new Map;for(let n=0;n<e.suggestions.length;n+=1){let r=e.suggestions[n].desc,i=t.get(r);g.ok(!t.has(r),`Suggestion message '${r}' reported from suggestion ${n} was previously reported by suggestion ${i}. Suggestion messages should be unique within an error.`),t.set(r,n)}}if(typeof e.errors==`number`)g.strictEqual(m.length,e.errors,y.format(`Should have %d error%s but had %d: %s`,e.errors,e.errors===1?``:`s`,m.length,y.inspect(m)));else{g.strictEqual(m.length,e.errors.length,y.format(`Should have %d error%s but had %d: %s`,e.errors.length,e.errors.length===1?``:`s`,m.length,y.inspect(m)));let n=m.some(e=>e.ruleId===a);for(let r=0,a=e.errors.length;r<a;r++)try{let a=e.errors[r],l=m[r];if(g(n,`Error rule name should be the same as the name of the rule being tested`),typeof a==`string`||a instanceof RegExp)f(l.message,a),g.ok(l.suggestions===void 0,`Error at index ${r} has suggestions. Please convert the test error into an object and specify 'suggestions' property on it to test suggestions.`);else if(typeof a==`object`&&a){if(L(a,`message`))f(l.message,a.message);else if(L(a,`messageId`)){g.ok(c,`Error can not use 'messageId' if rule under test doesn't define 'meta.messages'.`),L(t.meta.messages,a.messageId)||g(!1,`Invalid messageId '${a.messageId}'. Expected one of ${d}.`),g.strictEqual(l.messageId,a.messageId,`messageId '${l.messageId}' does not match expected messageId '${a.messageId}'.`);let e=W(l.message,t.meta.messages[l.messageId],a.data);if(g.ok(e.length===0,`The reported message has ${e.length>1?`unsubstituted placeholders: ${e.map(e=>`'${e}'`).join(`, `)}`:`an unsubstituted placeholder '${e[0]}'`}. Please provide the missing ${e.length>1?`values`:`value`} via the 'data' property in the context.report() call.`),L(a,`data`)){let e=t.meta.messages[a.messageId],n=E(e,a.data);g.strictEqual(l.message,n,`Hydrated message "${n}" does not match "${l.message}"`)}else{let e=s===!0||s===`error`,n=U(t.meta.messages[a.messageId]).length>0;g.ok(!e||!n,`Error should specify the 'data' property as the referenced message has placeholders.`)}}let n=[`line`,`column`,`endLine`,`endColumn`],u={},m={};for(let e of n)L(a,e)&&(u[e]=l[e],m[e]=a[e]);if(o){let e=n.filter(e=>!L(a,e)&&L(l,e));g.ok(e.length===0,`Error is missing expected location properties: ${e.join(`, `)}`)}if(Object.keys(m).length>0&&g.deepStrictEqual(u,m,`Actual error location does not match expected error location.`),g.ok(!l.suggestions||L(a,`suggestions`),`Error at index ${r} has suggestions. Please specify 'suggestions' property on the test error object.`),L(a,`suggestions`)){let n=Array.isArray(a.suggestions)?a.suggestions.length>0:!!a.suggestions,r=l.suggestions!==void 0;!r&&n?g.ok(!a.suggestions,`Error should have suggestions on error with message: "${l.message}"`):r&&(g.ok(n,`Error should have no suggestions on error with message: "${l.message}"`),typeof a.suggestions==`number`?g.strictEqual(l.suggestions.length,a.suggestions,`Error should have ${a.suggestions} suggestions. Instead found ${l.suggestions.length} suggestions`):Array.isArray(a.suggestions)?(g.strictEqual(l.suggestions.length,a.suggestions.length,`Error should have ${a.suggestions.length} suggestions. Instead found ${l.suggestions.length} suggestions`),a.suggestions.forEach((n,r)=>{g.ok(typeof n==`object`&&!!n,`Test suggestion in 'suggestions' array must be an object.`),Object.keys(n).forEach(e=>{g.ok(F.has(e),`Invalid suggestion property name '${e}'. Expected one of ${ce}.`)});let a=l.suggestions[r],o=`Error Suggestion at index ${r}:`;if(L(n,`desc`))g.ok(!L(n,`data`),`${o} Test should not specify both 'desc' and 'data'.`),g.ok(!L(n,`messageId`),`${o} Test should not specify both 'desc' and 'messageId'.`),g.strictEqual(a.desc,n.desc,`${o} desc should be "${n.desc}" but got "${a.desc}" instead.`);else if(L(n,`messageId`)){g.ok(c,`${o} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.`),g.ok(L(t.meta.messages,n.messageId),`${o} Test has invalid messageId '${n.messageId}', the rule under test allows only one of ${d}.`),g.strictEqual(a.messageId,n.messageId,`${o} messageId should be '${n.messageId}' but got '${a.messageId}' instead.`);let e=t.meta.messages[n.messageId],r=W(a.desc,e,n.data);if(g.ok(r.length===0,`The message of the suggestion has ${r.length>1?`unsubstituted placeholders: ${r.map(e=>`'${e}'`).join(`, `)}`:`an unsubstituted placeholder '${r[0]}'`}. Please provide the missing ${r.length>1?`values`:`value`} via the 'data' property for the suggestion in the context.report() call.`),L(n,`data`)){let e=t.meta.messages[n.messageId],r=E(e,n.data);g.strictEqual(a.desc,r,`${o} Hydrated test desc "${r}" does not match received desc "${a.desc}".`)}else{let t=s===!0||s===`suggestion`,n=U(e).length>0;g.ok(!t||!n,`${o} Suggestion should specify the 'data' property as the referenced message has placeholders.`)}}else L(n,`data`)?g.fail(`${o} Test must specify 'messageId' if 'data' is used.`):g.fail(`${o} Test must specify either 'messageId' or 'desc'.`);g.ok(L(n,`output`),`${o} The "output" property is required.`);let u=T.applyFixes(e.code,[a]).output,f=i.verify(u,p.configs,p.filename).find(e=>e.fatal);g(!f,[`A fatal parsing error occurred in suggestion fix.`,`Error: ${f&&f.message}`,`Suggestion output:`,u].join(`
|
|
5
5
|
`)),g.strictEqual(u,n.output,`Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${r} on error with message: "${l.message}"`),g.notStrictEqual(n.output,e.code,`The output of a suggestion should differ from the original source code for suggestion at index: ${r} on error with message: "${l.message}"`)})):g.fail(`Test error object property 'suggestions' should be an array or a number`))}}}catch(e){throw e instanceof Error&&(e.errorIndex=r),e}}L(e,`output`)?e.output===null?g.strictEqual(p.output,e.code,`Expected no autofixes to be suggested`):(g.strictEqual(p.output,e.output,`Output is incorrect.`),g.notStrictEqual(e.code,e.output,`Test property 'output' matches 'code'. If no autofix is expected, then omit the 'output' property or set it to null.`)):g.strictEqual(p.output,e.code,`The rule fixed the code. Please add 'output' property.`),u(p.beforeAST,p.afterAST)}this.constructor.describe(e,()=>{n.valid.length>0&&this.constructor.describe(`valid`,()=>{let e=/* @__PURE__ */ new Set;n.valid.forEach((t,n)=>{let r=K(t);this.constructor[t.only?`itOnly`:`it`](B(r.name||r.code),()=>{try{c(r,`before`),_e(r,e),d(r)}catch(e){throw e instanceof Error&&(e.scenarioType=`valid`,e.scenarioIndex=n,e.stack=e.stack.replace(/^ +at /mu,[` roughly at RuleTester.run.valid[${n}] (${o(`valid[${n}]`)})`,` roughly at RuleTester.run.valid (${o(`valid`)})`,` at RuleTester.run (${o(`root`)})`,` at `].join(`
|
|
6
6
|
`))),e}finally{c(r,`after`)}})})}),n.invalid.length>0&&this.constructor.describe(`invalid`,()=>{let t=/* @__PURE__ */ new Set;n.invalid.forEach((r,i)=>{let a=K(r);this.constructor[a.only?`itOnly`:`it`](B(a.name||a.code),()=>{try{c(a,`before`),ve(a,t,e,n.assertionOptions),p(a)}catch(e){if(e instanceof Error){e.scenarioType=`invalid`,e.scenarioIndex=i;let t=e.errorIndex;e.stack=e.stack.replace(/^ +at /mu,[...typeof t==`number`?[` roughly at RuleTester.run.invalid[${i}].error[${t}] (${o(`invalid[${i}].errors[${t}]`)})`]:[],` roughly at RuleTester.run.invalid[${i}] (${o(`invalid[${i}]`)})`,` roughly at RuleTester.run.invalid (${o(`invalid`)})`,` at RuleTester.run (${o(`root`)})`,` at `].join(`
|
|
7
|
-
`))}throw e}finally{c(a,`after`)}})})})})}};$[X]=$[Z]=$[Q]=null,
|
|
7
|
+
`))}throw e}finally{c(a,`after`)}})})})})}};$[X]=$[Z]=$[Q]=null,m.exports=$})),_=/* @__PURE__ */ t(((e,t)=>{t.exports={RuleTester:g()}})),v=(/* @__PURE__ */ t(((e,t)=>{let{ESLint:r}=m(),{Linter:i}=n(),{RuleTester:a}=_(),{SourceCode:o}=s();async function c(){return r}t.exports={Linter:i,loadESLint:c,ESLint:r,RuleTester:a,SourceCode:o}})))(),y=v.ESLint,b=v.Linter,x=v.RuleTester,S=v.SourceCode,C=v.loadESLint;export{y as ESLint,b as Linter,x as RuleTester,S as SourceCode,C as loadESLint};
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-C7uQZ-1I.js";var n=/* @__PURE__ */ t((t=>{var n=e(`node:fs`),r=e(`node:path`);let i=[`env`,`extends`,`globals`,`ignorePatterns`,`noInlineConfig`,`overrides`,`parser`,`parserOptions`,`reportUnusedDisableDirectives`,`root`],a=/* @__PURE__ */ new Set([`basePath`,`ignores`,`name`]);function o(e,t){return e.name?e.name:`UserConfig${t}`}function s(e,t){return typeof e==`string`?e:e.name?e.name:`ExtendedConfig${t}`}function c(e){if(Array.isArray(e.plugins))return!0;for(let t of i)if(t in e)return!0;return!1}function l(e){return Object.keys(e).every(e=>a.has(e))}function u(e){let t=e.indexOf(`/`);if(t===-1)return{namespace:``,name:e};let n=e.slice(0,t);if(n[0]===`@`&&n!==`@`){let r=e.indexOf(`/`,t+1);if(r!==-1)return n=e.slice(0,r),{namespace:n,name:e.slice(r+1)}}let r=e.slice(t+1);return{namespace:n,name:r}}function d(e,t,n){let r=t.meta?.namespace;if(!r||r===e||!n.rules&&!n.processor&&!n.language)return n;let i={...n};if(i.rules){let t=Object.keys(i.rules),n={};for(let a=0;a<t.length;a++){let o=t[a],{namespace:s,name:c}=u(o);s===r?n[`${e}/${c}`]=i.rules[o]:n[o]=i.rules[o]}i.rules=n}if(typeof i.processor==`string`){let{namespace:t,name:n}=u(i.processor);t&&t===r&&(i.processor=`${e}/${n}`)}if(typeof i.language==`string`){let{namespace:t,name:n}=u(i.language);t===r&&(i.language=`${e}/${n}`)}return i}function f(e,t,n,r){if(Array.isArray(n))return n.map(n=>f(e,t,n,r));if(c(n))throw TypeError(`Plugin config "${r}" is an eslintrc config and cannot be used in this context.`);return d(e,t,n)}function p(e,t){let{namespace:n,name:r}=u(t),i=e.plugins?.[n];if(!i)throw TypeError(`Plugin "${n}" not found.`);let a=i.configs?.[r];if(a&&(Array.isArray(a)||!c(a)))return f(n,i,a,t);let o=i.configs?.[`flat/${r}`];if(o&&(Array.isArray(o)||!c(o)))return f(n,i,o,t);let s=a||o?`Plugin config "${r}" in plugin "${n}" is an eslintrc config and cannot be used in this context.`:`Plugin config "${r}" not found in plugin "${n}".`;throw TypeError(s)}function*m(e,t=``){for(let n=0;n<e.length;n++){let r=t?`${t}[${n}]`:`[${n}]`;if(Array.isArray(e[n])){yield*m(e[n],r);continue}yield{indexPath:r,value:e[n]}}}function h(e=[],t=[]){if(!t.length)return e.concat();if(!e.length)return t.concat();let n=[];for(let r of e)for(let e of t){let t=[];Array.isArray(r)?t.push(...r):t.push(r),Array.isArray(e)?t.push(...e):t.push(e),n.push(t)}return n}function g(e,t,n,r){let i={...n};return l(n)||(e.files&&(i.files=h(e.files,n.files)),e.ignores&&(i.ignores=e.ignores.concat(n.ignores??[]))),i.name=`${t} > ${r}`,e.basePath&&(i.basePath=e.basePath),i}function _(e,t){if(!e.extends)return[e];if(!Array.isArray(e.extends))throw TypeError("The `extends` property must be an array.");let{extends:n,...r}=e,i=/* @__PURE__ */ new WeakMap,a=n.map(t=>{if(typeof t==`string`){let n=p(e,t);return Array.isArray(n)?n.forEach((e,n)=>{i.set(e,`${t}[${n}]`)}):i.set(n,t),n}return t}),o=[];for(let{indexPath:n,value:c}of m(a)){let a=c;if(`basePath`in a)throw TypeError("'basePath' in `extends` is not allowed.");if(`extends`in a)throw TypeError(`Nested 'extends' is not allowed.`);let l=t.get(e),u=i.get(c)??s(c,n);o.push(g(r,l,a,u))}return l(r)||o.push(r),o.flat()}function v(e,t){return e.flatMap(e=>_(e,t))}function y(...e){let t=/* @__PURE__ */ new WeakMap,n=[];if(e.length===0)throw TypeError(`Expected one or more arguments.`);for(let{indexPath:r,value:i}of m(e)){if(typeof i!=`object`||!i)throw TypeError(`Expected an object but received ${String(i)}.`);let e=i;t.set(e,o(e,r)),n.push(e)}return v(n,t)}let b=0;function x(e,t){if(!Array.isArray(e))throw TypeError(`ignorePatterns must be an array`);if(e.length===0)throw TypeError(`ignorePatterns must contain at least one pattern`);let n=b++;return{name:t||`globalIgnores ${n}`,ignores:e}}function S(e){let t=e.startsWith(`!`),n=t?`!`:``,r=(t?e.slice(1):e).trimEnd();if([``,`**`,`/**`,`**/`].includes(r))return`${n}${r}`;let i=r.indexOf(`/`);return`${n}${i<0||i===r.length-1?`**/`:``}${(i===0?r.slice(1):r).replaceAll(/(?=((?:\\.|[^{(])*))\1([{(])/guy,`$1\\$2`)}${r.endsWith(`/**`)?`/*`:``}`}function C(e){return n.readFileSync(e,`utf8`).split(/\r?\n/u).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`#`)).map(S)}function w(e){if(typeof e==`string`)return{gitignoreResolution:!1,name:e};let t=e??{};if(typeof t!=`object`||Array.isArray(t))throw TypeError("The options argument to `includeIgnoreFile()` should be an object or a string.");let n=t.gitignoreResolution??!1;if(typeof n!=`boolean`)throw TypeError("The `gitignoreResolution` option must be specified a boolean or omitted");let r=t.name??`Imported .gitignore patterns`;if(typeof r!=`string`)throw TypeError("The `name` option must be specified as a string or omitted.");return{gitignoreResolution:n,name:r}}function T(e,t){let n=!Array.isArray(e),i=Array.isArray(e)?e:[e];for(let e of i){if(typeof e!=`string`)throw TypeError("The first argument to `includeIgnoreFile()` should be a string or array of strings");if(!r.isAbsolute(e))throw Error(`The ignore file location must be an absolute path. Received ${e}`)}let{gitignoreResolution:a,name:o}=w(t);return n?{name:o,ignores:C(e),...a?{basePath:r.dirname(e)}:{}}:i.map((e,t)=>({name:`${o} (${t})`,ignores:C(e),...a?{basePath:r.dirname(e)}:{}}))}t.convertIgnorePatternToMinimatch=S,t.defineConfig=y,t.globalIgnores=x,t.includeIgnoreFile=T})),r=(/* @__PURE__ */ t(((e,t)=>{let{defineConfig:r,globalIgnores:i,includeIgnoreFile:a}=n();t.exports={defineConfig:r,globalIgnores:i,includeIgnoreFile:a}})))(),i=r.defineConfig,a=r.globalIgnores,o=r.includeIgnoreFile;export{i as defineConfig,a as globalIgnores,o as includeIgnoreFile};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import{r as e,t}from"./rolldown-runtime-C7uQZ-1I.js";import{C as n,l as r,m as i,n as a,p as o,r as s,s as c,t as l,w as u,x as d}from"./eslint-helpers-4m3QC9jt.js";import{t as f}from"./naming-BtEmRC_V.js";var p=/* @__PURE__ */ t(((e,t)=>{t.exports=function(e,t){let n=t.align,r=t.stringLength,i=e.map(e=>e.map(e=>r(e))),a=i.reduce((e,t)=>(t.forEach((t,n)=>{(!e[n]||t>e[n])&&(e[n]=t)}),e),[]);return e.map((e,t)=>e.map((e,r)=>{let o=a[r]-i[t][r]||0,s=o>0?` `.repeat(o):``;return n[r]===`r`?s+e:e+s}).join(` `).trimEnd()).join(`
|
|
2
|
+
`)}})),m=/* @__PURE__ */ t(((t,n)=>{let r=e(`node:util`),i=p();function a(e){return e===void 0?(e,t)=>r.styleText(e,t,{validateStream:!0}):e?(e,t)=>r.styleText(e,t,{validateStream:!1}):(e,t)=>t}function o(e){return e.includes(`\x1B`)||e.includes(``)?r.stripVTControlCharacters(e).length:e.length}function s(e,t){return t===1?e:`${e}s`}n.exports=function(e,t){let n=a(t?.color),r=`
|
|
3
|
+
`,c=0,l=0,u=0,d=0,f=`yellow`;e.forEach(e=>{let t=e.messages;t.length!==0&&(c+=e.errorCount,l+=e.warningCount,u+=e.fixableErrorCount,d+=e.fixableWarningCount,r+=`${n(`underline`,e.filePath)}\n`,r+=`${i(t.map(e=>{let t;e.fatal||e.severity===2?(t=n(`red`,`error`),f=`red`):t=n(`yellow`,`warning`);let r=e.message;return r.length>1&&r.endsWith(`.`)&&r.at(-2)!==` `&&(r=r.slice(0,-1)),[``,String(e.line||0),String(e.column||0),t,r,e.ruleId?n(`dim`,e.ruleId):``]}),{align:[``,`r`,`l`],stringLength:o}).split(`
|
|
4
|
+
`).map(e=>e.replace(/(\d+)\s+(\d+)/u,(e,t,r)=>n(`dim`,`${t}:${r}`))).join(`
|
|
5
|
+
`)}\n\n`)});let p=c+l;return p>0&&(r+=`${n(f,n(`bold`,[`✖ `,p,s(` problem`,p),` (`,c,s(` error`,c),`, `,l,s(` warning`,l),`)`].join(``)))}\n`,(u>0||d>0)&&(r+=`${n(f,n(`bold`,[` `,u,s(` error`,u),` and `,d,s(` warning`,d)," potentially fixable with the `--fix` option."].join(``)))}\n`)),p>0?n(`reset`,r):``}})),h=/* @__PURE__ */ t(((e,t)=>{let n=(function(){let e={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},t=/[&<>"']/gu;return function(n){return n?n.toString().replace(t,t=>e[t]||t):``}})();function r(e){let{reportColor:t,reportSummary:n,date:r,results:i}=e;return`
|
|
6
|
+
<!DOCTYPE html>
|
|
7
|
+
<html>
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
<title>ESLint Report</title>
|
|
11
|
+
<link rel="icon" type="image/png" sizes="any" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAHaAAAB2gGFomX7AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAABD1JREFUWMPFl11sk2UUx3/nbYtjxS1MF7MLMTECMgSTtSSyrQkLhAj7UBPnDSEGoxegGzMwojhXVpmTAA5iYpSoMQa8GBhFOrMFk03buei6yRAlcmOM0SEmU9d90b19jxcM1o5+sGnsc/e+z/l6ztf/HFFVMnns6QieeOCHBePGsHM+wrOtvLG2C4WRVDSSygNV7sCjlspxwDnPB44aols/DXk+mbMBmx/6OseITF1CuOtfevkPh2Uu+/jbdX8lujSScRlT5r7/QDlAfsRmfzmpnkQ/H3H13gf6bBrBn1uqK8WylgEnU8eZmk1repbfchJG1TyKyIKEwuBHFd3lD3naY3O1siiwXsVoBV2VgM1ht/QQUJk2ByqKghsQziYQ8ifKgexIXmuyzC4r67Y7R+xPAfuB/Nn3Cpva+0s7khpQVtZtd4bt51BWxtBYAiciprG7c7D4SixzU9PYalDL6110Ifb/w8W9eY7JqFeFHbO8fPGyLHwwFHJNJTSgwtVTB9oaw9BlQ+tO93vOxypoaQnfEYlI43SeCHDC4TDq9+51/h5fxr33q0ZfV9g04wat9Q943rjJgCp3952W2i8Bi6eDvdsfKj0cK/DYMRyXL4/sUJUmIHd2zYMezsvLaamp4WpcWN3BXSiHpuMwbGbZlnZ8tXY4rgosy+G7oRwQ0cAsd28YGgqfU5UjCZQDLALxDg+Hv/P5Rqvj4hwrS8izXzWb4spwc1GgENFnkpWRzxeuB+ssUHgLdb9UVdt8vpGdKQpze7n7y1U3DBChNRUuqOo9c+0+qpKKxyZqtAIYla7gY4JszAAQri93BSsMRZoyBcUC+w3Q3AyOA4sNhAOZ0q7Iq0b2vUNvK5zPgP+/H8+Zetdoa6uOikhdGurxebwvJY8Iz3V1rTMNAH+opEuQj5KTT/qA1yC+wyUjBm12OidaUtCcPNNX2h0Hx2JG69VulANZAJZJwfU7rzd/FHixuXniTdM0m4GtSQT7bTartqEh9yfImUEzkwKZmTwmo5a5JwkYBfcDL01/RkR5y8iWhtPBknB8ZxwtU9UjwOrrKCeizzc25nTGg1F/turEHoU9wMLpDvWKf8DTmNCAKnd/tqUTF4ElMXJ+A5rWDJS+41WsGWzALhJ+ErBWrLj9g+pqojHxlXJX8HGUg0BsR/x1yhxf3jm4cSzpQFLp6tmi6PEE7g1ZhtZ91ufpSZUAFa6gC+UoQslNaSmypT1U8mHKiUgEKS8KfgF4EpYunFI16tsHin+OG0LcgQK7yj7g6cSzpva2D3hKVNG0Y3mVO1BkqfSlmJrHBQ4uvM12gJHc6ETW8HZVfMRmXvyxxNC1Z/o839zyXlDuCr4nsC11J+MXueaVJWn6yPv+/pJtc9oLTNN4AeTvNGByd3rlhE2x9s5pLwDoHCy+grDzWmOZ95lUtLYj5Bma126Y8eX0/zj/ADxGyViSg4BXAAAAAElFTkSuQmCC">
|
|
12
|
+
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMjk0LjgyNSAyNTguOTgyJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPg0KPHBhdGggZmlsbD0nIzgwODBGMicgZD0nTTk3LjAyMSw5OS4wMTZsNDguNDMyLTI3Ljk2MmMxLjIxMi0wLjcsMi43MDYtMC43LDMuOTE4LDBsNDguNDMzLDI3Ljk2MiBjMS4yMTEsMC43LDEuOTU5LDEuOTkzLDEuOTU5LDMuMzkzdjU1LjkyNGMwLDEuMzk5LTAuNzQ4LDIuNjkzLTEuOTU5LDMuMzk0bC00OC40MzMsMjcuOTYyYy0xLjIxMiwwLjctMi43MDYsMC43LTMuOTE4LDAgbC00OC40MzItMjcuOTYyYy0xLjIxMi0wLjctMS45NTktMS45OTQtMS45NTktMy4zOTR2LTU1LjkyNEM5NS4wNjMsMTAxLjAwOSw5NS44MSw5OS43MTYsOTcuMDIxLDk5LjAxNicvPg0KPHBhdGggZmlsbD0nIzRCMzJDMycgZD0nTTI3My4zMzYsMTI0LjQ4OEwyMTUuNDY5LDIzLjgxNmMtMi4xMDItMy42NC01Ljk4NS02LjMyNS0xMC4xODgtNi4zMjVIODkuNTQ1IGMtNC4yMDQsMC04LjA4OCwyLjY4NS0xMC4xOSw2LjMyNWwtNTcuODY3LDEwMC40NWMtMi4xMDIsMy42NDEtMi4xMDIsOC4yMzYsMCwxMS44NzdsNTcuODY3LDk5Ljg0NyBjMi4xMDIsMy42NCw1Ljk4Niw1LjUwMSwxMC4xOSw1LjUwMWgxMTUuNzM1YzQuMjAzLDAsOC4wODctMS44MDUsMTAuMTg4LTUuNDQ2bDU3Ljg2Ny0xMDAuMDEgQzI3NS40MzksMTMyLjM5NiwyNzUuNDM5LDEyOC4xMjgsMjczLjMzNiwxMjQuNDg4IE0yMjUuNDE5LDE3Mi44OThjMCwxLjQ4LTAuODkxLDIuODQ5LTIuMTc0LDMuNTlsLTczLjcxLDQyLjUyNyBjLTEuMjgyLDAuNzQtMi44ODgsMC43NC00LjE3LDBsLTczLjc2Ny00Mi41MjdjLTEuMjgyLTAuNzQxLTIuMTc5LTIuMTA5LTIuMTc5LTMuNTlWODcuODQzYzAtMS40ODEsMC44ODQtMi44NDksMi4xNjctMy41OSBsNzMuNzA3LTQyLjUyN2MxLjI4Mi0wLjc0MSwyLjg4Ni0wLjc0MSw0LjE2OCwwbDczLjc3Miw0Mi41MjdjMS4yODMsMC43NDEsMi4xODYsMi4xMDksMi4xODYsMy41OVYxNzIuODk4eicvPg0KPC9zdmc+">
|
|
13
|
+
<style>
|
|
14
|
+
body {
|
|
15
|
+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
font-weight: normal;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
color: #333;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
#overview {
|
|
24
|
+
padding: 20px 30px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
td,
|
|
28
|
+
th {
|
|
29
|
+
padding: 5px 10px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
h1 {
|
|
33
|
+
margin: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
table {
|
|
37
|
+
margin: 30px;
|
|
38
|
+
width: calc(100% - 60px);
|
|
39
|
+
max-width: 1000px;
|
|
40
|
+
border-radius: 5px;
|
|
41
|
+
border: 1px solid #ddd;
|
|
42
|
+
border-spacing: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
th {
|
|
46
|
+
font-weight: 400;
|
|
47
|
+
font-size: medium;
|
|
48
|
+
text-align: left;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
td.clr-1,
|
|
53
|
+
td.clr-2,
|
|
54
|
+
th span {
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
th span {
|
|
59
|
+
float: right;
|
|
60
|
+
margin-left: 20px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
th span::after {
|
|
64
|
+
content: "";
|
|
65
|
+
clear: both;
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
tr:last-child td {
|
|
70
|
+
border-bottom: none;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
tr td:first-child,
|
|
74
|
+
tr td:last-child {
|
|
75
|
+
color: #9da0a4;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#overview.bg-0,
|
|
79
|
+
tr.bg-0 th {
|
|
80
|
+
color: #468847;
|
|
81
|
+
background: #dff0d8;
|
|
82
|
+
border-bottom: 1px solid #d6e9c6;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#overview.bg-1,
|
|
86
|
+
tr.bg-1 th {
|
|
87
|
+
color: #f0ad4e;
|
|
88
|
+
background: #fcf8e3;
|
|
89
|
+
border-bottom: 1px solid #fbeed5;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#overview.bg-2,
|
|
93
|
+
tr.bg-2 th {
|
|
94
|
+
color: #b94a48;
|
|
95
|
+
background: #f2dede;
|
|
96
|
+
border-bottom: 1px solid #eed3d7;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
td {
|
|
100
|
+
border-bottom: 1px solid #ddd;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
td.clr-1 {
|
|
104
|
+
color: #f0ad4e;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
td.clr-2 {
|
|
108
|
+
color: #b94a48;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
td a {
|
|
112
|
+
color: #3a33d1;
|
|
113
|
+
text-decoration: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
td a:hover {
|
|
117
|
+
color: #272296;
|
|
118
|
+
text-decoration: underline;
|
|
119
|
+
}
|
|
120
|
+
</style>
|
|
121
|
+
</head>
|
|
122
|
+
<body>
|
|
123
|
+
<div id="overview" class="bg-${t}">
|
|
124
|
+
<h1>ESLint Report</h1>
|
|
125
|
+
<div>
|
|
126
|
+
<span>${n}</span> - Generated on ${r}
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
<table>
|
|
130
|
+
<tbody>
|
|
131
|
+
${i}
|
|
132
|
+
</tbody>
|
|
133
|
+
</table>
|
|
134
|
+
<script type="text/javascript">
|
|
135
|
+
var groups = document.querySelectorAll("tr[data-group]");
|
|
136
|
+
for (i = 0; i < groups.length; i++) {
|
|
137
|
+
groups[i].addEventListener("click", function() {
|
|
138
|
+
var inGroup = document.getElementsByClassName(this.getAttribute("data-group"));
|
|
139
|
+
this.innerHTML = (this.innerHTML.indexOf("+") > -1) ? this.innerHTML.replace("+", "-") : this.innerHTML.replace("-", "+");
|
|
140
|
+
for (var j = 0; j < inGroup.length; j++) {
|
|
141
|
+
inGroup[j].style.display = (inGroup[j].style.display !== "none") ? "none" : "table-row";
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
<\/script>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
|
148
|
+
`.trimStart()}function i(e,t){return t===1?e:`${e}s`}function a(e,t){let n=e+t,r=`${n} ${i(`problem`,n)}`;return n!==0&&(r+=` (${e} ${i(`error`,e)}, ${t} ${i(`warning`,t)})`),r}function o(e,t){return e===0?t===0?0:1:2}function s(e){let{parentIndex:t,lineNumber:r,columnNumber:i,severityNumber:a,severityName:o,message:s,ruleUrl:c,ruleId:l}=e;return`
|
|
149
|
+
<tr style="display: none;" class="f-${t}">
|
|
150
|
+
<td>${r}:${i}</td>
|
|
151
|
+
<td class="clr-${a}">${o}</td>
|
|
152
|
+
<td>${n(s)}</td>
|
|
153
|
+
<td>
|
|
154
|
+
<a href="${c||``}" target="_blank" rel="noopener noreferrer">${n(l)}</a>
|
|
155
|
+
</td>
|
|
156
|
+
</tr>
|
|
157
|
+
`.trimStart()}function c(e,t,n){return e.map(e=>{let r=e.line||0,i=e.column||0,a;if(n){let t=n[e.ruleId];t&&t.docs&&t.docs.url&&(a=t.docs.url)}return s({parentIndex:t,lineNumber:r,columnNumber:i,severityNumber:e.severity,severityName:e.severity===1?`Warning`:`Error`,message:e.message,ruleId:e.ruleId,ruleUrl:a})}).join(`
|
|
158
|
+
`)}function l(e){let{color:t,index:r,filePath:i,summary:a}=e;return`
|
|
159
|
+
<tr class="bg-${t}" data-group="f-${r}">
|
|
160
|
+
<th colspan="4">
|
|
161
|
+
[+] ${n(i)}
|
|
162
|
+
<span>${n(a)}</span>
|
|
163
|
+
</th>
|
|
164
|
+
</tr>
|
|
165
|
+
`.trimStart()}function u(e,t){return e.map((e,n)=>l({index:n,color:o(e.errorCount,e.warningCount),filePath:e.filePath,summary:a(e.errorCount,e.warningCount)})+c(e.messages,n,t)).join(`
|
|
166
|
+
`)}t.exports=function(e,t){let n,i,s=t?t.rulesMeta:{};return n=0,i=0,e.forEach(e=>{n+=e.errorCount,i+=e.warningCount}),r({date:/* @__PURE__ */ new Date,reportColor:o(n,i),reportSummary:a(n,i),results:u(e,s)})}})),g=/* @__PURE__ */ t(((e,t)=>{t.exports=function(e){return JSON.stringify(e)}})),_=/* @__PURE__ */ t(((e,t)=>{t.exports=function(e,t){return JSON.stringify({results:e,metadata:t})}})),v=/* @__PURE__ */ t((e=>{function t(e){globalThis?.process?.env.DEBUG===`@hwc/retry`&&console.debug(e)}function n(e,t){let n=Date.now()-e.lastAttempt,r=Math.max(e.lastAttempt-e.timestamp,1);return n>=Math.min(r*1.2,t)}function r(e,t){return e.age>t}function i(){if(Promise.withResolvers)return Promise.withResolvers();let e,t,n=new Promise((n,r)=>{e=n,t=r});if(e===void 0||t===void 0)throw Error(`Promise executor did not initialize resolve or reject.`);return{promise:n,resolve:e,reject:t}}var a=class{id=Math.random().toString(36).slice(2);fn;error;timestamp=Date.now();lastAttempt=this.timestamp;resolve;reject;signal;constructor(e,t,n,r,i){this.fn=e,this.error=t,this.timestamp=Date.now(),this.lastAttempt=Date.now(),this.resolve=n,this.reject=r,this.signal=i}get age(){return Date.now()-this.timestamp}};e.Retrier=class{#e=[];#t=[];#n=0;#r;#i;#a;#o;#s;constructor(e,{timeout:t=6e4,maxDelay:n=100,concurrency:r=1e3}={}){if(typeof e!=`function`)throw Error(`Missing function to check errors`);this.#o=e,this.#r=t,this.#i=n,this.#s=r}get retrying(){return this.#e.length}get pending(){return this.#t.length}get working(){return this.#n}#c(e,{signal:n,promise:r,resolve:i,reject:o}){let s;try{s=e()}catch(e){return o(Error(`Synchronous error: ${e.message}`,{cause:e})),r}return!s||typeof s.then!=`function`?(o(/* @__PURE__ */ Error(`Result is not a promise.`)),r):(this.#n++,r.finally(()=>{this.#n--,this.#u()}).catch(()=>{}),Promise.resolve(s).then(e=>{t(`Function called successfully without retry.`),i(e)}).catch(r=>{if(!this.#o(r)){o(r);return}let s=new a(e,r,i,o,n);t(`Function failed, queuing for retry with task ${s.id}.`),this.#e.push(s),n?.addEventListener(`abort`,()=>{t(`Task ${s.id} was aborted due to AbortSignal.`),o(n.reason)}),this.#d()}),r)}retry(e,{signal:t}={}){t?.throwIfAborted();let{promise:n,resolve:r,reject:a}=i();return this.#t.push(()=>this.#c(e,{signal:t,promise:n,resolve:r,reject:a})),this.#u(),n}#l(){this.pending&&this.#u(),this.retrying&&this.#d()}#u(){t(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);let e=this.#s-this.working;if(e<=0)return;let n=Math.min(this.pending,e);for(let e=0;e<n;e++)this.#t.shift()?.();t(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`)}#d(){clearTimeout(this.#a),this.#a=void 0,t(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`);let e=()=>{this.#a=setTimeout(()=>this.#l(),0)},i=this.#e.shift();if(!i){t(`Queue is empty, exiting.`),this.pending&&e();return}if(r(i,this.#r)){t(`Task ${i.id} was abandoned due to timeout.`),i.reject(i.error),e();return}if(!n(i,this.#i)){t(`Task ${i.id} is not ready to retry, skipping.`),this.#e.push(i),e();return}i.lastAttempt=Date.now(),Promise.resolve(i.fn()).then(e=>{t(`Task ${i.id} succeeded after ${i.age}ms.`),i.resolve(e)}).catch(e=>{if(!this.#o(e)){t(`Task ${i.id} failed with non-retryable error: ${e.message}.`),i.reject(e);return}i.lastAttempt=Date.now(),this.#e.push(i),t(`Task ${i.id} failed, requeueing to try again.`)}).finally(()=>{this.#l()})}}})),y=/* @__PURE__ */ t((t=>{let n=e(`node:module`).createRequire;function r(e,t){return n(t).resolve(e)}t.resolve=r})),b=/* @__PURE__ */ t(((t,p)=>{n();let{existsSync:b}=e(`node:fs`),x=e(`node:fs/promises`),S=e(`node:os`),C=e(`node:path`),{pathToFileURL:w}=e(`node:url`),{SHARE_ENV:ee,Worker:te}=e(`node:worker_threads`),{version:ne}=u(),{defaultConfig:re}=i(),T=o(),ie={stylish:m(),html:h(),json:g(),"json-with-metadata":_()},{createDebug:ae,findFiles:oe,getCacheFile:E,isNonEmptyString:D,isArrayOfNonEmptyString:O,createIgnoreResult:se,isErrorMessage:k,getPlaceholderPath:A,processOptions:ce,loadOptionsFromModule:le,getFixerForFixTypes:ue,verifyText:j,lintFile:M,createLinter:N,createLintResultCache:P,createDefaultConfigs:F,createConfigLoader:I}=l(),{Retrier:L}=v(),{ConfigLoader:R}=s(),{WarningService:z}=c(),{SuppressionsService:B}=a(),{Config:V}=r(),{getShorthandName:H,getNamespaceFromTerm:U,normalizePackageName:W}=f(),{resolve:de}=y(),G=process.hrtime.bigint,K=ae(`eslint:eslint`),q=/* @__PURE__ */ new WeakMap,fe=/* @__PURE__ */ new Set([`checkstyle`,`codeframe`,`compact`,`jslint-xml`,`junit`,`table`,`tap`,`unix`,`visualstudio`]),J=/* @__PURE__ */ new Set([`ENFILE`,`EMFILE`]);function pe(e){return Array.from(e).reduce((e,[t,n])=>(e[t]=n.meta,e),{})}function me(e){if(typeof e.deprecated!=`object`)return e.replacedBy||[];let{replacedBy:t}=e.deprecated;return Array.isArray(t)?t.map(e=>{if(typeof e!=`object`||!e)return``;let t=e.plugin?.name,n=e.rule?.name;return`${typeof t==`string`?`${H(t,`eslint-plugin`)}/`:``}${typeof n==`string`?n:``}`}):[]}let Y=/* @__PURE__ */ new WeakMap;function he(e,t){let{options:{cwd:n},configLoader:r}=q.get(e),i=C.isAbsolute(t)?t:A(n),a=r.getCachedConfigArrayForFile(i).getConfig(i);if(a&&!Y.has(a)){let e=[];if(a.rules)for(let[t,n]of Object.entries(a.rules)){if(V.getRuleNumericSeverity(n)===0)continue;let r=a.getRuleDefinition(t),i=r&&r.meta;if(i&&i.deprecated){let n=typeof i.deprecated==`object`;e.push({ruleId:t,replacedBy:me(i),info:n?i.deprecated:void 0})}}Y.set(a,Object.freeze(e))}return a?Y.get(a):Object.freeze([])}function X(e,t){let n={configurable:!0,enumerable:!0,get(){return he(e,this.filePath)}};for(let e of t)Object.defineProperty(e,"usedDeprecatedRules",n);return t}function ge(e,t){return e.filePath<t.filePath?-1:+(e.filePath>t.filePath)}async function _e({configFile:e,cwd:t}){let n=await new R({cwd:t,configFile:e}).findConfigFileForPath(C.join(t,`__placeholder__.js`));if(!n)throw Error(`No ESLint configuration file was found.`);return{configFilePath:n,basePath:e?t:C.dirname(n)}}function Z(e){return TypeError(`Results object was not created from this ESLint instance.`,{cause:e})}function Q(e,t){let n=Math.ceil(e/50);return n>t&&(n=t),n<=1&&(n=0),n}function ve(e,t,n,r){let i=e.getValidCachedLintResults(n,r);return!i||t&&i.messages&&i.messages.length>0}function ye(e,t,n){let r=G(),{configLoader:i,lintResultCache:a,options:{cacheStrategy:o,fix:s}}=q.get(e),c=!a||o===`content`,l=0,u=t.length,d=0;for(let e of t){let t=Q(l+u,n);if(d>=t)break;u--;let r=i.getCachedConfigArrayForFile(e).getConfig(e);r&&(c||ve(a,s,e,r))&&(l++,d=Q(l,n))}return K(`%d file(s) to process counted in %t`,l,G()-r),d}function be(e,t,{availableParallelism:n}=S){let{concurrency:r}=q.get(e).options;switch(r){case`off`:return 0;case`auto`:return ye(e,t,n()>>1);default:{let e=Math.min(r,t.length);return e>1?e:0}}}let $=Symbol(`Do not check for uncloneable options.`);async function xe(e,t,n,r){let i=e.length,a=Array(i),o=w(C.join(d,`./worker.js`)),s=new Uint32Array(new SharedArrayBuffer(Uint32Array.BYTES_PER_ELEMENT)),c=new AbortController,l=c.signal,u={env:ee,workerData:{eslintOptionsOrURL:n,filePathIndexArray:s,filePaths:e}},f=1;function p(e,t){let n=G(),r=new te(o,u);r.once(`message`,t=>{let r=G()-n,i=Number(t.netLintingDuration)/Number(r);f=Math.min(f,i),T.enabled&&t.timings&&T.mergeData(t.timings);for(let e of t){let{index:t}=e;delete e.index,a[t]=e}e()}),r.once(`error`,e=>{c.abort(e),t(e)}),l.addEventListener(`abort`,()=>r.terminate())}let m=Array(t);for(let e=0;e<t;++e)m[e]=new Promise(p);try{await Promise.all(m)}catch(e){throw T.disableDisplay(),e}return f<.7&&r(),a}async function Se(e,t,n,r,i){let{configLoader:a,lintResultCache:o}=q.get(e),s=await xe(t,n,r,i);return o&&s.forEach((e,n)=>{if(e){let r=t[n],i=a.getCachedConfigArrayForFile(r).getConfig(r);i&&o.setCachedLintResults(r,i,e)}}),s}async function Ce(e,t){let{configLoader:n,linter:r,lintResultCache:i,options:a}=q.get(e),o=new AbortController,s=new L(e=>J.has(e.code),{concurrency:100});return await Promise.all(t.map(async e=>{let t=n.getCachedConfigArrayForFile(e),c=t.getConfig(e),l=await M(e,t,a,r,i,null,s,o);return c&&i?.setCachedLintResults(e,c,l),l}))}function we(e){try{structuredClone(e);return}catch{}let t=Object.keys(e).filter(t=>{try{structuredClone(e[t])}catch{return!0}return!1}).sort(),n=/* @__PURE__ */ TypeError(`The ${t.length===1?`option`:`options`} ${new Intl.ListFormat(`en-US`).format(t.map(e=>`"${e}"`))} cannot be cloned. When concurrency is enabled, all options must be cloneable values (JSON values). Remove uncloneable options or use an options module.`);throw n.code=`ESLINT_UNCLONEABLE_OPTIONS`,n}var Te=class e{static configType=`flat`;#e;#t;constructor(e={}){let t=ce(e);!e[$]&&t.concurrency!==`off`&&(we(e),this.#t=e);let n=new z,r=N(t,n),i=E(t.cacheLocation,t.cwd),a=P(t,i),o=null;if(t.applySuppressions){let e=E(t.suppressionsLocation,t.cwd,{prefix:`suppressions_`});o=new B({filePath:e,cwd:t.cwd})}let s=F(e.plugins);this.#e=I(t,s,r,n),q.set(this,{options:t,linter:r,cacheFilePath:i,lintResultCache:a,defaultConfigs:s,configs:null,configLoader:this.#e,warningService:n,suppressionsService:o}),b(C.resolve(t.cwd,`.eslintignore`))&&n.emitESLintIgnoreWarning()}static get version(){return ne}static get defaultConfig(){return re}static async outputFixes(e){if(!Array.isArray(e))throw Error(`'results' must be an array`);let t=new L(e=>J.has(e.code),{concurrency:100});await Promise.all(e.filter(e=>{if(typeof e!=`object`||!e)throw Error(`'results' must include only objects`);return typeof e.output==`string`&&C.isAbsolute(e.filePath)}).map(e=>t.retry(()=>x.writeFile(e.filePath,e.output))))}static getErrorResults(e){let t=[];return e.forEach(e=>{let n=e.messages.filter(k),r=e.suppressedMessages.filter(k);n.length>0&&t.push({...e,messages:n,suppressedMessages:r,errorCount:n.length,warningCount:0,fixableErrorCount:e.fixableErrorCount,fixableWarningCount:0})}),t}static async fromOptionsModule(t){if(!(t instanceof URL))throw TypeError(`Argument must be a URL object`);let n=t.href,r={...await le(n),[$]:!0},i=new e(r);return r.concurrency!==`off`&&(i.#t=n),i}getRulesMetaForResults(e){if(e.length===0)return{};let t=/* @__PURE__ */ new Map,{configLoader:n,options:{cwd:r}}=q.get(this);for(let i of e){let e=i.filePath===`<text>`?A(r):i.filePath,a=i.messages.concat(i.suppressedMessages);for(let{ruleId:r}of a){if(!r)continue;let i;try{i=n.getCachedConfigArrayForFile(e)}catch(e){throw Z(e)}let a=i.getConfig(e);if(!a)throw Z();let o=a.getRuleDefinition(r);o&&t.set(r,o)}}return pe(t)}hasFlag(e){return q.get(this).linter.hasFlag(e)}async lintFiles(e){let t=e,{cacheFilePath:n,lintResultCache:r,options:i,warningService:a,suppressionsService:o}=q.get(this);if(e===``||Array.isArray(e)&&e.length===0){if(i.passOnNoPatterns)return[];t=[`.`]}else{if(!D(e)&&!O(e))throw Error(`'patterns' must be a non-empty string or an array of non-empty strings`);typeof e==`string`&&(t=[e])}K(`Using file patterns: %s`,t);let{concurrency:s,cwd:c,globInputPaths:l,errorOnUnmatchedPattern:u}=i;if(!r&&n){K(`Deleting cache file at %s`,n);try{b(n)&&await x.unlink(n)}catch(e){if(b(n))throw e}}let d=G(),f=await oe({patterns:t,cwd:c,globInputPaths:l,configLoader:this.#e,errorOnUnmatchedPattern:u});K(`%d file(s) found in %t`,f.length,G()-d);let m,h=p.exports.calculateWorkerCount(this,f);if(h){K(`Linting using %d worker thread(s).`,h);let e;e=h<=2?`disable concurrency`:s===`auto`?`disable concurrency or use a numeric concurrency setting`:`reduce or disable concurrency`,m=await Se(this,f,h,this.#t,()=>a.emitPoorConcurrencyWarning(e))}else K(`Linting in single-thread mode.`),m=await Ce(this,f);r&&r.reconcile();let g=m.filter(e=>!!e);if(!i.applySuppressions)return X(this,g);let{results:_}=o.applySuppressions(g,await o.load());return X(this,_)}async lintText(e,t={}){if(typeof e!=`string`)throw Error(`'code' must be a string`);if(typeof t!=`object`)throw Error(`'options' must be an object, null, or undefined`);let{filePath:n,warnIgnored:r,...i}=t||{},a=Object.keys(i);if(a.length>0)throw Error(`'options' must not include the unknown option(s): ${a.join(`, `)}`);if(n!==void 0&&!D(n))throw Error(`'options.filePath' must be a non-empty string or undefined`);if(typeof r!=`boolean`&&r!==void 0)throw Error(`'options.warnIgnored' must be a boolean or undefined`);let{linter:o,options:s,suppressionsService:c}=q.get(this),{allowInlineConfig:l,cwd:u,fix:d,fixTypes:f,warnIgnored:p,ruleFilter:m,stats:h}=s,g=[],_=G(),v=f?new Set(f):null,y=C.resolve(u,n||`__placeholder__.js`),b=await this.#e.loadConfigArrayForFile(y),x=b?.getConfigStatus(y)??`unconfigured`;if(y&&x!==`matched`)(typeof r==`boolean`?r:p)&&g.push(se(y,u,x));else{let t=b.getConfig(y),n=ue(d,v,t);g.push(j({text:e,filePath:y.endsWith(`__placeholder__.js`)?`<text>`:y,configs:b,cwd:u,fix:n,allowInlineConfig:l,ruleFilter:m,stats:h,linter:o}))}if(K(`Linting complete in %t`,G()-_),!n||!s.applySuppressions)return X(this,g);let{results:S}=c.applySuppressions(g,await c.load());return X(this,S)}async loadFormatter(e=`stylish`){if(typeof e!=`string`)throw Error(`'name' must be a string`);let t=e.replace(/\\/gu,`/`),n=U(t),{cwd:r}=q.get(this).options,i,a=!1;if(!n&&t.includes(`/`))i=C.resolve(r,t);else try{let e=W(t,`eslint-formatter`);i=de(e,A(r))}catch{i=C.resolve(d,`../`,`cli-engine`,`formatters`,`${t}.js`),a=!0}let o;try{o=a&&ie[t]||(await import(w(i))).default}catch(t){throw t.message=a&&fe.has(e)?`The ${e} formatter is no longer part of core ESLint. Install it manually with \`npm install -D eslint-formatter-${e}\``:`There was a problem loading formatter: ${i}\nError: ${t.message}`,t}if(typeof o!=`function`)throw TypeError(`Formatter must be a function, but got a ${typeof o}.`);let s=this;return{format(e,t){let n=null;return e.sort(ge),o(e,{...t,cwd:r,get rulesMeta(){return n||=s.getRulesMetaForResults(e),n}})}}}async calculateConfigForFile(e){if(!D(e))throw Error(`'filePath' must be a non-empty string`);let t=q.get(this).options,n=C.resolve(t.cwd,e),r=await this.#e.loadConfigArrayForFile(n);if(!r){let e=/* @__PURE__ */ Error(`Could not find config file.`);throw e.messageTemplate=`config-file-missing`,e}return r.getConfig(n)}async findConfigFile(e){let t=q.get(this).options,n=C.join(t.cwd,`__placeholder__`);return this.#e.findConfigFileForPath(e??n).catch(()=>void 0)}async isPathIgnored(e){return await this.calculateConfigForFile(e)===void 0}};async function Ee(){return!0}p.exports={ESLint:Te,shouldUseFlatConfig:Ee,locateConfigFileToUse:_e,calculateWorkerCount:be}}));export{b as t};
|