eslint-plugin-zappie 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +18 -0
- package/dist/index.d.ts +42 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# eslint-plugin-zappie
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d9baf67: Add `no-offsite-navigation`, `no-global-indirection`, `no-document-write` and `no-remote-import`, and a `security` config that `zappie check` runs on every file. `no-eval`, `no-external-scripts` and `no-unsafe-html` catch more ways around them. The source map no longer copies the source text, which keeps the archive under its size budget.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 1ad2db2: Depends on minimatch 11.0.1 or later, which fixes a denial of service in glob pattern preprocessing (GHSA-g3hv-75wg-m249). The rules match file paths as before.
|
|
12
|
+
|
|
3
13
|
## 0.3.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -44,6 +44,24 @@ and `cacheable-menu-routes` also warn. `strict` makes every warning an error.
|
|
|
44
44
|
| `zappie/no-unlisted-fetch-dynamic` | Review computed request hosts. |
|
|
45
45
|
| `zappie/no-server-env-in-client` | Keep server environment values out of client bundles. |
|
|
46
46
|
| `zappie/cacheable-menu-routes` | Keep the session out of menu page loaders so caches can keep them. |
|
|
47
|
+
| `zappie/no-offsite-navigation` | Keep shoppers on the site unless they follow a link themselves. |
|
|
48
|
+
| `zappie/no-global-indirection` | Reach window, document and location by name. |
|
|
49
|
+
| `zappie/no-document-write` | Render markup with React, not `document.write`. |
|
|
50
|
+
| `zappie/no-remote-import` | Load code from the storefront bundle only. |
|
|
51
|
+
|
|
52
|
+
### Security rules
|
|
53
|
+
|
|
54
|
+
`zappie check` runs the security rules as errors on every source file outside
|
|
55
|
+
`build`, `dist` and `node_modules`, with only Zappie's `security` config. Your
|
|
56
|
+
`eslint.config.mjs`, its ignores and `eslint-disable` comments can't turn them
|
|
57
|
+
off. They are `no-offsite-navigation`, `no-global-indirection`,
|
|
58
|
+
`no-document-write`, `no-remote-import`, `no-eval`, `no-external-scripts`,
|
|
59
|
+
`no-unsafe-html` and `safe-external-links`.
|
|
60
|
+
|
|
61
|
+
Code may send the shopper to a path on the site, to a URL from `safeRedirect`
|
|
62
|
+
in `@zappie/sdk/redirect`, or to Zappie's checkout and accounts. Open a checkout
|
|
63
|
+
session with `redirectToCheckout` from `@zappie/sdk/redirect`. Link to
|
|
64
|
+
any other site with an `<a href>` the shopper clicks.
|
|
47
65
|
|
|
48
66
|
`recommended` also turns on the recommended `jsx-a11y` rules as the accessibility baseline. `zappie check` fails a project that turns any of them down.
|
|
49
67
|
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,11 @@ declare const noDirectApi: _typescript_eslint_utils_ts_eslint.RuleModule<Message
|
|
|
37
37
|
name: string;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
declare const
|
|
40
|
+
declare const noDocumentWrite: _typescript_eslint_utils_ts_eslint.RuleModule<"write", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
declare const noEval: TSESLint.RuleModule<"eval", [], unknown, TSESLint.RuleListener> & {
|
|
41
45
|
name: string;
|
|
42
46
|
};
|
|
43
47
|
|
|
@@ -45,6 +49,10 @@ declare const noExternalScripts: _typescript_eslint_utils_ts_eslint.RuleModule<"
|
|
|
45
49
|
name: string;
|
|
46
50
|
};
|
|
47
51
|
|
|
52
|
+
declare const noGlobalIndirection: _typescript_eslint_utils_ts_eslint.RuleModule<"computed" | "reflection", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
53
|
+
name: string;
|
|
54
|
+
};
|
|
55
|
+
|
|
48
56
|
declare const noLazyOverlay: _typescript_eslint_utils_ts_eslint.RuleModule<"lazy" | "suspense", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
49
57
|
name: string;
|
|
50
58
|
};
|
|
@@ -53,6 +61,15 @@ declare const noMoneyLiterals: _typescript_eslint_utils_ts_eslint.RuleModule<"ar
|
|
|
53
61
|
name: string;
|
|
54
62
|
};
|
|
55
63
|
|
|
64
|
+
type MessageId = "offsite" | "refresh" | "anchorClick";
|
|
65
|
+
declare const noOffsiteNavigation: _typescript_eslint_utils_ts_eslint.RuleModule<MessageId, [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
declare const noRemoteImport: TSESLint.RuleModule<"computed" | "remote", [], unknown, TSESLint.RuleListener> & {
|
|
70
|
+
name: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
56
73
|
declare const noServerEnvInClient: _typescript_eslint_utils_ts_eslint.RuleModule<"serverEnv", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
57
74
|
name: string;
|
|
58
75
|
};
|
|
@@ -91,6 +108,17 @@ declare const verifyMarkers: TSESLint.RuleModule<"marker", [], unknown, TSESLint
|
|
|
91
108
|
name: string;
|
|
92
109
|
};
|
|
93
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Origins outside the site that a storefront may send the shopper to. They match what @zappie/sdk trusts: its
|
|
113
|
+
* checkout origin check and the CSP form-action list. A test in @zappie/check compares them.
|
|
114
|
+
*/
|
|
115
|
+
declare const TRUSTED_NAVIGATION_ORIGINS: readonly ["https://checkout.zappie.ai", "https://checkout.stg.zappie.ai", "https://accounts.zappie.ai"];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The rules that stop code from running or leaving the site without review. zappie check runs them as errors on every
|
|
119
|
+
* source file, whatever the project's own ESLint config says.
|
|
120
|
+
*/
|
|
121
|
+
declare const SECURITY_RULES: readonly ["no-offsite-navigation", "no-global-indirection", "no-document-write", "no-remote-import", "no-eval", "no-external-scripts", "no-unsafe-html", "safe-external-links"];
|
|
94
122
|
type ZappieFlatConfig = Record<string, unknown>;
|
|
95
123
|
declare const plugin: {
|
|
96
124
|
meta: {
|
|
@@ -191,9 +219,21 @@ declare const plugin: {
|
|
|
191
219
|
}], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
192
220
|
name: string;
|
|
193
221
|
};
|
|
222
|
+
"no-offsite-navigation": _typescript_eslint_utils_ts_eslint.RuleModule<"offsite" | "refresh" | "anchorClick", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
223
|
+
name: string;
|
|
224
|
+
};
|
|
225
|
+
"no-global-indirection": _typescript_eslint_utils_ts_eslint.RuleModule<"computed" | "reflection", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
226
|
+
name: string;
|
|
227
|
+
};
|
|
228
|
+
"no-document-write": _typescript_eslint_utils_ts_eslint.RuleModule<"write", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
229
|
+
name: string;
|
|
230
|
+
};
|
|
231
|
+
"no-remote-import": _typescript_eslint_utils_ts_eslint.RuleModule<"computed" | "remote", [], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
|
|
232
|
+
name: string;
|
|
233
|
+
};
|
|
194
234
|
};
|
|
195
235
|
configs: Record<string, ZappieFlatConfig[]>;
|
|
196
236
|
};
|
|
197
237
|
|
|
198
|
-
export { cacheableMenuRoutes, cartViaSdk, checkoutViaSdk, plugin as default, imagePriority, itemLinkPrefetch, noCustomAuth, noDirectApi, noEval, noExternalScripts, noLazyOverlay, noMoneyLiterals, noServerEnvInClient, noTrackingScripts, noUnlistedFetch, noUnsafeHtml, overlayPrimitive, safeExternalLinks, useFormatMoney, verifyMarkers };
|
|
238
|
+
export { SECURITY_RULES, TRUSTED_NAVIGATION_ORIGINS, cacheableMenuRoutes, cartViaSdk, checkoutViaSdk, plugin as default, imagePriority, itemLinkPrefetch, noCustomAuth, noDirectApi, noDocumentWrite, noEval, noExternalScripts, noGlobalIndirection, noLazyOverlay, noMoneyLiterals, noOffsiteNavigation, noRemoteImport, noServerEnvInClient, noTrackingScripts, noUnlistedFetch, noUnsafeHtml, overlayPrimitive, safeExternalLinks, useFormatMoney, verifyMarkers };
|
|
199
239
|
export type { ZappieFlatConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import At from"@typescript-eslint/parser";import De from"eslint-plugin-jsx-a11y";import Ot from"eslint-plugin-react-hooks";import{minimatch as Be}from"minimatch";import{ESLintUtils as Je}from"@typescript-eslint/utils";var m=Je.RuleCreator(e=>`https://docs.zappie.ai/lint/${e}`);import{minimatch as _e}from"minimatch";var Ue=/(?:api|accounts|checkout|edge)\.zappie\.ai|\/storefront\/v1|\/customer\/graphql/i,Ve=/googletagmanager\.com|google-analytics\.com|connect\.facebook\.net|analytics\.tiktok\.com|static\.hotjar\.com|cdn\.segment\.com|plausible\.io|clarity\.ms/i,Q=/checkout\.paystack\.com|flutterwave|(?:^|\.)stripe\.com/i;function u(e){if(e?.type==="Literal"&&typeof e.value=="string")return e.value;if(e?.type==="TemplateLiteral")return e.quasis.map(t=>t.value.cooked??t.value.raw).join("")}function d(e){return!e.computed&&e.property.type==="Identifier"?e.property.name:u(e.property)}function h(e){return e.type==="TSAsExpression"||e.type==="TSTypeAssertion"||e.type==="TSNonNullExpression"?h(e.expression):e}function b(e,t,i){for(let r=e.getScope(t);r;r=r.upper){let c=r.set.get(i);if(c)return c}}function S(e,t){return e.attributes.find(i=>i.type==="JSXAttribute"&&i.name.type==="JSXIdentifier"&&i.name.name.toLowerCase()===t.toLowerCase())}function g(e){if(e?.value){if(e.value.type==="Literal")return typeof e.value.value=="string"?e.value.value:void 0;if(e.value.type==="JSXExpressionContainer")return u(e.value.expression)}}var N=e=>Ue.test(e),L=e=>Ve.test(e),Y=e=>e==="@zappie/sdk/internal"||e.startsWith("@zappie/sdk/internal/");function I(e,t){let i=e.replaceAll("\\","/");return t.some(r=>_e(i,r,{matchBase:!0}))}var F="{_index,index,home,menu,item,items,category,categories,catalogue,collection,collections,product,products}",M="{js,jsx,ts,tsx}",$e=[`**/app/root.${M}`,`**/app/routes/${F}.${M}`,`**/app/routes/${F}.*.${M}`,`**/app/routes/${F}/**/*.${M}`],qe=new Set(["loader","headers","middleware","unstable_middleware"]),He=new Set(["getCustomer","zappieFetch","getSession","requireCustomer","openSealedValue"]),ee=/session/i,Ke=new Set(["cookie","authorization"]),te=/\/_zappie\/(?:session|api\/)/,re=e=>e.parent?.type==="Program"||e.parent?.type==="ExportNamedDeclaration";function We(e){if(e.type==="FunctionDeclaration"&&re(e))return e.id?.name;if(e.type==="VariableDeclarator"&&e.id.type==="Identifier"&&re(e.parent))return e.id.name}function se(e,t){return b(e,t,t.name)?.defs[0]}function Ze(e,t){if(t.type==="MemberExpression")return d(t)==="headers";if(t.type!=="Identifier")return!1;if(t.name==="headers")return!0;let i=se(e,t);if(!i)return!1;let r=i.name;for(;r.parent?.type==="AssignmentPattern";)r=r.parent;return r.parent?.type==="Property"&&r.parent.value===r&&!r.parent.computed&&r.parent.key.type==="Identifier"&&r.parent.key.name==="headers"?!0:i.node.type==="VariableDeclarator"&&i.node.id===i.name&&i.node.init?.type==="MemberExpression"&&d(i.node.init)==="headers"}var Ge=e=>e?.type==="TSTypeReference"&&e.typeName.type==="Identifier"&&e.typeName.name.endsWith("SessionStore"),ie=e=>e?.type==="CallExpression"&&e.callee.type==="Identifier"&&/SessionStore$/.test(e.callee.name);function Qe(e,t){if(ie(t))return!0;if(t.type==="MemberExpression")return ee.test(d(t)??"");if(t.type!=="Identifier")return!1;if(ee.test(t.name))return!0;let i=se(e,t);if(!i)return!1;let r=i.name;return Ge(r.typeAnnotation?.typeAnnotation)||i.node.type==="VariableDeclarator"&&i.node.id===r&&ie(i.node.init)}function Ye(e){return e.callee.type==="Identifier"?e.callee.name:e.callee.type==="MemberExpression"?d(e.callee):void 0}var ne=m({name:"cacheable-menu-routes",meta:{type:"suggestion",docs:{description:"Keep the customer's session out of menu page loaders, so shared caches can keep those pages."},schema:[{type:"object",properties:{routes:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{sessionRead:"This menu page reads the customer's session on the server, so no shared cache can keep it. Show customer details in the browser with useCustomer() from @zappie/sdk/customer/react."}},defaultOptions:[{}],create(e,[t]){let i=e.filename.replaceAll("\\","/");if(!(t.routes??$e).some(a=>Be(i,a,{dot:!0})))return{};let r=a=>e.sourceCode.getAncestors(a).some(s=>qe.has(We(s)??"")),c=a=>{r(a)&&e.report({node:a,messageId:"sessionRead"})};return{CallExpression(a){let s=Ye(a);if(s&&He.has(s)){c(a);return}if(s!=="get"||a.callee.type!=="MemberExpression")return;let p=a.callee.object,n=u(a.arguments[0]??null)?.toLowerCase();(n!==void 0&&Ke.has(n)&&Ze(e.sourceCode,p)||Qe(e.sourceCode,p))&&c(a)},Literal(a){typeof a.value=="string"&&te.test(a.value)&&c(a)},TemplateLiteral(a){te.test(u(a)??"")&&c(a)}}}});var et=/^(cart|basket|bag)(Items|Lines|Count|Total)?$/i,tt=/cart|basket|bag/i;function D(e){if(e.type==="Identifier")return e.name;if(e.type==="MemberExpression"&&e.property.type==="Identifier")return e.property.name}function rt(e){return e.type==="Identifier"?e.name:e.type==="ArrayPattern"&&e.elements[0]?.type==="Identifier"?e.elements[0].name:void 0}function it(e){let t=D(e.callee)==="useReducer"?e.arguments[1]:e.arguments[0];return!!(t&&t.type!=="SpreadElement"&&(t.type==="ArrayExpression"||t.type==="Literal"&&typeof t.value=="number"))}var ae=m({name:"cart-via-sdk",meta:{type:"problem",docs:{description:"Keep your cart state in the SDK."},schema:[],messages:{cart:"Use useCart(), useCartLine() or the SDK client cart. Keep cart state and storage in the SDK."}},defaultOptions:[],create(e){return{CallExpression(t){let i=D(t.callee),r=t.arguments[0];["getItem","setItem","removeItem","open"].includes(i??"")&&r?.type==="Literal"&&typeof r.value=="string"&&tt.test(r.value)&&e.report({node:t,messageId:"cart"})},VariableDeclarator(t){if(t.init?.type!=="CallExpression")return;let i=rt(t.id),r=D(t.init.callee);i&&et.test(i)&&["useState","useReducer","createContext"].includes(r??"")&&it(t.init)&&e.report({node:t,messageId:"cart"}),i&&/cart/i.test(i)&&["create","createStore","atom"].includes(r??"")&&e.report({node:t,messageId:"cart"})}}}});var st=new Set(["cc-number","cc-exp","cc-csc","cc-name"]),oe=/card.?number|cvv|cvc|expiry/i;function nt(e){return e.startsWith("@paystack/")||e==="react-paystack"||e==="flutterwave-react-v3"||e.startsWith("@stripe/")}var pe=m({name:"checkout-via-sdk",meta:{type:"problem",docs:{description:"Open checkout through the Zappie SDK."},schema:[],messages:{checkout:"Use createCheckout().open() from @zappie/sdk/checkout. Let checkout collect payment details."}},defaultOptions:[],create(e){return{ImportDeclaration(t){nt(t.source.value)&&e.report({node:t.source,messageId:"checkout"})},JSXOpeningElement(t){let i=t.name.type==="JSXIdentifier"?t.name.name.toLowerCase():"",r=g(S(t,"autocomplete")),c=g(S(t,"name")),a=g(S(t,"id")),s=g(S(t,i==="iframe"?"src":"href")),p=i==="input"&&(r!==void 0&&st.has(r.toLowerCase())||c!==void 0&&oe.test(c)||a!==void 0&&oe.test(a)),n=(i==="iframe"||i==="a")&&s!==void 0&&Q.test(s);(p||n)&&e.report({node:t,messageId:"checkout"})}}}});function at(e){let t=e;for(;t?.parent;){let i=t.parent;if((i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression")&&i.parent?.type==="CallExpression"&&i.parent.callee.type==="MemberExpression"&&i.parent.callee.property.type==="Identifier"&&i.parent.callee.property.name==="map")return i;t=i}}function ot(e,t){let i=e.getText(t.parent);if(/\.slice\(\s*0\s*,\s*1\s*\)\.map/.test(i))return!0;let r=t.params[1];return r?.type!=="Identifier"?!1:new RegExp(`${r.name}\\s*(?:={2,3}\\s*0|<\\s*1)`).test(e.getText(t))}var ce=m({name:"image-priority",meta:{type:"problem",docs:{description:"Reserve priority for the first phone screen."},schema:[],messages:{mapped:"Remove priority from repeated images or limit it to the first.",routeLimit:"Keep no more than two priority images in a route."}},defaultOptions:[],create(e){let t=[];return{JSXOpeningElement(i){let r=S(i,"priority"),c=r?.value?.type==="JSXExpressionContainer"&&r.value.expression.type==="Literal"&&r.value.expression.value===!1;if(i.name.type!=="JSXIdentifier"||i.name.name!=="Image"||!r||c)return;t.push(i);let a=at(i);a&&!ot(e.sourceCode,a)&&e.report({node:r,messageId:"mapped"})},"Program:exit"(){if(/(?:^|\/)routes?\/[^/]+\.[jt]sx$/.test(e.filename.replaceAll("\\","/"))&&t.length>2)for(let i of t.slice(2))e.report({node:i,messageId:"routeLimit"})}}}});function pt(e){let t=e?.value?.type==="JSXExpressionContainer"?e.value.expression:void 0;if(t?.type==="CallExpression"&&t.callee.type==="Identifier"&&t.callee.name==="itemHref")return!0;let i=g(e);return i!==void 0&&/^\/item(?:\/|$)/.test(i)}var le=m({name:"item-link-prefetch",meta:{type:"problem",docs:{description:"Prefetch item routes before shoppers tap."},schema:[],messages:{prefetch:'Add prefetch="viewport" so this item route is ready to tap.'}},defaultOptions:[],create(e){let t=new Set;return{ImportDeclaration(i){if(["react-router","react-router-dom"].includes(i.source.value))for(let r of i.specifiers)r.type==="ImportSpecifier"&&r.imported.type==="Identifier"&&["Link","NavLink"].includes(r.imported.name)&&t.add(r.local.name)},JSXOpeningElement(i){i.name.type==="JSXIdentifier"&&t.has(i.name.name)&&pt(S(i,"to"))&&!S(i,"prefetch")&&e.report({node:i,messageId:"prefetch"})}}}});var ct=["**/*.server.*","**/server/**"],X=/otp|verify.?code|access.?token|refresh.?token|id.?token/i,me=new Set(["localStorage","sessionStorage"]),lt=new Set(["window","globalThis","self"]);function ue(e){return e.type==="Identifier"?me.has(e.name):e.type==="MemberExpression"&&!e.computed&&e.object.type==="Identifier"&<.has(e.object.name)&&e.property.type==="Identifier"&&me.has(e.property.name)}function mt(e){return!e.computed&&e.property.type==="Identifier"?e.property.name:u(e.property)}function ut(e){if(e==="jose"||e==="jsonwebtoken")return"server";if(e==="next-auth"||e.startsWith("next-auth/")||e.startsWith("@auth/")||e==="better-auth"||e.startsWith("better-auth/")||e==="lucia"||e.startsWith("@clerk/")||e==="firebase/auth"||e.startsWith("@supabase/auth-"))return"all"}var fe=m({name:"no-custom-auth",meta:{type:"problem",docs:{description:"Sign customers in through the Zappie SDK."},schema:[{type:"object",properties:{serverFiles:{type:"array",items:{type:"string"},uniqueItems:!0}},additionalProperties:!1}],messages:{auth:"Use createCustomer().signIn() from @zappie/sdk/customer to sign customers in."}},defaultOptions:[{}],create(e,[t]){let i=I(e.filename,t.serverFiles??ct);return{ImportDeclaration(r){let c=ut(r.source.value);(c==="all"||c==="server"&&!i)&&e.report({node:r.source,messageId:"auth"})},JSXOpeningElement(r){if(r.name.type!=="JSXIdentifier"||r.name.name.toLowerCase()!=="input")return;let c=g(S(r,"type")),a=g(S(r,"autocomplete"));(c?.toLowerCase()==="password"||a!==void 0&&["one-time-code","current-password","new-password"].includes(a.toLowerCase()))&&e.report({node:r,messageId:"auth"})},CallExpression(r){if(r.callee.type!=="MemberExpression"||!ue(r.callee.object))return;let c=r.arguments[0],a=c?.type==="Identifier"?c.name:u(c??null);a&&X.test(a)&&e.report({node:r,messageId:"auth"})},AssignmentExpression(r){if(r.left.type==="MemberExpression"&&ue(r.left.object)){let s=mt(r.left);s&&X.test(s)&&e.report({node:r,messageId:"auth"});return}let c=r.left.type==="MemberExpression"&&r.left.object.type==="Identifier"&&r.left.object.name==="document"&&r.left.property.type==="Identifier"&&r.left.property.name==="cookie",a=u(r.right);c&&a&&X.test(a)&&e.report({node:r,messageId:"auth"})}}}});function ft(e){return/checkout\.zappie\.ai|\/checkout(?:\/|$)/i.test(e)?"checkout":/accounts\.zappie\.ai|\/customer\/graphql/i.test(e)?"customer":/\/storefront\/v1/i.test(e)?"storefront":"direct"}var de=m({name:"no-direct-api",meta:{type:"problem",docs:{description:"Call Zappie through the SDK."},schema:[],messages:{direct:"Call the matching public @zappie/sdk client to reach this Zappie endpoint.",internal:"Use a public SDK entry. Only Zappie-owned packages can import @zappie/sdk/internal.",storefront:"Use createZappie(config).store or .menu to read storefront data.",checkout:"Use createCheckout().open() from @zappie/sdk/checkout.",customer:"Use createCustomer() from @zappie/sdk/customer."}},defaultOptions:[],create(e){let t=i=>{if(i.parent.type==="ImportDeclaration")return;let r=u(i);r&&N(r)&&e.report({node:i,messageId:ft(r)})};return{Literal:t,TemplateLiteral:t,ImportDeclaration(i){Y(i.source.value)&&e.report({node:i.source,messageId:"internal"})}}}});function J(e){if(e.type==="Identifier")return e.name;if(e.type==="SequenceExpression"){let t=e.expressions.at(-1);return t?J(t):void 0}if(e.type==="MemberExpression"&&e.object.type==="Identifier"&&["window","globalThis"].includes(e.object.name))return!e.computed&&e.property.type==="Identifier"?e.property.name:u(e.property)}var ye=m({name:"no-eval",meta:{type:"problem",docs:{description:"Do not execute strings as code."},schema:[],messages:{eval:"Remove code generated from a string. Ship executable code in the storefront bundle."}},defaultOptions:[],create(e){return{CallExpression(t){let i=J(t.callee);if(i==="eval"||i==="Function"){e.report({node:t,messageId:"eval"});return}["setTimeout","setInterval"].includes(i??"")&&u(t.arguments[0]??null)!==void 0&&e.report({node:t,messageId:"eval"})},NewExpression(t){J(t.callee)==="Function"&&e.report({node:t,messageId:"eval"})}}}});var Se=e=>!!(e&&/^(?:[a-z][a-z\d+.-]*:)?\/\//i.test(e)),dt=e=>e.type==="Identifier"&&e.name==="document"||e.type==="MemberExpression"&&e.object.type==="Identifier"&&["window","globalThis"].includes(e.object.name)&&(!e.computed&&e.property.type==="Identifier"&&e.property.name==="document"||u(e.property)==="document"),ge=m({name:"no-external-scripts",meta:{type:"problem",docs:{description:"Ship scripts in the storefront bundle."},schema:[],messages:{externalScript:"Remove the external script. Install reviewed code as a package so it ships in the storefront bundle."}},defaultOptions:[],create(e){return{JSXOpeningElement(t){if(t.name.type!=="JSXIdentifier")return;let i=t.name.name.toLowerCase();if(i==="script"){let s=S(t,"src"),p=g(s),n=s?.value?.type==="JSXExpressionContainer"&&!(s.value.expression.type==="Literal"||s.value.expression.type==="TemplateLiteral"&&s.value.expression.expressions.length===0);s&&(n||p===void 0||Se(p)&&!L(p))&&e.report({node:t,messageId:"externalScript"});return}if(i!=="link")return;let r=g(S(t,"rel"))?.toLowerCase(),c=g(S(t,"as"))?.toLowerCase(),a=g(S(t,"href"));(r==="preload"&&c==="script"||r==="modulepreload")&&Se(a)&&!L(a??"")&&e.report({node:t,messageId:"externalScript"})},CallExpression(t){if(t.callee.type==="MemberExpression"&&!t.callee.computed&&dt(t.callee.object)&&t.callee.property.type==="Identifier"&&t.callee.property.name==="createElement"&&u(t.arguments[0]??null)?.toLowerCase()==="script"){e.report({node:t,messageId:"externalScript"});return}t.callee.type==="MemberExpression"&&!t.callee.computed&&t.callee.object.type==="Identifier"&&t.callee.object.name==="React"&&t.callee.property.type==="Identifier"&&t.callee.property.name==="createElement"&&u(t.arguments[0]??null)?.toLowerCase()==="script"&&t.arguments[1]?.type==="ObjectExpression"&&t.arguments[1].properties.find(c=>c.type==="Property"&&(c.key.type==="Identifier"&&c.key.name==="src"||u(c.key)==="src"))&&e.report({node:t,messageId:"externalScript"})}}}});var yt=new Set(["react"]),St="React",Ee=m({name:"no-lazy-overlay",meta:{type:"problem",docs:{description:"Load overlays with deferred() from @zappie/foundations, not React.lazy or Suspense."},schema:[],messages:{lazy:"Load this component with deferred() from @zappie/foundations. React.lazy suspends, and React holds a suspended reveal back for about 300 ms, so the overlay opens late.",suspense:"Remove Suspense and load the component with deferred() from @zappie/foundations. It renders as soon as its code arrives and never suspends."}},defaultOptions:[],create(e){let t=new Set,i=new Set,r=new Set([St]),c=(a,s,p)=>a.type==="Identifier"&&r.has(a.name)&&s.type==="Identifier"&&s.name===p;return{ImportDeclaration(a){if(yt.has(a.source.value))for(let s of a.specifiers){if(s.type!=="ImportSpecifier"){r.add(s.local.name);continue}let p=s.imported.type==="Identifier"?s.imported.name:s.imported.value;p==="lazy"?t.add(s.local.name):p==="Suspense"&&i.add(s.local.name)}},CallExpression(a){let s=a.callee;(s.type==="Identifier"&&t.has(s.name)||s.type==="MemberExpression"&&!s.computed&&c(s.object,s.property,"lazy"))&&e.report({node:a,messageId:"lazy"})},JSXOpeningElement(a){let s=a.name;(s.type==="JSXIdentifier"&&i.has(s.name)||s.type==="JSXMemberExpression"&&s.object.type==="JSXIdentifier"&&r.has(s.object.name)&&s.property.name==="Suspense")&&e.report({node:a,messageId:"suspense"})}}}});import{ESLintUtils as gt}from"@typescript-eslint/utils";var Et=/[₦€£]\s?\d|\$\s?\d|NGN\s?\d|\d+(?:\.\d{2})?\s?(?:naira|NGN)/i;function R(e){return e.trim()!=="$1"&&Et.test(e)}function T(e){if(e.type==="MemberExpression"){if(!e.computed&&e.property.type==="Identifier")return e.property.name;if(e.computed&&e.property.type==="Literal")return typeof e.property.value=="string"?e.property.value:void 0}}var k=e=>T(e)==="amountMinor";function Tt(e){return e.type==="MemberExpression"&&k(e)?e.object:void 0}function x(e){if(!(e.type!=="BinaryExpression"||e.operator!=="/"||e.right.type!=="Literal"||e.right.value!==100))return Tt(e.left)}function z(e){try{return gt.getParserServices(e,!0)}catch{return}}function ht(e){return e.getName().includes("MoneyBrand")?(e.getDeclarations()??[]).some(t=>{let i=t.getSourceFile().fileName.replaceAll("\\","/");return i.endsWith("/packages/sdk/src/money.ts")||/\/node_modules\/@zappie\/sdk\/.*\.d\.ts$/.test(i)}):!1}function A(e,t){if(!e?.program)return!1;let i=e.program.getTypeChecker(),r=e.esTreeNodeToTSNodeMap.get(t),c=i.getTypeAtLocation(r);return(c.isUnionOrIntersection()?c.types:[c]).some(s=>s.getProperties().some(p=>ht(p)))}function O(e){return e?.type!=="ObjectExpression"?!1:e.properties.some(t=>t.type==="Property"&&!t.computed&&(t.key.type==="Identifier"&&t.key.name==="style"||t.key.type==="Literal"&&t.key.value==="style")&&t.value.type==="Literal"&&t.value.value==="currency")}var Te=m({name:"no-money-literals",meta:{type:"problem",docs:{description:"Use SDK prices and totals in your storefront."},schema:[],messages:{arithmetic:"Use cart.subtotal, line.lineSubtotal, quote.subtotal, quote.lines totals or quote.total. Let the SDK calculate amounts.",literal:"Render SDK Money with format.money() or <Money> instead of a hard-coded amount.",scale:"Use format.money() to display amountMinor. Currencies use 0, 2, 3 or 4 minor-unit digits."}},defaultOptions:[],create(e){let t=z(e),i=r=>k(r)||A(t,r);return{Literal(r){typeof r.value=="string"&&r.parent.type!=="ImportDeclaration"&&R(r.value)&&e.report({node:r,messageId:"literal"})},JSXText(r){R(r.value)&&e.report({node:r,messageId:"literal"})},BinaryExpression(r){["+","-","*","/"].includes(r.operator)&&(x(r)&&r.parent.type==="MemberExpression"&&r.parent.object===r&&T(r.parent)==="toFixed"||(i(r.left)||i(r.right))&&e.report({node:r,messageId:"arithmetic"}))},TemplateLiteral(r){for(let c of r.quasis)R(c.value.cooked??c.value.raw)&&e.report({node:c,messageId:"literal"})},CallExpression(r){r.callee.type==="MemberExpression"&&T(r.callee)==="toFixed"&&r.arguments[0]?.type==="Literal"&&r.arguments[0].value===2&&x(r.callee.object)&&e.report({node:r,messageId:"scale"})}}}});var bt=["**/*.server.{js,jsx,ts,tsx,mjs,cjs,mts,cts}","**/app/.server/**","**/app/server.ts","**/test/**","**/tests/**","**/__tests__/**","**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}","**/*.config.{js,ts,mjs,cjs,mts,cts}"],xt=new Set(["MODE","DEV","PROD","SSR","BASE_URL"]);function he(e){if(e.type==="FunctionDeclaration")return e.id?.name;if(e.type!=="FunctionExpression"&&e.type!=="ArrowFunctionExpression")return;let t=e.parent;if(t.type==="VariableDeclarator"&&t.id.type==="Identifier")return t.id.name;if(t.type==="Property")return t.key.type==="Identifier"?t.key.name:u(t.key)}function be(e){if(e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="process"&&d(e)==="env")return"process";if(e.type==="MemberExpression"&&e.object.type==="MetaProperty"&&e.object.meta.name==="import"&&e.object.property.name==="meta"&&d(e)==="env")return"vite"}function xe(e){return e.type!=="MemberExpression"||d(e)!=="cloudflare"?!1:e.object.type==="Identifier"&&e.object.name==="context"||e.object.type==="MemberExpression"&&d(e.object)==="context"}function ve(e,t,i=!1){return e==="process"?t!=="NODE_ENV"&&!(i&&t?.startsWith("NEXT_PUBLIC_ZAPPIE_")):t===void 0||!t.startsWith("VITE_ZAPPIE_")&&!xt.has(t)}var Ie=m({name:"no-server-env-in-client",meta:{type:"problem",docs:{description:"Read server environment values only in server code."},schema:[],messages:{serverEnv:"Move this environment read into a loader, action, *.server.ts file, app/.server/ or app/server.ts so it cannot reach the client bundle."}},defaultOptions:[],create(e){let t=e.filename.replaceAll("\\","/");if(I(t,bt)||/(?:^|\/)(?:test|tests|__tests__)(?:\/|$)/.test(t)||/\.(?:test|spec|config)\.[cm]?[jt]sx?$/.test(t))return{};let i=new Map,r=new Set,c=n=>e.sourceCode.getAncestors(n).some(o=>["loader","action"].includes(he(o)??"")),a=n=>{let o=be(n);return o||(n.type==="Identifier"?i.get(n.name):void 0)},s=n=>{if(n.type==="ObjectPattern")for(let o of n.properties)o.type==="Property"&&(o.key.type==="Identifier"&&o.key.name==="cloudflare"||u(o.key)==="cloudflare")&&o.value.type==="Identifier"&&r.add(o.value.name),o.type==="Property"&&(o.key.type==="Identifier"&&o.key.name==="context"||u(o.key)==="context")&&s(o.value)},p=n=>{if(!(c(n)||["loader","action"].includes(he(n)??"")))for(let o of n.params)o.type!=="RestElement"&&s(o)};return{ArrowFunctionExpression:p,FunctionDeclaration:p,FunctionExpression:p,VariableDeclarator(n){if(c(n)||!n.init)return;let o=a(n.init);if(n.id.type==="Identifier"&&o){i.set(n.id.name,o);return}if(n.id.type==="ObjectPattern"&&o){for(let l of n.id.properties){let y=l.type==="Property"?l.key.type==="Identifier"?l.key.name:u(l.key):void 0;ve(o,y)&&e.report({node:l,messageId:"serverEnv"})}return}if(n.id.type==="ObjectPattern"&&xe(n.init))for(let l of n.id.properties)l.type==="Property"&&(l.key.type==="Identifier"&&l.key.name==="env"||u(l.key)==="env")&&e.report({node:l,messageId:"serverEnv"})},MemberExpression(n){if(c(n))return;let o=a(n.object);if(o&&ve(o,d(n),be(n.object)===o)){e.report({node:n,messageId:"serverEnv"});return}d(n)==="env"&&(xe(n.object)||n.object.type==="Identifier"&&r.has(n.object.name))&&e.report({node:n,messageId:"serverEnv"})}}}});var vt=["react-ga4","react-facebook-pixel","@vercel/analytics","posthog-js"];function It(e){return vt.includes(e)||e.startsWith("@segment/")}var ke=m({name:"no-tracking-scripts",meta:{type:"problem",docs:{description:"Forward analytics through Zappie."},schema:[],messages:{tracking:"Configure analytics.forward in zappie.config.ts to forward analytics. Remove the tracking script."}},defaultOptions:[],create(e){let t=i=>{if(i.parent.type==="ImportDeclaration")return;let r=u(i);r&&L(r)&&e.report({node:i,messageId:"tracking"})};return{Literal:t,TemplateLiteral:t,ImportDeclaration(i){It(i.source.value)&&e.report({node:i.source,messageId:"tracking"})},CallExpression(i){let r=i.callee,c=r.type==="Identifier"&&["gtag","fbq"].includes(r.name),a=r.type==="MemberExpression"&&!r.computed&&r.object.type==="Identifier"&&r.object.name==="dataLayer"&&r.property.type==="Identifier"&&r.property.name==="push";(c||a)&&e.report({node:i,messageId:"tracking"})}}}});function je(e){let t=u(e??null);if(t!==void 0)return t;if(e?.type==="NewExpression"&&e.callee.type==="Identifier"&&e.callee.name==="URL")return je(e.arguments[0])}function kt(e){if(!(!/^(?:https?|wss?):\/\//i.test(e)&&!e.startsWith("//")))try{return new URL(e,"https://storefront.invalid").hostname.toLowerCase()}catch{return}}function jt(e,t){return t.some(i=>{let r=i.toLowerCase();return r.startsWith("*.")?e.endsWith(r.slice(1))&&e!==r.slice(2):e===r})}var C=m({name:"no-unlisted-fetch",meta:{type:"problem",docs:{description:"List every external request host in outbound.allow."},schema:[{type:"object",properties:{dynamicOnly:{type:"boolean"}},additionalProperties:!1}],messages:{dynamicRequest:"This request URL is computed. Review its possible hosts and list each external host in zappie.config.ts outbound.allow.",unlistedRequest:"Add {{host}} to zappie.config.ts outbound.allow, or remove this external request."}},defaultOptions:[{}],create(e,[t]){let i=e.filename.replaceAll("\\","/");if(I(i,["**/test/**","**/tests/**","**/__tests__/**","**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"])||/(?:^|\/)(?:test|tests|__tests__)(?:\/|$)/.test(i)||/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(i))return{};let r=e.settings?.zappie?.outboundAllow,c=Array.isArray(r)?r.filter(p=>typeof p=="string"):[],a=new Set,s=(p,n)=>{let o=je(n);if(o===void 0){t.dynamicOnly&&e.report({node:p,messageId:"dynamicRequest"});return}if(t.dynamicOnly)return;let l=kt(o);!l||N(o)||jt(l,c)||e.report({node:p,messageId:"unlistedRequest",data:{host:l}})};return{VariableDeclarator(p){p.id.type==="Identifier"&&p.init?.type==="NewExpression"&&p.init.callee.type==="Identifier"&&p.init.callee.name==="XMLHttpRequest"&&a.add(p.id.name)},CallExpression(p){if(p.callee.type==="Identifier"&&p.callee.name==="fetch"||p.callee.type==="MemberExpression"&&d(p.callee)==="fetch"&&p.callee.object.type==="Identifier"&&["window","globalThis"].includes(p.callee.object.name)){s(p,p.arguments[0]);return}if(p.callee.type!=="MemberExpression")return;let o=d(p.callee);if(o==="sendBeacon"&&p.callee.object.type==="Identifier"&&p.callee.object.name==="navigator"){s(p,p.arguments[0]);return}o==="open"&&(p.callee.object.type==="Identifier"&&a.has(p.callee.object.name)||p.callee.object.type==="NewExpression"&&p.callee.object.callee.type==="Identifier"&&p.callee.object.callee.name==="XMLHttpRequest")&&s(p,p.arguments[1])},NewExpression(p){p.callee.type==="Identifier"&&["WebSocket","EventSource"].includes(p.callee.name)&&s(p,p.arguments[0])}}}}),we={...C,meta:{...C.meta,docs:{...C.meta.docs,url:"https://docs.zappie.ai/lint/no-unlisted-fetch-dynamic"}}};function wt(e){return e.properties.find(t=>t.type==="Property"&&!t.computed&&(t.key.type==="Identifier"&&t.key.name==="__html"||u(t.key)==="__html"))?.value}var Le=m({name:"no-unsafe-html",meta:{type:"problem",docs:{description:"Sanitize rich text before inserting HTML."},schema:[],messages:{unsafeHtml:"Pass the HTML straight through a sanitizer created with createSanitizeRichText from @zappie/foundations/rich-text."}},defaultOptions:[],create(e){let t=e.sourceCode,i=s=>!!b(t,s,s.name)?.defs.some(n=>n.type==="ImportBinding"&&n.node.type==="ImportSpecifier"&&n.node.imported.type==="Identifier"&&n.node.imported.name==="createSanitizeRichText"&&n.parent?.type==="ImportDeclaration"&&n.parent.source.value==="@zappie/foundations/rich-text"),r=s=>!!b(t,s,s.name)?.defs.some(n=>{if(n.type!=="Variable"||n.node.type!=="VariableDeclarator")return!1;let o=n.node.init;return o?.type==="CallExpression"&&o.callee.type==="Identifier"&&i(o.callee)}),c=(s,p=new Set)=>{if(!s||s.type==="SpreadElement")return!1;let n=h(s);if(n.type==="Literal")return n.value==="";if(n.type==="ConditionalExpression")return c(n.consequent,p)&&c(n.alternate,p);if(n.type==="LogicalExpression")return c(n.left,p)&&c(n.right,p);if(n.type==="CallExpression")return n.callee.type==="Identifier"&&r(n.callee)?!0:n.callee.type==="CallExpression"&&n.callee.callee.type==="Identifier"&&i(n.callee.callee);if(n.type!=="Identifier")return!1;let o=b(t,n,n.name);if(!o||p.has(o))return!1;let l=new Set(p).add(o);for(let y of o.defs){if(y.type!=="Variable"||y.node.type!=="VariableDeclarator")continue;if(y.node.id.type==="Identifier")return c(y.node.init,l);if(y.node.id.type!=="ArrayPattern"||y.node.id.elements[0]?.type!=="Identifier"||y.node.id.elements[0].name!==n.name||y.node.init?.type!=="CallExpression"||y.node.init.callee.type!=="Identifier"||y.node.init.callee.name!=="useState")continue;let E=y.node.init.arguments[0],f=y.node.id.elements[1];if(!c(E,l)||f?.type!=="Identifier")return!1;let Z=b(t,f,f.name)?.references.filter(w=>w.identifier.parent.type==="CallExpression"&&w.identifier.parent.callee===w.identifier)??[];return Z.length>0&&Z.every(w=>{let G=w.identifier.parent;return G.type==="CallExpression"&&c(G.arguments[0],l)})}return!1},a=(s,p)=>{(p?.type!=="ObjectExpression"||!c(wt(p)))&&e.report({node:s,messageId:"unsafeHtml"})};return{JSXAttribute(s){if(s.name.type!=="JSXIdentifier")return;let p=s.name.name.toLowerCase();!["dangerouslysetinnerhtml","srcdoc"].includes(p)||s.value?.type!=="JSXExpressionContainer"||(p==="dangerouslysetinnerhtml"?a(s,s.value.expression):c(s.value.expression)||e.report({node:s,messageId:"unsafeHtml"}))},JSXSpreadAttribute(s){if(s.argument.type!=="ObjectExpression")return;let p=s.argument.properties.find(n=>n.type==="Property"&&(n.key.type==="Identifier"&&n.key.name==="dangerouslySetInnerHTML"||u(n.key)==="dangerouslySetInnerHTML"));p&&a(s,p.value)},JSXElement(s){if(s.openingElement.name.type==="JSXIdentifier"&&s.openingElement.name.name.toLowerCase()==="script")for(let p of s.children)p.type==="JSXExpressionContainer"&&p.expression.type!=="JSXEmptyExpression"&&e.report({node:p,messageId:"unsafeHtml"})},AssignmentExpression(s){s.left.type==="MemberExpression"&&["innerHTML","outerHTML"].includes(d(s.left)??"")&&!c(s.right)&&e.report({node:s,messageId:"unsafeHtml"})},CallExpression(s){if(s.callee.type==="MemberExpression"&&d(s.callee)==="insertAdjacentHTML"){c(s.arguments[1])||e.report({node:s,messageId:"unsafeHtml"});return}if(!(s.callee.type==="Identifier"&&s.callee.name==="createElement"||s.callee.type==="MemberExpression"&&d(s.callee)==="createElement"&&s.callee.object.type==="Identifier"&&s.callee.object.name==="React"))return;if(u(s.arguments[0]??null)?.toLowerCase()==="script")for(let l of s.arguments.slice(2))l.type!=="SpreadElement"&&e.report({node:l,messageId:"unsafeHtml"});let n=s.arguments[1];if(n?.type!=="ObjectExpression")return;let o=n.properties.find(l=>l.type==="Property"&&(l.key.type==="Identifier"&&l.key.name==="dangerouslySetInnerHTML"||u(l.key)==="dangerouslySetInnerHTML"));o&&a(s,o.value)}}}});var Lt=["modal","sheet","drawer","dialog","item","cart","cart_sheet","cart_edit","cart_clear","search","catalogue_search","catalogue_categories","product_note","modal_id"];function _(e){if(e.type==="Identifier")return e.name;if(e.type==="MemberExpression"&&e.property.type==="Identifier")return e.property.name}function Ce(e,t){return e.type==="Literal"&&typeof e.value=="string"?[...t].some(i=>new RegExp(`[?&]${i}=`).test(e.value)):e.type==="TemplateLiteral"?e.quasis.some(i=>Ce({...i,type:"Literal",value:i.value.raw},t)):e.type==="ObjectExpression"?e.properties.some(i=>i.type==="Property"&&(i.key.type==="Identifier"&&t.has(i.key.name)||i.key.type==="Literal"&&typeof i.key.value=="string"&&t.has(i.key.value))):!1}var Ne=m({name:"overlay-primitive",meta:{type:"problem",docs:{description:"Use Overlay to keep dialogs and sheets in the URL."},schema:[{type:"object",properties:{keys:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{overlay:"Use Overlay or useOverlay for dialogs and sheets in the URL. They handle Back, Forward and focus restoration."}},defaultOptions:[{}],create(e,[t]){let i=new Set([...Lt,...t.keys??[]]),r=new Set,c=a=>{let s=e.sourceCode.getText(a);return s.includes("useSearchParams(")||[...r].some(p=>new RegExp(`\\b${p}\\b`).test(s))};return{VariableDeclarator(a){a.init?.type==="CallExpression"&&_(a.init.callee)==="useSearchParams"?a.id.type==="Identifier"?r.add(a.id.name):a.id.type==="ArrayPattern"&&a.id.elements[0]?.type==="Identifier"&&r.add(a.id.elements[0].name):a.id.type==="Identifier"&&a.init&&c(a.init)&&r.add(a.id.name)},CallExpression(a){let s=_(a.callee);(s==="setSearchParams"||s==="navigate"||s==="pushState"||s==="replaceState"||a.callee.type==="CallExpression"&&_(a.callee.callee)==="useNavigate")&&a.arguments.some(n=>n.type!=="SpreadElement"&&Ce(n,i))&&e.report({node:a,messageId:"overlay"})},JSXOpeningElement(a){let s=a.name.type==="JSXIdentifier"&&a.name.name==="dialog",p=a.attributes.some(o=>o.type==="JSXAttribute"&&o.name.name==="role"&&o.value?.type==="Literal"&&o.value.value==="dialog"),n=a.attributes.find(o=>o.type==="JSXAttribute"&&o.name.name==="open");(s||p)&&n?.type==="JSXAttribute"&&n.value?.type==="JSXExpressionContainer"&&c(n.value.expression)&&e.report({node:a,messageId:"overlay"})}}}});function Ct(e){return e.callee.type==="Identifier"?e.callee.name:e.callee.type==="MemberExpression"?d(e.callee):void 0}function j(e){return!e||e.type==="JSXEmptyExpression"?!1:e.type==="TSAsExpression"||e.type==="TSTypeAssertion"||e.type==="TSNonNullExpression"?j(e.expression):e.type==="ConditionalExpression"?j(e.consequent)||j(e.alternate):e.type==="LogicalExpression"?j(e.left)||j(e.right):u(e)?.toLowerCase()==="_blank"}var Me=m({name:"safe-external-links",meta:{type:"problem",docs:{description:"Open links and redirects without exposing the site."},fixable:"code",schema:[],messages:{javascriptUrl:"Remove the javascript: URL. Use an event handler for storefront behavior.",noopener:'Add rel="noopener noreferrer" when target="_blank" opens a new tab.',redirect:"Pass this redirect target through safeRedirect(to, fallback) from @zappie/sdk/redirect."}},defaultOptions:[],create(e){let t=e.sourceCode,i=new Set,r=new Set,c=n=>!!b(t,n,n.name)?.defs.some(l=>l.type==="ImportBinding"&&l.node.type==="ImportSpecifier"&&l.node.imported.type==="Identifier"&&l.node.imported.name==="safeRedirect"&&l.parent?.type==="ImportDeclaration"&&l.parent.source.value==="@zappie/sdk/redirect"),a=n=>{if(!n||n.type==="SpreadElement")return!1;let o=h(n);return o.type==="Identifier"?i.has(o.name)&&!r.has(o.name):o.type==="MemberExpression"?o.object.type==="Identifier"&&o.object.name==="request"&&d(o)==="url"?!0:a(o.object):o.type==="CallExpression"?o.callee.type==="Identifier"&&c(o.callee)?!1:o.callee.type==="Identifier"&&o.callee.name==="safeRedirect"?o.arguments.some(a):!!(o.callee.type==="MemberExpression"&&d(o.callee)==="get"&&(o.callee.object.type==="MemberExpression"&&d(o.callee.object)==="searchParams"||o.callee.object.type==="Identifier"&&/searchParams/i.test(o.callee.object.name)||a(o.callee.object))):o.type==="NewExpression"?o.callee.type==="Identifier"&&o.callee.name==="URL"&&o.arguments.some(a):o.type==="ConditionalExpression"?a(o.consequent)||a(o.alternate):o.type==="LogicalExpression"?a(o.left)||a(o.right):o.type==="BinaryExpression"?a(o.left):o.type==="TemplateLiteral"?o.expressions.some(a):!1},s=(n,o)=>{if(o.type!=="Identifier")return!1;let l=E=>{let f=h(E);return f.type==="MemberExpression"&&d(f)==="origin"&&f.object.type==="Identifier"&&f.object.name===o.name},y=E=>{let f=h(E);return f.type==="MemberExpression"&&d(f)==="origin"&&(f.object.type==="Identifier"&&f.object.name==="location"||a(f.object))};return t.getAncestors(n).some(E=>{if(E.type!=="IfStatement"||!t.getAncestors(n).includes(E.consequent))return!1;let f=h(E.test);return f.type==="BinaryExpression"&&(f.operator==="==="||f.operator==="==")&&(l(f.left)&&y(f.right)||y(f.left)&&l(f.right))})};return{VariableDeclarator(n){n.id.type!=="Identifier"||!n.init||(n.init.type==="CallExpression"&&n.init.callee.type==="Identifier"&&c(n.init.callee)?r.add(n.id.name):a(n.init)&&i.add(n.id.name))},JSXOpeningElement(n){for(let f of["href","src","action","formAction"]){let v=g(S(n,f));/^javascript:/i.test((v??"").replace(/[\u0000-\u0020\u007f\s]/gu,""))&&e.report({node:S(n,f)??n,messageId:"javascriptUrl"})}let o=S(n,"target"),l=o?.value?.type==="JSXExpressionContainer"?o.value.expression:o?.value;if(!j(l))return;let y=S(n,"rel"),E=g(y);E?.toLowerCase().split(/\s+/).includes("noopener")||e.report({node:n,messageId:"noopener",fix(f){if(!y)return f.insertTextAfter(n.name,' rel="noopener noreferrer"');if(!y.value||y.value.type!=="Literal")return null;let v=new Set((E??"").split(/\s+/).filter(Boolean));return v.add("noopener"),v.add("noreferrer"),f.replaceText(y,`rel="${[...v].join(" ")}"`)}})},CallExpression:n=>{let o=Ct(n);if(!["redirect","navigate","assign","replace"].includes(o??""))return;let l=n.arguments[0];l&&l.type!=="SpreadElement"&&a(l)&&!s(n,h(l))&&e.report({node:l,messageId:"redirect"})},AssignmentExpression(n){n.left.type==="MemberExpression"&&d(n.left)==="href"&&(n.left.object.type==="Identifier"&&n.left.object.name==="location"||n.left.object.type==="MemberExpression"&&d(n.left.object)==="location")&&a(n.right)&&e.report({node:n.right,messageId:"redirect"})}}}});function U(e){return e.body.find(t=>t.type==="ImportDeclaration"&&t.source.value==="@zappie/sdk")}function V(e){return e?.specifiers.find(t=>t.type==="ImportSpecifier"&&t.imported.type==="Identifier"&&t.imported.name==="format")}function Nt(e,t,i,r){let c=U(i);if(V(c)?.local.name===r)return;let a=r==="format"?"format":`format as ${r}`,s=c?.specifiers.filter(o=>o.type==="ImportSpecifier");if(c&&c.importKind!=="type"&&s?.length){let o=s.at(-1);if(o)return e.insertTextAfter(o,`, ${a}`)}let p=i.body[0],n=`import { ${a} } from "@zappie/sdk";
|
|
2
|
-
`;return p?e.insertTextBefore(p,
|
|
1
|
+
import st from"@typescript-eslint/parser";import nt from"eslint-plugin-jsx-a11y";import or from"eslint-plugin-react-hooks";import{minimatch as mt}from"minimatch";import{ESLintUtils as ot}from"@typescript-eslint/utils";var y=ot.RuleCreator(e=>`https://docs.zappie.ai/lint/${e}`);import{minimatch as pt}from"minimatch";var ct=/(?:api|accounts|checkout|edge)\.zappie\.ai|\/storefront\/v1|\/customer\/graphql/i,lt=/googletagmanager\.com|google-analytics\.com|connect\.facebook\.net|analytics\.tiktok\.com|static\.hotjar\.com|cdn\.segment\.com|plausible\.io|clarity\.ms/i,pe=/checkout\.paystack\.com|flutterwave|(?:^|\.)stripe\.com/i;function S(e){if(e?.type==="Literal"&&typeof e.value=="string")return e.value;if(e?.type==="TemplateLiteral")return e.quasis.map(t=>t.value.cooked??t.value.raw).join("")}function u(e){return!e.computed&&e.property.type==="Identifier"?e.property.name:S(e.property)}function E(e){return e.type==="TSAsExpression"||e.type==="TSTypeAssertion"||e.type==="TSNonNullExpression"?E(e.expression):e}function T(e,t,i){for(let r=e.getScope(t);r;r=r.upper){let n=r.set.get(i);if(n)return n}}function g(e,t){return e.attributes.find(i=>i.type==="JSXAttribute"&&i.name.type==="JSXIdentifier"&&i.name.name.toLowerCase()===t.toLowerCase())}function h(e){if(e?.value){if(e.value.type==="Literal")return typeof e.value.value=="string"?e.value.value:void 0;if(e.value.type==="JSXExpressionContainer")return S(e.value.expression)}}var D=e=>ct.test(e),O=e=>lt.test(e),ce=e=>e==="@zappie/sdk/internal"||e.startsWith("@zappie/sdk/internal/");function C(e,t){let i=e.replaceAll("\\","/");return t.some(r=>pt(i,r,{matchBase:!0}))}var q="{_index,index,home,menu,item,items,category,categories,catalogue,collection,collections,product,products}",F="{js,jsx,ts,tsx}",ut=[`**/app/root.${F}`,`**/app/routes/${q}.${F}`,`**/app/routes/${q}.*.${F}`,`**/app/routes/${q}/**/*.${F}`],ft=new Set(["loader","headers","middleware","unstable_middleware"]),dt=new Set(["getCustomer","zappieFetch","getSession","requireCustomer","openSealedValue"]),le=/session/i,yt=new Set(["cookie","authorization"]),me=/\/_zappie\/(?:session|api\/)/,ue=e=>e.parent?.type==="Program"||e.parent?.type==="ExportNamedDeclaration";function St(e){if(e.type==="FunctionDeclaration"&&ue(e))return e.id?.name;if(e.type==="VariableDeclarator"&&e.id.type==="Identifier"&&ue(e.parent))return e.id.name}function de(e,t){return T(e,t,t.name)?.defs[0]}function gt(e,t){if(t.type==="MemberExpression")return u(t)==="headers";if(t.type!=="Identifier")return!1;if(t.name==="headers")return!0;let i=de(e,t);if(!i)return!1;let r=i.name;for(;r.parent?.type==="AssignmentPattern";)r=r.parent;return r.parent?.type==="Property"&&r.parent.value===r&&!r.parent.computed&&r.parent.key.type==="Identifier"&&r.parent.key.name==="headers"?!0:i.node.type==="VariableDeclarator"&&i.node.id===i.name&&i.node.init?.type==="MemberExpression"&&u(i.node.init)==="headers"}var Et=e=>e?.type==="TSTypeReference"&&e.typeName.type==="Identifier"&&e.typeName.name.endsWith("SessionStore"),fe=e=>e?.type==="CallExpression"&&e.callee.type==="Identifier"&&/SessionStore$/.test(e.callee.name);function ht(e,t){if(fe(t))return!0;if(t.type==="MemberExpression")return le.test(u(t)??"");if(t.type!=="Identifier")return!1;if(le.test(t.name))return!0;let i=de(e,t);if(!i)return!1;let r=i.name;return Et(r.typeAnnotation?.typeAnnotation)||i.node.type==="VariableDeclarator"&&i.node.id===r&&fe(i.node.init)}function Tt(e){return e.callee.type==="Identifier"?e.callee.name:e.callee.type==="MemberExpression"?u(e.callee):void 0}var ye=y({name:"cacheable-menu-routes",meta:{type:"suggestion",docs:{description:"Keep the customer's session out of menu page loaders, so shared caches can keep those pages."},schema:[{type:"object",properties:{routes:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{sessionRead:"This menu page reads the customer's session on the server, so no shared cache can keep it. Show customer details in the browser with useCustomer() from @zappie/sdk/customer/react."}},defaultOptions:[{}],create(e,[t]){let i=e.filename.replaceAll("\\","/");if(!(t.routes??ut).some(o=>mt(i,o,{dot:!0})))return{};let r=o=>e.sourceCode.getAncestors(o).some(s=>ft.has(St(s)??"")),n=o=>{r(o)&&e.report({node:o,messageId:"sessionRead"})};return{CallExpression(o){let s=Tt(o);if(s&&dt.has(s)){n(o);return}if(s!=="get"||o.callee.type!=="MemberExpression")return;let p=o.callee.object,a=S(o.arguments[0]??null)?.toLowerCase();(a!==void 0&&yt.has(a)&>(e.sourceCode,p)||ht(e.sourceCode,p))&&n(o)},Literal(o){typeof o.value=="string"&&me.test(o.value)&&n(o)},TemplateLiteral(o){me.test(S(o)??"")&&n(o)}}}});var bt=/^(cart|basket|bag)(Items|Lines|Count|Total)?$/i,xt=/cart|basket|bag/i;function B(e){if(e.type==="Identifier")return e.name;if(e.type==="MemberExpression"&&e.property.type==="Identifier")return e.property.name}function vt(e){return e.type==="Identifier"?e.name:e.type==="ArrayPattern"&&e.elements[0]?.type==="Identifier"?e.elements[0].name:void 0}function It(e){let t=B(e.callee)==="useReducer"?e.arguments[1]:e.arguments[0];return!!(t&&t.type!=="SpreadElement"&&(t.type==="ArrayExpression"||t.type==="Literal"&&typeof t.value=="number"))}var Se=y({name:"cart-via-sdk",meta:{type:"problem",docs:{description:"Keep your cart state in the SDK."},schema:[],messages:{cart:"Use useCart(), useCartLine() or the SDK client cart. Keep cart state and storage in the SDK."}},defaultOptions:[],create(e){return{CallExpression(t){let i=B(t.callee),r=t.arguments[0];["getItem","setItem","removeItem","open"].includes(i??"")&&r?.type==="Literal"&&typeof r.value=="string"&&xt.test(r.value)&&e.report({node:t,messageId:"cart"})},VariableDeclarator(t){if(t.init?.type!=="CallExpression")return;let i=vt(t.id),r=B(t.init.callee);i&&bt.test(i)&&["useState","useReducer","createContext"].includes(r??"")&&It(t.init)&&e.report({node:t,messageId:"cart"}),i&&/cart/i.test(i)&&["create","createStore","atom"].includes(r??"")&&e.report({node:t,messageId:"cart"})}}}});var kt=new Set(["cc-number","cc-exp","cc-csc","cc-name"]),ge=/card.?number|cvv|cvc|expiry/i;function wt(e){return e.startsWith("@paystack/")||e==="react-paystack"||e==="flutterwave-react-v3"||e.startsWith("@stripe/")}var Ee=y({name:"checkout-via-sdk",meta:{type:"problem",docs:{description:"Open checkout through the Zappie SDK."},schema:[],messages:{checkout:"Use createCheckout().open() from @zappie/sdk/checkout. Let checkout collect payment details."}},defaultOptions:[],create(e){return{ImportDeclaration(t){wt(t.source.value)&&e.report({node:t.source,messageId:"checkout"})},JSXOpeningElement(t){let i=t.name.type==="JSXIdentifier"?t.name.name.toLowerCase():"",r=h(g(t,"autocomplete")),n=h(g(t,"name")),o=h(g(t,"id")),s=h(g(t,i==="iframe"?"src":"href")),p=i==="input"&&(r!==void 0&&kt.has(r.toLowerCase())||n!==void 0&&ge.test(n)||o!==void 0&&ge.test(o)),a=(i==="iframe"||i==="a")&&s!==void 0&&pe.test(s);(p||a)&&e.report({node:t,messageId:"checkout"})}}}});function jt(e){let t=e;for(;t?.parent;){let i=t.parent;if((i.type==="ArrowFunctionExpression"||i.type==="FunctionExpression")&&i.parent?.type==="CallExpression"&&i.parent.callee.type==="MemberExpression"&&i.parent.callee.property.type==="Identifier"&&i.parent.callee.property.name==="map")return i;t=i}}function Ct(e,t){let i=e.getText(t.parent);if(/\.slice\(\s*0\s*,\s*1\s*\)\.map/.test(i))return!0;let r=t.params[1];return r?.type!=="Identifier"?!1:new RegExp(`${r.name}\\s*(?:={2,3}\\s*0|<\\s*1)`).test(e.getText(t))}var he=y({name:"image-priority",meta:{type:"problem",docs:{description:"Reserve priority for the first phone screen."},schema:[],messages:{mapped:"Remove priority from repeated images or limit it to the first.",routeLimit:"Keep no more than two priority images in a route."}},defaultOptions:[],create(e){let t=[];return{JSXOpeningElement(i){let r=g(i,"priority"),n=r?.value?.type==="JSXExpressionContainer"&&r.value.expression.type==="Literal"&&r.value.expression.value===!1;if(i.name.type!=="JSXIdentifier"||i.name.name!=="Image"||!r||n)return;t.push(i);let o=jt(i);o&&!Ct(e.sourceCode,o)&&e.report({node:r,messageId:"mapped"})},"Program:exit"(){if(/(?:^|\/)routes?\/[^/]+\.[jt]sx$/.test(e.filename.replaceAll("\\","/"))&&t.length>2)for(let i of t.slice(2))e.report({node:i,messageId:"routeLimit"})}}}});function Lt(e){let t=e?.value?.type==="JSXExpressionContainer"?e.value.expression:void 0;if(t?.type==="CallExpression"&&t.callee.type==="Identifier"&&t.callee.name==="itemHref")return!0;let i=h(e);return i!==void 0&&/^\/item(?:\/|$)/.test(i)}var Te=y({name:"item-link-prefetch",meta:{type:"problem",docs:{description:"Prefetch item routes before shoppers tap."},schema:[],messages:{prefetch:'Add prefetch="viewport" so this item route is ready to tap.'}},defaultOptions:[],create(e){let t=new Set;return{ImportDeclaration(i){if(["react-router","react-router-dom"].includes(i.source.value))for(let r of i.specifiers)r.type==="ImportSpecifier"&&r.imported.type==="Identifier"&&["Link","NavLink"].includes(r.imported.name)&&t.add(r.local.name)},JSXOpeningElement(i){i.name.type==="JSXIdentifier"&&t.has(i.name.name)&&Lt(g(i,"to"))&&!g(i,"prefetch")&&e.report({node:i,messageId:"prefetch"})}}}});var Nt=["**/*.server.*","**/server/**"],K=/otp|verify.?code|access.?token|refresh.?token|id.?token/i,be=new Set(["localStorage","sessionStorage"]),Mt=new Set(["window","globalThis","self"]);function xe(e){return e.type==="Identifier"?be.has(e.name):e.type==="MemberExpression"&&!e.computed&&e.object.type==="Identifier"&&Mt.has(e.object.name)&&e.property.type==="Identifier"&&be.has(e.property.name)}function Rt(e){return!e.computed&&e.property.type==="Identifier"?e.property.name:S(e.property)}function Ot(e){if(e==="jose"||e==="jsonwebtoken")return"server";if(e==="next-auth"||e.startsWith("next-auth/")||e.startsWith("@auth/")||e==="better-auth"||e.startsWith("better-auth/")||e==="lucia"||e.startsWith("@clerk/")||e==="firebase/auth"||e.startsWith("@supabase/auth-"))return"all"}var ve=y({name:"no-custom-auth",meta:{type:"problem",docs:{description:"Sign customers in through the Zappie SDK."},schema:[{type:"object",properties:{serverFiles:{type:"array",items:{type:"string"},uniqueItems:!0}},additionalProperties:!1}],messages:{auth:"Use createCustomer().signIn() from @zappie/sdk/customer to sign customers in."}},defaultOptions:[{}],create(e,[t]){let i=C(e.filename,t.serverFiles??Nt);return{ImportDeclaration(r){let n=Ot(r.source.value);(n==="all"||n==="server"&&!i)&&e.report({node:r.source,messageId:"auth"})},JSXOpeningElement(r){if(r.name.type!=="JSXIdentifier"||r.name.name.toLowerCase()!=="input")return;let n=h(g(r,"type")),o=h(g(r,"autocomplete"));(n?.toLowerCase()==="password"||o!==void 0&&["one-time-code","current-password","new-password"].includes(o.toLowerCase()))&&e.report({node:r,messageId:"auth"})},CallExpression(r){if(r.callee.type!=="MemberExpression"||!xe(r.callee.object))return;let n=r.arguments[0],o=n?.type==="Identifier"?n.name:S(n??null);o&&K.test(o)&&e.report({node:r,messageId:"auth"})},AssignmentExpression(r){if(r.left.type==="MemberExpression"&&xe(r.left.object)){let s=Rt(r.left);s&&K.test(s)&&e.report({node:r,messageId:"auth"});return}let n=r.left.type==="MemberExpression"&&r.left.object.type==="Identifier"&&r.left.object.name==="document"&&r.left.property.type==="Identifier"&&r.left.property.name==="cookie",o=S(r.right);n&&o&&K.test(o)&&e.report({node:r,messageId:"auth"})}}}});function At(e){return/checkout\.zappie\.ai|\/checkout(?:\/|$)/i.test(e)?"checkout":/accounts\.zappie\.ai|\/customer\/graphql/i.test(e)?"customer":/\/storefront\/v1/i.test(e)?"storefront":"direct"}var Ie=y({name:"no-direct-api",meta:{type:"problem",docs:{description:"Call Zappie through the SDK."},schema:[],messages:{direct:"Call the matching public @zappie/sdk client to reach this Zappie endpoint.",internal:"Use a public SDK entry. Only Zappie-owned packages can import @zappie/sdk/internal.",storefront:"Use createZappie(config).store or .menu to read storefront data.",checkout:"Use createCheckout().open() from @zappie/sdk/checkout.",customer:"Use createCustomer() from @zappie/sdk/customer."}},defaultOptions:[],create(e){let t=i=>{if(i.parent.type==="ImportDeclaration")return;let r=S(i);r&&D(r)&&e.report({node:i,messageId:At(r)})};return{Literal:t,TemplateLiteral:t,ImportDeclaration(i){ce(i.source.value)&&e.report({node:i.source,messageId:"internal"})}}}});var ke=["https://checkout.zappie.ai","https://checkout.stg.zappie.ai","https://accounts.zappie.ai"],we=new Set(["window","globalThis","self","top","parent","frames","opener"]),zt=new Set([...we,"defaultView","contentWindow"]),Pt=new Set(["document","ownerDocument","contentDocument"]);function A(e,t){let i=t.type==="ChainExpression"?t.expression:t;return b(e,i)==="location"||i.type==="MemberExpression"&&u(i)==="location"}function $(e,t,i){if(i.has(t.name))return;let r=T(e,t,t.name),n=r?.defs[0];if(r?.defs.length!==1||n?.type!=="Variable"||n.node.type!=="VariableDeclarator"||!n.node.init)return;i.add(t.name);let{id:o,init:s}=n.node;if(o.type==="Identifier")return s;if(o.type!=="ObjectPattern")return;let p=o.properties.find(a=>a.type==="Property"&&a.value.type==="Identifier"&&a.value.name===t.name);if(!(!p||p.computed||p.key.type!=="Identifier"))return{...s,type:"MemberExpression",object:s,property:p.key,computed:!1,optional:!1}}function L(e,t){let i=T(e,t,t.name);return!i||i.defs.length===0}function j(e,t,i){if(t.type==="ChainExpression")return j(e,t.expression,i);let r=E(t);if(r.type==="Identifier"){if(L(e,r))return we.has(r.name)?"window":r.name==="document"?"document":r.name==="location"?"location":void 0;let n=$(e,r,i);return n?j(e,n,i):void 0}if(r.type==="MemberExpression"){let n=u(r);if(n==="location"){let o=j(e,r.object,i);return o==="window"||o==="document"?"location":void 0}return n&&zt.has(n)?"window":n&&Pt.has(n)?"document":void 0}if(r.type==="LogicalExpression")return j(e,r.left,i)??j(e,r.right,i);if(r.type==="ConditionalExpression")return j(e,r.consequent,i)??j(e,r.alternate,i)}function b(e,t){return j(e,t,new Set)}function x(e,t,i=new Set){if(!t||t.type==="SpreadElement")return;let r=E(t);if(r.type==="Literal")return typeof r.value=="string"?r.value:void 0;if(r.type==="TemplateLiteral"){let n=[];for(let[o,s]of r.quasis.entries()){n.push(s.value.cooked??s.value.raw);let p=r.expressions[o];if(p){let a=x(e,p,i);if(a===void 0)return;n.push(a)}}return n.join("")}if(r.type==="BinaryExpression"&&r.operator==="+"){let n=x(e,r.left,i),o=x(e,r.right,i);return n===void 0||o===void 0?void 0:n+o}if(r.type==="Identifier"){let n=$(e,r,i);return n?x(e,n,i):void 0}}function v(e,t,i=new Set){if(!t||t.type==="SpreadElement")return"";let r=x(e,t,new Set(i));if(r!==void 0)return r;let n=E(t);if(n.type==="TemplateLiteral"){let o="";for(let[s,p]of n.quasis.entries()){o+=p.value.cooked??p.value.raw;let a=n.expressions[s];if(!a)break;let c=x(e,a,new Set(i));if(c===void 0)return o+v(e,a,i);o+=c}return o}if(n.type==="BinaryExpression"&&n.operator==="+"){let o=x(e,n.left,new Set(i));return o===void 0?v(e,n.left,i):o+v(e,n.right,i)}if(n.type==="Identifier"){let o=$(e,n,i);return o?v(e,o,i):""}return""}function H(e,t,i=ke){let r=e.replace(/[\t\n\r]/g,"").replaceAll("\\","/");return/^\s/.test(r)?!1:/^(?:[?#]|\/[^/])/.test(r)||/^(?:tel|mailto|sms):/i.test(r)||t&&r==="/"?!0:/^[a-z][a-z\d+.-]*:|^\/\//i.test(r)?i.some(n=>t?r===n||r.toLowerCase().startsWith(`${n}/`):r.toLowerCase().startsWith(`${n}/`)):t&&r.length>0&&!r.includes(":")}function je(e){let t=e.replace(/[\t\n\r]/g,"").replaceAll("\\","/");return/^\s*(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(t)}var Ce=y({name:"no-document-write",meta:{type:"problem",docs:{description:"Render markup with React, not document.write."},schema:[],messages:{write:"Remove document.write. Render the markup with React so it ships in the storefront bundle."}},defaultOptions:[],create(e){return{CallExpression(t){let i=t.callee,r=i.type==="MemberExpression"?u(i):void 0;i.type==="MemberExpression"&&(r==="write"||r==="writeln")&&b(e.sourceCode,i.object)==="document"&&e.report({node:t,messageId:"write"})}}}});function W(e,t){let i=E(t);if(i.type==="Identifier")return i.name;if(i.type==="SequenceExpression"){let r=i.expressions.at(-1);return r?W(e,r):void 0}if(i.type==="MemberExpression"&&b(e,i.object)==="window")return u(i)}function G(e){return!e||e.type==="SpreadElement"?!1:S(e)!==void 0?!0:e.type==="BinaryExpression"&&e.operator==="+"&&(G(e.left)||G(e.right))}var Le=y({name:"no-eval",meta:{type:"problem",docs:{description:"Do not execute strings as code."},schema:[],messages:{eval:"Remove code generated from a string. Ship executable code in the storefront bundle."}},defaultOptions:[],create(e){return{CallExpression(t){let i=W(e.sourceCode,t.callee),r=t.callee.type==="MemberExpression"&&u(t.callee)==="constructor";if(i==="eval"||i==="Function"||r){e.report({node:t,messageId:"eval"});return}["setTimeout","setInterval"].includes(i??"")&&G(t.arguments[0])&&e.report({node:t,messageId:"eval"})},NewExpression(t){let i=t.callee;(W(e.sourceCode,i)==="Function"||i.type==="MemberExpression"&&u(i)==="constructor")&&e.report({node:t,messageId:"eval"})}}}});var Ne=e=>!!(e&&/^\s*(?:[a-z][a-z\d+.-]*:|\/\/|\\\\)/i.test(e.replace(/[\t\n\r]/g,""))),Me=y({name:"no-external-scripts",meta:{type:"problem",docs:{description:"Ship scripts in the storefront bundle."},schema:[],messages:{externalScript:"Remove the external script. Install reviewed code as a package so it ships in the storefront bundle."}},defaultOptions:[],create(e){return{JSXOpeningElement(t){if(t.name.type!=="JSXIdentifier")return;let i=t.name.name.toLowerCase();if(i==="script"){let s=g(t,"src"),p=h(s),a=s?.value?.type==="JSXExpressionContainer"&&!(s.value.expression.type==="Literal"||s.value.expression.type==="TemplateLiteral"&&s.value.expression.expressions.length===0);s&&(a||p===void 0||Ne(p)&&!O(p))&&e.report({node:t,messageId:"externalScript"});return}if(i!=="link")return;let r=h(g(t,"rel"))?.toLowerCase(),n=h(g(t,"as"))?.toLowerCase(),o=h(g(t,"href"));(r==="preload"&&n==="script"||r==="modulepreload")&&Ne(o)&&!O(o??"")&&e.report({node:t,messageId:"externalScript"})},CallExpression(t){if(t.callee.type==="MemberExpression"&&u(t.callee)==="createElement"&&b(e.sourceCode,t.callee.object)==="document"&&S(t.arguments[0]??null)?.toLowerCase()==="script"){e.report({node:t,messageId:"externalScript"});return}t.callee.type==="MemberExpression"&&!t.callee.computed&&t.callee.object.type==="Identifier"&&t.callee.object.name==="React"&&t.callee.property.type==="Identifier"&&t.callee.property.name==="createElement"&&S(t.arguments[0]??null)?.toLowerCase()==="script"&&t.arguments[1]?.type==="ObjectExpression"&&t.arguments[1].properties.find(n=>n.type==="Property"&&(n.key.type==="Identifier"&&n.key.name==="src"||S(n.key)==="src"))&&e.report({node:t,messageId:"externalScript"})}}}});var Re=new Set(["location","href","host","hostname","origin","protocol","port"]);function Dt(e,t){if(t==="defineProperty"){let r=S(e.arguments[1]??null);return r!==void 0&&!Re.has(r)}let i=e.arguments.slice(1);return t==="assign"&&i.length>0&&i.every(r=>r.type==="ObjectExpression"&&r.properties.every(n=>n.type==="Property"&&!n.computed&&n.key.type==="Identifier"&&!Re.has(n.key.name)))}var Ft={Reflect:new Set(["get","set","apply","defineProperty","getOwnPropertyDescriptor"]),Object:new Set(["assign","defineProperty","defineProperties","getOwnPropertyDescriptor","getOwnPropertyDescriptors","setPrototypeOf"])},Oe=y({name:"no-global-indirection",meta:{type:"problem",docs:{description:"Reach window, document and location by name, so every use can be reviewed."},schema:[],messages:{computed:"Name the property with dot access. Computed access to window, document or location hides what the code reaches.",reflection:"Use window, document or location directly. Reflection on them hides what the code reaches."}},defaultOptions:[],create(e){let t=e.sourceCode,i=r=>b(t,r)!==void 0||A(t,r);return{MemberExpression(r){r.computed&&!(r.property.type==="Literal"&&typeof r.property.value=="number")&&i(r.object)&&e.report({node:r,messageId:"computed"})},VariableDeclarator(r){r.id.type==="ObjectPattern"&&r.init&&i(r.init)&&r.id.properties.some(n=>n.type==="Property"&&n.computed)&&e.report({node:r,messageId:"computed"})},CallExpression(r){let n=r.callee;if(n.type!=="MemberExpression"||n.object.type!=="Identifier")return;let o=Ft[n.object.name],s=u(n),p=r.arguments[0];o&&s&&o.has(s)&&p&&p.type!=="SpreadElement"&&i(p)&&!(n.object.name==="Object"&&b(t,p)!=="location"&&!A(t,p)&&Dt(r,s))&&e.report({node:r,messageId:"reflection"})}}}});var Xt=new Set(["react"]),Jt="React",Ae=y({name:"no-lazy-overlay",meta:{type:"problem",docs:{description:"Load overlays with deferred() from @zappie/foundations, not React.lazy or Suspense."},schema:[],messages:{lazy:"Load this component with deferred() from @zappie/foundations. React.lazy suspends, and React holds a suspended reveal back for about 300 ms, so the overlay opens late.",suspense:"Remove Suspense and load the component with deferred() from @zappie/foundations. It renders as soon as its code arrives and never suspends."}},defaultOptions:[],create(e){let t=new Set,i=new Set,r=new Set([Jt]),n=(o,s,p)=>o.type==="Identifier"&&r.has(o.name)&&s.type==="Identifier"&&s.name===p;return{ImportDeclaration(o){if(Xt.has(o.source.value))for(let s of o.specifiers){if(s.type!=="ImportSpecifier"){r.add(s.local.name);continue}let p=s.imported.type==="Identifier"?s.imported.name:s.imported.value;p==="lazy"?t.add(s.local.name):p==="Suspense"&&i.add(s.local.name)}},CallExpression(o){let s=o.callee;(s.type==="Identifier"&&t.has(s.name)||s.type==="MemberExpression"&&!s.computed&&n(s.object,s.property,"lazy"))&&e.report({node:o,messageId:"lazy"})},JSXOpeningElement(o){let s=o.name;(s.type==="JSXIdentifier"&&i.has(s.name)||s.type==="JSXMemberExpression"&&s.object.type==="JSXIdentifier"&&r.has(s.object.name)&&s.property.name==="Suspense")&&e.report({node:o,messageId:"suspense"})}}}});import{ESLintUtils as Vt}from"@typescript-eslint/utils";var Ut=/[₦€£]\s?\d|\$\s?\d|NGN\s?\d|\d+(?:\.\d{2})?\s?(?:naira|NGN)/i;function X(e){return e.trim()!=="$1"&&Ut.test(e)}function I(e){if(e.type==="MemberExpression"){if(!e.computed&&e.property.type==="Identifier")return e.property.name;if(e.computed&&e.property.type==="Literal")return typeof e.property.value=="string"?e.property.value:void 0}}var N=e=>I(e)==="amountMinor";function _t(e){return e.type==="MemberExpression"&&N(e)?e.object:void 0}function k(e){if(!(e.type!=="BinaryExpression"||e.operator!=="/"||e.right.type!=="Literal"||e.right.value!==100))return _t(e.left)}function J(e){try{return Vt.getParserServices(e,!0)}catch{return}}function qt(e){return e.getName().includes("MoneyBrand")?(e.getDeclarations()??[]).some(t=>{let i=t.getSourceFile().fileName.replaceAll("\\","/");return i.endsWith("/packages/sdk/src/money.ts")||/\/node_modules\/@zappie\/sdk\/.*\.d\.ts$/.test(i)}):!1}function V(e,t){if(!e?.program)return!1;let i=e.program.getTypeChecker(),r=e.esTreeNodeToTSNodeMap.get(t),n=i.getTypeAtLocation(r);return(n.isUnionOrIntersection()?n.types:[n]).some(s=>s.getProperties().some(p=>qt(p)))}function U(e){return e?.type!=="ObjectExpression"?!1:e.properties.some(t=>t.type==="Property"&&!t.computed&&(t.key.type==="Identifier"&&t.key.name==="style"||t.key.type==="Literal"&&t.key.value==="style")&&t.value.type==="Literal"&&t.value.value==="currency")}var ze=y({name:"no-money-literals",meta:{type:"problem",docs:{description:"Use SDK prices and totals in your storefront."},schema:[],messages:{arithmetic:"Use cart.subtotal, line.lineSubtotal, quote.subtotal, quote.lines totals or quote.total. Let the SDK calculate amounts.",literal:"Render SDK Money with format.money() or <Money> instead of a hard-coded amount.",scale:"Use format.money() to display amountMinor. Currencies use 0, 2, 3 or 4 minor-unit digits."}},defaultOptions:[],create(e){let t=J(e),i=r=>N(r)||V(t,r);return{Literal(r){typeof r.value=="string"&&r.parent.type!=="ImportDeclaration"&&X(r.value)&&e.report({node:r,messageId:"literal"})},JSXText(r){X(r.value)&&e.report({node:r,messageId:"literal"})},BinaryExpression(r){["+","-","*","/"].includes(r.operator)&&(k(r)&&r.parent.type==="MemberExpression"&&r.parent.object===r&&I(r.parent)==="toFixed"||(i(r.left)||i(r.right))&&e.report({node:r,messageId:"arithmetic"}))},TemplateLiteral(r){for(let n of r.quasis)X(n.value.cooked??n.value.raw)&&e.report({node:n,messageId:"literal"})},CallExpression(r){r.callee.type==="MemberExpression"&&I(r.callee)==="toFixed"&&r.arguments[0]?.type==="Literal"&&r.arguments[0].value===2&&k(r.callee.object)&&e.report({node:r,messageId:"scale"})}}}});var Bt=new Set(["host","hostname","origin","protocol","port"]),Kt=new Set(["navigate","redirect","redirectDocument"]),Pe=y({name:"no-offsite-navigation",meta:{type:"problem",docs:{description:"Keep shoppers on the site unless they follow a link themselves."},schema:[],messages:{offsite:"Navigate with a router link, navigate() to a path on this site, or an SDK helper such as redirectToCheckout from @zappie/sdk/redirect. Use a plain <a href> for a page on another site.",refresh:"Remove the refresh. Send the shopper on with a router redirect to a path on this site.",anchorClick:"Render an <a href> the shopper clicks instead of clicking a link from code."}},defaultOptions:[],create(e){let t=e.sourceCode,i=l=>b(t,l)==="location",r=l=>A(t,l),n=l=>{if(!l||l.type==="SpreadElement")return!1;let m=E(l);if(m.type==="CallExpression"&&o(m))return!0;if(m.type==="ConditionalExpression"||m.type==="LogicalExpression"){let[d,w]=m.type==="ConditionalExpression"?[m.consequent,m.alternate]:[m.left,m.right];return n(d)&&n(w)}let f=x(t,m);return f===void 0?H(v(t,m),!1):H(f,!0)},o=l=>l.callee.type!=="Identifier"?!1:!!T(t,l.callee,l.callee.name)?.defs.some(f=>f.type==="ImportBinding"&&f.node.type==="ImportSpecifier"&&f.node.imported.type==="Identifier"&&f.node.imported.name==="safeRedirect"&&f.parent?.type==="ImportDeclaration"&&f.parent.source.value==="@zappie/sdk/redirect"),s=l=>{if(!l||l.type==="SpreadElement")return!1;let m=v(t,l);return je(m)&&!n(l)},p=l=>{let m=l.callee;if(m.type==="Identifier"){if(Kt.has(m.name))return!0;let d=T(t,m,m.name)?.defs[0];return d?.type==="Variable"&&d.node.type==="VariableDeclarator"&&d.node.init?.type==="CallExpression"&&d.node.init.callee.type==="Identifier"&&d.node.init.callee.name==="useNavigate"}return m.type==="MemberExpression"&&u(m)==="redirect"&&m.object.type==="Identifier"&&m.object.name==="Response"},a=new Map,c=(l,m)=>{l.type==="Identifier"&&a.has(l.name)&&a.set(l.name,a.get(l.name)!=="unsafe"&&n(m)?"safe":"unsafe")};return{AssignmentExpression(l){let m=l.left;if(m.type==="MemberExpression"&&u(m)==="href"&&c(m.object,l.right),(m.type==="Identifier"||m.type==="MemberExpression")&&i(m)&&!n(l.right)){e.report({node:l,messageId:"offsite"});return}if(m.type!=="MemberExpression"||!r(m.object))return;let f=u(m);(f===void 0||Bt.has(f)||f==="href"&&!n(l.right))&&e.report({node:l,messageId:"offsite"})},CallExpression(l){let m=l.callee;if(m.type==="MemberExpression"){let f=u(m);if((f==="assign"||f==="replace")&&r(m.object)&&!n(l.arguments[0])){e.report({node:l,messageId:"offsite"});return}if(f==="open"&&b(t,m.object)==="window"&&!n(l.arguments[0])){e.report({node:l,messageId:"offsite"});return}if((f==="set"||f==="append")&&S(l.arguments[0]??null)?.toLowerCase()==="refresh"){e.report({node:l,messageId:"refresh"});return}if(f==="setAttribute"&&S(l.arguments[0]??null)?.toLowerCase()==="href"&&c(m.object,l.arguments[1]),f==="click"&&m.object.type==="Identifier"&&a.has(m.object.name)&&a.get(m.object.name)!=="safe"){e.report({node:l,messageId:"anchorClick"});return}}if(m.type==="Identifier"&&m.name==="open"&&L(t,m)&&!n(l.arguments[0])){e.report({node:l,messageId:"offsite"});return}p(l)&&s(l.arguments[0])&&e.report({node:l,messageId:"offsite"})},VariableDeclarator(l){let m=l.init&&E(l.init);l.id.type==="Identifier"&&m?.type==="CallExpression"&&m.callee.type==="MemberExpression"&&u(m.callee)==="createElement"&&b(t,m.callee.object)==="document"&&S(m.arguments[0]??null)?.toLowerCase()==="a"&&a.set(l.id.name,"none")},JSXOpeningElement(l){if(l.name.type!=="JSXIdentifier")return;let m=l.name.name;if(m.toLowerCase()==="meta"){let f=g(l,"httpEquiv")??g(l,"http-equiv"),d=f&&h(f);f&&(d===void 0||d.toLowerCase()==="refresh")&&e.report({node:l,messageId:"refresh"});return}if(m==="Navigate"){let f=g(l,"to"),d=f?.value?.type==="JSXExpressionContainer"&&f.value.expression.type!=="JSXEmptyExpression"?f.value.expression:f?.value;d&&s(d)&&e.report({node:l,messageId:"offsite"})}},Property(l){let m=l.key.type==="Identifier"&&!l.computed?l.key.name:S(l.key),f=l.value;if(!m)return;let d=m.toLowerCase();if((d==="httpequiv"||d==="http-equiv")&&S(f)?.toLowerCase()==="refresh"){e.report({node:l,messageId:"refresh"});return}d==="refresh"&&/^\s*\d/.test(S(f)??"")&&e.report({node:l,messageId:"refresh"})}}}});var Z=e=>/^\s*(?:https?:|data:|blob:|\/\/|\\\\)/i.test(e.replace(/[\t\n\r]/g,"")),$t=new Set(["Worker","SharedWorker"]),De=e=>e!==void 0&&/^\.\.?\//.test(e);function Fe(e,t){let i=E(t);if(i.type==="MemberExpression"&&u(i)==="href"&&(i=E(i.object)),i.type==="Identifier"){let n=T(e,i,i.name),o=n?.defs[0];return n?.defs.length!==1||o?.type!=="Variable"||o.node.type!=="VariableDeclarator"||o.parent?.type!=="VariableDeclaration"||o.parent.kind!=="const"||!o.node.init?!1:!n.references.some(p=>{let a=p.identifier.parent;return a.type==="MemberExpression"&&a.object===p.identifier&&a.parent.type==="AssignmentExpression"&&a.parent.left===a&&!["search","hash"].includes(u(a)??"")})&&Fe(e,o.node.init)}let r=i.type==="NewExpression"?i.arguments[1]:void 0;return i.type==="NewExpression"&&i.callee.type==="Identifier"&&i.callee.name==="URL"&&De(x(e,i.arguments[0]))&&r?.type==="MemberExpression"&&r.object.type==="MetaProperty"&&u(r)==="url"}var Xe=y({name:"no-remote-import",meta:{type:"problem",docs:{description:"Load code from the storefront bundle only."},schema:[],messages:{remote:"Install the code as a package so it ships in the storefront bundle. Code loaded from a URL changes without review.",computed:"Import a file in the project. A computed import must start with ./ or ../ so the bundler can see every file it may load."}},defaultOptions:[],create(e){let t=e.sourceCode,i=(n,o)=>{if(!o||o.type==="SpreadElement")return;let s=x(t,o),p=s??v(t,o);if(Z(p)){e.report({node:n,messageId:"remote"});return}s===void 0&&!De(p)&&!Fe(t,o)&&e.report({node:n,messageId:"computed"})},r=n=>{n.source&&Z(n.source.value)&&e.report({node:n,messageId:"remote"})};return{ImportExpression(n){i(n,n.source)},ImportDeclaration:r,ExportAllDeclaration:r,ExportNamedDeclaration:r,NewExpression(n){if(n.callee.type==="Identifier"&&$t.has(n.callee.name)&&L(t,n.callee)){let o=n.arguments[0];o&&o.type!=="SpreadElement"&&Z(v(t,o))&&e.report({node:n,messageId:"remote"})}},CallExpression(n){n.callee.type==="Identifier"&&n.callee.name==="importScripts"&&L(t,n.callee)&&e.report({node:n,messageId:"remote"})}}}});var Ht=["**/*.server.{js,jsx,ts,tsx,mjs,cjs,mts,cts}","**/app/.server/**","**/app/server.ts","**/test/**","**/tests/**","**/__tests__/**","**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}","**/*.config.{js,ts,mjs,cjs,mts,cts}"],Wt=new Set(["MODE","DEV","PROD","SSR","BASE_URL"]);function Je(e){if(e.type==="FunctionDeclaration")return e.id?.name;if(e.type!=="FunctionExpression"&&e.type!=="ArrowFunctionExpression")return;let t=e.parent;if(t.type==="VariableDeclarator"&&t.id.type==="Identifier")return t.id.name;if(t.type==="Property")return t.key.type==="Identifier"?t.key.name:S(t.key)}function Ve(e){if(e.type==="MemberExpression"&&e.object.type==="Identifier"&&e.object.name==="process"&&u(e)==="env")return"process";if(e.type==="MemberExpression"&&e.object.type==="MetaProperty"&&e.object.meta.name==="import"&&e.object.property.name==="meta"&&u(e)==="env")return"vite"}function Ue(e){return e.type!=="MemberExpression"||u(e)!=="cloudflare"?!1:e.object.type==="Identifier"&&e.object.name==="context"||e.object.type==="MemberExpression"&&u(e.object)==="context"}function _e(e,t,i=!1){return e==="process"?t!=="NODE_ENV"&&!(i&&t?.startsWith("NEXT_PUBLIC_ZAPPIE_")):t===void 0||!t.startsWith("VITE_ZAPPIE_")&&!Wt.has(t)}var qe=y({name:"no-server-env-in-client",meta:{type:"problem",docs:{description:"Read server environment values only in server code."},schema:[],messages:{serverEnv:"Move this environment read into a loader, action, *.server.ts file, app/.server/ or app/server.ts so it cannot reach the client bundle."}},defaultOptions:[],create(e){let t=e.filename.replaceAll("\\","/");if(C(t,Ht)||/(?:^|\/)(?:test|tests|__tests__)(?:\/|$)/.test(t)||/\.(?:test|spec|config)\.[cm]?[jt]sx?$/.test(t))return{};let i=new Map,r=new Set,n=a=>e.sourceCode.getAncestors(a).some(c=>["loader","action"].includes(Je(c)??"")),o=a=>{let c=Ve(a);return c||(a.type==="Identifier"?i.get(a.name):void 0)},s=a=>{if(a.type==="ObjectPattern")for(let c of a.properties)c.type==="Property"&&(c.key.type==="Identifier"&&c.key.name==="cloudflare"||S(c.key)==="cloudflare")&&c.value.type==="Identifier"&&r.add(c.value.name),c.type==="Property"&&(c.key.type==="Identifier"&&c.key.name==="context"||S(c.key)==="context")&&s(c.value)},p=a=>{if(!(n(a)||["loader","action"].includes(Je(a)??"")))for(let c of a.params)c.type!=="RestElement"&&s(c)};return{ArrowFunctionExpression:p,FunctionDeclaration:p,FunctionExpression:p,VariableDeclarator(a){if(n(a)||!a.init)return;let c=o(a.init);if(a.id.type==="Identifier"&&c){i.set(a.id.name,c);return}if(a.id.type==="ObjectPattern"&&c){for(let l of a.id.properties){let m=l.type==="Property"?l.key.type==="Identifier"?l.key.name:S(l.key):void 0;_e(c,m)&&e.report({node:l,messageId:"serverEnv"})}return}if(a.id.type==="ObjectPattern"&&Ue(a.init))for(let l of a.id.properties)l.type==="Property"&&(l.key.type==="Identifier"&&l.key.name==="env"||S(l.key)==="env")&&e.report({node:l,messageId:"serverEnv"})},MemberExpression(a){if(n(a))return;let c=o(a.object);if(c&&_e(c,u(a),Ve(a.object)===c)){e.report({node:a,messageId:"serverEnv"});return}u(a)==="env"&&(Ue(a.object)||a.object.type==="Identifier"&&r.has(a.object.name))&&e.report({node:a,messageId:"serverEnv"})}}}});var Gt=["react-ga4","react-facebook-pixel","@vercel/analytics","posthog-js"];function Zt(e){return Gt.includes(e)||e.startsWith("@segment/")}var Be=y({name:"no-tracking-scripts",meta:{type:"problem",docs:{description:"Forward analytics through Zappie."},schema:[],messages:{tracking:"Configure analytics.forward in zappie.config.ts to forward analytics. Remove the tracking script."}},defaultOptions:[],create(e){let t=i=>{if(i.parent.type==="ImportDeclaration")return;let r=S(i);r&&O(r)&&e.report({node:i,messageId:"tracking"})};return{Literal:t,TemplateLiteral:t,ImportDeclaration(i){Zt(i.source.value)&&e.report({node:i.source,messageId:"tracking"})},CallExpression(i){let r=i.callee,n=r.type==="Identifier"&&["gtag","fbq"].includes(r.name),o=r.type==="MemberExpression"&&!r.computed&&r.object.type==="Identifier"&&r.object.name==="dataLayer"&&r.property.type==="Identifier"&&r.property.name==="push";(n||o)&&e.report({node:i,messageId:"tracking"})}}}});function Ke(e){let t=S(e??null);if(t!==void 0)return t;if(e?.type==="NewExpression"&&e.callee.type==="Identifier"&&e.callee.name==="URL")return Ke(e.arguments[0])}function Yt(e){if(!(!/^(?:https?|wss?):\/\//i.test(e)&&!e.startsWith("//")))try{return new URL(e,"https://storefront.invalid").hostname.toLowerCase()}catch{return}}function Qt(e,t){return t.some(i=>{let r=i.toLowerCase();return r.startsWith("*.")?e.endsWith(r.slice(1))&&e!==r.slice(2):e===r})}var z=y({name:"no-unlisted-fetch",meta:{type:"problem",docs:{description:"List every external request host in outbound.allow."},schema:[{type:"object",properties:{dynamicOnly:{type:"boolean"}},additionalProperties:!1}],messages:{dynamicRequest:"This request URL is computed. Review its possible hosts and list each external host in zappie.config.ts outbound.allow.",unlistedRequest:"Add {{host}} to zappie.config.ts outbound.allow, or remove this external request."}},defaultOptions:[{}],create(e,[t]){let i=e.filename.replaceAll("\\","/");if(C(i,["**/test/**","**/tests/**","**/__tests__/**","**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"])||/(?:^|\/)(?:test|tests|__tests__)(?:\/|$)/.test(i)||/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(i))return{};let r=e.settings?.zappie?.outboundAllow,n=Array.isArray(r)?r.filter(p=>typeof p=="string"):[],o=new Set,s=(p,a)=>{let c=Ke(a);if(c===void 0){t.dynamicOnly&&e.report({node:p,messageId:"dynamicRequest"});return}if(t.dynamicOnly)return;let l=Yt(c);!l||D(c)||Qt(l,n)||e.report({node:p,messageId:"unlistedRequest",data:{host:l}})};return{VariableDeclarator(p){p.id.type==="Identifier"&&p.init?.type==="NewExpression"&&p.init.callee.type==="Identifier"&&p.init.callee.name==="XMLHttpRequest"&&o.add(p.id.name)},CallExpression(p){if(p.callee.type==="Identifier"&&p.callee.name==="fetch"||p.callee.type==="MemberExpression"&&u(p.callee)==="fetch"&&p.callee.object.type==="Identifier"&&["window","globalThis"].includes(p.callee.object.name)){s(p,p.arguments[0]);return}if(p.callee.type!=="MemberExpression")return;let c=u(p.callee);if(c==="sendBeacon"&&p.callee.object.type==="Identifier"&&p.callee.object.name==="navigator"){s(p,p.arguments[0]);return}c==="open"&&(p.callee.object.type==="Identifier"&&o.has(p.callee.object.name)||p.callee.object.type==="NewExpression"&&p.callee.object.callee.type==="Identifier"&&p.callee.object.callee.name==="XMLHttpRequest")&&s(p,p.arguments[1])},NewExpression(p){p.callee.type==="Identifier"&&["WebSocket","EventSource"].includes(p.callee.name)&&s(p,p.arguments[0])}}}}),$e={...z,meta:{...z.meta,docs:{...z.meta.docs,url:"https://docs.zappie.ai/lint/no-unlisted-fetch-dynamic"}}};function er(e){return e.properties.find(t=>t.type==="Property"&&!t.computed&&(t.key.type==="Identifier"&&t.key.name==="__html"||S(t.key)==="__html"))?.value}var He=y({name:"no-unsafe-html",meta:{type:"problem",docs:{description:"Sanitize rich text before inserting HTML."},schema:[],messages:{unsafeHtml:"Pass the HTML straight through a sanitizer created with createSanitizeRichText from @zappie/foundations/rich-text."}},defaultOptions:[],create(e){let t=e.sourceCode,i=s=>!!T(t,s,s.name)?.defs.some(a=>a.type==="ImportBinding"&&a.node.type==="ImportSpecifier"&&a.node.imported.type==="Identifier"&&a.node.imported.name==="createSanitizeRichText"&&a.parent?.type==="ImportDeclaration"&&a.parent.source.value==="@zappie/foundations/rich-text"),r=s=>!!T(t,s,s.name)?.defs.some(a=>{if(a.type!=="Variable"||a.node.type!=="VariableDeclarator")return!1;let c=a.node.init;return c?.type==="CallExpression"&&c.callee.type==="Identifier"&&i(c.callee)}),n=(s,p=new Set)=>{if(!s||s.type==="SpreadElement")return!1;let a=E(s);if(a.type==="Literal")return a.value==="";if(a.type==="ConditionalExpression")return n(a.consequent,p)&&n(a.alternate,p);if(a.type==="LogicalExpression")return n(a.left,p)&&n(a.right,p);if(a.type==="CallExpression")return a.callee.type==="Identifier"&&r(a.callee)?!0:a.callee.type==="CallExpression"&&a.callee.callee.type==="Identifier"&&i(a.callee.callee);if(a.type!=="Identifier")return!1;let c=T(t,a,a.name);if(!c||p.has(c))return!1;let l=new Set(p).add(c);for(let m of c.defs){if(m.type!=="Variable"||m.node.type!=="VariableDeclarator")continue;if(m.node.id.type==="Identifier")return n(m.node.init,l);if(m.node.id.type!=="ArrayPattern"||m.node.id.elements[0]?.type!=="Identifier"||m.node.id.elements[0].name!==a.name||m.node.init?.type!=="CallExpression"||m.node.init.callee.type!=="Identifier"||m.node.init.callee.name!=="useState")continue;let f=m.node.init.arguments[0],d=m.node.id.elements[1];if(!n(f,l)||d?.type!=="Identifier")return!1;let ae=T(t,d,d.name)?.references.filter(R=>R.identifier.parent.type==="CallExpression"&&R.identifier.parent.callee===R.identifier)??[];return ae.length>0&&ae.every(R=>{let oe=R.identifier.parent;return oe.type==="CallExpression"&&n(oe.arguments[0],l)})}return!1},o=(s,p)=>{(p?.type!=="ObjectExpression"||!n(er(p)))&&e.report({node:s,messageId:"unsafeHtml"})};return{JSXAttribute(s){if(s.name.type!=="JSXIdentifier")return;let p=s.name.name.toLowerCase();!["dangerouslysetinnerhtml","srcdoc"].includes(p)||s.value?.type!=="JSXExpressionContainer"||(p==="dangerouslysetinnerhtml"?o(s,s.value.expression):n(s.value.expression)||e.report({node:s,messageId:"unsafeHtml"}))},JSXSpreadAttribute(s){if(s.argument.type!=="ObjectExpression")return;let p=s.argument.properties.find(a=>a.type==="Property"&&(a.key.type==="Identifier"&&a.key.name==="dangerouslySetInnerHTML"||S(a.key)==="dangerouslySetInnerHTML"));p&&o(s,p.value)},JSXElement(s){if(s.openingElement.name.type==="JSXIdentifier"&&s.openingElement.name.name.toLowerCase()==="script")for(let p of s.children)p.type==="JSXExpressionContainer"&&p.expression.type!=="JSXEmptyExpression"&&e.report({node:p,messageId:"unsafeHtml"})},AssignmentExpression(s){s.left.type==="MemberExpression"&&["innerHTML","outerHTML","srcdoc"].includes(u(s.left)??"")&&!n(s.right)&&e.report({node:s,messageId:"unsafeHtml"})},CallExpression(s){if(s.callee.type==="MemberExpression"&&u(s.callee)==="insertAdjacentHTML"){n(s.arguments[1])||e.report({node:s,messageId:"unsafeHtml"});return}if(s.callee.type==="MemberExpression"&&["createContextualFragment","setHTMLUnsafe"].includes(u(s.callee)??"")){n(s.arguments[0])||e.report({node:s,messageId:"unsafeHtml"});return}if(!(s.callee.type==="Identifier"&&s.callee.name==="createElement"||s.callee.type==="MemberExpression"&&u(s.callee)==="createElement"&&s.callee.object.type==="Identifier"&&s.callee.object.name==="React"))return;if(S(s.arguments[0]??null)?.toLowerCase()==="script")for(let l of s.arguments.slice(2))l.type!=="SpreadElement"&&e.report({node:l,messageId:"unsafeHtml"});let a=s.arguments[1];if(a?.type!=="ObjectExpression")return;let c=a.properties.find(l=>l.type==="Property"&&(l.key.type==="Identifier"&&l.key.name==="dangerouslySetInnerHTML"||S(l.key)==="dangerouslySetInnerHTML"));c&&o(s,c.value)}}}});var tr=["modal","sheet","drawer","dialog","item","cart","cart_sheet","cart_edit","cart_clear","search","catalogue_search","catalogue_categories","product_note","modal_id"];function Y(e){if(e.type==="Identifier")return e.name;if(e.type==="MemberExpression"&&e.property.type==="Identifier")return e.property.name}function We(e,t){return e.type==="Literal"&&typeof e.value=="string"?[...t].some(i=>new RegExp(`[?&]${i}=`).test(e.value)):e.type==="TemplateLiteral"?e.quasis.some(i=>We({...i,type:"Literal",value:i.value.raw},t)):e.type==="ObjectExpression"?e.properties.some(i=>i.type==="Property"&&(i.key.type==="Identifier"&&t.has(i.key.name)||i.key.type==="Literal"&&typeof i.key.value=="string"&&t.has(i.key.value))):!1}var Ge=y({name:"overlay-primitive",meta:{type:"problem",docs:{description:"Use Overlay to keep dialogs and sheets in the URL."},schema:[{type:"object",properties:{keys:{type:"array",items:{type:"string"}}},additionalProperties:!1}],messages:{overlay:"Use Overlay or useOverlay for dialogs and sheets in the URL. They handle Back, Forward and focus restoration."}},defaultOptions:[{}],create(e,[t]){let i=new Set([...tr,...t.keys??[]]),r=new Set,n=o=>{let s=e.sourceCode.getText(o);return s.includes("useSearchParams(")||[...r].some(p=>new RegExp(`\\b${p}\\b`).test(s))};return{VariableDeclarator(o){o.init?.type==="CallExpression"&&Y(o.init.callee)==="useSearchParams"?o.id.type==="Identifier"?r.add(o.id.name):o.id.type==="ArrayPattern"&&o.id.elements[0]?.type==="Identifier"&&r.add(o.id.elements[0].name):o.id.type==="Identifier"&&o.init&&n(o.init)&&r.add(o.id.name)},CallExpression(o){let s=Y(o.callee);(s==="setSearchParams"||s==="navigate"||s==="pushState"||s==="replaceState"||o.callee.type==="CallExpression"&&Y(o.callee.callee)==="useNavigate")&&o.arguments.some(a=>a.type!=="SpreadElement"&&We(a,i))&&e.report({node:o,messageId:"overlay"})},JSXOpeningElement(o){let s=o.name.type==="JSXIdentifier"&&o.name.name==="dialog",p=o.attributes.some(c=>c.type==="JSXAttribute"&&c.name.name==="role"&&c.value?.type==="Literal"&&c.value.value==="dialog"),a=o.attributes.find(c=>c.type==="JSXAttribute"&&c.name.name==="open");(s||p)&&a?.type==="JSXAttribute"&&a.value?.type==="JSXExpressionContainer"&&n(a.value.expression)&&e.report({node:o,messageId:"overlay"})}}}});function rr(e){return e.callee.type==="Identifier"?e.callee.name:e.callee.type==="MemberExpression"?u(e.callee):void 0}function M(e){return!e||e.type==="JSXEmptyExpression"?!1:e.type==="TSAsExpression"||e.type==="TSTypeAssertion"||e.type==="TSNonNullExpression"?M(e.expression):e.type==="ConditionalExpression"?M(e.consequent)||M(e.alternate):e.type==="LogicalExpression"?M(e.left)||M(e.right):S(e)?.toLowerCase()==="_blank"}var Ze=y({name:"safe-external-links",meta:{type:"problem",docs:{description:"Open links and redirects without exposing the site."},fixable:"code",schema:[],messages:{javascriptUrl:"Remove the javascript: URL. Use an event handler for storefront behavior.",noopener:'Add rel="noopener noreferrer" when target="_blank" opens a new tab.',redirect:"Pass this redirect target through safeRedirect(to, fallback) from @zappie/sdk/redirect."}},defaultOptions:[],create(e){let t=e.sourceCode,i=new Set,r=new Set,n=a=>!!T(t,a,a.name)?.defs.some(l=>l.type==="ImportBinding"&&l.node.type==="ImportSpecifier"&&l.node.imported.type==="Identifier"&&l.node.imported.name==="safeRedirect"&&l.parent?.type==="ImportDeclaration"&&l.parent.source.value==="@zappie/sdk/redirect"),o=a=>{if(!a||a.type==="SpreadElement")return!1;let c=E(a);return c.type==="Identifier"?i.has(c.name)&&!r.has(c.name):c.type==="MemberExpression"?c.object.type==="Identifier"&&c.object.name==="request"&&u(c)==="url"?!0:o(c.object):c.type==="CallExpression"?c.callee.type==="Identifier"&&n(c.callee)?!1:c.callee.type==="Identifier"&&c.callee.name==="safeRedirect"?c.arguments.some(o):!!(c.callee.type==="MemberExpression"&&u(c.callee)==="get"&&(c.callee.object.type==="MemberExpression"&&u(c.callee.object)==="searchParams"||c.callee.object.type==="Identifier"&&/searchParams/i.test(c.callee.object.name)||o(c.callee.object))):c.type==="NewExpression"?c.callee.type==="Identifier"&&c.callee.name==="URL"&&c.arguments.some(o):c.type==="ConditionalExpression"?o(c.consequent)||o(c.alternate):c.type==="LogicalExpression"?o(c.left)||o(c.right):c.type==="BinaryExpression"?o(c.left):c.type==="TemplateLiteral"?c.expressions.some(o):!1},s=(a,c)=>{if(c.type!=="Identifier")return!1;let l=f=>{let d=E(f);return d.type==="MemberExpression"&&u(d)==="origin"&&d.object.type==="Identifier"&&d.object.name===c.name},m=f=>{let d=E(f);return d.type==="MemberExpression"&&u(d)==="origin"&&(d.object.type==="Identifier"&&d.object.name==="location"||o(d.object))};return t.getAncestors(a).some(f=>{if(f.type!=="IfStatement"||!t.getAncestors(a).includes(f.consequent))return!1;let d=E(f.test);return d.type==="BinaryExpression"&&(d.operator==="==="||d.operator==="==")&&(l(d.left)&&m(d.right)||m(d.left)&&l(d.right))})};return{VariableDeclarator(a){a.id.type!=="Identifier"||!a.init||(a.init.type==="CallExpression"&&a.init.callee.type==="Identifier"&&n(a.init.callee)?r.add(a.id.name):o(a.init)&&i.add(a.id.name))},JSXOpeningElement(a){for(let d of["href","src","action","formAction"]){let w=h(g(a,d));/^javascript:/i.test((w??"").replace(/[\u0000-\u0020\u007f\s]/gu,""))&&e.report({node:g(a,d)??a,messageId:"javascriptUrl"})}let c=g(a,"target"),l=c?.value?.type==="JSXExpressionContainer"?c.value.expression:c?.value;if(!M(l))return;let m=g(a,"rel"),f=h(m);f?.toLowerCase().split(/\s+/).includes("noopener")||e.report({node:a,messageId:"noopener",fix(d){if(!m)return d.insertTextAfter(a.name,' rel="noopener noreferrer"');if(!m.value||m.value.type!=="Literal")return null;let w=new Set((f??"").split(/\s+/).filter(Boolean));return w.add("noopener"),w.add("noreferrer"),d.replaceText(m,`rel="${[...w].join(" ")}"`)}})},CallExpression:a=>{let c=rr(a);if(!["redirect","navigate","assign","replace"].includes(c??""))return;let l=a.arguments[0];l&&l.type!=="SpreadElement"&&o(l)&&!s(a,E(l))&&e.report({node:l,messageId:"redirect"})},AssignmentExpression(a){a.left.type==="MemberExpression"&&u(a.left)==="href"&&(a.left.object.type==="Identifier"&&a.left.object.name==="location"||a.left.object.type==="MemberExpression"&&u(a.left.object)==="location")&&o(a.right)&&e.report({node:a.right,messageId:"redirect"})}}}});function Q(e){return e.body.find(t=>t.type==="ImportDeclaration"&&t.source.value==="@zappie/sdk")}function ee(e){return e?.specifiers.find(t=>t.type==="ImportSpecifier"&&t.imported.type==="Identifier"&&t.imported.name==="format")}function ir(e,t,i,r){let n=Q(i);if(ee(n)?.local.name===r)return;let o=r==="format"?"format":`format as ${r}`,s=n?.specifiers.filter(c=>c.type==="ImportSpecifier");if(n&&n.importKind!=="type"&&s?.length){let c=s.at(-1);if(c)return e.insertTextAfter(c,`, ${o}`)}let p=i.body[0],a=`import { ${o} } from "@zappie/sdk";
|
|
2
|
+
`;return p?e.insertTextBefore(p,a):e.insertTextAfter(i,a)}function te(e,t,i,r,n,o){let s=[e.replaceText(r,`${o}.money(${t.getText(n)})`)],p=ir(e,t,i,o);return p&&s.push(p),s}function Ye(e,t,i){if(ee(Q(t)))return"imported";let r=e.getScope(i);for(;r;){if(r.variables.some(n=>n.name==="format"))return"conflict";r=r.upper}return"available"}function Qe(e){return ee(Q(e))?.local.name}function et(e,t){let i=new Set,r=e.getScope(t);for(;r;){for(let n of r.variables)i.add(n.name);r=r.upper}for(let n of["zappieFormat","zappieMoneyFormat","formatMoneyValue"])if(!i.has(n))return n;return"zappieSdkFormat"}function tt(e){let t=e.type==="NewExpression"||e.type==="CallExpression"?e.callee:void 0;return t?.type==="MemberExpression"&&t.object.type==="Identifier"&&t.object.name==="Intl"&&I(t)==="NumberFormat"}function nr(e){if(e.callee.type==="MemberExpression"){if(I(e.callee)==="toLocaleString")return k(e.callee.object);if(I(e.callee)==="format")return k(e.arguments[0]??e)}}function sr(e){let t=e.parent,i=t.type==="MemberExpression"?t.parent:void 0;return!!(i?.type==="CallExpression"&&i.callee===t&&I(t)==="format"&&k(i.arguments[0]??i))}var rt=y({name:"use-format-money",meta:{type:"problem",docs:{description:"Format SDK Money with format.money() or <Money>."},fixable:"code",hasSuggestions:!0,schema:[],messages:{currency:"Use format.money(). Intl currency defaults can differ from the API minor-unit digits.",direct:"Render SDK Money with format.money(value) or <Money value={value}>.",minor:"Use format.money(value). Dividing by 100 gives the wrong amount for currencies with 0, 3 or 4 minor-unit digits.",useAlias:"Import format with an unused alias and format this Money value."}},defaultOptions:[],create(e){let t=e.sourceCode,i=J(e),r,n=(s,p,a)=>{let c={node:s,messageId:"minor"};if(Ye(t,r,s)==="conflict"){let m=et(t,s);e.report({...c,suggest:[{messageId:"useAlias",fix:f=>te(f,t,r,p,a,m)}]});return}e.report({...c,fix:m=>{let f=Qe(r)??"format";return te(m,t,r,p,a,f)}})},o=s=>{let p=nr(s);return p?(n(s,s,p),!0):!1};return{Program(s){r=s},NewExpression(s){tt(s)&&U(s.arguments[1])&&!sr(s)&&e.report({node:s,messageId:"currency"})},CallExpression(s){if(!o(s)){if(tt(s)&&U(s.arguments[1])){e.report({node:s,messageId:"currency"});return}s.callee.type==="MemberExpression"&&I(s.callee)==="toLocaleString"&&s.arguments.some(U)&&e.report({node:s,messageId:"currency"})}},TemplateLiteral(s){for(let p of s.expressions){let a=k(p);a?n(p,p,a):N(p)&&e.report({node:p,messageId:"minor"})}},JSXExpressionContainer(s){s.parent.type==="JSXAttribute"||s.expression.type==="JSXEmptyExpression"||(k(s.expression)||N(s.expression)?e.report({node:s.expression,messageId:"minor"}):V(i,s.expression)&&e.report({node:s.expression,messageId:"direct"}))}}}});var re={add:{name:"data-zappie-action",text:'data-zappie-action="add-to-cart"'},checkout:{name:"data-zappie-checkout",text:"data-zappie-checkout"},signin:{name:"data-zappie-signin",text:"data-zappie-signin"}};function ar(e,t){let i=t.value?e.getText(t.value):"";if(/\b(?:cart(?:\.actions)?\.add)\s*\(/.test(i))return"add";if(/\b(?:checkout|createCheckout\([^)]*\))\.open\s*\(/.test(i))return"checkout";if(/\b(?:auth|createCustomer\([^)]*\))\.signIn\s*\(/.test(i))return"signin"}var it=y({name:"verify-markers",meta:{type:"suggestion",docs:{description:"Mark shopping actions so verify can find them."},fixable:"code",schema:[],messages:{marker:"Add {{marker}} so zappie verify can find this shopping action."}},defaultOptions:[],create(e){return{JSXOpeningElement(t){let i=t.attributes.find(n=>n.type==="JSXAttribute"&&n.name.name==="onClick");if(!i)return;let r=ar(e.sourceCode,i);!r||t.attributes.some(n=>n.type==="JSXAttribute"&&n.name.name===re[r].name)||e.report({node:i,messageId:"marker",data:{marker:re[r].text},fix:n=>n.insertTextAfter(t.name,` ${re[r].text}`)})}}}});var at={"no-direct-api":Ie,"no-tracking-scripts":Be,"checkout-via-sdk":Ee,"no-custom-auth":ve,"no-money-literals":ze,"use-format-money":rt,"overlay-primitive":Ge,"cart-via-sdk":Se,"verify-markers":it,"item-link-prefetch":Te,"image-priority":he,"no-lazy-overlay":Ae,"no-unsafe-html":He,"no-eval":Le,"no-external-scripts":Me,"safe-external-links":Ze,"no-unlisted-fetch":z,"no-unlisted-fetch-dynamic":$e,"no-server-env-in-client":qe,"cacheable-menu-routes":ye,"no-offsite-navigation":Pe,"no-global-indirection":Oe,"no-document-write":Ce,"no-remote-import":Xe},pr=["no-offsite-navigation","no-global-indirection","no-document-write","no-remote-import","no-eval","no-external-scripts","no-unsafe-html","safe-external-links"],se=Object.fromEntries(Object.keys(at).map(e=>[`zappie/${e}`,e==="verify-markers"||e==="no-unlisted-fetch-dynamic"||e==="cacheable-menu-routes"?"warn":"error"])),cr={...se,"zappie/verify-markers":"error","zappie/cacheable-menu-routes":"error","zappie/no-unlisted-fetch-dynamic":["error",{dynamicOnly:!0}]};se["zappie/no-unlisted-fetch-dynamic"]=["warn",{dynamicOnly:!0}];var _={meta:{name:"eslint-plugin-zappie",version:"0.0.0"},rules:at,configs:{}},P={name:"zappie/rules",files:["**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"],languageOptions:{parser:st},plugins:{zappie:_,"jsx-a11y":nt,"react-hooks":or},rules:{...nt.flatConfigs.recommended.rules,"react-hooks/rules-of-hooks":"error",...se}},ie={name:"zappie/search-dialogs",files:["**/search/**/*.{jsx,tsx}","**/*search*.{jsx,tsx}"],rules:{"jsx-a11y/no-autofocus":"off"}},ne={name:"zappie/typed",files:["**/*.{ts,tsx,mts,cts}"],languageOptions:{parserOptions:{projectService:!0}}},lr={name:"zappie/security",files:P.files,languageOptions:{parser:st},plugins:{zappie:_},rules:Object.fromEntries(pr.map(e=>[`zappie/${e}`,"error"]))};_.configs={recommended:[P,ne,ie],security:[lr],strict:[{...P,rules:{...P.rules,...cr}},ne,ie],"zappie-internal":[P,ne,ie,{name:"zappie/internal-sdk",files:["packages/sdk/src/**/*.{ts,tsx}"],rules:{"zappie/no-direct-api":"off","zappie/no-unlisted-fetch":"off","zappie/no-unlisted-fetch-dynamic":"off"}},{name:"zappie/internal-map-loader",files:["packages/foundations/src/branch-map/loader.ts"],rules:{"zappie/no-external-scripts":"off","zappie/no-global-indirection":"off"}},{name:"zappie/internal-checkout-redirect",files:["packages/sdk/src/checkout/embed.ts","packages/sdk/src/redirect/index.ts"],rules:{"zappie/no-offsite-navigation":"off"}},{name:"zappie/internal-auth-ui",files:["packages/foundations/src/otp/**/*.{ts,tsx}"],rules:{"zappie/no-custom-auth":"off"}},{name:"zappie/internal-money",files:["packages/sdk/src/money.ts","packages/sdk/src/internal/money-math.ts","packages/sdk/src/cart/branch.ts","packages/sdk/src/pricing/index.ts"],rules:{"zappie/no-money-literals":"off","zappie/use-format-money":"off"}},{name:"zappie/internal-overlay",files:["packages/foundations/src/overlay/**/*.{ts,tsx}"],rules:{"zappie/overlay-primitive":"off"}},{name:"zappie/internal-overlay-tests",files:["themes/base/src/cart/cart-review.test.tsx","themes/base/src/cart/core-cart.test.tsx","themes/base/src/cart/fulfilment.test.tsx","themes/base/src/cart/theme-class.test.tsx"],rules:{"zappie/overlay-primitive":"off"}}]};var un=_;export{pr as SECURITY_RULES,ke as TRUSTED_NAVIGATION_ORIGINS,ye as cacheableMenuRoutes,Se as cartViaSdk,Ee as checkoutViaSdk,un as default,he as imagePriority,Te as itemLinkPrefetch,ve as noCustomAuth,Ie as noDirectApi,Ce as noDocumentWrite,Le as noEval,Me as noExternalScripts,Oe as noGlobalIndirection,Ae as noLazyOverlay,ze as noMoneyLiterals,Pe as noOffsiteNavigation,Xe as noRemoteImport,qe as noServerEnvInClient,Be as noTrackingScripts,z as noUnlistedFetch,He as noUnsafeHtml,Ge as overlayPrimitive,Ze as safeExternalLinks,rt as useFormatMoney,it as verifyMarkers};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/rules/cacheable-menu-routes.ts","../src/create-rule.ts","../src/matchers.ts","../src/rules/cart-via-sdk.ts","../src/rules/checkout-via-sdk.ts","../src/rules/image-priority.ts","../src/rules/item-link-prefetch.ts","../src/rules/no-custom-auth.ts","../src/rules/no-direct-api.ts","../src/rules/no-eval.ts","../src/rules/no-external-scripts.ts","../src/rules/no-lazy-overlay.ts","../src/money-rule-utils.ts","../src/rules/no-money-literals.ts","../src/rules/no-server-env-in-client.ts","../src/rules/no-tracking-scripts.ts","../src/rules/no-unlisted-fetch.ts","../src/rules/no-unsafe-html.ts","../src/rules/overlay-primitive.ts","../src/rules/safe-external-links.ts","../src/format-fix.ts","../src/rules/use-format-money.ts","../src/rules/verify-markers.ts"],"sourcesContent":["import parser from \"@typescript-eslint/parser\";\nimport jsxA11y from \"eslint-plugin-jsx-a11y\";\nimport reactHooks from \"eslint-plugin-react-hooks\";\nimport { cacheableMenuRoutes } from \"./rules/cacheable-menu-routes\";\nimport { cartViaSdk } from \"./rules/cart-via-sdk\";\nimport { checkoutViaSdk } from \"./rules/checkout-via-sdk\";\nimport { imagePriority } from \"./rules/image-priority\";\nimport { itemLinkPrefetch } from \"./rules/item-link-prefetch\";\nimport { noCustomAuth } from \"./rules/no-custom-auth\";\nimport { noDirectApi } from \"./rules/no-direct-api\";\nimport { noEval } from \"./rules/no-eval\";\nimport { noExternalScripts } from \"./rules/no-external-scripts\";\nimport { noLazyOverlay } from \"./rules/no-lazy-overlay\";\nimport { noMoneyLiterals } from \"./rules/no-money-literals\";\nimport { noServerEnvInClient } from \"./rules/no-server-env-in-client\";\nimport { noTrackingScripts } from \"./rules/no-tracking-scripts\";\nimport {\n noUnlistedFetch,\n noUnlistedFetchDynamic,\n} from \"./rules/no-unlisted-fetch\";\nimport { noUnsafeHtml } from \"./rules/no-unsafe-html\";\nimport { overlayPrimitive } from \"./rules/overlay-primitive\";\nimport { safeExternalLinks } from \"./rules/safe-external-links\";\nimport { useFormatMoney } from \"./rules/use-format-money\";\nimport { verifyMarkers } from \"./rules/verify-markers\";\n\nconst rules = {\n \"no-direct-api\": noDirectApi,\n \"no-tracking-scripts\": noTrackingScripts,\n \"checkout-via-sdk\": checkoutViaSdk,\n \"no-custom-auth\": noCustomAuth,\n \"no-money-literals\": noMoneyLiterals,\n \"use-format-money\": useFormatMoney,\n \"overlay-primitive\": overlayPrimitive,\n \"cart-via-sdk\": cartViaSdk,\n \"verify-markers\": verifyMarkers,\n \"item-link-prefetch\": itemLinkPrefetch,\n \"image-priority\": imagePriority,\n \"no-lazy-overlay\": noLazyOverlay,\n \"no-unsafe-html\": noUnsafeHtml,\n \"no-eval\": noEval,\n \"no-external-scripts\": noExternalScripts,\n \"safe-external-links\": safeExternalLinks,\n \"no-unlisted-fetch\": noUnlistedFetch,\n \"no-unlisted-fetch-dynamic\": noUnlistedFetchDynamic,\n \"no-server-env-in-client\": noServerEnvInClient,\n \"cacheable-menu-routes\": cacheableMenuRoutes,\n};\n\nexport type ZappieFlatConfig = Record<string, unknown>;\n\nconst enabled: Record<string, unknown> = Object.fromEntries(\n Object.keys(rules).map((name) => [\n `zappie/${name}`,\n name === \"verify-markers\" ||\n name === \"no-unlisted-fetch-dynamic\" ||\n name === \"cacheable-menu-routes\"\n ? \"warn\"\n : \"error\",\n ]),\n);\nconst strictRules = {\n ...enabled,\n \"zappie/verify-markers\": \"error\",\n \"zappie/cacheable-menu-routes\": \"error\",\n \"zappie/no-unlisted-fetch-dynamic\": [\"error\", { dynamicOnly: true }],\n};\nenabled[\"zappie/no-unlisted-fetch-dynamic\"] = [\"warn\", { dynamicOnly: true }];\n\nconst plugin = {\n meta: { name: \"eslint-plugin-zappie\", version: \"0.0.0\" },\n rules,\n configs: {} as Record<string, ZappieFlatConfig[]>,\n};\n\nconst base = {\n name: \"zappie/rules\",\n files: [\"**/*.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\"],\n languageOptions: { parser },\n plugins: { zappie: plugin, \"jsx-a11y\": jsxA11y, \"react-hooks\": reactHooks },\n rules: {\n ...jsxA11y.flatConfigs.recommended.rules,\n \"react-hooks/rules-of-hooks\": \"error\",\n ...enabled,\n },\n};\nconst searchDialogs = {\n name: \"zappie/search-dialogs\",\n files: [\"**/search/**/*.{jsx,tsx}\", \"**/*search*.{jsx,tsx}\"],\n rules: { \"jsx-a11y/no-autofocus\": \"off\" },\n};\n\n// JavaScript files (eslint.config.mjs among them) usually sit outside the\n// tsconfig, where the project service refuses to parse them. They get the\n// syntactic money checks only.\nconst typed = {\n name: \"zappie/typed\",\n files: [\"**/*.{ts,tsx,mts,cts}\"],\n languageOptions: { parserOptions: { projectService: true } },\n};\n\nplugin.configs = {\n recommended: [base, typed, searchDialogs],\n strict: [\n { ...base, rules: { ...base.rules, ...strictRules } },\n typed,\n searchDialogs,\n ],\n \"zappie-internal\": [\n base,\n typed,\n searchDialogs,\n {\n name: \"zappie/internal-sdk\",\n files: [\"packages/sdk/src/**/*.{ts,tsx}\"],\n rules: {\n \"zappie/no-direct-api\": \"off\",\n \"zappie/no-unlisted-fetch\": \"off\",\n \"zappie/no-unlisted-fetch-dynamic\": \"off\",\n },\n },\n {\n name: \"zappie/internal-map-loader\",\n files: [\"packages/foundations/src/branch-map/loader.ts\"],\n rules: { \"zappie/no-external-scripts\": \"off\" },\n },\n {\n name: \"zappie/internal-auth-ui\",\n files: [\"packages/foundations/src/otp/**/*.{ts,tsx}\"],\n rules: { \"zappie/no-custom-auth\": \"off\" },\n },\n {\n name: \"zappie/internal-money\",\n files: [\n \"packages/sdk/src/money.ts\",\n \"packages/sdk/src/internal/money-math.ts\",\n // Its own arithmetic: importing money-math here splits it out of the core bundle.\n \"packages/sdk/src/cart/branch.ts\",\n // The starting-price rule compares and adds variant and choice prices.\n \"packages/sdk/src/pricing/index.ts\",\n ],\n rules: {\n \"zappie/no-money-literals\": \"off\",\n \"zappie/use-format-money\": \"off\",\n },\n },\n {\n name: \"zappie/internal-overlay\",\n files: [\"packages/foundations/src/overlay/**/*.{ts,tsx}\"],\n rules: { \"zappie/overlay-primitive\": \"off\" },\n },\n {\n name: \"zappie/internal-overlay-tests\",\n files: [\n \"themes/base/src/cart/cart-review.test.tsx\",\n \"themes/base/src/cart/core-cart.test.tsx\",\n \"themes/base/src/cart/fulfilment.test.tsx\",\n \"themes/base/src/cart/theme-class.test.tsx\",\n ],\n rules: { \"zappie/overlay-primitive\": \"off\" },\n },\n ],\n};\n\nexport {\n cacheableMenuRoutes,\n cartViaSdk,\n checkoutViaSdk,\n imagePriority,\n itemLinkPrefetch,\n noCustomAuth,\n noDirectApi,\n noEval,\n noExternalScripts,\n noLazyOverlay,\n noMoneyLiterals,\n noServerEnvInClient,\n noTrackingScripts,\n noUnlistedFetch,\n noUnsafeHtml,\n overlayPrimitive,\n safeExternalLinks,\n useFormatMoney,\n verifyMarkers,\n};\nexport default plugin;\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { minimatch } from \"minimatch\";\nimport { createRule } from \"../create-rule\";\nimport { findVariable, memberName, staticText } from \"../matchers\";\n\nconst pages =\n \"{_index,index,home,menu,item,items,category,categories,catalogue,collection,collections,product,products}\";\nconst extensions = \"{js,jsx,ts,tsx}\";\n// The root route's loader runs for every page, the menu pages included.\nconst menuRoutes = [\n `**/app/root.${extensions}`,\n `**/app/routes/${pages}.${extensions}`,\n `**/app/routes/${pages}.*.${extensions}`,\n `**/app/routes/${pages}/**/*.${extensions}`,\n];\nconst serverExports = new Set([\n \"loader\",\n \"headers\",\n \"middleware\",\n \"unstable_middleware\",\n]);\nconst sessionCalls = new Set([\n \"getCustomer\",\n \"zappieFetch\",\n \"getSession\",\n \"requireCustomer\",\n \"openSealedValue\",\n]);\nconst sessionStoreName = /session/i;\nconst sessionHeaders = new Set([\"cookie\", \"authorization\"]);\nconst sessionRoutes = /\\/_zappie\\/(?:session|api\\/)/;\n\ntype Options = [{ routes?: string[] }];\n\nconst topLevel = (node: TSESTree.Node) =>\n node.parent?.type === \"Program\" ||\n node.parent?.type === \"ExportNamedDeclaration\";\n\n// A route module's own loader, headers or middleware, so a `const loader`\n// nested in another function isn't one.\nfunction exportedName(node: TSESTree.Node): string | undefined {\n if (node.type === \"FunctionDeclaration\" && topLevel(node)) {\n return node.id?.name;\n }\n if (\n node.type === \"VariableDeclarator\" &&\n node.id.type === \"Identifier\" &&\n topLevel(node.parent)\n ) {\n return node.id.name;\n }\n return undefined;\n}\n\ntype Source = Readonly<TSESLint.SourceCode>;\n\nfunction definitionOf(source: Source, node: TSESTree.Identifier) {\n return findVariable(source, node, node.name)?.defs[0];\n}\n\n// `headers.get()` after `const { headers } = request`, `{ headers: h }`,\n// `({ request: { headers } })` or `const h = request.headers`.\nfunction isHeaders(source: Source, node: TSESTree.Node): boolean {\n if (node.type === \"MemberExpression\") {\n return memberName(node) === \"headers\";\n }\n if (node.type !== \"Identifier\") {\n return false;\n }\n if (node.name === \"headers\") {\n return true;\n }\n const definition = definitionOf(source, node);\n if (!definition) {\n return false;\n }\n let binding: TSESTree.Node = definition.name;\n while (binding.parent?.type === \"AssignmentPattern\") {\n binding = binding.parent;\n }\n if (\n binding.parent?.type === \"Property\" &&\n binding.parent.value === binding &&\n !binding.parent.computed &&\n binding.parent.key.type === \"Identifier\" &&\n binding.parent.key.name === \"headers\"\n ) {\n return true;\n }\n return (\n definition.node.type === \"VariableDeclarator\" &&\n definition.node.id === definition.name &&\n definition.node.init?.type === \"MemberExpression\" &&\n memberName(definition.node.init) === \"headers\"\n );\n}\n\nconst storeType = (annotation: TSESTree.TypeNode | undefined) =>\n annotation?.type === \"TSTypeReference\" &&\n annotation.typeName.type === \"Identifier\" &&\n annotation.typeName.name.endsWith(\"SessionStore\");\n\nconst createsStore = (node: TSESTree.Node | null | undefined) =>\n node?.type === \"CallExpression\" &&\n node.callee.type === \"Identifier\" &&\n /SessionStore$/.test(node.callee.name);\n\n// `.get()` on a SessionStore: one named for sessions, created by a\n// `*SessionStore()` factory, or typed as a SessionStore.\nfunction isSessionStore(source: Source, node: TSESTree.Node): boolean {\n if (createsStore(node)) {\n return true;\n }\n if (node.type === \"MemberExpression\") {\n return sessionStoreName.test(memberName(node) ?? \"\");\n }\n if (node.type !== \"Identifier\") {\n return false;\n }\n if (sessionStoreName.test(node.name)) {\n return true;\n }\n const definition = definitionOf(source, node);\n if (!definition) {\n return false;\n }\n const declared = definition.name as TSESTree.Identifier;\n return (\n storeType(declared.typeAnnotation?.typeAnnotation) ||\n (definition.node.type === \"VariableDeclarator\" &&\n definition.node.id === declared &&\n createsStore(definition.node.init))\n );\n}\n\nfunction calleeName(node: TSESTree.CallExpression): string | undefined {\n if (node.callee.type === \"Identifier\") {\n return node.callee.name;\n }\n return node.callee.type === \"MemberExpression\"\n ? memberName(node.callee)\n : undefined;\n}\n\nexport const cacheableMenuRoutes = createRule<Options, \"sessionRead\">({\n name: \"cacheable-menu-routes\",\n meta: {\n type: \"suggestion\",\n docs: {\n description:\n \"Keep the customer's session out of menu page loaders, so shared caches can keep those pages.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n routes: { type: \"array\", items: { type: \"string\" } },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n sessionRead:\n \"This menu page reads the customer's session on the server, so no shared cache can keep it. Show customer details in the browser with useCustomer() from @zappie/sdk/customer/react.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const filename = context.filename.replaceAll(\"\\\\\", \"/\");\n // dot: a project inside a dot directory, such as a worktree, still matches.\n if (\n !(options.routes ?? menuRoutes).some((pattern) =>\n minimatch(filename, pattern, { dot: true }),\n )\n ) {\n return {};\n }\n const inServerExport = (node: TSESTree.Node) =>\n context.sourceCode\n .getAncestors(node)\n .some((ancestor) => serverExports.has(exportedName(ancestor) ?? \"\"));\n const report = (node: TSESTree.Node) => {\n if (inServerExport(node)) {\n context.report({ node, messageId: \"sessionRead\" });\n }\n };\n return {\n CallExpression(node) {\n const name = calleeName(node);\n if (name && sessionCalls.has(name)) {\n report(node);\n return;\n }\n if (name !== \"get\" || node.callee.type !== \"MemberExpression\") {\n return;\n }\n const target = node.callee.object;\n const header = staticText(node.arguments[0] ?? null)?.toLowerCase();\n if (\n (header !== undefined &&\n sessionHeaders.has(header) &&\n isHeaders(context.sourceCode, target)) ||\n isSessionStore(context.sourceCode, target)\n ) {\n report(node);\n }\n },\n Literal(node) {\n if (typeof node.value === \"string\" && sessionRoutes.test(node.value)) {\n report(node);\n }\n },\n TemplateLiteral(node) {\n if (sessionRoutes.test(staticText(node) ?? \"\")) {\n report(node);\n }\n },\n };\n },\n});\n","import { ESLintUtils } from \"@typescript-eslint/utils\";\n\nexport const createRule = ESLintUtils.RuleCreator(\n (name) => `https://docs.zappie.ai/lint/${name}`,\n);\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { minimatch } from \"minimatch\";\n\nconst endpointPattern =\n /(?:api|accounts|checkout|edge)\\.zappie\\.ai|\\/storefront\\/v1|\\/customer\\/graphql/i;\nconst trackingPattern =\n /googletagmanager\\.com|google-analytics\\.com|connect\\.facebook\\.net|analytics\\.tiktok\\.com|static\\.hotjar\\.com|cdn\\.segment\\.com|plausible\\.io|clarity\\.ms/i;\n\nexport const paymentHostPattern =\n /checkout\\.paystack\\.com|flutterwave|(?:^|\\.)stripe\\.com/i;\n\nexport function staticText(node: TSESTree.Node | null): string | undefined {\n if (node?.type === \"Literal\" && typeof node.value === \"string\") {\n return node.value;\n }\n if (node?.type === \"TemplateLiteral\") {\n return node.quasis\n .map((part) => part.value.cooked ?? part.value.raw)\n .join(\"\");\n }\n return undefined;\n}\n\nexport function memberName(\n node: TSESTree.MemberExpression,\n): string | undefined {\n return !node.computed && node.property.type === \"Identifier\"\n ? node.property.name\n : staticText(node.property);\n}\n\nexport function unwrapExpression(\n node: TSESTree.Expression,\n): TSESTree.Expression {\n return node.type === \"TSAsExpression\" ||\n node.type === \"TSTypeAssertion\" ||\n node.type === \"TSNonNullExpression\"\n ? unwrapExpression(node.expression)\n : node;\n}\n\nexport function findVariable(\n source: Readonly<TSESLint.SourceCode>,\n node: TSESTree.Node,\n name: string,\n): TSESLint.Scope.Variable | undefined {\n for (\n let scope: TSESLint.Scope.Scope | null = source.getScope(node);\n scope;\n scope = scope.upper\n ) {\n const found = scope.set.get(name);\n if (found) return found;\n }\n}\n\nexport function jsxAttribute(\n node: TSESTree.JSXOpeningElement,\n name: string,\n): TSESTree.JSXAttribute | undefined {\n return node.attributes.find(\n (attribute): attribute is TSESTree.JSXAttribute =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.type === \"JSXIdentifier\" &&\n attribute.name.name.toLowerCase() === name.toLowerCase(),\n );\n}\n\nexport function jsxValue(node?: TSESTree.JSXAttribute): string | undefined {\n if (!node?.value) {\n return undefined;\n }\n if (node.value.type === \"Literal\") {\n return typeof node.value.value === \"string\" ? node.value.value : undefined;\n }\n if (node.value.type === \"JSXExpressionContainer\") {\n return staticText(node.value.expression);\n }\n return undefined;\n}\n\nexport const isZappieEndpoint = (value: string) => endpointPattern.test(value);\nexport const isTrackingEndpoint = (value: string) =>\n trackingPattern.test(value);\nexport const isInternalSdkImport = (value: string) =>\n value === \"@zappie/sdk/internal\" || value.startsWith(\"@zappie/sdk/internal/\");\n\nexport function isServerFile(filename: string, patterns: string[]): boolean {\n const path = filename.replaceAll(\"\\\\\", \"/\");\n return patterns.some((pattern) =>\n minimatch(path, pattern, { matchBase: true }),\n );\n}\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\n\nconst cartName = /^(cart|basket|bag)(Items|Lines|Count|Total)?$/i;\nconst storageKey = /cart|basket|bag/i;\n\nfunction calleeName(node: TSESTree.Node): string | undefined {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n if (node.type === \"MemberExpression\" && node.property.type === \"Identifier\") {\n return node.property.name;\n }\n return undefined;\n}\n\nfunction variableName(node: TSESTree.BindingName): string | undefined {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n return node.type === \"ArrayPattern\" && node.elements[0]?.type === \"Identifier\"\n ? node.elements[0].name\n : undefined;\n}\n\nfunction cartInitial(node: TSESTree.CallExpression): boolean {\n const value =\n calleeName(node.callee) === \"useReducer\"\n ? node.arguments[1]\n : node.arguments[0];\n return Boolean(\n value &&\n value.type !== \"SpreadElement\" &&\n (value.type === \"ArrayExpression\" ||\n (value.type === \"Literal\" && typeof value.value === \"number\")),\n );\n}\n\nexport const cartViaSdk = createRule<[], \"cart\">({\n name: \"cart-via-sdk\",\n meta: {\n type: \"problem\",\n docs: { description: \"Keep your cart state in the SDK.\" },\n schema: [],\n messages: {\n cart: \"Use useCart(), useCartLine() or the SDK client cart. Keep cart state and storage in the SDK.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node) {\n const method = calleeName(node.callee);\n const key = node.arguments[0];\n if (\n [\"getItem\", \"setItem\", \"removeItem\", \"open\"].includes(method ?? \"\") &&\n key?.type === \"Literal\" &&\n typeof key.value === \"string\" &&\n storageKey.test(key.value)\n ) {\n context.report({ node, messageId: \"cart\" });\n }\n },\n VariableDeclarator(node) {\n if (node.init?.type !== \"CallExpression\") {\n return;\n }\n const id = variableName(node.id);\n const call = calleeName(node.init.callee);\n if (\n id &&\n cartName.test(id) &&\n [\"useState\", \"useReducer\", \"createContext\"].includes(call ?? \"\") &&\n cartInitial(node.init)\n ) {\n context.report({ node, messageId: \"cart\" });\n }\n if (\n id &&\n /cart/i.test(id) &&\n [\"create\", \"createStore\", \"atom\"].includes(call ?? \"\")\n ) {\n context.report({ node, messageId: \"cart\" });\n }\n },\n };\n },\n});\n","import { createRule } from \"../create-rule\";\nimport { jsxAttribute, jsxValue, paymentHostPattern } from \"../matchers\";\n\nconst autocomplete = new Set([\"cc-number\", \"cc-exp\", \"cc-csc\", \"cc-name\"]);\nconst paymentField = /card.?number|cvv|cvc|expiry/i;\n\nfunction providerImport(value: string): boolean {\n return (\n value.startsWith(\"@paystack/\") ||\n value === \"react-paystack\" ||\n value === \"flutterwave-react-v3\" ||\n value.startsWith(\"@stripe/\")\n );\n}\n\nexport const checkoutViaSdk = createRule<[], \"checkout\">({\n name: \"checkout-via-sdk\",\n meta: {\n type: \"problem\",\n docs: { description: \"Open checkout through the Zappie SDK.\" },\n schema: [],\n messages: {\n checkout:\n \"Use createCheckout().open() from @zappie/sdk/checkout. Let checkout collect payment details.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n ImportDeclaration(node) {\n if (providerImport(node.source.value)) {\n context.report({ node: node.source, messageId: \"checkout\" });\n }\n },\n JSXOpeningElement(node) {\n const tag =\n node.name.type === \"JSXIdentifier\"\n ? node.name.name.toLowerCase()\n : \"\";\n const auto = jsxValue(jsxAttribute(node, \"autocomplete\"));\n const name = jsxValue(jsxAttribute(node, \"name\"));\n const id = jsxValue(jsxAttribute(node, \"id\"));\n const target = jsxValue(\n jsxAttribute(node, tag === \"iframe\" ? \"src\" : \"href\"),\n );\n const cardInput =\n tag === \"input\" &&\n ((auto !== undefined && autocomplete.has(auto.toLowerCase())) ||\n (name !== undefined && paymentField.test(name)) ||\n (id !== undefined && paymentField.test(id)));\n const providerTarget =\n (tag === \"iframe\" || tag === \"a\") &&\n target !== undefined &&\n paymentHostPattern.test(target);\n if (cardInput || providerTarget) {\n context.report({ node, messageId: \"checkout\" });\n }\n },\n };\n },\n});\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { jsxAttribute } from \"../matchers\";\n\ntype Callback = TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;\n\nfunction mappedBy(node: TSESTree.Node) {\n let current: TSESTree.Node | undefined = node;\n while (current?.parent) {\n const parent: TSESTree.Node = current.parent;\n if (\n (parent.type === \"ArrowFunctionExpression\" ||\n parent.type === \"FunctionExpression\") &&\n parent.parent?.type === \"CallExpression\" &&\n parent.parent.callee.type === \"MemberExpression\" &&\n parent.parent.callee.property.type === \"Identifier\" &&\n parent.parent.callee.property.name === \"map\"\n ) {\n return parent;\n }\n current = parent;\n }\n}\n\nfunction firstOnly(source: Readonly<TSESLint.SourceCode>, callback: Callback) {\n const text = source.getText(callback.parent);\n if (/\\.slice\\(\\s*0\\s*,\\s*1\\s*\\)\\.map/.test(text)) {\n return true;\n }\n const index = callback.params[1];\n if (index?.type !== \"Identifier\") {\n return false;\n }\n const first = new RegExp(`${index.name}\\\\s*(?:={2,3}\\\\s*0|<\\\\s*1)`);\n return first.test(source.getText(callback));\n}\n\nexport const imagePriority = createRule<[], \"mapped\" | \"routeLimit\">({\n name: \"image-priority\",\n meta: {\n type: \"problem\",\n docs: { description: \"Reserve priority for the first phone screen.\" },\n schema: [],\n messages: {\n mapped: \"Remove priority from repeated images or limit it to the first.\",\n routeLimit: \"Keep no more than two priority images in a route.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const images: TSESTree.JSXOpeningElement[] = [];\n return {\n JSXOpeningElement(node) {\n const priority = jsxAttribute(node, \"priority\");\n const disabled =\n priority?.value?.type === \"JSXExpressionContainer\" &&\n priority.value.expression.type === \"Literal\" &&\n priority.value.expression.value === false;\n if (\n node.name.type !== \"JSXIdentifier\" ||\n node.name.name !== \"Image\" ||\n !priority ||\n disabled\n ) {\n return;\n }\n images.push(node);\n const callback = mappedBy(node);\n if (callback && !firstOnly(context.sourceCode, callback)) {\n context.report({ node: priority, messageId: \"mapped\" });\n }\n },\n \"Program:exit\"() {\n if (\n /(?:^|\\/)routes?\\/[^/]+\\.[jt]sx$/.test(\n context.filename.replaceAll(\"\\\\\", \"/\"),\n ) &&\n images.length > 2\n ) {\n for (const node of images.slice(2)) {\n context.report({ node, messageId: \"routeLimit\" });\n }\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { jsxAttribute, jsxValue } from \"../matchers\";\n\nfunction targetsItem(attribute?: TSESTree.JSXAttribute) {\n const expression =\n attribute?.value?.type === \"JSXExpressionContainer\"\n ? attribute.value.expression\n : undefined;\n if (\n expression?.type === \"CallExpression\" &&\n expression.callee.type === \"Identifier\" &&\n expression.callee.name === \"itemHref\"\n ) {\n return true;\n }\n const target = jsxValue(attribute);\n return target !== undefined && /^\\/item(?:\\/|$)/.test(target);\n}\n\nexport const itemLinkPrefetch = createRule<[], \"prefetch\">({\n name: \"item-link-prefetch\",\n meta: {\n type: \"problem\",\n docs: { description: \"Prefetch item routes before shoppers tap.\" },\n schema: [],\n messages: {\n prefetch: 'Add prefetch=\"viewport\" so this item route is ready to tap.',\n },\n },\n defaultOptions: [],\n create(context) {\n const links = new Set<string>();\n return {\n ImportDeclaration(node) {\n if (![\"react-router\", \"react-router-dom\"].includes(node.source.value)) {\n return;\n }\n for (const item of node.specifiers) {\n if (\n item.type === \"ImportSpecifier\" &&\n item.imported.type === \"Identifier\" &&\n [\"Link\", \"NavLink\"].includes(item.imported.name)\n ) {\n links.add(item.local.name);\n }\n }\n },\n JSXOpeningElement(node) {\n if (\n node.name.type === \"JSXIdentifier\" &&\n links.has(node.name.name) &&\n targetsItem(jsxAttribute(node, \"to\")) &&\n !jsxAttribute(node, \"prefetch\")\n ) {\n context.report({ node, messageId: \"prefetch\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { isServerFile, jsxAttribute, jsxValue, staticText } from \"../matchers\";\n\ntype Options = [{ serverFiles?: string[] }];\nconst defaults = [\"**/*.server.*\", \"**/server/**\"];\nconst authValue = /otp|verify.?code|access.?token|refresh.?token|id.?token/i;\nconst browserStorage = new Set([\"localStorage\", \"sessionStorage\"]);\nconst globals = new Set([\"window\", \"globalThis\", \"self\"]);\n\nfunction isStorage(node: TSESTree.Node): boolean {\n if (node.type === \"Identifier\") {\n return browserStorage.has(node.name);\n }\n return (\n node.type === \"MemberExpression\" &&\n !node.computed &&\n node.object.type === \"Identifier\" &&\n globals.has(node.object.name) &&\n node.property.type === \"Identifier\" &&\n browserStorage.has(node.property.name)\n );\n}\n\nfunction memberKey(node: TSESTree.MemberExpression): string | undefined {\n if (!node.computed && node.property.type === \"Identifier\") {\n return node.property.name;\n }\n return staticText(node.property);\n}\n\nfunction authImport(value: string): \"server\" | \"all\" | undefined {\n if (value === \"jose\" || value === \"jsonwebtoken\") {\n return \"server\";\n }\n if (\n value === \"next-auth\" ||\n value.startsWith(\"next-auth/\") ||\n value.startsWith(\"@auth/\") ||\n value === \"better-auth\" ||\n value.startsWith(\"better-auth/\") ||\n value === \"lucia\" ||\n value.startsWith(\"@clerk/\") ||\n value === \"firebase/auth\" ||\n value.startsWith(\"@supabase/auth-\")\n ) {\n return \"all\";\n }\n return undefined;\n}\n\nexport const noCustomAuth = createRule<Options, \"auth\">({\n name: \"no-custom-auth\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Sign customers in through the Zappie SDK.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n serverFiles: {\n type: \"array\",\n items: { type: \"string\" },\n uniqueItems: true,\n },\n },\n additionalProperties: false,\n },\n ],\n messages: {\n auth: \"Use createCustomer().signIn() from @zappie/sdk/customer to sign customers in.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const server = isServerFile(\n context.filename,\n options.serverFiles ?? defaults,\n );\n return {\n ImportDeclaration(node) {\n const kind = authImport(node.source.value);\n if (kind === \"all\" || (kind === \"server\" && !server)) {\n context.report({ node: node.source, messageId: \"auth\" });\n }\n },\n JSXOpeningElement(node) {\n if (\n node.name.type !== \"JSXIdentifier\" ||\n node.name.name.toLowerCase() !== \"input\"\n ) {\n return;\n }\n const type = jsxValue(jsxAttribute(node, \"type\"));\n const auto = jsxValue(jsxAttribute(node, \"autocomplete\"));\n if (\n type?.toLowerCase() === \"password\" ||\n (auto !== undefined &&\n [\"one-time-code\", \"current-password\", \"new-password\"].includes(\n auto.toLowerCase(),\n ))\n ) {\n context.report({ node, messageId: \"auth\" });\n }\n },\n CallExpression(node) {\n if (\n node.callee.type !== \"MemberExpression\" ||\n !isStorage(node.callee.object)\n ) {\n return;\n }\n const first = node.arguments[0];\n const value =\n first?.type === \"Identifier\" ? first.name : staticText(first ?? null);\n if (value && authValue.test(value)) {\n context.report({ node, messageId: \"auth\" });\n }\n },\n AssignmentExpression(node) {\n if (\n node.left.type === \"MemberExpression\" &&\n isStorage(node.left.object)\n ) {\n const key = memberKey(node.left);\n if (key && authValue.test(key)) {\n context.report({ node, messageId: \"auth\" });\n }\n return;\n }\n const cookie =\n node.left.type === \"MemberExpression\" &&\n node.left.object.type === \"Identifier\" &&\n node.left.object.name === \"document\" &&\n node.left.property.type === \"Identifier\" &&\n node.left.property.name === \"cookie\";\n const value = staticText(node.right);\n if (cookie && value && authValue.test(value)) {\n context.report({ node, messageId: \"auth\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { isInternalSdkImport, isZappieEndpoint, staticText } from \"../matchers\";\n\ntype Message = \"direct\" | \"internal\" | \"storefront\" | \"checkout\" | \"customer\";\n\nfunction message(value: string): Message {\n if (/checkout\\.zappie\\.ai|\\/checkout(?:\\/|$)/i.test(value)) {\n return \"checkout\";\n }\n if (/accounts\\.zappie\\.ai|\\/customer\\/graphql/i.test(value)) {\n return \"customer\";\n }\n if (/\\/storefront\\/v1/i.test(value)) {\n return \"storefront\";\n }\n return \"direct\";\n}\n\nexport const noDirectApi = createRule<[], Message>({\n name: \"no-direct-api\",\n meta: {\n type: \"problem\",\n docs: { description: \"Call Zappie through the SDK.\" },\n schema: [],\n messages: {\n direct:\n \"Call the matching public @zappie/sdk client to reach this Zappie endpoint.\",\n internal:\n \"Use a public SDK entry. Only Zappie-owned packages can import @zappie/sdk/internal.\",\n storefront:\n \"Use createZappie(config).store or .menu to read storefront data.\",\n checkout: \"Use createCheckout().open() from @zappie/sdk/checkout.\",\n customer: \"Use createCustomer() from @zappie/sdk/customer.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const inspect = (node: TSESTree.Literal | TSESTree.TemplateLiteral) => {\n if (node.parent.type === \"ImportDeclaration\") {\n return;\n }\n const value = staticText(node);\n if (value && isZappieEndpoint(value)) {\n context.report({ node, messageId: message(value) });\n }\n };\n return {\n Literal: inspect,\n TemplateLiteral: inspect,\n ImportDeclaration(node) {\n if (isInternalSdkImport(node.source.value)) {\n context.report({ node: node.source, messageId: \"internal\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { staticText } from \"../matchers\";\n\nfunction globalCallName(node: TSESTree.Expression): string | undefined {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n if (node.type === \"SequenceExpression\") {\n const last = node.expressions.at(-1);\n return last ? globalCallName(last) : undefined;\n }\n if (\n node.type === \"MemberExpression\" &&\n node.object.type === \"Identifier\" &&\n [\"window\", \"globalThis\"].includes(node.object.name)\n ) {\n if (!node.computed && node.property.type === \"Identifier\") {\n return node.property.name;\n }\n return staticText(node.property);\n }\n return undefined;\n}\n\nexport const noEval = createRule<[], \"eval\">({\n name: \"no-eval\",\n meta: {\n type: \"problem\",\n docs: { description: \"Do not execute strings as code.\" },\n schema: [],\n messages: {\n eval: \"Remove code generated from a string. Ship executable code in the storefront bundle.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n CallExpression(node) {\n const name = globalCallName(node.callee);\n if (name === \"eval\" || name === \"Function\") {\n context.report({ node, messageId: \"eval\" });\n return;\n }\n if (\n [\"setTimeout\", \"setInterval\"].includes(name ?? \"\") &&\n staticText(node.arguments[0] ?? null) !== undefined\n ) {\n context.report({ node, messageId: \"eval\" });\n }\n },\n NewExpression(node) {\n if (globalCallName(node.callee) === \"Function\") {\n context.report({ node, messageId: \"eval\" });\n }\n },\n };\n },\n});\n","import { createRule } from \"../create-rule\";\nimport {\n isTrackingEndpoint,\n jsxAttribute,\n jsxValue,\n staticText,\n} from \"../matchers\";\n\nconst external = (value?: string) =>\n Boolean(value && /^(?:[a-z][a-z\\d+.-]*:)?\\/\\//i.test(value));\n\nconst documentObject = (\n node: import(\"@typescript-eslint/utils\").TSESTree.Node,\n) =>\n (node.type === \"Identifier\" && node.name === \"document\") ||\n (node.type === \"MemberExpression\" &&\n node.object.type === \"Identifier\" &&\n [\"window\", \"globalThis\"].includes(node.object.name) &&\n ((!node.computed &&\n node.property.type === \"Identifier\" &&\n node.property.name === \"document\") ||\n staticText(node.property) === \"document\"));\n\nexport const noExternalScripts = createRule<[], \"externalScript\">({\n name: \"no-external-scripts\",\n meta: {\n type: \"problem\",\n docs: { description: \"Ship scripts in the storefront bundle.\" },\n schema: [],\n messages: {\n externalScript:\n \"Remove the external script. Install reviewed code as a package so it ships in the storefront bundle.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node) {\n if (node.name.type !== \"JSXIdentifier\") {\n return;\n }\n const element = node.name.name.toLowerCase();\n if (element === \"script\") {\n const attribute = jsxAttribute(node, \"src\");\n const src = jsxValue(attribute);\n const dynamic =\n attribute?.value?.type === \"JSXExpressionContainer\" &&\n !(\n attribute.value.expression.type === \"Literal\" ||\n (attribute.value.expression.type === \"TemplateLiteral\" &&\n attribute.value.expression.expressions.length === 0)\n );\n if (\n attribute &&\n (dynamic ||\n src === undefined ||\n (external(src) && !isTrackingEndpoint(src)))\n ) {\n context.report({ node, messageId: \"externalScript\" });\n }\n return;\n }\n if (element !== \"link\") {\n return;\n }\n const rel = jsxValue(jsxAttribute(node, \"rel\"))?.toLowerCase();\n const as = jsxValue(jsxAttribute(node, \"as\"))?.toLowerCase();\n const href = jsxValue(jsxAttribute(node, \"href\"));\n if (\n ((rel === \"preload\" && as === \"script\") || rel === \"modulepreload\") &&\n external(href) &&\n !isTrackingEndpoint(href ?? \"\")\n ) {\n context.report({ node, messageId: \"externalScript\" });\n }\n },\n CallExpression(node) {\n if (\n node.callee.type === \"MemberExpression\" &&\n !node.callee.computed &&\n documentObject(node.callee.object) &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"createElement\" &&\n staticText(node.arguments[0] ?? null)?.toLowerCase() === \"script\"\n ) {\n context.report({ node, messageId: \"externalScript\" });\n return;\n }\n const reactCreateElement =\n node.callee.type === \"MemberExpression\" &&\n !node.callee.computed &&\n node.callee.object.type === \"Identifier\" &&\n node.callee.object.name === \"React\" &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"createElement\";\n if (\n reactCreateElement &&\n staticText(node.arguments[0] ?? null)?.toLowerCase() === \"script\" &&\n node.arguments[1]?.type === \"ObjectExpression\"\n ) {\n const src = node.arguments[1].properties.find(\n (property) =>\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"src\") ||\n staticText(property.key) === \"src\"),\n );\n if (src) {\n context.report({ node, messageId: \"externalScript\" });\n }\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\n\nconst react = new Set([\"react\"]);\n\n// React's own name for its default and namespace import, even without an import (a global build).\nconst conventionalNamespace = \"React\";\n\nexport const noLazyOverlay = createRule<[], \"lazy\" | \"suspense\">({\n name: \"no-lazy-overlay\",\n meta: {\n type: \"problem\",\n docs: {\n description:\n \"Load overlays with deferred() from @zappie/foundations, not React.lazy or Suspense.\",\n },\n schema: [],\n messages: {\n lazy: \"Load this component with deferred() from @zappie/foundations. React.lazy suspends, and React holds a suspended reveal back for about 300 ms, so the overlay opens late.\",\n suspense:\n \"Remove Suspense and load the component with deferred() from @zappie/foundations. It renders as soon as its code arrives and never suspends.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const lazyNames = new Set<string>();\n const suspenseNames = new Set<string>();\n const namespaces = new Set<string>([conventionalNamespace]);\n\n const fromNamespace = (\n object: TSESTree.Node,\n property: TSESTree.Node,\n wanted: string,\n ) =>\n object.type === \"Identifier\" &&\n namespaces.has(object.name) &&\n property.type === \"Identifier\" &&\n property.name === wanted;\n\n return {\n ImportDeclaration(node) {\n if (!react.has(node.source.value)) {\n return;\n }\n for (const specifier of node.specifiers) {\n if (specifier.type !== \"ImportSpecifier\") {\n namespaces.add(specifier.local.name);\n continue;\n }\n const imported =\n specifier.imported.type === \"Identifier\"\n ? specifier.imported.name\n : specifier.imported.value;\n if (imported === \"lazy\") {\n lazyNames.add(specifier.local.name);\n } else if (imported === \"Suspense\") {\n suspenseNames.add(specifier.local.name);\n }\n }\n },\n CallExpression(node) {\n const callee = node.callee;\n if (\n (callee.type === \"Identifier\" && lazyNames.has(callee.name)) ||\n (callee.type === \"MemberExpression\" &&\n !callee.computed &&\n fromNamespace(callee.object, callee.property, \"lazy\"))\n ) {\n context.report({ node, messageId: \"lazy\" });\n }\n },\n JSXOpeningElement(node) {\n const name = node.name;\n if (\n (name.type === \"JSXIdentifier\" && suspenseNames.has(name.name)) ||\n (name.type === \"JSXMemberExpression\" &&\n name.object.type === \"JSXIdentifier\" &&\n namespaces.has(name.object.name) &&\n name.property.name === \"Suspense\")\n ) {\n context.report({ node, messageId: \"suspense\" });\n }\n },\n };\n },\n});\n","import {\n ESLintUtils,\n type TSESLint,\n type TSESTree,\n} from \"@typescript-eslint/utils\";\nimport type ts from \"typescript\";\n\nconst moneyLiteralPattern =\n /[₦€£]\\s?\\d|\\$\\s?\\d|NGN\\s?\\d|\\d+(?:\\.\\d{2})?\\s?(?:naira|NGN)/i;\n\nexport function isMoneyLiteral(value: string): boolean {\n return value.trim() !== \"$1\" && moneyLiteralPattern.test(value);\n}\n\nexport function memberName(node: TSESTree.Node): string | undefined {\n if (node.type !== \"MemberExpression\") {\n return undefined;\n }\n if (!node.computed && node.property.type === \"Identifier\") {\n return node.property.name;\n }\n if (node.computed && node.property.type === \"Literal\") {\n return typeof node.property.value === \"string\"\n ? node.property.value\n : undefined;\n }\n return undefined;\n}\n\nexport const isAmountMinor = (node: TSESTree.Node) =>\n memberName(node) === \"amountMinor\";\n\nexport function amountOwner(\n node: TSESTree.Node,\n): TSESTree.Expression | undefined {\n return node.type === \"MemberExpression\" && isAmountMinor(node)\n ? node.object\n : undefined;\n}\n\nexport function dividedMinorOwner(\n node: TSESTree.Node,\n): TSESTree.Expression | undefined {\n if (\n node.type !== \"BinaryExpression\" ||\n node.operator !== \"/\" ||\n node.right.type !== \"Literal\" ||\n node.right.value !== 100\n ) {\n return undefined;\n }\n return amountOwner(node.left);\n}\n\ntype Services = ReturnType<typeof ESLintUtils.getParserServices>;\n\nexport function parserServices<\n MessageIds extends string,\n Options extends readonly unknown[],\n>(context: TSESLint.RuleContext<MessageIds, Options>): Services | undefined {\n try {\n return ESLintUtils.getParserServices(context, true);\n } catch {\n return undefined;\n }\n}\n\nfunction declaredBySdkMoney(symbol: ts.Symbol): boolean {\n if (!symbol.getName().includes(\"MoneyBrand\")) {\n return false;\n }\n return (symbol.getDeclarations() ?? []).some((declaration) => {\n const path = declaration.getSourceFile().fileName.replaceAll(\"\\\\\", \"/\");\n return (\n path.endsWith(\"/packages/sdk/src/money.ts\") ||\n /\\/node_modules\\/@zappie\\/sdk\\/.*\\.d\\.ts$/.test(path)\n );\n });\n}\n\nexport function isSdkMoney(\n services: Services | undefined,\n node: TSESTree.Node,\n): boolean {\n if (!services?.program) {\n return false;\n }\n const checker = services.program.getTypeChecker();\n const tsNode = services.esTreeNodeToTSNodeMap.get(node);\n const type = checker.getTypeAtLocation(tsNode);\n const types = type.isUnionOrIntersection() ? type.types : [type];\n return types.some((part) =>\n part.getProperties().some((property) => declaredBySdkMoney(property)),\n );\n}\n\nexport function currencyStyle(node: TSESTree.Node | undefined): boolean {\n if (node?.type !== \"ObjectExpression\") {\n return false;\n }\n return node.properties.some(\n (property) =>\n property.type === \"Property\" &&\n !property.computed &&\n ((property.key.type === \"Identifier\" && property.key.name === \"style\") ||\n (property.key.type === \"Literal\" && property.key.value === \"style\")) &&\n property.value.type === \"Literal\" &&\n property.value.value === \"currency\",\n );\n}\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport {\n dividedMinorOwner,\n isAmountMinor,\n isMoneyLiteral,\n isSdkMoney,\n memberName,\n parserServices,\n} from \"../money-rule-utils\";\n\nexport const noMoneyLiterals = createRule<\n [],\n \"arithmetic\" | \"literal\" | \"scale\"\n>({\n name: \"no-money-literals\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Use SDK prices and totals in your storefront.\",\n },\n schema: [],\n messages: {\n arithmetic:\n \"Use cart.subtotal, line.lineSubtotal, quote.subtotal, quote.lines totals or quote.total. Let the SDK calculate amounts.\",\n literal:\n \"Render SDK Money with format.money() or <Money> instead of a hard-coded amount.\",\n scale:\n \"Use format.money() to display amountMinor. Currencies use 0, 2, 3 or 4 minor-unit digits.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const services = parserServices(context);\n const arithmetic = (node: TSESTree.Node) =>\n isAmountMinor(node) || isSdkMoney(services, node);\n return {\n Literal(node) {\n if (\n typeof node.value === \"string\" &&\n node.parent.type !== \"ImportDeclaration\" &&\n isMoneyLiteral(node.value)\n ) {\n context.report({ node, messageId: \"literal\" });\n }\n },\n JSXText(node) {\n if (isMoneyLiteral(node.value)) {\n context.report({ node, messageId: \"literal\" });\n }\n },\n BinaryExpression(node) {\n if (![\"+\", \"-\", \"*\", \"/\"].includes(node.operator)) {\n return;\n }\n if (\n dividedMinorOwner(node) &&\n node.parent.type === \"MemberExpression\" &&\n node.parent.object === node &&\n memberName(node.parent) === \"toFixed\"\n ) {\n return;\n }\n if (arithmetic(node.left) || arithmetic(node.right)) {\n context.report({ node, messageId: \"arithmetic\" });\n }\n },\n TemplateLiteral(node) {\n for (const quasi of node.quasis) {\n if (isMoneyLiteral(quasi.value.cooked ?? quasi.value.raw)) {\n context.report({ node: quasi, messageId: \"literal\" });\n }\n }\n },\n CallExpression(node) {\n if (\n node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"toFixed\" &&\n node.arguments[0]?.type === \"Literal\" &&\n node.arguments[0].value === 2 &&\n dividedMinorOwner(node.callee.object)\n ) {\n context.report({ node, messageId: \"scale\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { isServerFile, memberName, staticText } from \"../matchers\";\n\nconst serverFiles = [\n \"**/*.server.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\",\n \"**/app/.server/**\",\n \"**/app/server.ts\",\n \"**/test/**\",\n \"**/tests/**\",\n \"**/__tests__/**\",\n \"**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\",\n \"**/*.config.{js,ts,mjs,cjs,mts,cts}\",\n];\nconst vitePublic = new Set([\"MODE\", \"DEV\", \"PROD\", \"SSR\", \"BASE_URL\"]);\ntype EnvKind = \"process\" | \"vite\";\n\nfunction namedFunction(node: TSESTree.Node): string | undefined {\n if (node.type === \"FunctionDeclaration\") {\n return node.id?.name;\n }\n if (\n node.type !== \"FunctionExpression\" &&\n node.type !== \"ArrowFunctionExpression\"\n ) {\n return undefined;\n }\n const parent = node.parent;\n if (parent.type === \"VariableDeclarator\" && parent.id.type === \"Identifier\") {\n return parent.id.name;\n }\n if (parent.type === \"Property\") {\n if (parent.key.type === \"Identifier\") {\n return parent.key.name;\n }\n return staticText(parent.key);\n }\n return undefined;\n}\n\nfunction directEnv(node: TSESTree.Node): EnvKind | undefined {\n if (\n node.type === \"MemberExpression\" &&\n node.object.type === \"Identifier\" &&\n node.object.name === \"process\" &&\n memberName(node) === \"env\"\n ) {\n return \"process\";\n }\n if (\n node.type === \"MemberExpression\" &&\n node.object.type === \"MetaProperty\" &&\n node.object.meta.name === \"import\" &&\n node.object.property.name === \"meta\" &&\n memberName(node) === \"env\"\n ) {\n return \"vite\";\n }\n return undefined;\n}\n\nfunction contextCloudflare(node: TSESTree.Node): boolean {\n if (node.type !== \"MemberExpression\" || memberName(node) !== \"cloudflare\") {\n return false;\n }\n return (\n (node.object.type === \"Identifier\" && node.object.name === \"context\") ||\n (node.object.type === \"MemberExpression\" &&\n memberName(node.object) === \"context\")\n );\n}\n\n// Next.js inlines a NEXT_PUBLIC_ value into the client build only where the code reads\n// process.env.NAME directly, so a destructured or aliased read stays forbidden.\nfunction forbidden(\n kind: EnvKind,\n key: string | undefined,\n direct = false,\n): boolean {\n if (kind === \"process\") {\n return (\n key !== \"NODE_ENV\" && !(direct && key?.startsWith(\"NEXT_PUBLIC_ZAPPIE_\"))\n );\n }\n return (\n key === undefined ||\n (!key.startsWith(\"VITE_ZAPPIE_\") && !vitePublic.has(key))\n );\n}\n\nexport const noServerEnvInClient = createRule<[], \"serverEnv\">({\n name: \"no-server-env-in-client\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Read server environment values only in server code.\",\n },\n schema: [],\n messages: {\n serverEnv:\n \"Move this environment read into a loader, action, *.server.ts file, app/.server/ or app/server.ts so it cannot reach the client bundle.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const filename = context.filename.replaceAll(\"\\\\\", \"/\");\n if (\n isServerFile(filename, serverFiles) ||\n /(?:^|\\/)(?:test|tests|__tests__)(?:\\/|$)/.test(filename) ||\n /\\.(?:test|spec|config)\\.[cm]?[jt]sx?$/.test(filename)\n ) {\n return {};\n }\n const aliases = new Map<string, EnvKind>();\n const cloudflareAliases = new Set<string>();\n const serverBody = (node: TSESTree.Node) =>\n context.sourceCode\n .getAncestors(node)\n .some((ancestor) =>\n [\"loader\", \"action\"].includes(namedFunction(ancestor) ?? \"\"),\n );\n const kindOf = (node: TSESTree.Node): EnvKind | undefined => {\n const direct = directEnv(node);\n if (direct) {\n return direct;\n }\n return node.type === \"Identifier\" ? aliases.get(node.name) : undefined;\n };\n const recordCloudflarePattern = (pattern: TSESTree.BindingName) => {\n if (pattern.type !== \"ObjectPattern\") {\n return;\n }\n for (const property of pattern.properties) {\n if (\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"cloudflare\") ||\n staticText(property.key) === \"cloudflare\") &&\n property.value.type === \"Identifier\"\n ) {\n cloudflareAliases.add(property.value.name);\n }\n if (\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"context\") ||\n staticText(property.key) === \"context\")\n ) {\n recordCloudflarePattern(property.value as TSESTree.BindingName);\n }\n }\n };\n const inspectParameters = (\n node:\n | TSESTree.ArrowFunctionExpression\n | TSESTree.FunctionDeclaration\n | TSESTree.FunctionExpression,\n ) => {\n if (\n serverBody(node) ||\n [\"loader\", \"action\"].includes(namedFunction(node) ?? \"\")\n ) {\n return;\n }\n for (const parameter of node.params) {\n if (parameter.type !== \"RestElement\") {\n recordCloudflarePattern(parameter as TSESTree.BindingName);\n }\n }\n };\n return {\n ArrowFunctionExpression: inspectParameters,\n FunctionDeclaration: inspectParameters,\n FunctionExpression: inspectParameters,\n VariableDeclarator(node) {\n if (serverBody(node) || !node.init) {\n return;\n }\n const kind = kindOf(node.init);\n if (node.id.type === \"Identifier\" && kind) {\n aliases.set(node.id.name, kind);\n return;\n }\n if (node.id.type === \"ObjectPattern\" && kind) {\n for (const property of node.id.properties) {\n const key =\n property.type === \"Property\"\n ? property.key.type === \"Identifier\"\n ? property.key.name\n : staticText(property.key)\n : undefined;\n if (forbidden(kind, key)) {\n context.report({ node: property, messageId: \"serverEnv\" });\n }\n }\n return;\n }\n if (node.id.type === \"ObjectPattern\" && contextCloudflare(node.init)) {\n for (const property of node.id.properties) {\n if (\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"env\") ||\n staticText(property.key) === \"env\")\n ) {\n context.report({ node: property, messageId: \"serverEnv\" });\n }\n }\n }\n },\n MemberExpression(node) {\n if (serverBody(node)) {\n return;\n }\n const kind = kindOf(node.object);\n if (\n kind &&\n forbidden(kind, memberName(node), directEnv(node.object) === kind)\n ) {\n context.report({ node, messageId: \"serverEnv\" });\n return;\n }\n if (\n memberName(node) === \"env\" &&\n (contextCloudflare(node.object) ||\n (node.object.type === \"Identifier\" &&\n cloudflareAliases.has(node.object.name)))\n ) {\n context.report({ node, messageId: \"serverEnv\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport { isTrackingEndpoint, staticText } from \"../matchers\";\n\nconst imports = [\n \"react-ga4\",\n \"react-facebook-pixel\",\n \"@vercel/analytics\",\n \"posthog-js\",\n];\n\nfunction imported(value: string): boolean {\n return imports.includes(value) || value.startsWith(\"@segment/\");\n}\n\nexport const noTrackingScripts = createRule<[], \"tracking\">({\n name: \"no-tracking-scripts\",\n meta: {\n type: \"problem\",\n docs: { description: \"Forward analytics through Zappie.\" },\n schema: [],\n messages: {\n tracking:\n \"Configure analytics.forward in zappie.config.ts to forward analytics. Remove the tracking script.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const inspect = (node: TSESTree.Literal | TSESTree.TemplateLiteral) => {\n if (node.parent.type === \"ImportDeclaration\") {\n return;\n }\n const value = staticText(node);\n if (value && isTrackingEndpoint(value)) {\n context.report({ node, messageId: \"tracking\" });\n }\n };\n return {\n Literal: inspect,\n TemplateLiteral: inspect,\n ImportDeclaration(node) {\n if (imported(node.source.value)) {\n context.report({ node: node.source, messageId: \"tracking\" });\n }\n },\n CallExpression(node) {\n const callee = node.callee;\n const direct =\n callee.type === \"Identifier\" && [\"gtag\", \"fbq\"].includes(callee.name);\n const dataLayer =\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.object.type === \"Identifier\" &&\n callee.object.name === \"dataLayer\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === \"push\";\n if (direct || dataLayer) {\n context.report({ node, messageId: \"tracking\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport {\n isServerFile,\n isZappieEndpoint,\n memberName,\n staticText,\n} from \"../matchers\";\n\ntype Settings = { zappie?: { outboundAllow?: unknown } };\n\nfunction literal(node: TSESTree.Node | null | undefined): string | undefined {\n const text = staticText(node ?? null);\n if (text !== undefined) return text;\n if (\n node?.type === \"NewExpression\" &&\n node.callee.type === \"Identifier\" &&\n node.callee.name === \"URL\"\n ) {\n return literal(node.arguments[0]);\n }\n return undefined;\n}\n\nfunction hostname(value: string): string | undefined {\n if (!/^(?:https?|wss?):\\/\\//i.test(value) && !value.startsWith(\"//\")) {\n return undefined;\n }\n try {\n return new URL(value, \"https://storefront.invalid\").hostname.toLowerCase();\n } catch {\n return undefined;\n }\n}\n\nfunction allowed(host: string, entries: string[]): boolean {\n return entries.some((entry) => {\n const candidate = entry.toLowerCase();\n return candidate.startsWith(\"*.\")\n ? host.endsWith(candidate.slice(1)) && host !== candidate.slice(2)\n : host === candidate;\n });\n}\n\ntype Options = { dynamicOnly?: boolean };\n\nexport const noUnlistedFetch = createRule<\n [Options],\n \"dynamicRequest\" | \"unlistedRequest\"\n>({\n name: \"no-unlisted-fetch\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"List every external request host in outbound.allow.\",\n },\n schema: [\n {\n type: \"object\",\n properties: { dynamicOnly: { type: \"boolean\" } },\n additionalProperties: false,\n },\n ],\n messages: {\n dynamicRequest:\n \"This request URL is computed. Review its possible hosts and list each external host in zappie.config.ts outbound.allow.\",\n unlistedRequest:\n \"Add {{host}} to zappie.config.ts outbound.allow, or remove this external request.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const filename = context.filename.replaceAll(\"\\\\\", \"/\");\n if (\n isServerFile(filename, [\n \"**/test/**\",\n \"**/tests/**\",\n \"**/__tests__/**\",\n \"**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}\",\n ]) ||\n /(?:^|\\/)(?:test|tests|__tests__)(?:\\/|$)/.test(filename) ||\n /\\.(?:test|spec)\\.[cm]?[jt]sx?$/.test(filename)\n ) {\n return {};\n }\n const configured = (context.settings as Settings | undefined)?.zappie\n ?.outboundAllow;\n const allow = Array.isArray(configured)\n ? configured.filter((value): value is string => typeof value === \"string\")\n : [];\n const xhr = new Set<string>();\n const inspect = (node: TSESTree.Node, target?: TSESTree.Node) => {\n const value = literal(target);\n if (value === undefined) {\n if (options.dynamicOnly) {\n context.report({ node, messageId: \"dynamicRequest\" });\n }\n return;\n }\n if (options.dynamicOnly) {\n return;\n }\n const host = hostname(value);\n if (!host || isZappieEndpoint(value) || allowed(host, allow)) {\n return;\n }\n context.report({ node, messageId: \"unlistedRequest\", data: { host } });\n };\n return {\n VariableDeclarator(node) {\n if (\n node.id.type === \"Identifier\" &&\n node.init?.type === \"NewExpression\" &&\n node.init.callee.type === \"Identifier\" &&\n node.init.callee.name === \"XMLHttpRequest\"\n ) {\n xhr.add(node.id.name);\n }\n },\n CallExpression(node) {\n const fetchCall =\n (node.callee.type === \"Identifier\" && node.callee.name === \"fetch\") ||\n (node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"fetch\" &&\n node.callee.object.type === \"Identifier\" &&\n [\"window\", \"globalThis\"].includes(node.callee.object.name));\n if (fetchCall) {\n inspect(node, node.arguments[0]);\n return;\n }\n if (node.callee.type !== \"MemberExpression\") {\n return;\n }\n const name = memberName(node.callee);\n if (\n name === \"sendBeacon\" &&\n node.callee.object.type === \"Identifier\" &&\n node.callee.object.name === \"navigator\"\n ) {\n inspect(node, node.arguments[0]);\n return;\n }\n if (\n name === \"open\" &&\n ((node.callee.object.type === \"Identifier\" &&\n xhr.has(node.callee.object.name)) ||\n (node.callee.object.type === \"NewExpression\" &&\n node.callee.object.callee.type === \"Identifier\" &&\n node.callee.object.callee.name === \"XMLHttpRequest\"))\n ) {\n inspect(node, node.arguments[1]);\n }\n },\n NewExpression(node) {\n if (\n node.callee.type === \"Identifier\" &&\n [\"WebSocket\", \"EventSource\"].includes(node.callee.name)\n ) {\n inspect(node, node.arguments[0]);\n }\n },\n };\n },\n});\n\nexport const noUnlistedFetchDynamic = {\n ...noUnlistedFetch,\n meta: {\n ...noUnlistedFetch.meta,\n docs: {\n ...noUnlistedFetch.meta.docs,\n url: \"https://docs.zappie.ai/lint/no-unlisted-fetch-dynamic\",\n },\n },\n};\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport {\n findVariable,\n memberName,\n staticText,\n unwrapExpression,\n} from \"../matchers\";\n\nfunction objectHtml(node: TSESTree.ObjectExpression) {\n return node.properties.find(\n (property): property is TSESTree.Property =>\n property.type === \"Property\" &&\n !property.computed &&\n ((property.key.type === \"Identifier\" && property.key.name === \"__html\") ||\n staticText(property.key) === \"__html\"),\n )?.value;\n}\n\nexport const noUnsafeHtml = createRule<[], \"unsafeHtml\">({\n name: \"no-unsafe-html\",\n meta: {\n type: \"problem\",\n docs: { description: \"Sanitize rich text before inserting HTML.\" },\n schema: [],\n messages: {\n unsafeHtml:\n \"Pass the HTML straight through a sanitizer created with createSanitizeRichText from @zappie/foundations/rich-text.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const source = context.sourceCode;\n const isFactory = (node: TSESTree.Identifier): boolean => {\n const binding = findVariable(source, node, node.name);\n return Boolean(\n binding?.defs.some(\n (definition) =>\n definition.type === \"ImportBinding\" &&\n definition.node.type === \"ImportSpecifier\" &&\n definition.node.imported.type === \"Identifier\" &&\n definition.node.imported.name === \"createSanitizeRichText\" &&\n definition.parent?.type === \"ImportDeclaration\" &&\n definition.parent.source.value === \"@zappie/foundations/rich-text\",\n ),\n );\n };\n const isSanitizer = (node: TSESTree.Identifier): boolean => {\n const binding = findVariable(source, node, node.name);\n return Boolean(\n binding?.defs.some((definition) => {\n if (\n definition.type !== \"Variable\" ||\n definition.node.type !== \"VariableDeclarator\"\n ) {\n return false;\n }\n const init = definition.node.init;\n return (\n init?.type === \"CallExpression\" &&\n init.callee.type === \"Identifier\" &&\n isFactory(init.callee)\n );\n }),\n );\n };\n const sanitized = (\n input: TSESTree.Node | null | undefined,\n seen = new Set<TSESLint.Scope.Variable>(),\n ): boolean => {\n if (!input || input.type === \"SpreadElement\") {\n return false;\n }\n const node = unwrapExpression(input as TSESTree.Expression);\n if (node.type === \"Literal\") {\n return node.value === \"\";\n }\n if (node.type === \"ConditionalExpression\") {\n return (\n sanitized(node.consequent, seen) && sanitized(node.alternate, seen)\n );\n }\n if (node.type === \"LogicalExpression\") {\n return sanitized(node.left, seen) && sanitized(node.right, seen);\n }\n if (node.type === \"CallExpression\") {\n if (node.callee.type === \"Identifier\" && isSanitizer(node.callee)) {\n return true;\n }\n return (\n node.callee.type === \"CallExpression\" &&\n node.callee.callee.type === \"Identifier\" &&\n isFactory(node.callee.callee)\n );\n }\n if (node.type !== \"Identifier\") {\n return false;\n }\n const binding = findVariable(source, node, node.name);\n if (!binding || seen.has(binding)) {\n return false;\n }\n const nextSeen = new Set(seen).add(binding);\n for (const definition of binding.defs) {\n if (\n definition.type !== \"Variable\" ||\n definition.node.type !== \"VariableDeclarator\"\n ) {\n continue;\n }\n if (definition.node.id.type === \"Identifier\") {\n return sanitized(definition.node.init, nextSeen);\n }\n if (\n definition.node.id.type !== \"ArrayPattern\" ||\n definition.node.id.elements[0]?.type !== \"Identifier\" ||\n definition.node.id.elements[0].name !== node.name ||\n definition.node.init?.type !== \"CallExpression\" ||\n definition.node.init.callee.type !== \"Identifier\" ||\n definition.node.init.callee.name !== \"useState\"\n ) {\n continue;\n }\n const initial = definition.node.init.arguments[0];\n const setter = definition.node.id.elements[1];\n if (!sanitized(initial, nextSeen) || setter?.type !== \"Identifier\") {\n return false;\n }\n const setterBinding = findVariable(source, setter, setter.name);\n const updates =\n setterBinding?.references.filter(\n (reference) =>\n reference.identifier.parent.type === \"CallExpression\" &&\n reference.identifier.parent.callee === reference.identifier,\n ) ?? [];\n return (\n updates.length > 0 &&\n updates.every((reference) => {\n const call = reference.identifier.parent;\n return (\n call.type === \"CallExpression\" &&\n sanitized(call.arguments[0], nextSeen)\n );\n })\n );\n }\n return false;\n };\n const reportHtmlObject = (\n node: TSESTree.Node,\n value: TSESTree.Node | null | undefined,\n ) => {\n if (value?.type !== \"ObjectExpression\" || !sanitized(objectHtml(value))) {\n context.report({ node, messageId: \"unsafeHtml\" });\n }\n };\n return {\n JSXAttribute(node) {\n if (node.name.type !== \"JSXIdentifier\") {\n return;\n }\n const name = node.name.name.toLowerCase();\n if (\n ![\"dangerouslysetinnerhtml\", \"srcdoc\"].includes(name) ||\n node.value?.type !== \"JSXExpressionContainer\"\n ) {\n return;\n }\n if (name === \"dangerouslysetinnerhtml\") {\n reportHtmlObject(node, node.value.expression);\n } else if (!sanitized(node.value.expression)) {\n context.report({ node, messageId: \"unsafeHtml\" });\n }\n },\n JSXSpreadAttribute(node) {\n if (node.argument.type !== \"ObjectExpression\") {\n return;\n }\n const dangerous = node.argument.properties.find(\n (property): property is TSESTree.Property =>\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"dangerouslySetInnerHTML\") ||\n staticText(property.key) === \"dangerouslySetInnerHTML\"),\n );\n if (dangerous) {\n reportHtmlObject(node, dangerous.value);\n }\n },\n JSXElement(node) {\n if (\n node.openingElement.name.type === \"JSXIdentifier\" &&\n node.openingElement.name.name.toLowerCase() === \"script\"\n ) {\n for (const child of node.children) {\n if (\n child.type === \"JSXExpressionContainer\" &&\n child.expression.type !== \"JSXEmptyExpression\"\n ) {\n context.report({ node: child, messageId: \"unsafeHtml\" });\n }\n }\n }\n },\n AssignmentExpression(node) {\n if (\n node.left.type === \"MemberExpression\" &&\n [\"innerHTML\", \"outerHTML\"].includes(memberName(node.left) ?? \"\") &&\n !sanitized(node.right)\n ) {\n context.report({ node, messageId: \"unsafeHtml\" });\n }\n },\n CallExpression(node) {\n if (\n node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"insertAdjacentHTML\"\n ) {\n if (!sanitized(node.arguments[1])) {\n context.report({ node, messageId: \"unsafeHtml\" });\n }\n return;\n }\n const createElement =\n (node.callee.type === \"Identifier\" &&\n node.callee.name === \"createElement\") ||\n (node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"createElement\" &&\n node.callee.object.type === \"Identifier\" &&\n node.callee.object.name === \"React\");\n if (!createElement) {\n return;\n }\n if (staticText(node.arguments[0] ?? null)?.toLowerCase() === \"script\") {\n for (const child of node.arguments.slice(2)) {\n if (child.type !== \"SpreadElement\") {\n context.report({ node: child, messageId: \"unsafeHtml\" });\n }\n }\n }\n const props = node.arguments[1];\n if (props?.type !== \"ObjectExpression\") {\n return;\n }\n const dangerous = props.properties.find(\n (property): property is TSESTree.Property =>\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" &&\n property.key.name === \"dangerouslySetInnerHTML\") ||\n staticText(property.key) === \"dangerouslySetInnerHTML\"),\n );\n if (dangerous) {\n reportHtmlObject(node, dangerous.value);\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\n\nconst defaults = [\n \"modal\",\n \"sheet\",\n \"drawer\",\n \"dialog\",\n \"item\",\n \"cart\",\n \"cart_sheet\",\n \"cart_edit\",\n \"cart_clear\",\n \"search\",\n \"catalogue_search\",\n \"catalogue_categories\",\n \"product_note\",\n \"modal_id\",\n];\n\nfunction name(node: TSESTree.Node): string | undefined {\n if (node.type === \"Identifier\") {\n return node.name;\n }\n if (node.type === \"MemberExpression\" && node.property.type === \"Identifier\") {\n return node.property.name;\n }\n return undefined;\n}\n\nfunction carriesKey(node: TSESTree.Node, keys: Set<string>): boolean {\n if (node.type === \"Literal\" && typeof node.value === \"string\") {\n return [...keys].some((key) => new RegExp(`[?&]${key}=`).test(node.value));\n }\n if (node.type === \"TemplateLiteral\") {\n return node.quasis.some((part) =>\n carriesKey(\n { ...part, type: \"Literal\", value: part.value.raw } as never,\n keys,\n ),\n );\n }\n if (node.type === \"ObjectExpression\") {\n return node.properties.some(\n (property) =>\n property.type === \"Property\" &&\n ((property.key.type === \"Identifier\" && keys.has(property.key.name)) ||\n (property.key.type === \"Literal\" &&\n typeof property.key.value === \"string\" &&\n keys.has(property.key.value))),\n );\n }\n return false;\n}\n\nexport const overlayPrimitive = createRule<[{ keys?: string[] }], \"overlay\">({\n name: \"overlay-primitive\",\n meta: {\n type: \"problem\",\n docs: { description: \"Use Overlay to keep dialogs and sheets in the URL.\" },\n schema: [\n {\n type: \"object\",\n properties: { keys: { type: \"array\", items: { type: \"string\" } } },\n additionalProperties: false,\n },\n ],\n messages: {\n overlay:\n \"Use Overlay or useOverlay for dialogs and sheets in the URL. They handle Back, Forward and focus restoration.\",\n },\n },\n defaultOptions: [{}],\n create(context, [options]) {\n const keys = new Set([...defaults, ...(options.keys ?? [])]);\n const searchValues = new Set<string>();\n const derivedFromSearch = (node: TSESTree.Node) => {\n const text = context.sourceCode.getText(node);\n return (\n text.includes(\"useSearchParams(\") ||\n [...searchValues].some((value) =>\n new RegExp(`\\\\b${value}\\\\b`).test(text),\n )\n );\n };\n return {\n VariableDeclarator(node) {\n if (\n node.init?.type === \"CallExpression\" &&\n name(node.init.callee) === \"useSearchParams\"\n ) {\n if (node.id.type === \"Identifier\") {\n searchValues.add(node.id.name);\n } else if (\n node.id.type === \"ArrayPattern\" &&\n node.id.elements[0]?.type === \"Identifier\"\n ) {\n searchValues.add(node.id.elements[0].name);\n }\n } else if (\n node.id.type === \"Identifier\" &&\n node.init &&\n derivedFromSearch(node.init)\n ) {\n searchValues.add(node.id.name);\n }\n },\n CallExpression(node) {\n const callee = name(node.callee);\n const navigation =\n callee === \"setSearchParams\" ||\n callee === \"navigate\" ||\n callee === \"pushState\" ||\n callee === \"replaceState\" ||\n (node.callee.type === \"CallExpression\" &&\n name(node.callee.callee) === \"useNavigate\");\n if (\n navigation &&\n node.arguments.some(\n (argument) =>\n argument.type !== \"SpreadElement\" && carriesKey(argument, keys),\n )\n ) {\n context.report({ node, messageId: \"overlay\" });\n }\n },\n JSXOpeningElement(node) {\n const dialog =\n node.name.type === \"JSXIdentifier\" && node.name.name === \"dialog\";\n const role = node.attributes.some(\n (attribute) =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.name === \"role\" &&\n attribute.value?.type === \"Literal\" &&\n attribute.value.value === \"dialog\",\n );\n const open = node.attributes.find(\n (attribute) =>\n attribute.type === \"JSXAttribute\" && attribute.name.name === \"open\",\n );\n if (\n (dialog || role) &&\n open?.type === \"JSXAttribute\" &&\n open.value?.type === \"JSXExpressionContainer\" &&\n derivedFromSearch(open.value.expression)\n ) {\n context.report({ node, messageId: \"overlay\" });\n }\n },\n };\n },\n});\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport {\n findVariable,\n jsxAttribute,\n jsxValue,\n memberName,\n staticText,\n unwrapExpression,\n} from \"../matchers\";\n\nfunction callName(node: TSESTree.CallExpression): string | undefined {\n if (node.callee.type === \"Identifier\") {\n return node.callee.name;\n }\n return node.callee.type === \"MemberExpression\"\n ? memberName(node.callee)\n : undefined;\n}\n\nfunction possibleBlank(node: TSESTree.Node | null | undefined): boolean {\n if (!node || node.type === \"JSXEmptyExpression\") {\n return false;\n }\n if (\n node.type === \"TSAsExpression\" ||\n node.type === \"TSTypeAssertion\" ||\n node.type === \"TSNonNullExpression\"\n ) {\n return possibleBlank(node.expression);\n }\n if (node.type === \"ConditionalExpression\") {\n return possibleBlank(node.consequent) || possibleBlank(node.alternate);\n }\n if (node.type === \"LogicalExpression\") {\n return possibleBlank(node.left) || possibleBlank(node.right);\n }\n return staticText(node)?.toLowerCase() === \"_blank\";\n}\n\nexport const safeExternalLinks = createRule<\n [],\n \"javascriptUrl\" | \"noopener\" | \"redirect\"\n>({\n name: \"safe-external-links\",\n meta: {\n type: \"problem\",\n docs: {\n description: \"Open links and redirects without exposing the site.\",\n },\n fixable: \"code\",\n schema: [],\n messages: {\n javascriptUrl:\n \"Remove the javascript: URL. Use an event handler for storefront behavior.\",\n noopener:\n 'Add rel=\"noopener noreferrer\" when target=\"_blank\" opens a new tab.',\n redirect:\n \"Pass this redirect target through safeRedirect(to, fallback) from @zappie/sdk/redirect.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const source = context.sourceCode;\n const tainted = new Set<string>();\n const safe = new Set<string>();\n const importedSafeRedirect = (node: TSESTree.Identifier): boolean => {\n const binding = findVariable(source, node, node.name);\n return Boolean(\n binding?.defs.some(\n (definition) =>\n definition.type === \"ImportBinding\" &&\n definition.node.type === \"ImportSpecifier\" &&\n definition.node.imported.type === \"Identifier\" &&\n definition.node.imported.name === \"safeRedirect\" &&\n definition.parent?.type === \"ImportDeclaration\" &&\n definition.parent.source.value === \"@zappie/sdk/redirect\",\n ),\n );\n };\n const fromRequest = (input: TSESTree.Node | null | undefined): boolean => {\n if (!input || input.type === \"SpreadElement\") {\n return false;\n }\n const node = unwrapExpression(input as TSESTree.Expression);\n if (node.type === \"Identifier\") {\n return tainted.has(node.name) && !safe.has(node.name);\n }\n if (node.type === \"MemberExpression\") {\n if (\n node.object.type === \"Identifier\" &&\n node.object.name === \"request\" &&\n memberName(node) === \"url\"\n ) {\n return true;\n }\n return fromRequest(node.object);\n }\n if (node.type === \"CallExpression\") {\n if (\n node.callee.type === \"Identifier\" &&\n importedSafeRedirect(node.callee)\n ) {\n return false;\n }\n if (\n node.callee.type === \"Identifier\" &&\n node.callee.name === \"safeRedirect\"\n ) {\n return node.arguments.some(fromRequest);\n }\n if (\n node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"get\" &&\n ((node.callee.object.type === \"MemberExpression\" &&\n memberName(node.callee.object) === \"searchParams\") ||\n (node.callee.object.type === \"Identifier\" &&\n /searchParams/i.test(node.callee.object.name)) ||\n fromRequest(node.callee.object))\n ) {\n return true;\n }\n return false;\n }\n if (node.type === \"NewExpression\") {\n return (\n node.callee.type === \"Identifier\" &&\n node.callee.name === \"URL\" &&\n node.arguments.some(fromRequest)\n );\n }\n if (node.type === \"ConditionalExpression\") {\n return fromRequest(node.consequent) || fromRequest(node.alternate);\n }\n if (node.type === \"LogicalExpression\") {\n return fromRequest(node.left) || fromRequest(node.right);\n }\n if (node.type === \"BinaryExpression\") {\n return fromRequest(node.left);\n }\n if (node.type === \"TemplateLiteral\") {\n return node.expressions.some(fromRequest);\n }\n return false;\n };\n const sameOriginGuard = (node: TSESTree.Node, target: TSESTree.Node) => {\n if (target.type !== \"Identifier\") {\n return false;\n }\n const targetOrigin = (input: TSESTree.Node) => {\n const expression = unwrapExpression(input as TSESTree.Expression);\n return (\n expression.type === \"MemberExpression\" &&\n memberName(expression) === \"origin\" &&\n expression.object.type === \"Identifier\" &&\n expression.object.name === target.name\n );\n };\n const trustedOrigin = (input: TSESTree.Node) => {\n const expression = unwrapExpression(input as TSESTree.Expression);\n return (\n expression.type === \"MemberExpression\" &&\n memberName(expression) === \"origin\" &&\n ((expression.object.type === \"Identifier\" &&\n expression.object.name === \"location\") ||\n fromRequest(expression.object))\n );\n };\n return source.getAncestors(node).some((ancestor) => {\n if (\n ancestor.type !== \"IfStatement\" ||\n !source.getAncestors(node).includes(ancestor.consequent)\n ) {\n return false;\n }\n const test = unwrapExpression(ancestor.test);\n return (\n test.type === \"BinaryExpression\" &&\n (test.operator === \"===\" || test.operator === \"==\") &&\n ((targetOrigin(test.left) && trustedOrigin(test.right)) ||\n (trustedOrigin(test.left) && targetOrigin(test.right)))\n );\n });\n };\n const redirectTarget = (node: TSESTree.CallExpression) => {\n const name = callName(node);\n if (![\"redirect\", \"navigate\", \"assign\", \"replace\"].includes(name ?? \"\")) {\n return;\n }\n const target = node.arguments[0];\n if (\n target &&\n target.type !== \"SpreadElement\" &&\n fromRequest(target) &&\n !sameOriginGuard(node, unwrapExpression(target))\n ) {\n context.report({ node: target, messageId: \"redirect\" });\n }\n };\n return {\n VariableDeclarator(node) {\n if (node.id.type !== \"Identifier\" || !node.init) {\n return;\n }\n if (\n node.init.type === \"CallExpression\" &&\n node.init.callee.type === \"Identifier\" &&\n importedSafeRedirect(node.init.callee)\n ) {\n safe.add(node.id.name);\n } else if (fromRequest(node.init)) {\n tainted.add(node.id.name);\n }\n },\n JSXOpeningElement(node) {\n for (const name of [\"href\", \"src\", \"action\", \"formAction\"]) {\n const value = jsxValue(jsxAttribute(node, name));\n if (\n /^javascript:/i.test(\n (value ?? \"\").replace(/[\\u0000-\\u0020\\u007f\\s]/gu, \"\"),\n )\n ) {\n context.report({\n node: jsxAttribute(node, name) ?? node,\n messageId: \"javascriptUrl\",\n });\n }\n }\n const targetAttribute = jsxAttribute(node, \"target\");\n const targetExpression =\n targetAttribute?.value?.type === \"JSXExpressionContainer\"\n ? targetAttribute.value.expression\n : targetAttribute?.value;\n if (!possibleBlank(targetExpression)) {\n return;\n }\n const relAttribute = jsxAttribute(node, \"rel\");\n const rel = jsxValue(relAttribute);\n if (rel?.toLowerCase().split(/\\s+/).includes(\"noopener\")) {\n return;\n }\n context.report({\n node,\n messageId: \"noopener\",\n fix(fixer) {\n if (!relAttribute) {\n return fixer.insertTextAfter(\n node.name,\n ' rel=\"noopener noreferrer\"',\n );\n }\n if (!relAttribute.value || relAttribute.value.type !== \"Literal\") {\n return null;\n }\n const tokens = new Set((rel ?? \"\").split(/\\s+/).filter(Boolean));\n tokens.add(\"noopener\");\n tokens.add(\"noreferrer\");\n return fixer.replaceText(\n relAttribute,\n `rel=\"${[...tokens].join(\" \")}\"`,\n );\n },\n });\n },\n CallExpression: redirectTarget,\n AssignmentExpression(node) {\n if (\n node.left.type === \"MemberExpression\" &&\n memberName(node.left) === \"href\" &&\n ((node.left.object.type === \"Identifier\" &&\n node.left.object.name === \"location\") ||\n (node.left.object.type === \"MemberExpression\" &&\n memberName(node.left.object) === \"location\")) &&\n fromRequest(node.right)\n ) {\n context.report({ node: node.right, messageId: \"redirect\" });\n }\n },\n };\n },\n});\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\n\ntype Fixer = TSESLint.RuleFixer;\ntype Fix = TSESLint.RuleFix;\ntype Source = Readonly<TSESLint.SourceCode>;\n\nfunction sdkImport(\n program: TSESTree.Program,\n): TSESTree.ImportDeclaration | undefined {\n return program.body.find(\n (node): node is TSESTree.ImportDeclaration =>\n node.type === \"ImportDeclaration\" && node.source.value === \"@zappie/sdk\",\n );\n}\n\nfunction importedFormat(\n declaration: TSESTree.ImportDeclaration | undefined,\n): TSESTree.ImportSpecifier | undefined {\n return declaration?.specifiers.find(\n (specifier): specifier is TSESTree.ImportSpecifier =>\n specifier.type === \"ImportSpecifier\" &&\n specifier.imported.type === \"Identifier\" &&\n specifier.imported.name === \"format\",\n );\n}\n\nfunction importFix(\n fixer: Fixer,\n source: Source,\n program: TSESTree.Program,\n local: string,\n): Fix | undefined {\n const declaration = sdkImport(program);\n if (importedFormat(declaration)?.local.name === local) {\n return undefined;\n }\n const importedName = local === \"format\" ? \"format\" : `format as ${local}`;\n const named = declaration?.specifiers.filter(\n (specifier) => specifier.type === \"ImportSpecifier\",\n );\n if (declaration && declaration.importKind !== \"type\" && named?.length) {\n const last = named.at(-1);\n if (last) {\n return fixer.insertTextAfter(last, `, ${importedName}`);\n }\n }\n const first = program.body[0];\n const text = `import { ${importedName} } from \"@zappie/sdk\";\\n`;\n return first\n ? fixer.insertTextBefore(first, text)\n : fixer.insertTextAfter(program, text);\n}\n\nexport function formatFixes(\n fixer: Fixer,\n source: Source,\n program: TSESTree.Program,\n replace: TSESTree.Node,\n owner: TSESTree.Expression,\n local: string,\n): Fix[] {\n const fixes = [\n fixer.replaceText(replace, `${local}.money(${source.getText(owner)})`),\n ];\n const addition = importFix(fixer, source, program, local);\n if (addition) {\n fixes.push(addition);\n }\n return fixes;\n}\n\nexport function formatBinding(\n source: Source,\n program: TSESTree.Program,\n node: TSESTree.Node,\n): \"available\" | \"conflict\" | \"imported\" {\n if (importedFormat(sdkImport(program))) {\n return \"imported\";\n }\n let scope: TSESLint.Scope.Scope | null = source.getScope(node);\n while (scope) {\n if (scope.variables.some((variable) => variable.name === \"format\")) {\n return \"conflict\";\n }\n scope = scope.upper;\n }\n return \"available\";\n}\n\nexport function importedFormatLocal(\n program: TSESTree.Program,\n): string | undefined {\n return importedFormat(sdkImport(program))?.local.name;\n}\n\nexport function availableAlias(source: Source, node: TSESTree.Node): string {\n const names = new Set<string>();\n let scope: TSESLint.Scope.Scope | null = source.getScope(node);\n while (scope) {\n for (const variable of scope.variables) {\n names.add(variable.name);\n }\n scope = scope.upper;\n }\n for (const name of [\n \"zappieFormat\",\n \"zappieMoneyFormat\",\n \"formatMoneyValue\",\n ]) {\n if (!names.has(name)) {\n return name;\n }\n }\n return \"zappieSdkFormat\";\n}\n","import type { TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\nimport {\n availableAlias,\n formatBinding,\n formatFixes,\n importedFormatLocal,\n} from \"../format-fix\";\nimport {\n currencyStyle,\n dividedMinorOwner,\n isAmountMinor,\n isSdkMoney,\n memberName,\n parserServices,\n} from \"../money-rule-utils\";\n\ntype Message = \"currency\" | \"direct\" | \"minor\" | \"useAlias\";\n\nfunction intlNumberFormat(node: TSESTree.Node): boolean {\n const callee =\n node.type === \"NewExpression\" || node.type === \"CallExpression\"\n ? node.callee\n : undefined;\n return Boolean(\n callee?.type === \"MemberExpression\" &&\n callee.object.type === \"Identifier\" &&\n callee.object.name === \"Intl\" &&\n memberName(callee) === \"NumberFormat\",\n );\n}\n\nfunction formattedMinor(node: TSESTree.CallExpression) {\n if (node.callee.type !== \"MemberExpression\") {\n return undefined;\n }\n if (memberName(node.callee) === \"toLocaleString\") {\n return dividedMinorOwner(node.callee.object);\n }\n if (memberName(node.callee) === \"format\") {\n return dividedMinorOwner(node.arguments[0] ?? node);\n }\n return undefined;\n}\n\nfunction formatsDividedMinor(node: TSESTree.NewExpression): boolean {\n const member = node.parent;\n const call = member.type === \"MemberExpression\" ? member.parent : undefined;\n return Boolean(\n call?.type === \"CallExpression\" &&\n call.callee === member &&\n memberName(member) === \"format\" &&\n dividedMinorOwner(call.arguments[0] ?? call),\n );\n}\n\nexport const useFormatMoney = createRule<[], Message>({\n name: \"use-format-money\",\n meta: {\n type: \"problem\",\n docs: { description: \"Format SDK Money with format.money() or <Money>.\" },\n fixable: \"code\",\n hasSuggestions: true,\n schema: [],\n messages: {\n currency:\n \"Use format.money(). Intl currency defaults can differ from the API minor-unit digits.\",\n direct:\n \"Render SDK Money with format.money(value) or <Money value={value}>.\",\n minor:\n \"Use format.money(value). Dividing by 100 gives the wrong amount for currencies with 0, 3 or 4 minor-unit digits.\",\n useAlias:\n \"Import format with an unused alias and format this Money value.\",\n },\n },\n defaultOptions: [],\n create(context) {\n const source = context.sourceCode;\n const services = parserServices(context);\n let program: TSESTree.Program;\n const reportFix = (\n node: TSESTree.Node,\n replace: TSESTree.Node,\n owner: TSESTree.Expression,\n ) => {\n const data = { node, messageId: \"minor\" as const };\n const binding = formatBinding(source, program, node);\n if (binding === \"conflict\") {\n const alias = availableAlias(source, node);\n context.report({\n ...data,\n suggest: [\n {\n messageId: \"useAlias\",\n fix: (fixer) =>\n formatFixes(fixer, source, program, replace, owner, alias),\n },\n ],\n });\n return;\n }\n context.report({\n ...data,\n fix: (fixer) => {\n const local = importedFormatLocal(program) ?? \"format\";\n return formatFixes(fixer, source, program, replace, owner, local);\n },\n });\n };\n const inspectFormatter = (node: TSESTree.CallExpression) => {\n const owner = formattedMinor(node);\n if (owner) {\n reportFix(node, node, owner);\n return true;\n }\n return false;\n };\n return {\n Program(node) {\n program = node;\n },\n NewExpression(node) {\n if (\n intlNumberFormat(node) &&\n currencyStyle(node.arguments[1]) &&\n !formatsDividedMinor(node)\n ) {\n context.report({ node, messageId: \"currency\" });\n }\n },\n CallExpression(node) {\n if (inspectFormatter(node)) {\n return;\n }\n if (intlNumberFormat(node) && currencyStyle(node.arguments[1])) {\n context.report({ node, messageId: \"currency\" });\n return;\n }\n if (\n node.callee.type === \"MemberExpression\" &&\n memberName(node.callee) === \"toLocaleString\" &&\n node.arguments.some(currencyStyle)\n ) {\n context.report({ node, messageId: \"currency\" });\n }\n },\n TemplateLiteral(node) {\n for (const expression of node.expressions) {\n const owner = dividedMinorOwner(expression);\n if (owner) {\n reportFix(expression, expression, owner);\n } else if (isAmountMinor(expression)) {\n context.report({ node: expression, messageId: \"minor\" });\n }\n }\n },\n JSXExpressionContainer(node) {\n if (\n node.parent.type === \"JSXAttribute\" ||\n node.expression.type === \"JSXEmptyExpression\"\n ) {\n return;\n }\n if (\n dividedMinorOwner(node.expression) ||\n isAmountMinor(node.expression)\n ) {\n context.report({ node: node.expression, messageId: \"minor\" });\n } else if (isSdkMoney(services, node.expression)) {\n context.report({ node: node.expression, messageId: \"direct\" });\n }\n },\n };\n },\n});\n","import type { TSESLint, TSESTree } from \"@typescript-eslint/utils\";\nimport { createRule } from \"../create-rule\";\n\ntype Kind = \"add\" | \"checkout\" | \"signin\";\nconst marker: Record<Kind, { name: string; text: string }> = {\n add: { name: \"data-zappie-action\", text: 'data-zappie-action=\"add-to-cart\"' },\n checkout: { name: \"data-zappie-checkout\", text: \"data-zappie-checkout\" },\n signin: { name: \"data-zappie-signin\", text: \"data-zappie-signin\" },\n};\n\nfunction handlerKind(\n source: Readonly<TSESLint.SourceCode>,\n node: TSESTree.JSXAttribute,\n): Kind | undefined {\n const text = node.value ? source.getText(node.value) : \"\";\n if (/\\b(?:cart(?:\\.actions)?\\.add)\\s*\\(/.test(text)) {\n return \"add\";\n }\n if (/\\b(?:checkout|createCheckout\\([^)]*\\))\\.open\\s*\\(/.test(text)) {\n return \"checkout\";\n }\n if (/\\b(?:auth|createCustomer\\([^)]*\\))\\.signIn\\s*\\(/.test(text)) {\n return \"signin\";\n }\n return undefined;\n}\n\nexport const verifyMarkers = createRule<[], \"marker\">({\n name: \"verify-markers\",\n meta: {\n type: \"suggestion\",\n docs: { description: \"Mark shopping actions so verify can find them.\" },\n fixable: \"code\",\n schema: [],\n messages: {\n marker: \"Add {{marker}} so zappie verify can find this shopping action.\",\n },\n },\n defaultOptions: [],\n create(context) {\n return {\n JSXOpeningElement(node) {\n const click = node.attributes.find(\n (attribute): attribute is TSESTree.JSXAttribute =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.name === \"onClick\",\n );\n if (!click) {\n return;\n }\n const kind = handlerKind(context.sourceCode, click);\n if (\n !kind ||\n node.attributes.some(\n (attribute) =>\n attribute.type === \"JSXAttribute\" &&\n attribute.name.name === marker[kind].name,\n )\n ) {\n return;\n }\n context.report({\n node: click,\n messageId: \"marker\",\n data: { marker: marker[kind].text },\n fix: (fixer) =>\n fixer.insertTextAfter(node.name, ` ${marker[kind].text}`),\n });\n },\n };\n },\n});\n"],"mappings":"AAAA,OAAOA,OAAY,4BACnB,OAAOC,OAAa,yBACpB,OAAOC,OAAgB,4BCDvB,OAAS,aAAAC,OAAiB,YCD1B,OAAS,eAAAC,OAAmB,2BAErB,IAAMC,EAAaD,GAAY,YACnCE,GAAS,+BAA+BA,CAAI,EAC/C,ECHA,OAAS,aAAAC,OAAiB,YAE1B,IAAMC,GACJ,mFACIC,GACJ,6JAEWC,EACX,2DAEK,SAASC,EAAWC,EAAgD,CACzE,GAAIA,GAAM,OAAS,WAAa,OAAOA,EAAK,OAAU,SACpD,OAAOA,EAAK,MAEd,GAAIA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,CACF,EACMQ,EAAgB,CACpB,KAAM,wBACN,MAAO,CAAC,2BAA4B,uBAAuB,EAC3D,MAAO,CAAE,wBAAyB,KAAM,CAC1C,EAKMC,EAAQ,CACZ,KAAM,eACN,MAAO,CAAC,uBAAuB,EAC/B,gBAAiB,CAAE,cAAe,CAAE,eAAgB,EAAK,CAAE,CAC7D,EAEAN,EAAO,QAAU,CACf,YAAa,CAACC,EAAMK,EAAOD,CAAa,EACxC,OAAQ,CACN,CAAE,GAAGJ,EAAM,MAAO,CAAE,GAAGA,EAAK,MAAO,GAAGF,EAAY,CAAE,EACpDO,EACAD,CACF,EACA,kBAAmB,CACjBJ,EACAK,EACAD,EACA,CACE,KAAM,sBACN,MAAO,CAAC,gCAAgC,EACxC,MAAO,CACL,uBAAwB,MACxB,2BAA4B,MAC5B,mCAAoC,KACtC,CACF,EACA,CACE,KAAM,6BACN,MAAO,CAAC,+CAA+C,EACvD,MAAO,CAAE,6BAA8B,KAAM,CAC/C,EACA,CACE,KAAM,0BACN,MAAO,CAAC,4CAA4C,EACpD,MAAO,CAAE,wBAAyB,KAAM,CAC1C,EACA,CACE,KAAM,wBACN,MAAO,CACL,4BACA,0CAEA,kCAEA,mCACF,EACA,MAAO,CACL,2BAA4B,MAC5B,0BAA2B,KAC7B,CACF,EACA,CACE,KAAM,0BACN,MAAO,CAAC,gDAAgD,EACxD,MAAO,CAAE,2BAA4B,KAAM,CAC7C,EACA,CACE,KAAM,gCACN,MAAO,CACL,4CACA,0CACA,2CACA,2CACF,EACA,MAAO,CAAE,2BAA4B,KAAM,CAC7C,CACF,CACF,EAuBA,IAAOE,GAAQC","names":["parser","jsxA11y","reactHooks","minimatch","ESLintUtils","createRule","name","minimatch","endpointPattern","trackingPattern","paymentHostPattern","staticText","node","part","memberName","unwrapExpression","findVariable","source","name","scope","found","jsxAttribute","attribute","jsxValue","isZappieEndpoint","value","isTrackingEndpoint","isInternalSdkImport","isServerFile","filename","patterns","path","pattern","pages","extensions","menuRoutes","serverExports","sessionCalls","sessionStoreName","sessionHeaders","sessionRoutes","topLevel","node","exportedName","definitionOf","source","findVariable","isHeaders","memberName","definition","binding","storeType","annotation","createsStore","isSessionStore","declared","calleeName","cacheableMenuRoutes","createRule","context","options","filename","pattern","minimatch","inServerExport","ancestor","report","name","target","header","staticText","cartName","storageKey","calleeName","node","variableName","cartInitial","value","cartViaSdk","createRule","context","method","key","id","call","autocomplete","paymentField","providerImport","value","checkoutViaSdk","createRule","context","node","tag","auto","jsxValue","jsxAttribute","name","id","target","cardInput","providerTarget","paymentHostPattern","mappedBy","node","current","parent","firstOnly","source","callback","text","index","imagePriority","createRule","context","images","priority","jsxAttribute","disabled","targetsItem","attribute","expression","target","jsxValue","itemLinkPrefetch","createRule","context","links","node","item","jsxAttribute","defaults","authValue","browserStorage","globals","isStorage","node","memberKey","staticText","authImport","value","noCustomAuth","createRule","context","options","server","isServerFile","kind","type","jsxValue","jsxAttribute","auto","first","key","cookie","message","value","noDirectApi","createRule","context","inspect","node","staticText","isZappieEndpoint","isInternalSdkImport","globalCallName","node","last","staticText","noEval","createRule","context","name","external","value","documentObject","node","staticText","noExternalScripts","createRule","context","element","attribute","jsxAttribute","src","jsxValue","dynamic","isTrackingEndpoint","rel","as","href","property","react","conventionalNamespace","noLazyOverlay","createRule","context","lazyNames","suspenseNames","namespaces","fromNamespace","object","property","wanted","node","specifier","imported","callee","name","ESLintUtils","moneyLiteralPattern","isMoneyLiteral","value","memberName","node","isAmountMinor","amountOwner","dividedMinorOwner","parserServices","context","declaredBySdkMoney","symbol","declaration","path","isSdkMoney","services","checker","tsNode","type","part","property","currencyStyle","noMoneyLiterals","createRule","context","services","parserServices","arithmetic","node","isAmountMinor","isSdkMoney","isMoneyLiteral","dividedMinorOwner","memberName","quasi","serverFiles","vitePublic","namedFunction","node","parent","staticText","directEnv","memberName","contextCloudflare","forbidden","kind","key","direct","noServerEnvInClient","createRule","context","filename","isServerFile","aliases","cloudflareAliases","serverBody","ancestor","kindOf","recordCloudflarePattern","pattern","property","inspectParameters","parameter","imports","imported","value","noTrackingScripts","createRule","context","inspect","node","staticText","isTrackingEndpoint","callee","direct","dataLayer","literal","node","text","staticText","hostname","value","allowed","host","entries","entry","candidate","noUnlistedFetch","createRule","context","options","filename","isServerFile","configured","allow","xhr","inspect","target","isZappieEndpoint","memberName","name","noUnlistedFetchDynamic","objectHtml","node","property","staticText","noUnsafeHtml","createRule","context","source","isFactory","findVariable","definition","isSanitizer","init","sanitized","input","seen","unwrapExpression","binding","nextSeen","initial","setter","updates","reference","call","reportHtmlObject","value","name","dangerous","child","memberName","props","defaults","name","node","carriesKey","keys","key","part","property","overlayPrimitive","createRule","context","options","searchValues","derivedFromSearch","text","value","callee","argument","dialog","role","attribute","open","callName","node","memberName","possibleBlank","staticText","safeExternalLinks","createRule","context","source","tainted","safe","importedSafeRedirect","findVariable","definition","fromRequest","input","unwrapExpression","sameOriginGuard","target","targetOrigin","expression","trustedOrigin","ancestor","test","name","value","jsxValue","jsxAttribute","targetAttribute","targetExpression","relAttribute","rel","fixer","tokens","sdkImport","program","node","importedFormat","declaration","specifier","importFix","fixer","source","local","importedName","named","last","first","text","formatFixes","replace","owner","fixes","addition","formatBinding","scope","variable","importedFormatLocal","availableAlias","names","name","intlNumberFormat","node","callee","memberName","formattedMinor","dividedMinorOwner","formatsDividedMinor","member","call","useFormatMoney","createRule","context","source","services","parserServices","program","reportFix","replace","owner","data","formatBinding","alias","availableAlias","fixer","formatFixes","local","importedFormatLocal","inspectFormatter","currencyStyle","expression","isAmountMinor","isSdkMoney","marker","handlerKind","source","node","text","verifyMarkers","createRule","context","click","attribute","kind","fixer","rules","noDirectApi","noTrackingScripts","checkoutViaSdk","noCustomAuth","noMoneyLiterals","useFormatMoney","overlayPrimitive","cartViaSdk","verifyMarkers","itemLinkPrefetch","imagePriority","noLazyOverlay","noUnsafeHtml","noEval","noExternalScripts","safeExternalLinks","noUnlistedFetch","noUnlistedFetchDynamic","noServerEnvInClient","cacheableMenuRoutes","enabled","name","strictRules","plugin","base","parser","jsxA11y","reactHooks","searchDialogs","typed","src_default","plugin"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/rules/cacheable-menu-routes.ts","../src/create-rule.ts","../src/matchers.ts","../src/rules/cart-via-sdk.ts","../src/rules/checkout-via-sdk.ts","../src/rules/image-priority.ts","../src/rules/item-link-prefetch.ts","../src/rules/no-custom-auth.ts","../src/rules/no-direct-api.ts","../src/globals.ts","../src/rules/no-document-write.ts","../src/rules/no-eval.ts","../src/rules/no-external-scripts.ts","../src/rules/no-global-indirection.ts","../src/rules/no-lazy-overlay.ts","../src/money-rule-utils.ts","../src/rules/no-money-literals.ts","../src/rules/no-offsite-navigation.ts","../src/rules/no-remote-import.ts","../src/rules/no-server-env-in-client.ts","../src/rules/no-tracking-scripts.ts","../src/rules/no-unlisted-fetch.ts","../src/rules/no-unsafe-html.ts","../src/rules/overlay-primitive.ts","../src/rules/safe-external-links.ts","../src/format-fix.ts","../src/rules/use-format-money.ts","../src/rules/verify-markers.ts"],"mappings":"AAAA,OAAOA,OAAY,4BACnB,OAAOC,OAAa,yBACpB,OAAOC,OAAgB,4BCDvB,OAAS,aAAAC,OAAiB,YCD1B,OAAS,eAAAC,OAAmB,2BAErB,IAAMC,EAAaD,GAAY,YACnCE,GAAS,+BAA+BA,CAAI,EAC/C,ECHA,OAAS,aAAAC,OAAiB,YAE1B,IAAMC,GACJ,mFACIC,GACJ,6JAEWC,GACX,2DAEK,SAASC,EAAWC,EAAgD,CACzE,GAAIA,GAAM,OAAS,WAAa,OAAOA,EAAK,OAAU,SACpD,OAAOA,EAAK,MAEd,GAAIA,GAAM,OAAS,kBACjB,OAAOA,EAAK,OACT,IAAKC,GAASA,EAAK,MAAM,QAAUA,EAAK,MAAM,GAAG,EACjD,KAAK,EAAE,CAGd,CAEO,SAASC,EACdF,EACoB,CACpB,MAAO,CAACA,EAAK,UAAYA,EAAK,SAAS,OAAS,aAC5CA,EAAK,SAAS,KACdD,EAAWC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AI,GAAI,OAAO,CAAC,CAC1D,CACF,EAEAE,EAAO,QAAU,CACf,YAAa,CAACC,EAAMK,GAAOD,EAAa,EACxC,SAAU,CAACE,EAAQ,EACnB,OAAQ,CACN,CAAE,GAAGN,EAAM,MAAO,CAAE,GAAGA,EAAK,MAAO,GAAGF,EAAY,CAAE,EACpDO,GACAD,EACF,EACA,kBAAmB,CACjBJ,EACAK,GACAD,GACA,CACE,KAAM,sBACN,MAAO,CAAC,gCAAgC,EACxC,MAAO,CACL,uBAAwB,MACxB,2BAA4B,MAC5B,mCAAoC,KACtC,CACF,EACA,CACE,KAAM,6BACN,MAAO,CAAC,+CAA+C,EACvD,MAAO,CACL,6BAA8B,MAE9B,+BAAgC,KAClC,CACF,EACA,CAEE,KAAM,oCACN,MAAO,CACL,qCACA,oCACF,EACA,MAAO,CAAE,+BAAgC,KAAM,CACjD,EACA,CACE,KAAM,0BACN,MAAO,CAAC,4CAA4C,EACpD,MAAO,CAAE,wBAAyB,KAAM,CAC1C,EACA,CACE,KAAM,wBACN,MAAO,CACL,4BACA,0CAEA,kCAEA,mCACF,EACA,MAAO,CACL,2BAA4B,MAC5B,0BAA2B,KAC7B,CACF,EACA,CACE,KAAM,0BACN,MAAO,CAAC,gDAAgD,EACxD,MAAO,CAAE,2BAA4B,KAAM,CAC7C,EACA,CACE,KAAM,gCACN,MAAO,CACL,4CACA,0CACA,2CACA,2CACF,EACA,MAAO,CAAE,2BAA4B,KAAM,CAC7C,CACF,CACF,EA4BA,IAAOG,GAAQC","names":["parser","jsxA11y","reactHooks","minimatch","ESLintUtils","createRule","name","minimatch","endpointPattern","trackingPattern","paymentHostPattern","staticText","node","part","memberName","unwrapExpression","findVariable","source","name","scope","found","jsxAttribute","attribute","jsxValue","isZappieEndpoint","value","isTrackingEndpoint","isInternalSdkImport","isServerFile","filename","patterns","path","pattern","pages","extensions","menuRoutes","serverExports","sessionCalls","sessionStoreName","sessionHeaders","sessionRoutes","topLevel","node","exportedName","definitionOf","source","findVariable","isHeaders","memberName","definition","binding","storeType","annotation","createsStore","isSessionStore","declared","calleeName","cacheableMenuRoutes","createRule","context","options","filename","pattern","minimatch","inServerExport","ancestor","report","name","target","header","staticText","cartName","storageKey","calleeName","node","variableName","cartInitial","value","cartViaSdk","createRule","context","method","key","id","call","autocomplete","paymentField","providerImport","value","checkoutViaSdk","createRule","context","node","tag","auto","jsxValue","jsxAttribute","name","id","target","cardInput","providerTarget","paymentHostPattern","mappedBy","node","current","parent","firstOnly","source","callback","text","index","imagePriority","createRule","context","images","priority","jsxAttribute","disabled","targetsItem","attribute","expression","target","jsxValue","itemLinkPrefetch","createRule","context","links","node","item","jsxAttribute","defaults","authValue","browserStorage","globals","isStorage","node","memberKey","staticText","authImport","value","noCustomAuth","createRule","context","options","server","isServerFile","kind","type","jsxValue","jsxAttribute","auto","first","key","cookie","message","value","noDirectApi","createRule","context","inspect","node","staticText","isZappieEndpoint","isInternalSdkImport","TRUSTED_NAVIGATION_ORIGINS","WINDOW_NAMES","WINDOW_MEMBERS","DOCUMENT_MEMBERS","isLocationObject","source","node","inner","globalKind","memberName","aliasOf","seen","variable","findVariable","definition","id","init","property","entry","isGlobalName","kind","input","unwrapExpression","alias","name","owner","constantText","parts","index","quasi","expression","value","left","right","leadingText","whole","text","staysTrusted","complete","trusted","origin","isAbsoluteUrl","noDocumentWrite","createRule","context","node","callee","name","memberName","globalKind","globalCallName","source","input","node","unwrapExpression","last","globalKind","memberName","stringValued","staticText","noEval","createRule","context","name","constructorCall","callee","external","value","noExternalScripts","createRule","context","node","element","attribute","jsxAttribute","src","jsxValue","dynamic","isTrackingEndpoint","rel","as","href","memberName","globalKind","staticText","property","NAVIGATION_KEYS","addsGlobals","node","method","key","staticText","added","argument","property","REFLECTION","noGlobalIndirection","createRule","context","source","guarded","globalKind","isLocationObject","callee","methods","name","memberName","target","react","conventionalNamespace","noLazyOverlay","createRule","context","lazyNames","suspenseNames","namespaces","fromNamespace","object","property","wanted","node","specifier","imported","callee","name","ESLintUtils","moneyLiteralPattern","isMoneyLiteral","value","memberName","node","isAmountMinor","amountOwner","dividedMinorOwner","parserServices","context","declaredBySdkMoney","symbol","declaration","path","isSdkMoney","services","checker","tsNode","type","part","property","currencyStyle","noMoneyLiterals","createRule","context","services","parserServices","arithmetic","node","isAmountMinor","isSdkMoney","isMoneyLiteral","dividedMinorOwner","memberName","quasi","ORIGIN_PARTS","ROUTER_CALLS","noOffsiteNavigation","createRule","context","source","location","node","globalKind","locationObject","isLocationObject","safe","target","unwrapExpression","isSafeRedirect","left","right","whole","constantText","staysTrusted","leadingText","findVariable","definition","leaves","lead","isAbsoluteUrl","routerCall","callee","memberName","anchors","anchorHref","object","value","name","staticText","isGlobalName","init","element","attribute","jsxAttribute","jsxValue","to","key","lower","isRemote","text","WORKERS","relativePath","projectFileUrl","source","input","node","unwrapExpression","memberName","variable","findVariable","definition","reference","parent","base","constantText","noRemoteImport","createRule","context","check","target","whole","leadingText","declaration","isGlobalName","serverFiles","vitePublic","namedFunction","node","parent","staticText","directEnv","memberName","contextCloudflare","forbidden","kind","key","direct","noServerEnvInClient","createRule","context","filename","isServerFile","aliases","cloudflareAliases","serverBody","ancestor","kindOf","recordCloudflarePattern","pattern","property","inspectParameters","parameter","imports","imported","value","noTrackingScripts","createRule","context","inspect","node","staticText","isTrackingEndpoint","callee","direct","dataLayer","literal","node","text","staticText","hostname","value","allowed","host","entries","entry","candidate","noUnlistedFetch","createRule","context","options","filename","isServerFile","configured","allow","xhr","inspect","target","isZappieEndpoint","memberName","name","noUnlistedFetchDynamic","objectHtml","node","property","staticText","noUnsafeHtml","createRule","context","source","isFactory","findVariable","definition","isSanitizer","init","sanitized","input","seen","unwrapExpression","binding","nextSeen","initial","setter","updates","reference","call","reportHtmlObject","value","name","dangerous","child","memberName","props","defaults","name","node","carriesKey","keys","key","part","property","overlayPrimitive","createRule","context","options","searchValues","derivedFromSearch","text","value","callee","argument","dialog","role","attribute","open","callName","node","memberName","possibleBlank","staticText","safeExternalLinks","createRule","context","source","tainted","safe","importedSafeRedirect","findVariable","definition","fromRequest","input","unwrapExpression","sameOriginGuard","target","targetOrigin","expression","trustedOrigin","ancestor","test","name","value","jsxValue","jsxAttribute","targetAttribute","targetExpression","relAttribute","rel","fixer","tokens","sdkImport","program","node","importedFormat","declaration","specifier","importFix","fixer","source","local","importedName","named","last","first","text","formatFixes","replace","owner","fixes","addition","formatBinding","scope","variable","importedFormatLocal","availableAlias","names","name","intlNumberFormat","node","callee","memberName","formattedMinor","dividedMinorOwner","formatsDividedMinor","member","call","useFormatMoney","createRule","context","source","services","parserServices","program","reportFix","replace","owner","data","formatBinding","alias","availableAlias","fixer","formatFixes","local","importedFormatLocal","inspectFormatter","currencyStyle","expression","isAmountMinor","isSdkMoney","marker","handlerKind","source","node","text","verifyMarkers","createRule","context","click","attribute","kind","fixer","rules","noDirectApi","noTrackingScripts","checkoutViaSdk","noCustomAuth","noMoneyLiterals","useFormatMoney","overlayPrimitive","cartViaSdk","verifyMarkers","itemLinkPrefetch","imagePriority","noLazyOverlay","noUnsafeHtml","noEval","noExternalScripts","safeExternalLinks","noUnlistedFetch","noUnlistedFetchDynamic","noServerEnvInClient","cacheableMenuRoutes","noOffsiteNavigation","noGlobalIndirection","noDocumentWrite","noRemoteImport","SECURITY_RULES","enabled","name","strictRules","plugin","base","parser","jsxA11y","reactHooks","searchDialogs","typed","security","src_default","plugin"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-zappie",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Flat ESLint rules for Zappie storefront projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@typescript-eslint/utils": "8.72.0",
|
|
34
34
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
35
35
|
"eslint-plugin-react-hooks": "7.1.1",
|
|
36
|
-
"minimatch": "^
|
|
36
|
+
"minimatch": "^11.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|