docs: update to next 15 + eslint 9 (#9839)

* update next

* updated react

* update eslint

* finish updating eslint

* fix content lint errors

* fix docs test

* fix vale action

* fix installation errors
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-11-13 17:03:17 +02:00
1 parent 6f7467f071
commit 938f3bd934
143 files changed
+4193 -3226

No files matched your search

-6
View File
@@ -1,6 +0,0 @@
module.exports = {
root: true,
extends: [
"docs/content"
],
}
+159
View File
@@ -0,0 +1,159 @@
import prettier from "eslint-plugin-prettier"
import markdown from "eslint-plugin-markdown"
import globals from "globals"
import babelParser from "@babel/eslint-parser"
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"
import tsParser from "@typescript-eslint/parser"
import path from "node:path"
import { fileURLToPath } from "node:url"
import js from "@eslint/js"
import { FlatCompat } from "@eslint/eslintrc"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
{
ignores: [
"**/references/**/*",
"**/events-reference/**/*",
"**/_events-table/**/*",
],
},
{
plugins: {
prettier,
markdown,
},
languageOptions: {
globals: {
...globals.node,
},
parser: babelParser,
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
experimentalDecorators: true,
modules: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
"no-undef": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"no-unused-labels": "off",
"no-console": "off",
curly: ["error", "all"],
"new-cap": "off",
"require-jsdoc": "off",
camelcase: "off",
"no-invalid-this": "off",
"max-len": [
"warn",
{
code: 64,
},
],
semi: ["error", "never"],
quotes: [
"error",
"double",
{
allowTemplateLiterals: true,
},
],
"comma-dangle": [
"error",
{
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
},
],
"object-curly-spacing": ["error", "always"],
"arrow-parens": ["error", "always"],
"linebreak-style": 0,
"no-confusing-arrow": [
"error",
{
allowParens: false,
},
],
"space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always",
},
],
"space-infix-ops": "off",
"eol-last": ["error", "always"],
"react/prop-types": "off",
"react/jsx-no-undef": "off",
},
},
{
files: ["**/*.md", "**/*.mdx"],
processor: "markdown/markdown",
},
{
files: ["**/*.md/*.js", "**/*.mdx/*.js", "**/*.md/*.jsx", "**/*.mdx/*.jsx"],
},
...compat.extends("plugin:@typescript-eslint/recommended").map((config) => ({
...config,
files: ["**/*.md/*.ts", "**/*.mdx/*.ts", "**/*.md/*.tsx", "**/*.mdx/*.tsx"],
})),
{
files: ["**/*.md/*.ts", "**/*.mdx/*.ts", "**/*.md/*.tsx", "**/*.mdx/*.tsx"],
plugins: {
"@typescript-eslint": typescriptEslintEslintPlugin,
},
languageOptions: {
parser: tsParser,
},
rules: {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-var-requires": "off",
"prefer-rest-params": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
"@typescript-eslint/ban-types": "off",
},
},
]
-14
View File
@@ -1,14 +0,0 @@
module.exports = {
root: true,
extends: [
"docs/next"
],
settings: {
next: {
rootDir: ".",
},
},
ignorePatterns: [
"generated"
]
}
@@ -20,7 +20,7 @@ To create a component that shows this menu in your customizations, create the fi
import {
DropdownMenu,
IconButton,
clx
clx,
} from "@medusajs/ui"
import { EllipsisHorizontal } from "@medusajs/icons"
import { Link } from "react-router-dom"
@@ -202,10 +202,10 @@ const ProductWidget = () => {
label: "Edit",
onClick: () => {
alert("You clicked the edit action!")
}
}
]
}
},
},
],
},
]} />
</Container>
)
@@ -250,13 +250,13 @@ const ProductWidget = () => {
label: "Edit",
onClick: () => {
alert("You clicked the edit action!")
}
}
]
}
]
}
}
},
},
],
},
],
},
},
]}
/>
</Container>
@@ -17,7 +17,7 @@ To create a component that uses the same container styling in your widgets or UI
```tsx
import {
Container as UiContainer,
clx
clx,
} from "@medusajs/ui"
type ContainerProps = React.ComponentProps<typeof UiContainer>
@@ -38,24 +38,24 @@ import {
Heading,
Label,
Input,
Button
Button,
} from "@medusajs/ui"
import {
useForm,
FormProvider,
Controller
Controller,
} from "react-hook-form"
import * as zod from "zod"
const schema = zod.object({
name: zod.string()
name: zod.string(),
})
export const CreateForm = () => {
const form = useForm<zod.infer<typeof schema>>({
defaultValues: {
name: ""
}
name: "",
},
})
const handleSubmit = form.handleSubmit(({ name }) => {
@@ -137,7 +137,7 @@ In `src/admin/components/create-form.tsx`, create a validation schema with Zod f
import * as zod from "zod"
const schema = zod.object({
name: zod.string()
name: zod.string(),
})
```
@@ -158,8 +158,8 @@ import { useForm } from "react-hook-form"
export const CreateForm = () => {
const form = useForm<zod.infer<typeof schema>>({
defaultValues: {
name: ""
}
name: "",
},
})
const handleSubmit = form.handleSubmit(({ name }) => {
@@ -190,11 +190,11 @@ import {
Heading,
Label,
Input,
Button
Button,
} from "@medusajs/ui"
import {
FormProvider,
Controller
Controller,
} from "react-hook-form"
export const CreateForm = () => {
@@ -290,8 +290,8 @@ const ProductWidget = () => {
actions={[
{
type: "custom",
children: <CreateForm />
}
children: <CreateForm />,
},
]}
/>
</Container>
@@ -323,24 +323,24 @@ import {
Heading,
Label,
Input,
Button
Button,
} from "@medusajs/ui"
import {
useForm,
FormProvider,
Controller
Controller,
} from "react-hook-form"
import * as zod from "zod"
const schema = zod.object({
name: zod.string()
name: zod.string(),
})
export const EditForm = () => {
const form = useForm<zod.infer<typeof schema>>({
defaultValues: {
name: ""
}
name: "",
},
})
const handleSubmit = form.handleSubmit(({ name }) => {
@@ -416,7 +416,7 @@ In `src/admin/components/edit-form.tsx`, create a validation schema with Zod for
import * as zod from "zod"
const schema = zod.object({
name: zod.string()
name: zod.string(),
})
```
@@ -437,8 +437,8 @@ import { useForm } from "react-hook-form"
export const EditForm = () => {
const form = useForm<zod.infer<typeof schema>>({
defaultValues: {
name: ""
}
name: "",
},
})
const handleSubmit = form.handleSubmit(({ name }) => {
@@ -469,11 +469,11 @@ import {
Heading,
Label,
Input,
Button
Button,
} from "@medusajs/ui"
import {
FormProvider,
Controller
Controller,
} from "react-hook-form"
export const EditForm = () => {
@@ -563,8 +563,8 @@ const ProductWidget = () => {
actions={[
{
type: "custom",
children: <EditForm />
}
children: <EditForm />,
},
]}
/>
</Container>
@@ -45,7 +45,7 @@ export type HeadingProps = {
export const Header = ({
title,
subtitle,
actions = []
actions = [],
}: HeadingProps) => {
return (
<div className="flex items-center justify-between px-6 py-4">
@@ -172,9 +172,9 @@ const ProductWidget = () => {
variant: "secondary",
onClick: () => {
alert("You clicked the button.")
}
}
}
},
},
},
]}
/>
</Container>
@@ -222,7 +222,7 @@ import { JsonViewSection } from "../components/json-view-section"
const ProductWidget = () => {
return <JsonViewSection data={{
name: "John"
name: "John",
}} />
}
@@ -39,7 +39,7 @@ export const Table = ({
pageSize,
count,
currentPage,
setCurrentPage
setCurrentPage,
}: TableProps) => {
const pageCount = useMemo(() => {
return Math.ceil(data.length / pageSize)
@@ -200,7 +200,7 @@ const ProductWidget = () => {
columns={[
{
key: "name",
label: "Name"
label: "Name",
},
{
key: "is_enabled",
@@ -213,18 +213,18 @@ const ProductWidget = () => {
{isEnabled ? "Enabled" : "Disabled"}
</StatusBadge>
)
}
}
},
},
]}
data={[
{
name: "John",
is_enabled: true
is_enabled: true,
},
{
name: "Jane",
is_enabled: false
}
is_enabled: false,
},
]}
pageSize={2}
count={2}
@@ -28,7 +28,7 @@ export type TwoColumnLayoutProps = {
export const TwoColumnLayout = ({
firstCol,
secondCol
secondCol,
}: TwoColumnLayoutProps) => {
return (
<div className="flex flex-col gap-x-4 gap-y-3 xl:flex-row xl:items-start">
@@ -167,6 +167,6 @@ module.exports = defineConfig({
ttl: 30,
},
},
]
],
})
```
@@ -37,7 +37,7 @@ module.exports = defineConfig({
// optional options
},
},
]
],
})
```
@@ -39,7 +39,7 @@ module.exports = defineConfig({
redisUrl: process.env.CACHE_REDIS_URL,
},
},
]
],
})
```
@@ -249,6 +249,6 @@ module.exports = defineConfig({
// any options
},
},
]
],
})
```
@@ -31,9 +31,9 @@ module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/event-bus-local"
}
]
resolve: "@medusajs/medusa/event-bus-local",
},
],
})
```
@@ -42,8 +42,8 @@ module.exports = defineConfig({
options: {
redisUrl: process.env.EVENTS_REDIS_URL,
},
}
]
},
],
})
```
@@ -54,7 +54,7 @@ module.exports = {
],
},
},
]
],
}
```
@@ -141,7 +141,7 @@ module.exports = {
],
},
},
]
],
}
```
@@ -370,7 +370,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
---
@@ -49,7 +49,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -54,7 +54,7 @@ module.exports = {
],
},
},
]
],
}
```
@@ -62,7 +62,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -33,8 +33,8 @@ module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/workflow-engine-inmemory"
}
resolve: "@medusajs/medusa/workflow-engine-inmemory",
},
],
})
```
@@ -41,7 +41,7 @@ module.exports = defineConfig({
},
},
},
]
],
})
```
@@ -48,7 +48,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -195,7 +195,7 @@ export async function POST(request: MedusaRequest, res: MedusaResponse) {
```ts
import { NextResponse } from "next/server"
// eslint-disable-next-line prettier/prettier
import { initialize as initializeCustomerModule } from "@medusajs/medusa/customer"
export async function POST(request: Request) {
@@ -42,7 +42,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -125,7 +125,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -44,7 +44,7 @@ Then, create a link between the payment collection and the resource it's storing
```ts
import {
ContainerRegistrationKeys,
Modules
Modules,
} from "@medusajs/framework/utils"
// ...
@@ -56,11 +56,11 @@ const remoteLink = container.resolve(
remoteLink.create({
[Modules.CART]: {
cart_id: "cart_123"
cart_id: "cart_123",
},
[Modules.PAYMENT]: {
payment_collection_id: paymentCollection.id
}
payment_collection_id: paymentCollection.id,
},
})
```
@@ -53,7 +53,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -68,13 +68,13 @@ Learn more about module links in [this guide](!docs!/module-links).
Create the file `src/links/product-custom.ts` with the following content:
```ts title="src/links/product-custom.ts"
import { defineLink } from "@medusajs/framework/utils";
import { defineLink } from "@medusajs/framework/utils"
import HelloModule from "../modules/hello"
import ProductModule from "@medusajs/medusa/product"
export default defineLink(
ProductModule.linkable.product,
HelloModule.linkable.custom,
HelloModule.linkable.custom
)
```
@@ -234,29 +234,29 @@ export const createCustomFromProductWorkflow = createWorkflow(
(input: CreateCustomFromProductWorkflowInput) => {
const customName = transform(
{
input
input,
},
(data) => data.input.additional_data.custom_name || ""
)
const custom = createCustomStep({
custom_name: customName
custom_name: customName,
})
when(({ custom }), ({ custom }) => custom !== undefined)
.then(() => {
createRemoteLinkStep([{
[Modules.PRODUCT]: {
product_id: input.product.id
product_id: input.product.id,
},
[HELLO_MODULE]: {
custom_id: custom.id
}
custom_id: custom.id,
},
}])
})
return new WorkflowResponse({
custom
custom,
})
}
)
@@ -282,19 +282,19 @@ To consume the hook, create the file `src/workflow/hooks/product-created.ts` wit
import { createProductsWorkflow } from "@medusajs/medusa/core-flows"
import {
createCustomFromProductWorkflow,
CreateCustomFromProductWorkflowInput
CreateCustomFromProductWorkflowInput,
} from "../create-custom-from-product"
createProductsWorkflow.hooks.productsCreated(
async ({ products, additional_data }, { container }) => {
const workflow = createCustomFromProductWorkflow(container)
for (let product of products) {
for (const product of products) {
await workflow.run({
input: {
product,
additional_data
} as CreateCustomFromProductWorkflowInput
additional_data,
} as CreateCustomFromProductWorkflowInput,
})
}
}
@@ -556,16 +556,16 @@ const created = when({
)
.then(() => {
const custom = createCustomStep({
custom_name: input.additional_data.custom_name
custom_name: input.additional_data.custom_name,
})
createRemoteLinkStep([{
[Modules.PRODUCT]: {
product_id: input.product.id
product_id: input.product.id,
},
[HELLO_MODULE]: {
custom_id: custom.id
}
custom_id: custom.id,
},
}])
return custom
@@ -628,7 +628,7 @@ const updated = when({
return new WorkflowResponse({
created,
updated,
deleted
deleted,
})
```
@@ -646,19 +646,19 @@ Create the file `src/workflows/hooks/product-updated.ts` with the following cont
import { updateProductsWorkflow } from "@medusajs/medusa/core-flows"
import {
UpdateCustomFromProductStepInput,
updateCustomFromProductWorkflow
updateCustomFromProductWorkflow,
} from "../update-custom-from-product"
updateProductsWorkflow.hooks.productsUpdated(
async ({ products, additional_data }, { container }) => {
const workflow = updateCustomFromProductWorkflow(container)
for (let product of products) {
for (const product of products) {
await workflow.run({
input: {
product,
additional_data
} as UpdateCustomFromProductStepInput
additional_data,
} as UpdateCustomFromProductStepInput,
})
}
}
@@ -68,13 +68,13 @@ Learn more about module links in [this guide](!docs!/module-links).
Create the file `src/links/promotion-custom.ts` with the following content:
```ts title="src/links/promotion-custom.ts"
import { defineLink } from "@medusajs/framework/utils";
import { defineLink } from "@medusajs/framework/utils"
import HelloModule from "../modules/hello"
import PromotionModule from "@medusajs/medusa/promotion"
export default defineLink(
PromotionModule.linkable.promotion,
HelloModule.linkable.custom,
HelloModule.linkable.custom
)
```
@@ -234,29 +234,29 @@ export const createCustomFromPromotionWorkflow = createWorkflow(
(input: CreateCustomFromPromotionWorkflowInput) => {
const customName = transform(
{
input
input,
},
(data) => data.input.additional_data.custom_name || ""
)
const custom = createCustomStep({
custom_name: customName
custom_name: customName,
})
when(({ custom }), ({ custom }) => custom !== undefined)
.then(() => {
createRemoteLinkStep([{
[Modules.PROMOTION]: {
promotion_id: input.promotion.id
promotion_id: input.promotion.id,
},
[HELLO_MODULE]: {
custom_id: custom.id
}
custom_id: custom.id,
},
}])
})
return new WorkflowResponse({
custom
custom,
})
}
)
@@ -282,19 +282,19 @@ To consume the hook, create the file `src/workflow/hooks/promotion-created.ts` w
import { createPromotionsWorkflow } from "@medusajs/medusa/core-flows"
import {
createCustomFromPromotionWorkflow,
CreateCustomFromPromotionWorkflowInput
CreateCustomFromPromotionWorkflowInput,
} from "../create-custom-from-promotion"
createPromotionsWorkflow.hooks.promotionsCreated(
async ({ promotions, additional_data }, { container }) => {
const workflow = createCustomFromPromotionWorkflow(container)
for (let promotion of promotions) {
for (const promotion of promotions) {
await workflow.run({
input: {
promotion,
additional_data
} as CreateCustomFromPromotionWorkflowInput
additional_data,
} as CreateCustomFromPromotionWorkflowInput,
})
}
}
@@ -562,16 +562,16 @@ const created = when({
)
.then(() => {
const custom = createCustomStep({
custom_name: input.additional_data.custom_name
custom_name: input.additional_data.custom_name,
})
createRemoteLinkStep([{
[Modules.PROMOTION]: {
promotion_id: input.promotion.id
promotion_id: input.promotion.id,
},
[HELLO_MODULE]: {
custom_id: custom.id
}
custom_id: custom.id,
},
}])
return custom
@@ -634,7 +634,7 @@ const updated = when({
return new WorkflowResponse({
created,
updated,
deleted
deleted,
})
```
@@ -652,19 +652,19 @@ Create the file `src/workflows/hooks/promotion-updated.ts` with the following co
import { updatePromotionsWorkflow } from "@medusajs/medusa/core-flows"
import {
UpdateCustomFromPromotionStepInput,
updateCustomFromPromotionWorkflow
updateCustomFromPromotionWorkflow,
} from "../update-custom-from-promotion"
updatePromotionsWorkflow.hooks.promotionsUpdated(
async ({ promotions, additional_data }, { container }) => {
const workflow = updateCustomFromPromotionWorkflow(container)
for (let promotion of promotions) {
for (const promotion of promotions) {
await workflow.run({
input: {
promotion,
additional_data
} as UpdateCustomFromPromotionStepInput
additional_data,
} as UpdateCustomFromPromotionStepInput,
})
}
}
@@ -40,7 +40,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -28,7 +28,7 @@ module.exports = defineConfig({
jwt_secret: process.env.JWT_SECRET,
},
},
]
],
})
```
@@ -158,7 +158,7 @@ module.exports = defineConfig({
},
},
},
]
],
})
```
+17 -17
View File
@@ -454,7 +454,7 @@ export default defineMiddlewares({
authenticate(
"user",
["session", "bearer", "api-key"]
)
),
],
},
],
@@ -480,7 +480,7 @@ export default defineMiddlewares({
{
matcher: "/custom/customer*",
middlewares: [
authenticate("customer", ["session", "bearer"])
authenticate("customer", ["session", "bearer"]),
],
},
],
@@ -676,8 +676,8 @@ export default defineMiddlewares({
matcher: "/webhooks/*",
bodyParser: { preserveRawBody: true },
method: ["POST"],
}
]
},
],
})
```
@@ -762,8 +762,8 @@ module.exports = defineConfig({
modules: [
{
resolve: "./modules/hello",
}
]
},
],
})
```
@@ -790,11 +790,11 @@ export async function GET(
)
const my_custom = await helloModuleService.createMyCustoms({
name: "test"
name: "test",
})
res.json({
my_custom
my_custom,
})
}
```
@@ -863,7 +863,7 @@ module.exports = defineConfig({
apiKey: true,
},
},
]
],
})
```
@@ -2043,7 +2043,7 @@ export const GET = async (
my_customs: myCustoms,
count,
take,
skip
skip,
})
}
```
@@ -2915,7 +2915,7 @@ import {
LoaderOptions,
} from "@medusajs/framework/types"
import {
ContainerRegistrationKeys
ContainerRegistrationKeys,
} from "@medusajs/framework/utils"
export default async function helloWorldLoader({
@@ -2972,7 +2972,7 @@ export default async function helloWorldLoader({
container.registerAdd(
"custom_data",
asValue({
test: true
test: true,
})
)
}
@@ -3690,7 +3690,7 @@ To accept payment using the Payment Module's main service:
```ts
import {
ContainerRegistrationKeys,
Modules
Modules,
} from "@medusajs/framework/utils"
// ...
@@ -3710,11 +3710,11 @@ const remoteLink = container.resolve(
// create a link between the cart and payment collection
remoteLink.create({
[Modules.CART]: {
cart_id: "cart_123"
cart_id: "cart_123",
},
[Modules.PAYMENT]: {
payment_collection_id: paymentCollection.id
}
payment_collection_id: paymentCollection.id,
},
})
```
@@ -3814,7 +3814,7 @@ import {
} from "@medusajs/framework/types"
import {
QueryContext,
calculateAmountsWithTax
calculateAmountsWithTax,
} from "@medusajs/framework/utils"
// other imports...
+7 -7
View File
@@ -296,7 +296,7 @@ import { DetailWidgetProps, HttpTypes } from "@medusajs/framework/types"
const ProductWidget = () => {
const { data, isLoading } = useQuery({
queryFn: () => sdk.admin.product.list(),
queryKey: ["products"]
queryKey: ["products"],
})
return (
@@ -331,17 +331,17 @@ import { sdk } from "../lib/config"
import { DetailWidgetProps, HttpTypes } from "@medusajs/framework/types"
const ProductWidget = ({
data: productData
data: productData,
}: DetailWidgetProps<HttpTypes.AdminProduct>) => {
const { mutateAsync } = useMutation({
mutationFn: (payload: HttpTypes.AdminUpdateProduct) =>
sdk.admin.product.update(productData.id, payload),
onSuccess: () => alert("updated product")
onSuccess: () => alert("updated product"),
})
const handleUpdate = () => {
mutateAsync({
title: "New Product Title"
title: "New Product Title",
})
}
@@ -375,8 +375,8 @@ For example:
```ts highlights={[["2", "next"], ["3", "tags", "An array of tags to cache the data under."]]}
sdk.store.product.list({}, {
next: {
tags: ["products"]
}
tags: ["products"],
},
})
```
@@ -385,7 +385,7 @@ The `tags` property accepts an array of tags that the data is cached under.
Then, to purge the cache later, use Next.js's `revalidateTag` utility:
```ts
import { revalidateTag } from "next/cache";
import { revalidateTag } from "next/cache"
// ...
@@ -159,7 +159,7 @@ export const restockModelHighlights = [
{
resolve: "./src/modules/restock-notification",
},
]
],
})
```
@@ -202,7 +202,7 @@ module.exports = defineConfig({
{
resolve: "./src/modules/digital-product",
},
]
],
})
```
@@ -1545,7 +1545,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -2043,7 +2043,7 @@ module.exports = defineConfig({
],
},
},
]
],
})
```
@@ -128,7 +128,7 @@ export const serviceHighlights = [
apiKey: process.env.ERP_API_KEY,
},
},
]
],
})
```
@@ -168,7 +168,7 @@ module.exports = defineConfig({
{
resolve: "./src/modules/restaurant",
},
]
],
})
```
@@ -312,7 +312,7 @@ module.exports = defineConfig({
{
resolve: "./src/modules/delivery",
},
]
],
})
```
@@ -148,7 +148,7 @@ module.exports = defineConfig({
{
resolve: "./src/modules/marketplace",
},
]
],
})
```
@@ -1151,7 +1151,7 @@ import {
useQueryGraphStep,
createRemoteLinkStep,
completeCartWorkflow,
getOrderDetailWorkflow
getOrderDetailWorkflow,
} from "@medusajs/medusa/core-flows"
import groupVendorItemsStep from "./steps/group-vendor-items"
import createVendorOrdersStep from "./steps/create-vendor-orders"
@@ -1194,8 +1194,8 @@ const createVendorOrdersWorkflow = createWorkflow(
"shipping_address.*",
"billing_address.*",
"shipping_methods.*",
]
}
],
},
})
const {
@@ -166,7 +166,7 @@ module.exports = defineConfig({
{
resolve: "./src/modules/subscription",
},
]
],
})
```
@@ -14,12 +14,13 @@ import { slugChanges } from "../../../generated/slug-changes.mjs"
import { filesMap } from "../../../generated/files-map.mjs"
type PageProps = {
params: {
params: Promise<{
slug: string[]
}
}>
}
export default async function ReferencesPage({ params }: PageProps) {
export default async function ReferencesPage(props: PageProps) {
const params = await props.params
const { slug } = params
// ensure that Vercel loads references files
+207
View File
@@ -0,0 +1,207 @@
import prettier from "eslint-plugin-prettier/recommended"
import globals from "globals"
import babelParser from "@babel/eslint-parser"
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin"
import tsParser from "@typescript-eslint/parser"
import path from "node:path"
import { fileURLToPath } from "node:url"
import js from "@eslint/js"
import { FlatCompat } from "@eslint/eslintrc"
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})
export default [
prettier,
{
ignores: ["**/eslint-config-docs", "**/.eslintrc.js", "**/dist"],
},
...compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:@next/next/recommended"
),
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
...globals.browser,
},
parser: babelParser,
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
requireConfigFile: false,
ecmaFeatures: {
experimentalDecorators: true,
jsx: true,
modules: true,
},
project: true,
},
},
settings: {
react: {
version: "detect",
},
},
rules: {
curly: ["error", "all"],
"new-cap": "off",
"require-jsdoc": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
camelcase: "off",
"no-invalid-this": "off",
"max-len": [
"error",
{
code: 80,
ignoreStrings: true,
ignoreRegExpLiterals: true,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreTemplateLiterals: true,
},
],
semi: ["error", "never"],
quotes: [
"error",
"double",
{
allowTemplateLiterals: true,
},
],
"comma-dangle": [
"error",
{
arrays: "always-multiline",
objects: "always-multiline",
imports: "always-multiline",
exports: "always-multiline",
functions: "never",
},
],
"object-curly-spacing": ["error", "always"],
"arrow-parens": ["error", "always"],
"linebreak-style": 0,
"no-confusing-arrow": [
"error",
{
allowParens: false,
},
],
"space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always",
},
],
"space-infix-ops": "error",
"eol-last": ["error", "always"],
"no-console": [
"error",
{
allow: ["error", "warn"],
},
],
"react/prop-types": [
2,
{
ignore: ["className"],
},
],
},
},
...compat
.extends(
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
)
.map((config) => ({
...config,
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
})),
{
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"],
plugins: {
"@typescript-eslint": typescriptEslintEslintPlugin,
},
languageOptions: {
parser: tsParser,
ecmaVersion: 13,
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
settings: {
next: {
rootDir: ".",
},
},
ignores: [
"**/next.config.js",
"**/spec",
"**/node_modules",
"**/public",
"**/.eslintrc.js",
],
rules: {
"react/react-in-jsx-scope": "off",
"@typescript-eslint/prefer-ts-expect-error": "off",
"valid-jsdoc": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/promise-function-async": "error",
"@/keyword-spacing": "error",
"@/space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always",
},
],
"@/space-infix-ops": "error",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
},
},
]
+17 -13
View File
@@ -9,33 +9,33 @@
"start": "next start",
"start:monorepo": "yarn start -p 3003",
"lint": "next lint --fix",
"lint:content": "eslint --no-eslintrc -c .content.eslintrc.js app/**/*.mdx --fix",
"lint:content": "eslint --no-config-lookup -c .content.eslintrc.mjs app/**/*.mdx --fix",
"prep": "node ./scripts/prepare.mjs"
},
"dependencies": {
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
"@medusajs/icons": "^2.0.0",
"@next/mdx": "^14.2.14",
"@next/mdx": "15.0.1",
"clsx": "^2.1.0",
"docs-ui": "*",
"next": "14.2.14",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "15.0.1",
"react": "rc",
"react-dom": "rc",
"rehype-mdx-code-props": "^2.0.0",
"remark-directive": "^3.0.0",
"remark-frontmatter": "^5.0.0"
},
"devDependencies": {
"@types/mdx": "^2.0.11",
"@types/mdx": "^2.0.13",
"@types/node": "^20",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react@rc",
"autoprefixer": "^10.0.1",
"build-scripts": "*",
"eslint": "^8",
"eslint-config-docs": "*",
"eslint-config-next": "14.2.3",
"eslint": "^9.13.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^5.0.0",
"postcss": "^8",
"remark-rehype-plugins": "*",
"tailwind": "*",
@@ -47,5 +47,9 @@
},
"engines": {
"node": ">=20"
},
"overrides": {
"@types/react": "npm:types-react@rc",
"@types/react-dom": "npm:types-react-dom@rc"
}
}