@alien_intelligence/eslint-plugin-nitpicker 0.7.3 → 0.7.5

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/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import {ESLintUtils,ASTUtils}from'@typescript-eslint/utils';var kt={PLUGIN_NAME:"nitpicker",REPO_URL:"https://github.com/Alien-Intelligence/eslint-plugin-nitpicker",EM_DASH:"\u2014",EMOJI:new RegExp("\\p{Regional_Indicator}\\p{Regional_Indicator}|\\p{Emoji_Presentation}(?:\\uFE0F|\\p{Emoji_Modifier})?(?:\\u200D\\p{Emoji_Presentation}(?:\\uFE0F|\\p{Emoji_Modifier})?)*|\\p{Extended_Pictographic}\\uFE0F","gu"),COMMENTS:{BOX_DRAWING:/[─-▟]/,PURE_SEPARATOR:/^[-=~*#_+]{3,}$/,WRAPPED_LABEL:/^[-=~*#_+]{2,}\s.*\s[-=~*#_+]{2,}$/,DIRECTIVE:/^\s*(?:eslint\b|eslint-|globals?\b|exported\b|jshint\b|jslint\b|istanbul\b|[cv]8\b|ts-|prettier-ignore|biome-ignore|webpack\b|noinspection\b|@)/,QUOTES:new Set(['"',"`"]),ABBREVIATIONS:["e.g.","i.e.","etc.","vs.","cf.","al.","approx.","resp."]},JSDOC:{TAG:/^\s*\*?\s*@(\w+)/},WORDS:{WORD_CHAR:/[\p{L}\p{N}_$]/u,SUB_WORD:/[A-Z]+(?![a-z])|[A-Z][a-z]+|[a-z]+/g},OBJECTS:{MAX_INLINE_KEYS:2,INDENT_WIDTH:4},FUNCTIONS:{NODE_TYPES:new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"])},FRAMEWORKS:{ADONIS_SUBPATH:/^#(models|controllers|services|middleware|validators|policies|config|start|database|providers|lib)\b/,REACT_FILE:/\.[jt]sx$/},REACT:{HOOK:/^use[A-Z]/,CONTEXT_HOOK:/^use[A-Z]\w*Context$/,MEMO_HOOKS:new Set(["useMemo","useCallback"])},REQUEST:{RAW_ACCESSORS:new Set(["input","body","qs","all","only","except"])},MIGRATIONS:{INDEX_METHODS:new Set(["index","unique","primary","foreign"]),TIMESTAMP_METHODS:new Set(["timestamp","dateTime","datetime"]),AUDIT_TIMESTAMPS:new Set(["created_at","updated_at","deleted_at"]),CATEGORY_ORDER:["column","timestamp","index"]}},o=kt;var ge=ESLintUtils.RuleCreator(()=>`${o.REPO_URL}/blob/main/README.md#rules`);var l=class{toRuleModule(){return ge({name:this.name,meta:this.meta,defaultOptions:this.defaultOptions,create:(e,i)=>this.create(e,i)})}};function p({problem:t,why:e,fix:i}){return `${t}
1
+ import {ESLintUtils,ASTUtils}from'@typescript-eslint/utils';var kt={PLUGIN_NAME:"nitpicker",REPO_URL:"https://github.com/Alien-Intelligence/eslint-plugin-nitpicker",EM_DASH:"\u2014",EMOJI:new RegExp("\\p{Regional_Indicator}\\p{Regional_Indicator}|\\p{Emoji_Presentation}(?:\\uFE0F|\\p{Emoji_Modifier})?(?:\\u200D\\p{Emoji_Presentation}(?:\\uFE0F|\\p{Emoji_Modifier})?)*|\\p{Extended_Pictographic}\\uFE0F","gu"),COMMENTS:{BOX_DRAWING:/[─-▟]/,PURE_SEPARATOR:/^[-=~*#_+]{3,}$/,WRAPPED_LABEL:/^[-=~*#_+]{2,}\s.*\s[-=~*#_+]{2,}$/,DIRECTIVE:/^\s*(?:eslint\b|eslint-|globals?\b|exported\b|jshint\b|jslint\b|istanbul\b|[cv]8\b|ts-|prettier-ignore|biome-ignore|webpack\b|noinspection\b|@)/,QUOTES:new Set(['"',"`"]),ABBREVIATIONS:["e.g.","i.e.","etc.","vs.","cf.","al.","approx.","resp."]},JSDOC:{TAG:/^\s*\*?\s*@(\w+)/},WORDS:{WORD_CHAR:/[\p{L}\p{N}_$]/u,SUB_WORD:/[A-Z]+(?![a-z])|[A-Z][a-z]+|[a-z]+/g},OBJECTS:{MAX_INLINE_KEYS:2,INDENT_WIDTH:4},FUNCTIONS:{NODE_TYPES:new Set(["FunctionDeclaration","FunctionExpression","ArrowFunctionExpression"])},FRAMEWORKS:{ADONIS_SUBPATH:/^#(models|controllers|services|middleware|validators|policies|config|start|database|providers|lib)\b/,REACT_FILE:/\.[jt]sx$/},REACT:{HOOK:/^use[A-Z]/,CONTEXT_HOOK:/^use[A-Z]\w*Context$/,MEMO_HOOKS:new Set(["useMemo","useCallback"])},REQUEST:{RAW_ACCESSORS:new Set(["input","body","qs","all","only","except"])},MIGRATIONS:{INDEX_METHODS:new Set(["index","unique","primary","foreign"]),TIMESTAMP_METHODS:new Set(["timestamp","dateTime","datetime"]),AUDIT_TIMESTAMPS:new Set(["created_at","updated_at","deleted_at"]),CATEGORY_ORDER:["column","timestamp","index"]}},o=kt;var Se=ESLintUtils.RuleCreator(()=>`${o.REPO_URL}/blob/main/README.md#rules`);var l=class{toRuleModule(){return Se({name:this.name,meta:this.meta,defaultOptions:this.defaultOptions,create:(e,i)=>this.create(e,i)})}};function p({problem:t,why:e,fix:i}){return `${t}
2
2
  - why: ${e}
3
- - fix: ${i}`}function ye(t){return t.parent.type==="ExportDefaultDeclaration"&&t.superClass?.type==="Identifier"&&t.superClass.name==="BaseSchema"}function Se(t){if(t.callee.type!=="MemberExpression"||t.callee.property.type!=="Identifier"||t.callee.property.name!=="createTable"||t.callee.object.type!=="MemberExpression"||t.callee.object.property.type!=="Identifier"||t.callee.object.property.name!=="schema")return null;let e=t.arguments.at(-1);return e?.type!=="ArrowFunctionExpression"&&e?.type!=="FunctionExpression"||e.body.type!=="BlockStatement"||e.params[0]?.type!=="Identifier"?null:{body:e.body.body,builderName:e.params[0].name}}function he(t,e){if(t.type!=="ExpressionStatement")return null;let i=Dt(t.expression,e);return i===null?null:o.MIGRATIONS.INDEX_METHODS.has(i.method)?"index":i.method==="timestamps"?"timestamp":o.MIGRATIONS.TIMESTAMP_METHODS.has(i.method)?i.firstArgument!==void 0&&o.MIGRATIONS.AUDIT_TIMESTAMPS.has(i.firstArgument)?"timestamp":null:"column"}function Dt(t,e){let i=t;for(;i.type==="CallExpression"&&i.callee.type==="MemberExpression";){if(i.callee.object.type==="Identifier"&&i.callee.object.name===e){if(i.callee.property.type!=="Identifier")return null;let n=i.arguments[0],s=n?.type==="Literal"&&typeof n.value=="string"?n.value:void 0;return {method:i.callee.property.name,firstArgument:s}}i=i.callee.object;}return null}var M=class extends l{name="migration-table-order";defaultOptions=[];meta={type:"suggestion",docs:{description:"Group migration table statements as columns, then timestamps, then indexes and constraints.",recommended:true,category:"adonisjs"},schema:[],messages:{outOfOrder:p({problem:"This {{category}} is out of order in the table definition.",why:"A migration reads consistently when columns come first, then timestamps, then indexes and constraints, each grouped together",fix:"Move it into its group so the order stays columns, timestamps, then indexes and constraints"})}};create(e){return {CallExpression(i){let n=Se(i);if(n===null)return;let s=0;for(let r of n.body){let a=he(r,n.builderName);if(a===null)continue;let m=o.MIGRATIONS.CATEGORY_ORDER.indexOf(a);m<s&&e.report({node:r,messageId:"outOfOrder",data:{category:a}}),s=Math.max(s,m);}}}}},Te=new M;function be(t){return t.parent.type==="ExportDefaultDeclaration"&&t.id?.name.endsWith("Controller")===true}function f(t){return t.type==="Block"&&t.value.startsWith("*")}function wt(t){let e=(t.type==="ExportDefaultDeclaration"||t.type==="ExportNamedDeclaration")&&t.declaration!==null?t.declaration:t,n=("decorators"in e?e.decorators:void 0)?.reduce((s,r)=>s===void 0||r.range[0]<s.range[0]?r:s,void 0);return n!==void 0&&n.range[0]<t.range[0]?n:t}function y(t,e){let n=t.getCommentsBefore(wt(e)).at(-1);return n!==void 0&&f(n)}function A(t){return /^\s*\*\s*$/.test(t)}function O(t){return t.match(o.JSDOC.TAG)?.[1]??null}function v(t){return O(t)!==null}function Ee(t){let e=[];for(let i of t.value.split(`
4
- `)){let n=i.replace(/^\s*\*? ?/,"").trimEnd();if(n.startsWith("@"))break;e.push(n);}return e.join(" ").replace(/\s+/g," ").trim()}function xe(t,e){let i=-1;for(let s=e.loc.start.line+1;s<e.loc.end.line;s++){let r=O(t.lines[s-1]??"");if(r==="returns"||r==="return"){i=s;break}}if(i===-1)return null;let n=e.loc.end.line-1;for(let s=i+1;s<e.loc.end.line;s++)if(v(t.lines[s-1]??"")){n=s-1;break}return {from:i,to:n}}var z=class extends l{name="require-controller-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment describing an AdonisJS controller.",recommended:true,category:"adonisjs"},schema:[],messages:{missingJSDoc:p({problem:"This controller has no JSDoc describing what it does.",why:"A controller's responsibility should be readable at a glance, before diving into its handler methods",fix:"Add a `/** ... */` JSDoc above the controller class summarizing what it handles"})}};create(e){return {ClassDeclaration(i){be(i)&&(y(e.sourceCode,i.parent)||e.report({node:i.id??i,messageId:"missingJSDoc"}));}}}},Re=new z;var F=class extends l{name="require-migration-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment describing an AdonisJS migration.",recommended:true,category:"adonisjs"},schema:[],messages:{missingJSDoc:p({problem:"This migration has no JSDoc describing what it does.",why:"A migration's intent should be readable at a glance, the timestamped filename does not convey the schema change",fix:"Add a `/** ... */` JSDoc above the migration class summarizing the change"})}};create(e){return {ClassDeclaration(i){ye(i)&&(y(e.sourceCode,i.parent)||e.report({node:i.id??i,messageId:"missingJSDoc"}));}}}},Oe=new F;function Mt(t){let e=t.replace(/\\/g,"/"),i="^";for(let n=0;n<e.length;n++){let s=e[n];if(s===void 0)break;s==="*"?e[n+1]==="*"?(i+=".*",n++,e[n+1]==="/"&&n++):i+="[^/]*":"\\^$.|?+()[]{}".includes(s)?i+=`\\${s}`:i+=s;}return new RegExp(`${i}$`)}function h(t,e){let i=t.replace(/\\/g,"/");return e.some(n=>Mt(n).test(i))}var j=class extends l{name="require-validated-request";defaultOptions=[{allowIn:[]}];meta={type:"suggestion",docs:{description:"Require request data to be read through a Vine validator, not raw request accessors.",recommended:true,category:"adonisjs"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{rawRead:p({problem:"`request.{{method}}()` reads request data directly.",why:"Request data must pass through a Vine validator so it is typed and checked, a raw accessor bypasses that contract",fix:"Read it through `request.validateUsing(someValidator)` instead"})}};create(e,i){let n=i[0]?.allowIn??[];if(n.length>0&&h(e.filename,n))return {};let s=r=>r.type==="Identifier"?r.name==="request":r.type==="MemberExpression"&&r.property.type==="Identifier"&&r.property.name==="request";return {CallExpression(r){r.callee.type!=="MemberExpression"||r.callee.property.type!=="Identifier"||!o.REQUEST.RAW_ACCESSORS.has(r.callee.property.name)||!s(r.callee.object)||e.report({node:r.callee.property,messageId:"rawRead",data:{method:r.callee.property.name}});}}}},Ie=new j;var P=class extends l{name="catch-error-name";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a `catch` clause to bind its error as `error`.",recommended:true,category:"base"},schema:[],messages:{rename:p({problem:"This `catch` binds the error as `{{name}}`.",why:"Every catch binds the error as `error` so error handling reads the same across the codebase",fix:"Rename the binding to `error`, or `_error` if it is intentionally unused"})}};create(e){return {CatchClause(i){i.param?.type==="Identifier"&&(i.param.name==="error"||i.param.name.startsWith("_")||e.report({node:i.param,messageId:"rename",data:{name:i.param.name}}));}}}},Le=new P;var Ce=250,_=class extends l{name="max-jsdoc-description-length";defaultOptions=[{max:Ce}];meta={type:"suggestion",docs:{description:"Enforce a maximum character length for a JSDoc description.",recommended:true,category:"base"},schema:[{type:"object",properties:{max:{type:"integer",minimum:1}},additionalProperties:false}],messages:{tooLong:p({problem:"This JSDoc description is {{length}} characters, over the {{max}}-character limit.",why:"A JSDoc description should summarize what something is, an oversized one usually restates the code or explains how it is used, which does not belong here",fix:'Trim it to a concise summary of what it does, and remove any note about how or where it is used (e.g "used by X to ...", "called from Y"), which is an anti-pattern'})}};create(e,i){let n=i[0]?.max??Ce;return {Program(){for(let s of e.sourceCode.getAllComments()){if(!f(s))continue;let r=Ee(s).length;r<=n||e.report({loc:s.loc,messageId:"tooLong",data:{length:r,max:n}});}}}}},ke=new _;function I(t){let e=[],i=t;for(;;){if(i.type==="ChainExpression"||i.type==="TSNonNullExpression"){i=i.expression;continue}if(i.type==="MemberExpression"){if(i.computed||i.property.type!=="Identifier")return null;e.unshift(i.property.name),i=i.object;continue}break}return e.length===0?null:i.type==="ThisExpression"?["this",...e].join("."):i.type==="Identifier"?[i.name,...e].join("."):null}function Ne(t){return I(t)!==null}function L(t,e){let i=ASTUtils.findVariable(t,e);if(i===null)return false;let n=new Set(i.defs.map(s=>s.name));return i.references.some(s=>s.isWrite()&&!n.has(s.identifier))}function De(t,e){for(let i of t)if(e===i||e.startsWith(`${i}.`))return true;return false}function we(t){return t.properties.length===0?false:t.properties.every(e=>e.type==="Property"&&e.shorthand&&!e.computed&&e.value.type==="Identifier")}var J=class extends l{name="no-alias-variables";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow a `const` whose whole value is another variable, use the source directly.",recommended:true,category:"base"},schema:[],messages:{alias:p({problem:"`{{name}}` only aliases `{{source}}`.",why:"A variable that just renames another hides the original and adds a name to track for no gain",fix:"Remove it and use `{{source}}` directly, or rename `{{source}}` itself if the new name is better"})}};create(e){return {VariableDeclarator(i){i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.parent.parent.type!=="ExportNamedDeclaration"&&(i.id.type!=="Identifier"||i.init?.type!=="Identifier"||i.id.typeAnnotation===void 0&&(L(e.sourceCode.getScope(i),i.init.name)||e.report({node:i,messageId:"alias",data:{name:i.id.name,source:i.init.name}})));}}}},Me=new J;var Ae={colour:"color",colours:"colors",coloured:"colored",colouring:"coloring",behaviour:"behavior",behaviours:"behaviors",favour:"favor",favours:"favors",favoured:"favored",favouring:"favoring",favourable:"favorable",favourite:"favorite",favourites:"favorites",flavour:"flavor",flavours:"flavors",honour:"honor",honours:"honors",honoured:"honored",honouring:"honoring",labour:"labor",labours:"labors",laboured:"labored",labouring:"laboring",neighbour:"neighbor",neighbours:"neighbors",humour:"humor",humours:"humors",rumour:"rumor",rumours:"rumors",harbour:"harbor",harbours:"harbors",endeavour:"endeavor",endeavours:"endeavors",endeavoured:"endeavored",endeavouring:"endeavoring",normalise:"normalize",normalised:"normalized",normalising:"normalizing",normalisation:"normalization",initialise:"initialize",initialises:"initializes",initialised:"initialized",initialising:"initializing",initialisation:"initialization",serialise:"serialize",serialised:"serialized",serialising:"serializing",serialisation:"serialization",organise:"organize",organises:"organizes",organised:"organized",organising:"organizing",organisation:"organization",optimise:"optimize",optimised:"optimized",optimising:"optimizing",optimisation:"optimization",customise:"customize",customised:"customized",customising:"customizing",sanitise:"sanitize",sanitised:"sanitized",sanitising:"sanitizing",synchronise:"synchronize",synchronised:"synchronized",synchronising:"synchronizing",synchronisation:"synchronization",authorise:"authorize",authorised:"authorized",authorising:"authorizing",authorisation:"authorization",finalise:"finalize",finalised:"finalized",finalising:"finalizing",capitalise:"capitalize",capitalised:"capitalized",capitalising:"capitalizing",categorise:"categorize",categorises:"categorizes",categorised:"categorized",categorising:"categorizing",categorisation:"categorization",utilise:"utilize",utilises:"utilizes",utilised:"utilized",utilising:"utilizing",utilisation:"utilization",realise:"realize",realises:"realizes",realised:"realized",realising:"realizing",realisation:"realization",recognise:"recognize",recognises:"recognizes",recognised:"recognized",recognising:"recognizing",summarise:"summarize",summarises:"summarizes",summarised:"summarized",summarising:"summarizing",specialise:"specialize",specialises:"specializes",specialised:"specialized",specialising:"specializing",specialisation:"specialization",minimise:"minimize",minimises:"minimizes",minimised:"minimized",minimising:"minimizing",minimisation:"minimization",maximise:"maximize",maximises:"maximizes",maximised:"maximized",maximising:"maximizing",maximisation:"maximization",prioritise:"prioritize",prioritises:"prioritizes",prioritised:"prioritized",prioritising:"prioritizing",prioritisation:"prioritization",standardise:"standardize",standardises:"standardizes",standardised:"standardized",standardising:"standardizing",standardisation:"standardization",harmonise:"harmonize",harmonises:"harmonizes",harmonised:"harmonized",harmonising:"harmonizing",harmonisation:"harmonization",centralise:"centralize",centralises:"centralizes",centralised:"centralized",centralising:"centralizing",centralisation:"centralization",decentralise:"decentralize",decentralises:"decentralizes",decentralised:"decentralized",decentralising:"decentralizing",decentralisation:"decentralization",emphasise:"emphasize",emphasises:"emphasizes",emphasised:"emphasized",emphasising:"emphasizing",visualise:"visualize",visualises:"visualizes",visualised:"visualized",visualising:"visualizing",visualisation:"visualization",analyse:"analyze",analyses:"analyzes",analysed:"analyzed",analysing:"analyzing",paralyse:"paralyze",paralyses:"paralyzes",paralysed:"paralyzed",paralysing:"paralyzing",centre:"center",centred:"centered",centres:"centers",fibre:"fiber",fibres:"fibers",metre:"meter",metres:"meters",litre:"liter",litres:"liters",theatre:"theater",theatres:"theaters",calibre:"caliber",spectre:"specter",spectres:"specters",licence:"license",defence:"defense",offence:"offense",pretence:"pretense",practise:"practice",cancelled:"canceled",cancelling:"canceling",labelled:"labeled",labelling:"labeling",modelled:"modeled",modelling:"modeling",travelled:"traveled",travelling:"traveling",signalled:"signaled",signalling:"signaling",fuelled:"fueled",fuelling:"fueling",marvellous:"marvelous",counsellor:"counselor",fulfil:"fulfill",fulfils:"fulfills",fulfilment:"fulfillment",enrol:"enroll",enrols:"enrolls",enrolment:"enrollment",instalment:"installment",skilful:"skillful",wilful:"willful",dialogue:"dialog",dialogues:"dialogs",catalogue:"catalog",catalogues:"catalogs",analogue:"analog",analogues:"analogs",grey:"gray",artefact:"artifact",artefacts:"artifacts",sceptic:"skeptic",sceptical:"skeptical",programme:"program",programmes:"programs",enquiry:"inquiry",enquiries:"inquiries",aluminium:"aluminum",tyre:"tire",tyres:"tires"};function ve(t,e,i){let n=Object.create(null);for(let[s,r]of Object.entries(t))n[s.toLowerCase()]=r;for(let[s,r]of Object.entries(e))n[s.toLowerCase()]=r;for(let s of i)delete n[s.toLowerCase()];return n}function U(t){let e=[];for(let i of t.matchAll(o.WORDS.SUB_WORD))i.index!==void 0&&e.push({text:i[0],index:i.index});return e}function B(t,e){return t===t.toUpperCase()?e.toUpperCase():t.charAt(0)===t.charAt(0).toUpperCase()?e.charAt(0).toUpperCase()+e.slice(1):e}function ze(t){return t!==void 0&&o.WORDS.WORD_CHAR.test(t)}var W=class extends l{name="no-british-english";defaultOptions=[{extra:{},ignore:[]}];meta={type:"suggestion",docs:{description:"Disallow British English spellings in identifiers and comments.",recommended:true,category:"base"},fixable:"code",schema:[{type:"object",properties:{extra:{type:"object",additionalProperties:{type:"string"}},ignore:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{british:p({problem:"British spelling `{{british}}`, this codebase uses American English.",why:"One spelling convention keeps identifiers and docs consistent and searchable",fix:"Use `{{american}}` instead"})}};create(e,i){let n=ve(Ae,i[0]?.extra??{},i[0]?.ignore??[]);return {Identifier(s){if(!(s.parent.type==="MemberExpression"&&s.parent.property===s&&!s.parent.computed))for(let r of U(s.name)){let a=n[r.text.toLowerCase()];a!==void 0&&e.report({node:s,messageId:"british",data:{british:r.text,american:B(r.text,a)}});}},Program(){for(let s of e.sourceCode.getAllComments())for(let r of U(s.value)){let a=n[r.text.toLowerCase()];if(a===void 0)continue;let m=B(r.text,a),d=s.range[0]+2+r.index,g=d+r.text.length;e.report({loc:{start:e.sourceCode.getLocFromIndex(d),end:e.sourceCode.getLocFromIndex(g)},messageId:"british",data:{british:r.text,american:m},fix:Ct=>Ct.replaceTextRange([d,g],m)});}}}}},Fe=new W;function je(t){let e=t.replace(/^\s*\*?\s*/,"").trimEnd();return e.length===0?false:o.COMMENTS.BOX_DRAWING.test(e)||o.COMMENTS.PURE_SEPARATOR.test(e)||o.COMMENTS.WRAPPED_LABEL.test(e)}var q=class extends l{name="no-decorative-comment-separators";defaultOptions=[{allowIn:[]}];meta={type:"layout",docs:{description:"Disallow decorative separators (banners, box-drawing, repeated dashes) inside comments.",recommended:true,category:"base"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{decorative:p({problem:"This comment uses a decorative separator.",why:"Repeated separator characters and box-drawing lines are visual noise that add nothing over a plain label",fix:"Remove the separator, a one-line label or a blank line already divides sections clearly"})}};create(e,i){let n=i[0]?.allowIn??[];return n.length>0&&h(e.filename,n)?{}:{Program(){for(let s of e.sourceCode.getAllComments()){let r=s.value.split(`
5
- `);for(let a=0;a<r.length;a++){let m=r[a];if(m===void 0||!je(m))continue;let d=s.loc.start.line+a,g=e.sourceCode.lines[d-1]??"";e.report({loc:{start:{line:d,column:0},end:{line:d,column:g.length}},messageId:"decorative"});}}}}}},Pe=new q;var vt={strings:"String",templates:"Template",jsx:"JSXText"};function C(t,e){let i=new Set(e),n=[];if(i.size===0)return n;let s=new Set([...i].map(r=>vt[r]).filter(r=>r!==void 0));for(let r of t.ast.tokens??[])s.has(r.type)&&n.push(r.range);if(i.has("comments"))for(let r of t.getAllComments())n.push(r.range);return n}function k(t,e){return e.some(([i,n])=>t>=i&&t<n)}var V=class extends l{name="no-em-dash";defaultOptions=[{allow:[]}];meta={type:"suggestion",docs:{description:"Disallow the em dash (\u2014) character anywhere in the source.",recommended:true},schema:[{type:"object",properties:{allow:{type:"array",items:{type:"string",enum:["strings","templates","jsx","comments"]}}},additionalProperties:false}],messages:{emDash:p({problem:"Found an em dash (\u2014) character.",why:"Em dashes are typically introduced by AI-generated or auto-formatted text and are discouraged here.",fix:"Replace the em dash with a hyphen (-), a comma (,), or reword the sentence to avoid it, or allow it here with the rule's `allow` option if it is deliberate user-facing copy."})}};create(e,i){return {Program(){let n=e.sourceCode.getText(),s=C(e.sourceCode,i[0]?.allow??[]);for(let r=0;r<n.length;r++)n[r]===o.EM_DASH&&(k(r,s)||e.report({loc:{start:e.sourceCode.getLocFromIndex(r),end:e.sourceCode.getLocFromIndex(r+1)},messageId:"emDash"}));}}}},_e=new V;var G=class extends l{name="no-emojis";defaultOptions=[{allow:[]}];meta={type:"suggestion",docs:{description:"Disallow emoji characters anywhere in the source.",recommended:true,category:"base"},schema:[{type:"object",properties:{allow:{type:"array",items:{type:"string",enum:["strings","templates","jsx","comments"]}}},additionalProperties:false}],messages:{emoji:p({problem:"Found an emoji ({{emoji}}).",why:"Emojis are usually introduced by AI-generated text and add noise to code, comments, and identifiers",fix:"Remove the emoji, or allow it here with the rule's `allow` option if it is deliberate user-facing copy"})}};create(e,i){return {Program(){let n=e.sourceCode.getText(),s=C(e.sourceCode,i[0]?.allow??[]);for(let r of n.matchAll(o.EMOJI))k(r.index,s)||e.report({loc:{start:e.sourceCode.getLocFromIndex(r.index),end:e.sourceCode.getLocFromIndex(r.index+r[0].length)},messageId:"emoji",data:{emoji:r[0]}});}}}},Je=new G;var K=class extends l{name="no-jsdoc-blank-before-tags";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Disallow blank lines before JSDoc tags such as `@param` or `@returns`.",recommended:true},schema:[],messages:{blankBeforeTag:p({problem:"There is a blank line before a JSDoc tag.",why:"Tags should follow the description directly; an empty line there is noise that inflates the comment.",fix:"Remove the blank line so the tag follows on directly."})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(f(i)&&i.loc.start.line!==i.loc.end.line)for(let n=i.loc.start.line;n<=i.loc.end.line;n++){let s=e.sourceCode.lines[n-1];if(s===void 0||!A(s))continue;let r=n;for(;r<i.loc.end.line&&A(e.sourceCode.lines[r]??"");)r++;let a=e.sourceCode.lines[r];if(a!==void 0&&v(a)){let m=e.sourceCode.getIndexFromLoc({line:n,column:0}),d=e.sourceCode.getIndexFromLoc({line:r+1,column:0});e.report({loc:{start:{line:n,column:0},end:{line:r,column:s.length}},messageId:"blankBeforeTag",fix:g=>g.removeRange([m,d])});}n=r;}}}}},Ue=new K;function x(t){let e=t;return e.parent.type==="VariableDeclarator"&&e.parent.parent.type==="VariableDeclaration"&&(e=e.parent.parent),(e.parent.type==="ExportNamedDeclaration"||e.parent.type==="ExportDefaultDeclaration")&&(e=e.parent),e}function Be(t){return t.parent?.type==="Program"}function We(t){let e=t.parent;for(;e;){if(o.FUNCTIONS.NODE_TYPES.has(e.type))return e;e=e.parent;}return null}function qe(t){return t.type==="ArrowFunctionExpression"&&t.params.length===0&&t.body.type==="ImportExpression"}function T(t){if((t.type==="FunctionDeclaration"||t.type==="FunctionExpression")&&t.id)return t.id.name;if(t.parent.type==="VariableDeclarator"&&t.parent.id.type==="Identifier")return t.parent.id.name}function b(t,e,i){if(t.type==="ReturnStatement")return i(t.argument);for(let n of e[t.type]??[]){let s=t[n],r=Array.isArray(s)?s:[s];for(let a of r){let m=a;if(!(!m||typeof m.type!="string")&&!o.FUNCTIONS.NODE_TYPES.has(m.type)&&b(m,e,i))return true}}return false}function zt(t,e){return t.type==="ArrowFunctionExpression"&&t.body.type!=="BlockStatement"?true:b(t.body,e,i=>i!==null)}function Ft(t){return t.typeAnnotation.type==="TSVoidKeyword"?true:t.typeAnnotation.type==="TSTypeReference"&&t.typeAnnotation.typeName.type==="Identifier"&&t.typeAnnotation.typeName.name==="Promise"?t.typeAnnotation.typeArguments?.params.length===1&&t.typeAnnotation.typeArguments?.params[0]?.type==="TSVoidKeyword":false}function Ve(t,e){return t.returnType?Ft(t.returnType):!zt(t,e)}var $=class extends l{name="no-jsdoc-returns-on-void";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Disallow a JSDoc `@returns` tag on a function that returns nothing.",recommended:true,category:"base"},schema:[],messages:{voidReturns:p({problem:"This function returns nothing, but its JSDoc has a `@returns` tag.",why:"A `@returns` on a void function documents a value that never exists and drifts from the code",fix:"Remove the `@returns` tag"})}};create(e){let i=(n,s)=>{let r=e.sourceCode.getCommentsBefore(s).at(-1);if(r===void 0||!f(r))return;let a=xe(e.sourceCode,r);if(a===null||!Ve(n,e.sourceCode.visitorKeys))return;let m=e.sourceCode.getIndexFromLoc({line:a.from,column:0}),d=e.sourceCode.getIndexFromLoc({line:a.to+1,column:0});e.report({loc:{start:{line:a.from,column:0},end:{line:a.to,column:(e.sourceCode.lines[a.to-1]??"").length}},messageId:"voidReturns",fix:g=>g.removeRange([m,d])});};return {FunctionDeclaration(n){i(n,x(n));},VariableDeclarator(n){(n.init?.type==="ArrowFunctionExpression"||n.init?.type==="FunctionExpression")&&i(n.init,x(n.init));},MethodDefinition(n){n.value.type==="FunctionExpression"&&i(n.value,n);}}}},Ge=new $;function N(t){return o.COMMENTS.DIRECTIVE.test(t.value)}function Ke(t){let e=t.range[0]+2;if(t.type==="Line"){let n=t.value.match(/\S/u);return n?.index===void 0?null:{index:e+n.index,char:n[0]}}let i=0;for(let n of t.value.split(`
6
- `)){let s=(n.match(/^\s*\*?\s*/u)?.[0]??"").length,r=n.slice(s).charAt(0);if(r!=="")return {index:e+i+s,char:r};i+=n.length+1;}return null}function $e(t){let e=[],i=t.range[0]+2,n=null;for(let s=0;s<t.value.length;s++){let r=t.value.charAt(s);if(n!==null){r===n&&(n=null);continue}if(o.COMMENTS.QUOTES.has(r)&&t.value.includes(r,s+1)){n=r;continue}if(r!==".")continue;if(t.value.charAt(s+1)==="."){for(;t.value.charAt(s+1)===".";)s++;continue}let a=t.value.slice(s+1);a!==""&&!/^\s/u.test(a)||jt(t.value.slice(0,s+1))||e.push({index:i+s,terminal:a.trim()===""});}return e}function He(t){let e=[],i=t.range[0]+2;for(let n=0;n<t.value.length;n++){if(t.value.charAt(n)!=="`")continue;if(t.value.charAt(n+1)==="`"){for(;t.value.charAt(n+1)==="`";)n++;continue}let s=t.value.indexOf("`",n+1);if(s===-1)break;let r=t.value.slice(n+1,s);r.includes('"')||e.push({start:i+n,end:i+s,text:r}),n=s;}return e}function jt(t){let e=t.toLowerCase();return o.COMMENTS.ABBREVIATIONS.some(i=>{if(!e.endsWith(i))return false;let n=e.charAt(e.length-i.length-1);return n===""||!ze(n)})}var H=class extends l{name="no-line-comment-backticks";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Disallow backticks in `//` line comments, use double quotes for code references.",recommended:true,category:"base"},schema:[],messages:{backticks:p({problem:"This line comment wraps `{{text}}` in backticks.",why:"Backticks only render as code inside a JSDoc block, in a `//` comment they stay literal characters, so double quotes read better",fix:'Wrap it in double quotes instead: "{{text}}"'})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(!(i.type!=="Line"||N(i)))for(let n of He(i))e.report({loc:{start:e.sourceCode.getLocFromIndex(n.start),end:e.sourceCode.getLocFromIndex(n.end+1)},messageId:"backticks",data:{text:n.text},fix:s=>[s.replaceTextRange([n.start,n.start+1],'"'),s.replaceTextRange([n.end,n.end+1],'"')]});}}}},Xe=new H;var X=class extends l{name="no-line-comment-period";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Disallow prose periods in `//` line comments (code-reference dots and ellipses are allowed).",recommended:true},schema:[],messages:{period:p({problem:"This line comment ends with a period.",why:"Line comments should be short, clear fragments, not full sentences, so a closing period is just noise, dots inside code references like `foo.bar` are allowed.",fix:"Remove the period and keep the comment terse."}),sentence:p({problem:"This line comment runs two sentences together with a period.",why:"Line comments should be short, clear fragments, dropping the period on its own would leave a run-on, so the sentences belong on separate lines",fix:"Split it into one `//` line per fragment, or reword it as a single fragment (reported, not auto-fixed, so wrapped prose is never mangled)"})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(i.type==="Line")for(let n of $e(i)){let s={start:e.sourceCode.getLocFromIndex(n.index),end:e.sourceCode.getLocFromIndex(n.index+1)};if(n.terminal){e.report({loc:s,messageId:"period",fix:r=>r.removeRange([n.index,n.index+1])});continue}e.report({loc:s,messageId:"sentence"});}}}}},Ye=new X;var Y=class extends l{name="no-property-access-alias";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow a `const` whose whole value is a single property access, inline the expression instead.",recommended:true,category:"base"},schema:[],messages:{propertyAccessAlias:p({problem:"`{{name}}` only aliases the property access `{{expression}}`.",why:"A variable that just renames a property hides where the value comes from when scanning the code",fix:"Remove it and use `{{expression}}` inline, or use `let` if it is reassigned later"})}};create(e){let i=[],n=new Set,s=r=>{if(r.type!=="MemberExpression")return;let a=I(r);a!==null&&n.add(a);};return {AssignmentExpression(r){s(r.left);},UpdateExpression(r){s(r.argument);},VariableDeclarator(r){if(r.parent.type!=="VariableDeclaration"||r.parent.kind!=="const"||r.parent.parent.type==="ExportNamedDeclaration"||r.id.type!=="Identifier"||r.init===null||r.id.typeAnnotation!==void 0)return;let a=I(r.init);if(a===null)return;let m=a.slice(0,a.indexOf("."));m!=="this"&&L(e.sourceCode.getScope(r),m)||i.push({node:r,name:r.id.name,path:a,expression:e.sourceCode.getText(r.init)});},"Program:exit"(){for(let r of i)De(n,r.path)||e.report({node:r.node,messageId:"propertyAccessAlias",data:{name:r.name,expression:r.expression}});}}}},Ze=new Y;var Z=class extends l{name="no-property-destructuring";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow shorthand destructuring off a plain object reference, access the property directly.",recommended:true,category:"base"},schema:[],messages:{destructure:p({problem:"Destructuring from `{{source}}` here just aliases its properties.",why:"Reading `{{source}}.x` at the use site keeps the origin visible, destructuring a plain object hides where a value comes from (destructuring a call or hook result is fine)",fix:"Access the properties on `{{source}}` directly instead of destructuring"})}};create(e){return {VariableDeclarator(i){i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.parent.parent.type!=="ExportNamedDeclaration"&&(i.id.type!=="ObjectPattern"||i.init===null||i.init.type!=="Identifier"&&!Ne(i.init)||we(i.id)&&e.report({node:i,messageId:"destructure",data:{source:e.sourceCode.getText(i.init)}}));}}}},Qe=new Z;var Q=class extends l{name="no-relative-imports";defaultOptions=[{allowIn:[]}];meta={type:"suggestion",docs:{description:"Disallow relative import and re-export specifiers, use the package path alias.",recommended:true,category:"base"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{relative:p({problem:"This import uses a relative path (`{{path}}`).",why:"A relative path breaks when a file moves and hides which package a module belongs to, the path alias is stable and explicit",fix:"Import through the package alias (`#...` or `@frontend/...`) instead of a relative path"})}};create(e,i){let n=i[0]?.allowIn??[];if(n.length>0&&h(e.filename,n))return {};let s=r=>{r!=null&&(!r.value.startsWith("./")&&!r.value.startsWith("../")||e.report({node:r,messageId:"relative",data:{path:r.value}}));};return {ImportDeclaration(r){s(r.source);},ExportNamedDeclaration(r){s(r.source);},ExportAllDeclaration(r){s(r.source);},ImportExpression(r){r.source.type==="Literal"&&typeof r.source.value=="string"&&s(r.source);}}}},et=new Q;var ee=class extends l{name="no-single-line-jsdoc";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Require JSDoc comments to span multiple lines rather than sit on a single line.",recommended:true},schema:[],messages:{singleLine:p({problem:"This JSDoc comment is written on a single line.",why:"Multi-line JSDoc is easier to read, diff, and extend with additional tags, and is the house style.",fix:"Put the opening `/**`, the ` * ` content, and the closing `*/` each on their own line."})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments()){if(!f(i)||i.loc.start.line!==i.loc.end.line)continue;let n=i.value.replace(/^\*/,"").trim();n.length!==0&&e.report({loc:i.loc,messageId:"singleLine",fix(s){let r=" ".repeat(i.loc.start.column),a=`/**
3
+ - fix: ${i}`}function he(t){return t.parent.type==="ExportDefaultDeclaration"&&t.superClass?.type==="Identifier"&&t.superClass.name==="BaseSchema"}function Te(t){if(t.callee.type!=="MemberExpression"||t.callee.property.type!=="Identifier"||t.callee.property.name!=="createTable"||t.callee.object.type!=="MemberExpression"||t.callee.object.property.type!=="Identifier"||t.callee.object.property.name!=="schema")return null;let e=t.arguments.at(-1);return e?.type!=="ArrowFunctionExpression"&&e?.type!=="FunctionExpression"||e.body.type!=="BlockStatement"||e.params[0]?.type!=="Identifier"?null:{body:e.body.body,builderName:e.params[0].name}}function be(t,e){if(t.type!=="ExpressionStatement")return null;let i=wt(t.expression,e);return i===null?null:o.MIGRATIONS.INDEX_METHODS.has(i.method)?"index":i.method==="timestamps"?"timestamp":o.MIGRATIONS.TIMESTAMP_METHODS.has(i.method)?i.firstArgument!==void 0&&o.MIGRATIONS.AUDIT_TIMESTAMPS.has(i.firstArgument)?"timestamp":null:"column"}function wt(t,e){let i=t;for(;i.type==="CallExpression"&&i.callee.type==="MemberExpression";){if(i.callee.object.type==="Identifier"&&i.callee.object.name===e){if(i.callee.property.type!=="Identifier")return null;let n=i.arguments[0],s=n?.type==="Literal"&&typeof n.value=="string"?n.value:void 0;return {method:i.callee.property.name,firstArgument:s}}i=i.callee.object;}return null}var v=class extends l{name="migration-table-order";defaultOptions=[];meta={type:"suggestion",docs:{description:"Group migration table statements as columns, then timestamps, then indexes and constraints.",recommended:true,category:"adonisjs"},schema:[],messages:{outOfOrder:p({problem:"This {{category}} is out of order in the table definition.",why:"A migration reads consistently when columns come first, then timestamps, then indexes and constraints, each grouped together",fix:"Move it into its group so the order stays columns, timestamps, then indexes and constraints"})}};create(e){return {CallExpression(i){let n=Te(i);if(n===null)return;let s=0;for(let r of n.body){let a=be(r,n.builderName);if(a===null)continue;let m=o.MIGRATIONS.CATEGORY_ORDER.indexOf(a);m<s&&e.report({node:r,messageId:"outOfOrder",data:{category:a}}),s=Math.max(s,m);}}}}},Ee=new v;function xe(t){return t.parent.type==="ExportDefaultDeclaration"&&t.id?.name.endsWith("Controller")===true}function z(t){let e=[];for(let i of t.matchAll(o.WORDS.SUB_WORD))i.index!==void 0&&e.push({text:i[0],index:i.index});return e}function F(t,e){return t===t.toUpperCase()?e.toUpperCase():t.charAt(0)===t.charAt(0).toUpperCase()?e.charAt(0).toUpperCase()+e.slice(1):e}function Re(t){return t!==void 0&&o.WORDS.WORD_CHAR.test(t)}function h(t){return o.COMMENTS.DIRECTIVE.test(t.value)}function Oe(t){let e=t.range[0]+2;if(t.type==="Line"){let n=t.value.match(/\S/u);return n?.index===void 0?null:{index:e+n.index,char:n[0]}}let i=0;for(let n of t.value.split(`
4
+ `)){let s=(n.match(/^\s*\*?\s*/u)?.[0]??"").length,r=n.slice(s).charAt(0);if(r!=="")return {index:e+i+s,char:r};i+=n.length+1;}return null}function Ie(t){let e=[],i=t.range[0]+2,n=null;for(let s=0;s<t.value.length;s++){let r=t.value.charAt(s);if(n!==null){r===n&&(n=null);continue}if(o.COMMENTS.QUOTES.has(r)&&t.value.includes(r,s+1)){n=r;continue}if(r!==".")continue;if(t.value.charAt(s+1)==="."){for(;t.value.charAt(s+1)===".";)s++;continue}let a=t.value.slice(s+1);a!==""&&!/^\s/u.test(a)||Mt(t.value.slice(0,s+1))||e.push({index:i+s,terminal:a.trim()===""});}return e}function Le(t){let e=[],i=t.range[0]+2;for(let n=0;n<t.value.length;n++){if(t.value.charAt(n)!=="`")continue;if(t.value.charAt(n+1)==="`"){for(;t.value.charAt(n+1)==="`";)n++;continue}let s=t.value.indexOf("`",n+1);if(s===-1)break;let r=t.value.slice(n+1,s);r.includes('"')||e.push({start:i+n,end:i+s,text:r}),n=s;}return e}function Mt(t){let e=t.toLowerCase();return o.COMMENTS.ABBREVIATIONS.some(i=>{if(!e.endsWith(i))return false;let n=e.charAt(e.length-i.length-1);return n===""||!Re(n)})}function g(t){return t.type==="Block"&&t.value.startsWith("*")}function At(t){let e=(t.type==="ExportDefaultDeclaration"||t.type==="ExportNamedDeclaration")&&t.declaration!==null?t.declaration:t,n=("decorators"in e?e.decorators:void 0)?.reduce((s,r)=>s===void 0||r.range[0]<s.range[0]?r:s,void 0);return n!==void 0&&n.range[0]<t.range[0]?n:t}function y(t,e){let i=t.getCommentsBefore(At(e)),n=i.length-1;for(;n>=0;){let r=i[n];if(r===void 0||!h(r))break;n--;}let s=i[n];return s!==void 0&&g(s)}function j(t){return /^\s*\*\s*$/.test(t)}function L(t){return t.match(o.JSDOC.TAG)?.[1]??null}function P(t){return L(t)!==null}function Ce(t){let e=[];for(let i of t.value.split(`
5
+ `)){let n=i.replace(/^\s*\*? ?/,"").trimEnd();if(n.startsWith("@"))break;e.push(n);}return e.join(" ").replace(/\s+/g," ").trim()}function Ne(t,e){let i=-1;for(let s=e.loc.start.line+1;s<e.loc.end.line;s++){let r=L(t.lines[s-1]??"");if(r==="returns"||r==="return"){i=s;break}}if(i===-1)return null;let n=e.loc.end.line-1;for(let s=i+1;s<e.loc.end.line;s++)if(P(t.lines[s-1]??"")){n=s-1;break}return {from:i,to:n}}var _=class extends l{name="require-controller-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment describing an AdonisJS controller.",recommended:true,category:"adonisjs"},schema:[],messages:{missingJSDoc:p({problem:"This controller has no JSDoc describing what it does.",why:"A controller's responsibility should be readable at a glance, before diving into its handler methods",fix:"Add a `/** ... */` JSDoc above the controller class summarizing what it handles"})}};create(e){return {ClassDeclaration(i){xe(i)&&(y(e.sourceCode,i.parent)||e.report({node:i.id??i,messageId:"missingJSDoc"}));}}}},ke=new _;var J=class extends l{name="require-migration-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment describing an AdonisJS migration.",recommended:true,category:"adonisjs"},schema:[],messages:{missingJSDoc:p({problem:"This migration has no JSDoc describing what it does.",why:"A migration's intent should be readable at a glance, the timestamped filename does not convey the schema change",fix:"Add a `/** ... */` JSDoc above the migration class summarizing the change"})}};create(e){return {ClassDeclaration(i){he(i)&&(y(e.sourceCode,i.parent)||e.report({node:i.id??i,messageId:"missingJSDoc"}));}}}},De=new J;function vt(t){let e=t.replace(/\\/g,"/"),i="^";for(let n=0;n<e.length;n++){let s=e[n];if(s===void 0)break;s==="*"?e[n+1]==="*"?(i+=".*",n++,e[n+1]==="/"&&n++):i+="[^/]*":"\\^$.|?+()[]{}".includes(s)?i+=`\\${s}`:i+=s;}return new RegExp(`${i}$`)}function T(t,e){let i=t.replace(/\\/g,"/");return e.some(n=>vt(n).test(i))}var U=class extends l{name="require-validated-request";defaultOptions=[{allowIn:[]}];meta={type:"suggestion",docs:{description:"Require request data to be read through a Vine validator, not raw request accessors.",recommended:true,category:"adonisjs"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{rawRead:p({problem:"`request.{{method}}()` reads request data directly.",why:"Request data must pass through a Vine validator so it is typed and checked, a raw accessor bypasses that contract",fix:"Read it through `request.validateUsing(someValidator)` instead"})}};create(e,i){let n=i[0]?.allowIn??[];if(n.length>0&&T(e.filename,n))return {};let s=r=>r.type==="Identifier"?r.name==="request":r.type==="MemberExpression"&&r.property.type==="Identifier"&&r.property.name==="request";return {CallExpression(r){r.callee.type!=="MemberExpression"||r.callee.property.type!=="Identifier"||!o.REQUEST.RAW_ACCESSORS.has(r.callee.property.name)||!s(r.callee.object)||e.report({node:r.callee.property,messageId:"rawRead",data:{method:r.callee.property.name}});}}}},we=new U;var B=class extends l{name="catch-error-name";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a `catch` clause to bind its error as `error`.",recommended:true,category:"base"},schema:[],messages:{rename:p({problem:"This `catch` binds the error as `{{name}}`.",why:"Every catch binds the error as `error` so error handling reads the same across the codebase",fix:"Rename the binding to `error`, or `_error` if it is intentionally unused"})}};create(e){return {CatchClause(i){i.param?.type==="Identifier"&&(i.param.name==="error"||i.param.name.startsWith("_")||e.report({node:i.param,messageId:"rename",data:{name:i.param.name}}));}}}},Me=new B;var Ae=250,W=class extends l{name="max-jsdoc-description-length";defaultOptions=[{max:Ae}];meta={type:"suggestion",docs:{description:"Enforce a maximum character length for a JSDoc description.",recommended:true,category:"base"},schema:[{type:"object",properties:{max:{type:"integer",minimum:1}},additionalProperties:false}],messages:{tooLong:p({problem:"This JSDoc description is {{length}} characters, over the {{max}}-character limit.",why:"A JSDoc description should summarize what something is, an oversized one usually restates the code or explains how it is used, which does not belong here",fix:'Trim it to a concise summary of what it does, and remove any note about how or where it is used (e.g "used by X to ...", "called from Y"), which is an anti-pattern'})}};create(e,i){let n=i[0]?.max??Ae;return {Program(){for(let s of e.sourceCode.getAllComments()){if(!g(s))continue;let r=Ce(s).length;r<=n||e.report({loc:s.loc,messageId:"tooLong",data:{length:r,max:n}});}}}}},ve=new W;function C(t){let e=[],i=t;for(;;){if(i.type==="ChainExpression"||i.type==="TSNonNullExpression"){i=i.expression;continue}if(i.type==="MemberExpression"){if(i.computed||i.property.type!=="Identifier")return null;e.unshift(i.property.name),i=i.object;continue}break}return e.length===0?null:i.type==="ThisExpression"?["this",...e].join("."):i.type==="Identifier"?[i.name,...e].join("."):null}function ze(t){return C(t)!==null}function N(t,e){let i=ASTUtils.findVariable(t,e);if(i===null)return false;let n=new Set(i.defs.map(s=>s.name));return i.references.some(s=>s.isWrite()&&!n.has(s.identifier))}function Fe(t,e){for(let i of t)if(e===i||e.startsWith(`${i}.`))return true;return false}function je(t){return t.properties.length===0?false:t.properties.every(e=>e.type==="Property"&&e.shorthand&&!e.computed&&e.value.type==="Identifier")}var q=class extends l{name="no-alias-variables";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow a `const` whose whole value is another variable, use the source directly.",recommended:true,category:"base"},schema:[],messages:{alias:p({problem:"`{{name}}` only aliases `{{source}}`.",why:"A variable that just renames another hides the original and adds a name to track for no gain",fix:"Remove it and use `{{source}}` directly, or rename `{{source}}` itself if the new name is better"})}};create(e){return {VariableDeclarator(i){i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.parent.parent.type!=="ExportNamedDeclaration"&&(i.id.type!=="Identifier"||i.init?.type!=="Identifier"||i.id.typeAnnotation===void 0&&(N(e.sourceCode.getScope(i),i.init.name)||e.report({node:i,messageId:"alias",data:{name:i.id.name,source:i.init.name}})));}}}},Pe=new q;var _e={colour:"color",colours:"colors",coloured:"colored",colouring:"coloring",behaviour:"behavior",behaviours:"behaviors",favour:"favor",favours:"favors",favoured:"favored",favouring:"favoring",favourable:"favorable",favourite:"favorite",favourites:"favorites",flavour:"flavor",flavours:"flavors",honour:"honor",honours:"honors",honoured:"honored",honouring:"honoring",labour:"labor",labours:"labors",laboured:"labored",labouring:"laboring",neighbour:"neighbor",neighbours:"neighbors",humour:"humor",humours:"humors",rumour:"rumor",rumours:"rumors",harbour:"harbor",harbours:"harbors",endeavour:"endeavor",endeavours:"endeavors",endeavoured:"endeavored",endeavouring:"endeavoring",normalise:"normalize",normalised:"normalized",normalising:"normalizing",normalisation:"normalization",initialise:"initialize",initialises:"initializes",initialised:"initialized",initialising:"initializing",initialisation:"initialization",serialise:"serialize",serialised:"serialized",serialising:"serializing",serialisation:"serialization",organise:"organize",organises:"organizes",organised:"organized",organising:"organizing",organisation:"organization",optimise:"optimize",optimised:"optimized",optimising:"optimizing",optimisation:"optimization",customise:"customize",customised:"customized",customising:"customizing",sanitise:"sanitize",sanitised:"sanitized",sanitising:"sanitizing",synchronise:"synchronize",synchronised:"synchronized",synchronising:"synchronizing",synchronisation:"synchronization",authorise:"authorize",authorised:"authorized",authorising:"authorizing",authorisation:"authorization",finalise:"finalize",finalised:"finalized",finalising:"finalizing",capitalise:"capitalize",capitalised:"capitalized",capitalising:"capitalizing",categorise:"categorize",categorises:"categorizes",categorised:"categorized",categorising:"categorizing",categorisation:"categorization",utilise:"utilize",utilises:"utilizes",utilised:"utilized",utilising:"utilizing",utilisation:"utilization",realise:"realize",realises:"realizes",realised:"realized",realising:"realizing",realisation:"realization",recognise:"recognize",recognises:"recognizes",recognised:"recognized",recognising:"recognizing",summarise:"summarize",summarises:"summarizes",summarised:"summarized",summarising:"summarizing",specialise:"specialize",specialises:"specializes",specialised:"specialized",specialising:"specializing",specialisation:"specialization",minimise:"minimize",minimises:"minimizes",minimised:"minimized",minimising:"minimizing",minimisation:"minimization",maximise:"maximize",maximises:"maximizes",maximised:"maximized",maximising:"maximizing",maximisation:"maximization",prioritise:"prioritize",prioritises:"prioritizes",prioritised:"prioritized",prioritising:"prioritizing",prioritisation:"prioritization",standardise:"standardize",standardises:"standardizes",standardised:"standardized",standardising:"standardizing",standardisation:"standardization",harmonise:"harmonize",harmonises:"harmonizes",harmonised:"harmonized",harmonising:"harmonizing",harmonisation:"harmonization",centralise:"centralize",centralises:"centralizes",centralised:"centralized",centralising:"centralizing",centralisation:"centralization",decentralise:"decentralize",decentralises:"decentralizes",decentralised:"decentralized",decentralising:"decentralizing",decentralisation:"decentralization",emphasise:"emphasize",emphasises:"emphasizes",emphasised:"emphasized",emphasising:"emphasizing",visualise:"visualize",visualises:"visualizes",visualised:"visualized",visualising:"visualizing",visualisation:"visualization",analyse:"analyze",analyses:"analyzes",analysed:"analyzed",analysing:"analyzing",paralyse:"paralyze",paralyses:"paralyzes",paralysed:"paralyzed",paralysing:"paralyzing",centre:"center",centred:"centered",centres:"centers",fibre:"fiber",fibres:"fibers",metre:"meter",metres:"meters",litre:"liter",litres:"liters",theatre:"theater",theatres:"theaters",calibre:"caliber",spectre:"specter",spectres:"specters",licence:"license",defence:"defense",offence:"offense",pretence:"pretense",practise:"practice",cancelled:"canceled",cancelling:"canceling",labelled:"labeled",labelling:"labeling",modelled:"modeled",modelling:"modeling",travelled:"traveled",travelling:"traveling",signalled:"signaled",signalling:"signaling",fuelled:"fueled",fuelling:"fueling",marvellous:"marvelous",counsellor:"counselor",fulfil:"fulfill",fulfils:"fulfills",fulfilment:"fulfillment",enrol:"enroll",enrols:"enrolls",enrolment:"enrollment",instalment:"installment",skilful:"skillful",wilful:"willful",dialogue:"dialog",dialogues:"dialogs",catalogue:"catalog",catalogues:"catalogs",analogue:"analog",analogues:"analogs",grey:"gray",artefact:"artifact",artefacts:"artifacts",sceptic:"skeptic",sceptical:"skeptical",programme:"program",programmes:"programs",enquiry:"inquiry",enquiries:"inquiries",aluminium:"aluminum",tyre:"tire",tyres:"tires"};function Je(t,e,i){let n=Object.create(null);for(let[s,r]of Object.entries(t))n[s.toLowerCase()]=r;for(let[s,r]of Object.entries(e))n[s.toLowerCase()]=r;for(let s of i)delete n[s.toLowerCase()];return n}var V=class extends l{name="no-british-english";defaultOptions=[{extra:{},ignore:[]}];meta={type:"suggestion",docs:{description:"Disallow British English spellings in identifiers and comments.",recommended:true,category:"base"},fixable:"code",schema:[{type:"object",properties:{extra:{type:"object",additionalProperties:{type:"string"}},ignore:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{british:p({problem:"British spelling `{{british}}`, this codebase uses American English.",why:"One spelling convention keeps identifiers and docs consistent and searchable",fix:"Use `{{american}}` instead"})}};create(e,i){let n=Je(_e,i[0]?.extra??{},i[0]?.ignore??[]);return {Identifier(s){if(!(s.parent.type==="MemberExpression"&&s.parent.property===s&&!s.parent.computed))for(let r of z(s.name)){let a=n[r.text.toLowerCase()];a!==void 0&&e.report({node:s,messageId:"british",data:{british:r.text,american:F(r.text,a)}});}},Program(){for(let s of e.sourceCode.getAllComments())for(let r of z(s.value)){let a=n[r.text.toLowerCase()];if(a===void 0)continue;let m=F(r.text,a),d=s.range[0]+2+r.index,f=d+r.text.length;e.report({loc:{start:e.sourceCode.getLocFromIndex(d),end:e.sourceCode.getLocFromIndex(f)},messageId:"british",data:{british:r.text,american:m},fix:A=>A.replaceTextRange([d,f],m)});}}}}},Ue=new V;function Be(t){let e=t.replace(/^\s*\*?\s*/,"").trimEnd();return e.length===0?false:o.COMMENTS.BOX_DRAWING.test(e)||o.COMMENTS.PURE_SEPARATOR.test(e)||o.COMMENTS.WRAPPED_LABEL.test(e)}var G=class extends l{name="no-decorative-comment-separators";defaultOptions=[{allowIn:[]}];meta={type:"layout",docs:{description:"Disallow decorative separators (banners, box-drawing, repeated dashes) inside comments.",recommended:true,category:"base"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{decorative:p({problem:"This comment uses a decorative separator.",why:"Repeated separator characters and box-drawing lines are visual noise that add nothing over a plain label",fix:"Remove the separator, a one-line label or a blank line already divides sections clearly"})}};create(e,i){let n=i[0]?.allowIn??[];return n.length>0&&T(e.filename,n)?{}:{Program(){for(let s of e.sourceCode.getAllComments()){let r=s.value.split(`
6
+ `);for(let a=0;a<r.length;a++){let m=r[a];if(m===void 0||!Be(m))continue;let d=s.loc.start.line+a,f=e.sourceCode.lines[d-1]??"";e.report({loc:{start:{line:d,column:0},end:{line:d,column:f.length}},messageId:"decorative"});}}}}}},We=new G;var Ft={strings:"String",templates:"Template",jsx:"JSXText"};function k(t,e){let i=new Set(e),n=[];if(i.size===0)return n;let s=new Set([...i].map(r=>Ft[r]).filter(r=>r!==void 0));for(let r of t.ast.tokens??[])s.has(r.type)&&n.push(r.range);if(i.has("comments"))for(let r of t.getAllComments())n.push(r.range);return n}function D(t,e){return e.some(([i,n])=>t>=i&&t<n)}var K=class extends l{name="no-em-dash";defaultOptions=[{allow:[]}];meta={type:"suggestion",docs:{description:"Disallow the em dash (\u2014) character anywhere in the source.",recommended:true},schema:[{type:"object",properties:{allow:{type:"array",items:{type:"string",enum:["strings","templates","jsx","comments"]}}},additionalProperties:false}],messages:{emDash:p({problem:"Found an em dash (\u2014) character.",why:"Em dashes are typically introduced by AI-generated or auto-formatted text and are discouraged here.",fix:"Replace the em dash with a hyphen (-), a comma (,), or reword the sentence to avoid it, or allow it here with the rule's `allow` option if it is deliberate user-facing copy."})}};create(e,i){return {Program(){let n=e.sourceCode.getText(),s=k(e.sourceCode,i[0]?.allow??[]);for(let r=0;r<n.length;r++)n[r]===o.EM_DASH&&(D(r,s)||e.report({loc:{start:e.sourceCode.getLocFromIndex(r),end:e.sourceCode.getLocFromIndex(r+1)},messageId:"emDash"}));}}}},qe=new K;var $=class extends l{name="no-emojis";defaultOptions=[{allow:[]}];meta={type:"suggestion",docs:{description:"Disallow emoji characters anywhere in the source.",recommended:true,category:"base"},schema:[{type:"object",properties:{allow:{type:"array",items:{type:"string",enum:["strings","templates","jsx","comments"]}}},additionalProperties:false}],messages:{emoji:p({problem:"Found an emoji ({{emoji}}).",why:"Emojis are usually introduced by AI-generated text and add noise to code, comments, and identifiers",fix:"Remove the emoji, or allow it here with the rule's `allow` option if it is deliberate user-facing copy"})}};create(e,i){return {Program(){let n=e.sourceCode.getText(),s=k(e.sourceCode,i[0]?.allow??[]);for(let r of n.matchAll(o.EMOJI))D(r.index,s)||e.report({loc:{start:e.sourceCode.getLocFromIndex(r.index),end:e.sourceCode.getLocFromIndex(r.index+r[0].length)},messageId:"emoji",data:{emoji:r[0]}});}}}},Ve=new $;var H=class extends l{name="no-jsdoc-blank-before-tags";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Disallow blank lines before JSDoc tags such as `@param` or `@returns`.",recommended:true},schema:[],messages:{blankBeforeTag:p({problem:"There is a blank line before a JSDoc tag.",why:"Tags should follow the description directly; an empty line there is noise that inflates the comment.",fix:"Remove the blank line so the tag follows on directly."})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(g(i)&&i.loc.start.line!==i.loc.end.line)for(let n=i.loc.start.line;n<=i.loc.end.line;n++){let s=e.sourceCode.lines[n-1];if(s===void 0||!j(s))continue;let r=n;for(;r<i.loc.end.line&&j(e.sourceCode.lines[r]??"");)r++;let a=e.sourceCode.lines[r];if(a!==void 0&&P(a)){let m=e.sourceCode.getIndexFromLoc({line:n,column:0}),d=e.sourceCode.getIndexFromLoc({line:r+1,column:0});e.report({loc:{start:{line:n,column:0},end:{line:r,column:s.length}},messageId:"blankBeforeTag",fix:f=>f.removeRange([m,d])});}n=r;}}}}},Ge=new H;function R(t){let e=t;return e.parent.type==="VariableDeclarator"&&e.parent.parent.type==="VariableDeclaration"&&(e=e.parent.parent),(e.parent.type==="ExportNamedDeclaration"||e.parent.type==="ExportDefaultDeclaration")&&(e=e.parent),e}function Ke(t){return t.parent?.type==="Program"}function $e(t){let e=t.parent;for(;e;){if(o.FUNCTIONS.NODE_TYPES.has(e.type))return e;e=e.parent;}return null}function He(t){return t.type==="ArrowFunctionExpression"&&t.params.length===0&&t.body.type==="ImportExpression"}function b(t){if((t.type==="FunctionDeclaration"||t.type==="FunctionExpression")&&t.id)return t.id.name;if(t.parent.type==="VariableDeclarator"&&t.parent.id.type==="Identifier")return t.parent.id.name}function E(t,e,i){if(t.type==="ReturnStatement")return i(t.argument);for(let n of e[t.type]??[]){let s=t[n],r=Array.isArray(s)?s:[s];for(let a of r){let m=a;if(!(!m||typeof m.type!="string")&&!o.FUNCTIONS.NODE_TYPES.has(m.type)&&E(m,e,i))return true}}return false}function jt(t,e){return t.type==="ArrowFunctionExpression"&&t.body.type!=="BlockStatement"?true:E(t.body,e,i=>i!==null)}function Pt(t){return t.typeAnnotation.type==="TSVoidKeyword"?true:t.typeAnnotation.type==="TSTypeReference"&&t.typeAnnotation.typeName.type==="Identifier"&&t.typeAnnotation.typeName.name==="Promise"?t.typeAnnotation.typeArguments?.params.length===1&&t.typeAnnotation.typeArguments?.params[0]?.type==="TSVoidKeyword":false}function Xe(t,e){return t.returnType?Pt(t.returnType):!jt(t,e)}var X=class extends l{name="no-jsdoc-returns-on-void";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Disallow a JSDoc `@returns` tag on a function that returns nothing.",recommended:true,category:"base"},schema:[],messages:{voidReturns:p({problem:"This function returns nothing, but its JSDoc has a `@returns` tag.",why:"A `@returns` on a void function documents a value that never exists and drifts from the code",fix:"Remove the `@returns` tag"})}};create(e){let i=(n,s)=>{let r=e.sourceCode.getCommentsBefore(s).at(-1);if(r===void 0||!g(r))return;let a=Ne(e.sourceCode,r);if(a===null||!Xe(n,e.sourceCode.visitorKeys))return;let m=e.sourceCode.getIndexFromLoc({line:a.from,column:0}),d=e.sourceCode.getIndexFromLoc({line:a.to+1,column:0});e.report({loc:{start:{line:a.from,column:0},end:{line:a.to,column:(e.sourceCode.lines[a.to-1]??"").length}},messageId:"voidReturns",fix:f=>f.removeRange([m,d])});};return {FunctionDeclaration(n){i(n,R(n));},VariableDeclarator(n){(n.init?.type==="ArrowFunctionExpression"||n.init?.type==="FunctionExpression")&&i(n.init,R(n.init));},MethodDefinition(n){n.value.type==="FunctionExpression"&&i(n.value,n);}}}},Ye=new X;var Y=class extends l{name="no-line-comment-backticks";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Disallow backticks in `//` line comments, use double quotes for code references.",recommended:true,category:"base"},schema:[],messages:{backticks:p({problem:"This line comment wraps `{{text}}` in backticks.",why:"Backticks only render as code inside a JSDoc block, in a `//` comment they stay literal characters, so double quotes read better",fix:'Wrap it in double quotes instead: "{{text}}"'})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(!(i.type!=="Line"||h(i)))for(let n of Le(i))e.report({loc:{start:e.sourceCode.getLocFromIndex(n.start),end:e.sourceCode.getLocFromIndex(n.end+1)},messageId:"backticks",data:{text:n.text},fix:s=>[s.replaceTextRange([n.start,n.start+1],'"'),s.replaceTextRange([n.end,n.end+1],'"')]});}}}},Ze=new Y;var Z=class extends l{name="no-line-comment-period";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Disallow prose periods in `//` line comments (code-reference dots and ellipses are allowed).",recommended:true},schema:[],messages:{period:p({problem:"This line comment ends with a period.",why:"Line comments should be short, clear fragments, not full sentences, so a closing period is just noise, dots inside code references like `foo.bar` are allowed.",fix:"Remove the period and keep the comment terse."}),sentence:p({problem:"This line comment runs two sentences together with a period.",why:"Line comments should be short, clear fragments, dropping the period on its own would leave a run-on, so the sentences belong on separate lines",fix:"Split it into one `//` line per fragment, or reword it as a single fragment (reported, not auto-fixed, so wrapped prose is never mangled)"})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments())if(i.type==="Line")for(let n of Ie(i)){let s={start:e.sourceCode.getLocFromIndex(n.index),end:e.sourceCode.getLocFromIndex(n.index+1)};if(n.terminal){e.report({loc:s,messageId:"period",fix:r=>r.removeRange([n.index,n.index+1])});continue}e.report({loc:s,messageId:"sentence"});}}}}},Qe=new Z;var Q=class extends l{name="no-property-access-alias";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow a `const` whose whole value is a single property access, inline the expression instead.",recommended:true,category:"base"},schema:[],messages:{propertyAccessAlias:p({problem:"`{{name}}` only aliases the property access `{{expression}}`.",why:"A variable that just renames a property hides where the value comes from when scanning the code",fix:"Remove it and use `{{expression}}` inline, or use `let` if it is reassigned later"})}};create(e){let i=[],n=new Set,s=r=>{if(r.type!=="MemberExpression")return;let a=C(r);a!==null&&n.add(a);};return {AssignmentExpression(r){s(r.left);},UpdateExpression(r){s(r.argument);},VariableDeclarator(r){if(r.parent.type!=="VariableDeclaration"||r.parent.kind!=="const"||r.parent.parent.type==="ExportNamedDeclaration"||r.id.type!=="Identifier"||r.init===null||r.id.typeAnnotation!==void 0)return;let a=C(r.init);if(a===null)return;let m=a.slice(0,a.indexOf("."));m!=="this"&&N(e.sourceCode.getScope(r),m)||i.push({node:r,name:r.id.name,path:a,expression:e.sourceCode.getText(r.init)});},"Program:exit"(){for(let r of i)Fe(n,r.path)||e.report({node:r.node,messageId:"propertyAccessAlias",data:{name:r.name,expression:r.expression}});}}}},et=new Q;var ee=class extends l{name="no-property-destructuring";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow shorthand destructuring off a plain object reference, access the property directly.",recommended:true,category:"base"},schema:[],messages:{destructure:p({problem:"Destructuring from `{{source}}` here just aliases its properties.",why:"Reading `{{source}}.x` at the use site keeps the origin visible, destructuring a plain object hides where a value comes from (destructuring a call or hook result is fine)",fix:"Access the properties on `{{source}}` directly instead of destructuring"})}};create(e){return {VariableDeclarator(i){i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.parent.parent.type!=="ExportNamedDeclaration"&&(i.id.type!=="ObjectPattern"||i.init===null||i.init.type!=="Identifier"&&!ze(i.init)||je(i.id)&&e.report({node:i,messageId:"destructure",data:{source:e.sourceCode.getText(i.init)}}));}}}},tt=new ee;var te=class extends l{name="no-relative-imports";defaultOptions=[{allowIn:[]}];meta={type:"suggestion",docs:{description:"Disallow relative import and re-export specifiers, use the package path alias.",recommended:true,category:"base"},schema:[{type:"object",properties:{allowIn:{type:"array",items:{type:"string"}}},additionalProperties:false}],messages:{relative:p({problem:"This import uses a relative path (`{{path}}`).",why:"A relative path breaks when a file moves and hides which package a module belongs to, the path alias is stable and explicit",fix:"Import through the package alias (`#...` or `@frontend/...`) instead of a relative path"})}};create(e,i){let n=i[0]?.allowIn??[];if(n.length>0&&T(e.filename,n))return {};let s=r=>{r!=null&&(!r.value.startsWith("./")&&!r.value.startsWith("../")||e.report({node:r,messageId:"relative",data:{path:r.value}}));};return {ImportDeclaration(r){s(r.source);},ExportNamedDeclaration(r){s(r.source);},ExportAllDeclaration(r){s(r.source);},ImportExpression(r){r.source.type==="Literal"&&typeof r.source.value=="string"&&s(r.source);}}}},it=new te;var ie=class extends l{name="no-single-line-jsdoc";defaultOptions=[];meta={type:"layout",fixable:"code",docs:{description:"Require JSDoc comments to span multiple lines rather than sit on a single line.",recommended:true},schema:[],messages:{singleLine:p({problem:"This JSDoc comment is written on a single line.",why:"Multi-line JSDoc is easier to read, diff, and extend with additional tags, and is the house style.",fix:"Put the opening `/**`, the ` * ` content, and the closing `*/` each on their own line."})}};create(e){return {Program(){for(let i of e.sourceCode.getAllComments()){if(!g(i)||i.loc.start.line!==i.loc.end.line)continue;let n=i.value.replace(/^\*/,"").trim();n.length!==0&&e.report({loc:i.loc,messageId:"singleLine",fix(s){let r=" ".repeat(i.loc.start.column),a=`/**
7
7
  ${r} * ${n}
8
- ${r} */`;return s.replaceTextRange(i.range,a)}});}}}}},tt=new ee;var te=class extends l{name="require-capitalized-comments";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Require a comment to start with an uppercase letter.",recommended:true,category:"base"},schema:[],messages:{capitalize:p({problem:"This comment starts with a lowercase letter.",why:"A comment reads as a sentence, and a sentence starts with a capital letter",fix:"Capitalize the first letter of the comment"})}};create(e){let i=n=>{if(n.type!=="Line")return false;let s=e.sourceCode.lines[n.loc.start.line-2];return s!==void 0&&/^\s*\/\//.test(s)};return {Program(){for(let n of e.sourceCode.getAllComments()){if(N(n)||i(n))continue;let s=Ke(n);s===null||!new RegExp("\\p{Ll}","u").test(s.char)||/^(?:https?:\/\/|www\.)/u.test(e.sourceCode.getText().slice(s.index))||e.report({loc:{start:e.sourceCode.getLocFromIndex(s.index),end:e.sourceCode.getLocFromIndex(s.index+s.char.length)},messageId:"capitalize",fix:r=>r.replaceTextRange([s.index,s.index+s.char.length],s.char.toUpperCase())});}}}}},it=new te;var rt={adonisjs:"AdonisJS",react:"React"};function Pt(t){let e=[];for(let i of t.ast.body)i.type==="ImportDeclaration"&&e.push(String(i.source.value));return e}function nt(t,e){let i=new Set,n=Pt(t);return n.some(r=>r.startsWith("@adonisjs/")||o.FRAMEWORKS.ADONIS_SUBPATH.test(r))&&i.add("adonisjs"),(n.some(r=>r==="react"||r.startsWith("react/")||r==="react-dom")||o.FRAMEWORKS.REACT_FILE.test(e))&&i.add("react"),i}var ie=class extends l{name="require-framework-config";defaultOptions=[{ignore:[]}];meta={type:"suggestion",docs:{description:"Warn when a file uses a framework whose Nitpicker config is not enabled.",recommended:true,category:"base"},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["adonisjs","react"]}}},additionalProperties:false}],messages:{missingConfig:p({problem:"This file uses {{framework}} but the Nitpicker {{framework}} rules are not enabled.",why:"Framework rules only run when you opt into the matching config, so files like this one go unchecked",fix:"Add `nitpicker.configs.{{config}}` (scoped to these files) to your ESLint config, or turn off `nitpicker/require-framework-config`"})}};create(e,i){let n=new Set(i[0]?.ignore??[]),s=e.settings[o.PLUGIN_NAME]??{};return {Program(r){let a=nt(e.sourceCode,e.filename);for(let m of a)n.has(m)||s[m]||e.report({node:r,messageId:"missingConfig",data:{framework:rt[m],config:m}});}}}},st=new ie;function re(t){return /^[A-Z]/.test(t)}function D(t){return o.REACT.HOOK.test(t)}function ot(t){return o.REACT.CONTEXT_HOOK.test(t)}function ne(t){return t?t.type==="ArrowFunctionExpression"||t.type==="FunctionExpression"?true:t.type==="CallExpression"&&t.callee.type==="Identifier"&&t.callee.name==="useCallback":false}function S(t){if(!t)return false;switch(t.type){case "JSXElement":case "JSXFragment":return true;case "ConditionalExpression":return S(t.consequent)||S(t.alternate);case "LogicalExpression":return S(t.left)||S(t.right);case "SequenceExpression":return S(t.expressions.at(-1));default:return false}}function se(t,e){return t.type==="ArrowFunctionExpression"&&t.body.type!=="BlockStatement"?S(t.body):b(t.body,e,S)}function at(t,e){let i=T(t);return i===void 0?false:D(i)||re(i)&&se(t,e)}function lt(t,e){if(t.type==="CallExpression")return !(t.callee.type==="Identifier"&&D(t.callee.name));for(let i of e[t.type]??[]){let n=t[i],s=Array.isArray(n)?n:[n];for(let r of s){let a=r;if(!(!a||typeof a.type!="string")&&!o.FUNCTIONS.NODE_TYPES.has(a.type)&&lt(a,e))return true}}return false}function pt(t,e){return t.type==="ArrowFunctionExpression"||t.type==="FunctionExpression"?false:lt(t,e)}var oe=class extends l{name="require-function-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment on top-level functions, except React component functions.",recommended:true},schema:[],messages:{missingJSDoc:p({problem:"The function `{{name}}` has no JSDoc comment.",why:"Top-level functions must document their purpose, parameters, and return value, React component functions are the only exception.",fix:"Add a `/** ... */` JSDoc block immediately above the function describing what it does."})}};create(e){let i=(n,s)=>{let r=T(n);if(r===void 0)return;let a=x(n);Be(a)&&(qe(n)||re(r)&&se(n,e.sourceCode.visitorKeys)||y(e.sourceCode,a)||e.report({node:s,messageId:"missingJSDoc",data:{name:r}}));};return {FunctionDeclaration(n){i(n,n.id??n);},VariableDeclarator(n){n.init&&(n.init.type!=="ArrowFunctionExpression"&&n.init.type!=="FunctionExpression"||i(n.init,n.id));}}}},ct=new oe;function ut(t,e,i){let s=(t.lines[e.loc.start.line-1]??"").match(/^\s*/)?.[0]??"",r=s+" ".repeat(i);return `{
8
+ ${r} */`;return s.replaceTextRange(i.range,a)}});}}}}},rt=new ie;var re=class extends l{name="require-capitalized-comments";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Require a comment to start with an uppercase letter.",recommended:true,category:"base"},schema:[],messages:{capitalize:p({problem:"This comment starts with a lowercase letter.",why:"A comment reads as a sentence, and a sentence starts with a capital letter",fix:"Capitalize the first letter of the comment"})}};create(e){let i=n=>{if(n.type!=="Line")return false;let s=e.sourceCode.lines[n.loc.start.line-2];return s!==void 0&&/^\s*\/\//.test(s)};return {Program(){for(let n of e.sourceCode.getAllComments()){if(h(n)||i(n))continue;let s=Oe(n);s===null||!new RegExp("\\p{Ll}","u").test(s.char)||/^(?:https?:\/\/|www\.)/u.test(e.sourceCode.getText().slice(s.index))||e.report({loc:{start:e.sourceCode.getLocFromIndex(s.index),end:e.sourceCode.getLocFromIndex(s.index+s.char.length)},messageId:"capitalize",fix:r=>r.replaceTextRange([s.index,s.index+s.char.length],s.char.toUpperCase())});}}}}},nt=new re;var st={adonisjs:"AdonisJS",react:"React"};function _t(t){let e=[];for(let i of t.ast.body)i.type==="ImportDeclaration"&&e.push(String(i.source.value));return e}function ot(t,e){let i=new Set,n=_t(t);return n.some(r=>r.startsWith("@adonisjs/")||o.FRAMEWORKS.ADONIS_SUBPATH.test(r))&&i.add("adonisjs"),(n.some(r=>r==="react"||r.startsWith("react/")||r==="react-dom")||o.FRAMEWORKS.REACT_FILE.test(e))&&i.add("react"),i}var ne=class extends l{name="require-framework-config";defaultOptions=[{ignore:[]}];meta={type:"suggestion",docs:{description:"Warn when a file uses a framework whose Nitpicker config is not enabled.",recommended:true,category:"base"},schema:[{type:"object",properties:{ignore:{type:"array",items:{type:"string",enum:["adonisjs","react"]}}},additionalProperties:false}],messages:{missingConfig:p({problem:"This file uses {{framework}} but the Nitpicker {{framework}} rules are not enabled.",why:"Framework rules only run when you opt into the matching config, so files like this one go unchecked",fix:"Add `nitpicker.configs.{{config}}` (scoped to these files) to your ESLint config, or turn off `nitpicker/require-framework-config`"})}};create(e,i){let n=new Set(i[0]?.ignore??[]),s=e.settings[o.PLUGIN_NAME]??{};return {Program(r){let a=ot(e.sourceCode,e.filename);for(let m of a)n.has(m)||s[m]||e.report({node:r,messageId:"missingConfig",data:{framework:st[m],config:m}});}}}},at=new ne;function se(t){return /^[A-Z]/.test(t)}function w(t){return o.REACT.HOOK.test(t)}function lt(t){return o.REACT.CONTEXT_HOOK.test(t)}function oe(t){return t?t.type==="ArrowFunctionExpression"||t.type==="FunctionExpression"?true:t.type==="CallExpression"&&t.callee.type==="Identifier"&&t.callee.name==="useCallback":false}function S(t){if(!t)return false;switch(t.type){case "JSXElement":case "JSXFragment":return true;case "ConditionalExpression":return S(t.consequent)||S(t.alternate);case "LogicalExpression":return S(t.left)||S(t.right);case "SequenceExpression":return S(t.expressions.at(-1));default:return false}}function ae(t,e){return t.type==="ArrowFunctionExpression"&&t.body.type!=="BlockStatement"?S(t.body):E(t.body,e,S)}function pt(t,e){let i=b(t);return i===void 0?false:w(i)||se(i)&&ae(t,e)}function ct(t,e){if(t.type==="CallExpression")return !(t.callee.type==="Identifier"&&w(t.callee.name));for(let i of e[t.type]??[]){let n=t[i],s=Array.isArray(n)?n:[n];for(let r of s){let a=r;if(!(!a||typeof a.type!="string")&&!o.FUNCTIONS.NODE_TYPES.has(a.type)&&ct(a,e))return true}}return false}function ut(t,e){return t.type==="ArrowFunctionExpression"||t.type==="FunctionExpression"?false:ct(t,e)}var le=class extends l{name="require-function-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc comment on top-level functions, except React component functions.",recommended:true},schema:[],messages:{missingJSDoc:p({problem:"The function `{{name}}` has no JSDoc comment.",why:"Top-level functions must document their purpose, parameters, and return value, React component functions are the only exception.",fix:"Add a `/** ... */` JSDoc block immediately above the function describing what it does."})}};create(e){let i=(n,s)=>{let r=b(n);if(r===void 0)return;let a=R(n);Ke(a)&&(He(n)||se(r)&&ae(n,e.sourceCode.visitorKeys)||y(e.sourceCode,a)||e.report({node:s,messageId:"missingJSDoc",data:{name:r}}));};return {FunctionDeclaration(n){i(n,n.id??n);},VariableDeclarator(n){n.init&&(n.init.type!=="ArrowFunctionExpression"&&n.init.type!=="FunctionExpression"||i(n.init,n.id));}}}},mt=new le;function dt(t,e,i){let s=(t.lines[e.loc.start.line-1]??"").match(/^\s*/)?.[0]??"",r=s+" ".repeat(i);return `{
9
9
  ${e.properties.map(m=>`${r}${t.getText(m)}`).join(`,
10
10
  `)},
11
- ${s}}`}var ae=class extends l{name="require-multiline-object";defaultOptions=[{maxKeys:o.OBJECTS.MAX_INLINE_KEYS,indent:o.OBJECTS.INDENT_WIDTH}];meta={type:"suggestion",fixable:"code",docs:{description:"Require an object literal with more than a few properties to span multiple lines.",recommended:true,category:"base"},schema:[{type:"object",properties:{maxKeys:{type:"integer",minimum:1},indent:{type:"integer",minimum:1}},additionalProperties:false}],messages:{shouldWrap:p({problem:"This object literal has {{count}} properties packed onto a single line.",why:"An object with more than {{max}} properties is easier to scan, diff, and edit when each property sits on its own line",fix:"Break it across multiple lines, one property per line with a trailing comma"})}};create(e,i){let n=i[0]?.maxKeys??o.OBJECTS.MAX_INLINE_KEYS,s=i[0]?.indent??o.OBJECTS.INDENT_WIDTH;return {ObjectExpression(r){if(r.properties.length<=n||r.loc.start.line!==r.loc.end.line)return;let a=e.sourceCode.getCommentsInside(r).length>0;e.report({node:r,messageId:"shouldWrap",data:{count:r.properties.length,max:n},fix:a?null:m=>m.replaceText(r,ut(e.sourceCode,r,s))});}}}},mt=new ae;var dt=120,le=class extends l{name="max-classname-length";defaultOptions=[{max:dt}];meta={type:"suggestion",docs:{description:"Enforce a maximum length for a `className` class string.",recommended:true,category:"react"},schema:[{type:"object",properties:{max:{type:"integer",minimum:1}},additionalProperties:false}],messages:{tooLong:p({problem:"This `className` string is {{length}} characters, over the {{max}}-character limit.",why:"A long wall of Tailwind classes is hard to scan and diff, and it overflows the line",fix:"Break the classes across multiple lines, grouping related ones into separate `cn()` arguments"})}};create(e,i){let n=i[0]?.max??dt,s=r=>r===null?null:r.type==="Literal"?typeof r.value=="string"?r.value:null:r.type!=="JSXExpressionContainer"?null:r.expression.type==="Literal"?typeof r.expression.value=="string"?r.expression.value:null:r.expression.type==="TemplateLiteral"&&r.expression.expressions.length===0?r.expression.quasis[0]?.value.cooked??"":null;return {JSXAttribute(r){if(r.name.type!=="JSXIdentifier"||r.name.name!=="className")return;let a=s(r.value);a===null||a.length<=n||r.value===null||e.report({node:r.value,messageId:"tooLong",data:{length:a.length,max:n}});}}}},ft=new le;var pe=class extends l{name="no-jsx-comments";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow inline `{/* ... */}` comments inside JSX.",recommended:true,category:"react"},schema:[],messages:{jsxComment:p({problem:"This JSX holds an inline `{/* ... */}` comment.",why:"A comment labeling a JSX section is a sign it should be its own named component, JSX should read as structure, not carry prose markers",fix:"Extract the section into a named sub-component whose name says what the comment said, or drop the comment"})}};create(e){return {JSXExpressionContainer(i){i.expression.type==="JSXEmptyExpression"&&e.sourceCode.getCommentsInside(i).length!==0&&e.report({node:i,messageId:"jsxComment"});}}}},gt=new pe;var ce=class extends l{name="require-context-hook-destructure";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require the result of a context-consumer hook to be destructured.",recommended:true,category:"react"},schema:[],messages:{destructure:p({problem:"`{{hook}}` is bound whole instead of destructured.",why:"Destructuring at the call site names exactly what the caller uses and reads better than repeated `{{name}}.member` access",fix:"Destructure the members in use, e.g. `const { a, b } = {{hook}}()`"})}};create(e){return {VariableDeclarator(i){i.id.type!=="Identifier"||i.init?.type!=="CallExpression"||i.init.callee.type!=="Identifier"||!ot(i.init.callee.name)||e.report({node:i,messageId:"destructure",data:{hook:i.init.callee.name,name:i.id.name}});}}}},yt=new ce;var ue=class extends l{name="require-derived-usememo";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a derived value in a component or hook to be memoized with useMemo.",recommended:true,category:"react"},schema:[],messages:{useMemo:p({problem:"This derived value is computed inline on every render.",why:"A value derived through a call is recomputed each render and has nowhere to document itself, a useMemo makes it stable and gives it a JSDoc home",fix:"Wrap it in `useMemo(() => ..., [deps])` with a JSDoc describing the value, even for a one-liner"})}};create(e){return {VariableDeclarator(i){if(i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.id.type!=="Identifier"||i.init===null)return;let n=We(i);n===null||!at(n,e.sourceCode.visitorKeys)||pt(i.init,e.sourceCode.visitorKeys)&&e.report({node:i,messageId:"useMemo"});}}}},St=new ue;var me=class extends l{name="require-hook-object-return";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Require a custom hook to return an object rather than a bare function.",recommended:true,category:"react"},schema:[],messages:{wrapInObject:p({problem:"This hook returns a bare function instead of an object.",why:"Returning an object lets the hook expose new members later without changing every call site, a bare function locks its shape",fix:"Return the function inside an object, e.g. `return { handleThing }`"})}};create(e){let i=r=>{if(ne(r))return true;if(r.type!=="Identifier")return false;let m=ASTUtils.findVariable(e.sourceCode.getScope(r),r.name)?.defs.at(-1)?.node;return m?.type==="VariableDeclarator"&&ne(m.init)},n=r=>{e.report({node:r,messageId:"wrapInObject",fix:r.type==="Identifier"?a=>a.replaceText(r,`{ ${r.name} }`):void 0});},s=r=>{let a=T(r);if(!(a===void 0||!D(a))){if(r.type==="ArrowFunctionExpression"&&r.body.type!=="BlockStatement"){i(r.body)&&n(r.body);return}b(r.body,e.sourceCode.visitorKeys,m=>(m!==null&&i(m)&&n(m),false));}};return {FunctionDeclaration(r){s(r);},FunctionExpression(r){s(r);},ArrowFunctionExpression(r){s(r);}}}},ht=new me;var de=class extends l{name="require-memo-callback-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc on a useMemo or useCallback (with an `@param` per useCallback parameter).",recommended:true,category:"react"},schema:[],messages:{missingJSDoc:p({problem:"This `{{hook}}` has no JSDoc.",why:"A memoized value or handler should document what it is, so its purpose is clear without reading the factory",fix:"Add a `/** ... */` JSDoc above the `const`"}),missingParam:p({problem:"This `useCallback`'s JSDoc documents fewer parameters than the callback takes.",why:"A callback is a function, so each parameter it takes should be documented like any other",fix:"Add an `@param` line for each parameter of the callback"})}};create(e){return {VariableDeclarator(i){if(i.init?.type!=="CallExpression"||i.init.callee.type!=="Identifier"||!o.REACT.MEMO_HOOKS.has(i.init.callee.name))return;let n=i.parent;if(n.parent?.type==="ExportNamedDeclaration"&&(n=n.parent),!y(e.sourceCode,n)){e.report({node:i.id,messageId:"missingJSDoc",data:{hook:i.init.callee.name}});return}if(i.init.callee.name!=="useCallback")return;let s=i.init.arguments[0];if(s?.type!=="ArrowFunctionExpression"&&s?.type!=="FunctionExpression"||s.params.length===0)return;(e.sourceCode.getCommentsBefore(n).at(-1)?.value.split(`
12
- `)??[]).filter(m=>O(m)==="param").length<s.params.length&&e.report({node:i.id,messageId:"missingParam"});}}}},Tt=new de;var Jt=[Te,Re,Oe,Ie,Le,ke,Me,Fe,Pe,_e,Je,Ue,Ge,Xe,Ye,Ze,Qe,et,tt,it,st,ct,mt,ft,gt,yt,St,ht,Tt],R=Object.fromEntries(Jt.map(t=>[t.name,t.toRuleModule()]));function E(t){let e={};for(let[i,n]of Object.entries(R))(n.meta.docs?.category??"base")===t&&(e[`${o.PLUGIN_NAME}/${i}`]="warn");return e}function bt(){let t={};for(let e of Object.keys(R))t[`${o.PLUGIN_NAME}/${e}`]="warn";return t}function Et(t){return {name:`${o.PLUGIN_NAME}/all`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{adonisjs:true,react:true}},rules:bt()}}function w(t){return {name:`${o.PLUGIN_NAME}/base`,plugins:{[o.PLUGIN_NAME]:t},rules:E("base")}}function xt(t){return {...w(t),name:`${o.PLUGIN_NAME}/recommended`}}var Ut=["**/start/routes.ts","**/start/routes/**/*.ts"];function Rt(t){return {name:`${o.PLUGIN_NAME}/adonisjs`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{adonisjs:true}},rules:{...E("adonisjs"),[`${o.PLUGIN_NAME}/no-decorative-comment-separators`]:["warn",{allowIn:Ut}]}}}function Ot(t){return {name:`${o.PLUGIN_NAME}/react`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{react:true}},rules:E("react")}}function It(t){return {base:w(t),recommended:xt(t),adonisjs:Rt(t),react:Ot(t),all:Et(t)}}var Lt="0.7.3";var fe={meta:{name:`eslint-plugin-${o.PLUGIN_NAME}`,version:Lt},rules:R,configs:{}};fe.configs=It(fe);var ea=fe;export{ea as default};//# sourceMappingURL=index.js.map
11
+ ${s}}`}var pe=class extends l{name="require-multiline-object";defaultOptions=[{maxKeys:o.OBJECTS.MAX_INLINE_KEYS,indent:o.OBJECTS.INDENT_WIDTH}];meta={type:"suggestion",fixable:"code",docs:{description:"Require an object literal with more than a few properties to span multiple lines.",recommended:true,category:"base"},schema:[{type:"object",properties:{maxKeys:{type:"integer",minimum:1},indent:{type:"integer",minimum:1}},additionalProperties:false}],messages:{shouldWrap:p({problem:"This object literal has {{count}} properties packed onto a single line.",why:"An object with more than {{max}} properties is easier to scan, diff, and edit when each property sits on its own line",fix:"Break it across multiple lines, one property per line with a trailing comma"})}};create(e,i){let n=i[0]?.maxKeys??o.OBJECTS.MAX_INLINE_KEYS,s=i[0]?.indent??o.OBJECTS.INDENT_WIDTH;return {ObjectExpression(r){if(r.properties.length<=n||r.loc.start.line!==r.loc.end.line)return;let a=e.sourceCode.getCommentsInside(r).length>0;e.report({node:r,messageId:"shouldWrap",data:{count:r.properties.length,max:n},fix:a?null:m=>m.replaceText(r,dt(e.sourceCode,r,s))});}}}},ft=new pe;var gt=120,ce=class extends l{name="max-classname-length";defaultOptions=[{max:gt}];meta={type:"suggestion",docs:{description:"Enforce a maximum length for a `className` class string.",recommended:true,category:"react"},schema:[{type:"object",properties:{max:{type:"integer",minimum:1}},additionalProperties:false}],messages:{tooLong:p({problem:"This `className` string is {{length}} characters, over the {{max}}-character limit.",why:"A long wall of Tailwind classes is hard to scan and diff, and it overflows the line",fix:"Break the classes across multiple lines, grouping related ones into separate `cn()` arguments"})}};create(e,i){let n=i[0]?.max??gt,s=(r,a)=>{if(r){if(r.type==="Literal"){typeof r.value=="string"&&a.push({node:r,text:r.value});return}if(r.type==="TemplateLiteral"){r.expressions.length===0&&a.push({node:r,text:r.quasis[0]?.value.cooked??""});return}for(let m of e.sourceCode.visitorKeys[r.type]??[]){let d=r[m],f=Array.isArray(d)?d:[d];for(let A of f){let I=A;!I||typeof I.type!="string"||o.FUNCTIONS.NODE_TYPES.has(I.type)||s(I,a);}}}};return {JSXAttribute(r){if(r.name.type!=="JSXIdentifier"||r.name.name!=="className"||r.value===null)return;let a=[];s(r.value,a);for(let{node:m,text:d}of a)d.length<=n||e.report({node:m,messageId:"tooLong",data:{length:d.length,max:n}});}}}},yt=new ce;var ue=class extends l{name="no-jsx-comments";defaultOptions=[];meta={type:"suggestion",docs:{description:"Disallow inline `{/* ... */}` comments inside JSX.",recommended:true,category:"react"},schema:[],messages:{jsxComment:p({problem:"This JSX holds an inline `{/* ... */}` comment.",why:"A comment labeling a JSX section is a sign it should be its own named component, JSX should read as structure, not carry prose markers",fix:"Extract the section into a named sub-component whose name says what the comment said, or drop the comment"})}};create(e){return {JSXExpressionContainer(i){i.expression.type==="JSXEmptyExpression"&&e.sourceCode.getCommentsInside(i).length!==0&&e.report({node:i,messageId:"jsxComment"});}}}},St=new ue;var me=class extends l{name="require-context-hook-destructure";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require the result of a context-consumer hook to be destructured.",recommended:true,category:"react"},schema:[],messages:{destructure:p({problem:"`{{hook}}` is bound whole instead of destructured.",why:"Destructuring at the call site names exactly what the caller uses and reads better than repeated `{{name}}.member` access",fix:"Destructure the members in use, e.g. `const { a, b } = {{hook}}()`"})}};create(e){return {VariableDeclarator(i){i.id.type!=="Identifier"||i.init?.type!=="CallExpression"||i.init.callee.type!=="Identifier"||!lt(i.init.callee.name)||e.report({node:i,messageId:"destructure",data:{hook:i.init.callee.name,name:i.id.name}});}}}},ht=new me;var de=class extends l{name="require-derived-usememo";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a derived value in a component or hook to be memoized with useMemo.",recommended:true,category:"react"},schema:[],messages:{useMemo:p({problem:"This derived value is computed inline on every render.",why:"A value derived through a call is recomputed each render and has nowhere to document itself, a useMemo makes it stable and gives it a JSDoc home",fix:"Wrap it in `useMemo(() => ..., [deps])` with a JSDoc describing the value, even for a one-liner"})}};create(e){return {VariableDeclarator(i){if(i.parent.type!=="VariableDeclaration"||i.parent.kind!=="const"||i.id.type!=="Identifier"||i.init===null)return;let n=$e(i);n===null||!pt(n,e.sourceCode.visitorKeys)||ut(i.init,e.sourceCode.visitorKeys)&&e.report({node:i,messageId:"useMemo"});}}}},Tt=new de;var fe=class extends l{name="require-hook-object-return";defaultOptions=[];meta={type:"suggestion",fixable:"code",docs:{description:"Require a custom hook to return an object rather than a bare function.",recommended:true,category:"react"},schema:[],messages:{wrapInObject:p({problem:"This hook returns a bare function instead of an object.",why:"Returning an object lets the hook expose new members later without changing every call site, a bare function locks its shape",fix:"Return the function inside an object, e.g. `return { handleThing }`"})}};create(e){let i=r=>{if(oe(r))return true;if(r.type!=="Identifier")return false;let m=ASTUtils.findVariable(e.sourceCode.getScope(r),r.name)?.defs.at(-1)?.node;return m?.type==="VariableDeclarator"&&oe(m.init)},n=r=>{e.report({node:r,messageId:"wrapInObject",fix:r.type==="Identifier"?a=>a.replaceText(r,`{ ${r.name} }`):void 0});},s=r=>{let a=b(r);if(!(a===void 0||!w(a))){if(r.type==="ArrowFunctionExpression"&&r.body.type!=="BlockStatement"){i(r.body)&&n(r.body);return}E(r.body,e.sourceCode.visitorKeys,m=>(m!==null&&i(m)&&n(m),false));}};return {FunctionDeclaration(r){s(r);},FunctionExpression(r){s(r);},ArrowFunctionExpression(r){s(r);}}}},bt=new fe;var ge=class extends l{name="require-memo-callback-jsdoc";defaultOptions=[];meta={type:"suggestion",docs:{description:"Require a JSDoc on a useMemo or useCallback (with an `@param` per useCallback parameter).",recommended:true,category:"react"},schema:[],messages:{missingJSDoc:p({problem:"This `{{hook}}` has no JSDoc.",why:"A memoized value or handler should document what it is, so its purpose is clear without reading the factory",fix:"Add a `/** ... */` JSDoc above the `const`"}),missingParam:p({problem:"This `useCallback`'s JSDoc documents fewer parameters than the callback takes.",why:"A callback is a function, so each parameter it takes should be documented like any other",fix:"Add an `@param` line for each parameter of the callback"})}};create(e){return {VariableDeclarator(i){if(i.init?.type!=="CallExpression"||i.init.callee.type!=="Identifier"||!o.REACT.MEMO_HOOKS.has(i.init.callee.name))return;let n=i.parent;if(n.parent?.type==="ExportNamedDeclaration"&&(n=n.parent),!y(e.sourceCode,n)){e.report({node:i.id,messageId:"missingJSDoc",data:{hook:i.init.callee.name}});return}if(i.init.callee.name!=="useCallback")return;let s=i.init.arguments[0];if(s?.type!=="ArrowFunctionExpression"&&s?.type!=="FunctionExpression"||s.params.length===0)return;(e.sourceCode.getCommentsBefore(n).at(-1)?.value.split(`
12
+ `)??[]).filter(m=>L(m)==="param").length<s.params.length&&e.report({node:i.id,messageId:"missingParam"});}}}},Et=new ge;var Ut=[Ee,ke,De,we,Me,ve,Pe,Ue,We,qe,Ve,Ge,Ye,Ze,Qe,et,tt,it,rt,nt,at,mt,ft,yt,St,ht,Tt,bt,Et],O=Object.fromEntries(Ut.map(t=>[t.name,t.toRuleModule()]));function x(t){let e={};for(let[i,n]of Object.entries(O))(n.meta.docs?.category??"base")===t&&(e[`${o.PLUGIN_NAME}/${i}`]="warn");return e}function xt(){let t={};for(let e of Object.keys(O))t[`${o.PLUGIN_NAME}/${e}`]="warn";return t}function Rt(t){return {name:`${o.PLUGIN_NAME}/all`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{adonisjs:true,react:true}},rules:xt()}}function M(t){return {name:`${o.PLUGIN_NAME}/base`,plugins:{[o.PLUGIN_NAME]:t},rules:x("base")}}function Ot(t){return {...M(t),name:`${o.PLUGIN_NAME}/recommended`}}var Bt=["**/start/routes.ts","**/start/routes/**/*.ts"];function It(t){return {name:`${o.PLUGIN_NAME}/adonisjs`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{adonisjs:true}},rules:{...x("adonisjs"),[`${o.PLUGIN_NAME}/no-decorative-comment-separators`]:["warn",{allowIn:Bt}]}}}function Lt(t){return {name:`${o.PLUGIN_NAME}/react`,plugins:{[o.PLUGIN_NAME]:t},settings:{[o.PLUGIN_NAME]:{react:true}},rules:x("react")}}function Ct(t){return {base:M(t),recommended:Ot(t),adonisjs:It(t),react:Lt(t),all:Rt(t)}}var Nt="0.7.5";var ye={meta:{name:`eslint-plugin-${o.PLUGIN_NAME}`,version:Nt},rules:O,configs:{}};ye.configs=Ct(ye);var ra=ye;export{ra as default};//# sourceMappingURL=index.js.map
13
13
  //# sourceMappingURL=index.js.map