chore(docs): added eslint to lint documentation code blocks (#2920)
* docs: added rule for code length * chore: fixes based on vale errors * changed to use eslint * fixes using eslint * added github action for documentation eslint * changed allowed max-length * fixed incorrect heading level * removed comment
This commit is contained in:
@@ -57,9 +57,9 @@ You can retrieve regions available on your server using the [List Regions](/api/
|
||||
```tsx
|
||||
medusa.admin.regions.list()
|
||||
.then(({ regions, limit, offset, count }) => {
|
||||
console.log(regions.length);
|
||||
//display regions
|
||||
});
|
||||
console.log(regions.length)
|
||||
// display regions
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -67,13 +67,13 @@ medusa.admin.regions.list()
|
||||
|
||||
```tsx
|
||||
fetch(`<SERVER_URL>/admin/regions`, {
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ regions, limit, offset, count }) => {
|
||||
console.log(regions.length);
|
||||
//display regions
|
||||
});
|
||||
console.log(regions.length)
|
||||
// display regions
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -102,22 +102,22 @@ You can create a region by sending a request to the [Create a Region](/api/admin
|
||||
|
||||
```tsx
|
||||
medusa.admin.regions.create({
|
||||
name: 'Europe',
|
||||
currency_code: 'eur',
|
||||
name: "Europe",
|
||||
currency_code: "eur",
|
||||
tax_rate: 0,
|
||||
payment_providers: [
|
||||
'manual'
|
||||
"manual",
|
||||
],
|
||||
fulfillment_providers: [
|
||||
'manual'
|
||||
"manual",
|
||||
],
|
||||
countries: [
|
||||
'DK'
|
||||
]
|
||||
"DK",
|
||||
],
|
||||
})
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
console.log(region.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -125,27 +125,27 @@ medusa.admin.regions.create({
|
||||
|
||||
```tsx
|
||||
fetch(`<SERVER_URL>/admin/regions`, {
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name: 'Europe',
|
||||
currency_code: 'eur',
|
||||
name: "Europe",
|
||||
currency_code: "eur",
|
||||
tax_rate: 0,
|
||||
payment_providers: [
|
||||
'manual'
|
||||
"manual",
|
||||
],
|
||||
fulfillment_providers: [
|
||||
'manual'
|
||||
"manual",
|
||||
],
|
||||
countries: [
|
||||
'DK'
|
||||
]
|
||||
})
|
||||
"DK",
|
||||
],
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
console.log(region.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -202,12 +202,12 @@ Alternatively, you can update the details of a region using the [Update a Region
|
||||
medusa.admin.regions.update(regionId, {
|
||||
countries: [
|
||||
"DK",
|
||||
"DE"
|
||||
]
|
||||
"DE",
|
||||
],
|
||||
})
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
console.log(region.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -215,25 +215,25 @@ medusa.admin.regions.update(regionId, {
|
||||
|
||||
```tsx
|
||||
fetch(`<SERVER_URL>/admin/regions/${regionId}`, {
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
countries: [
|
||||
'DK',
|
||||
'DE'
|
||||
]
|
||||
})
|
||||
"DK",
|
||||
"DE",
|
||||
],
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ region }) => {
|
||||
console.log(region.id);
|
||||
});
|
||||
console.log(region.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="curl" label="cURL">
|
||||
|
||||
```tsx
|
||||
```bash
|
||||
curl -L -X POST '<SERVER_URL>/admin/regions/<REGION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
@@ -271,17 +271,17 @@ You can add a shipping option to a region by sending a request to the [Create Sh
|
||||
|
||||
```tsx
|
||||
medusa.admin.shippingOptions.create({
|
||||
name: 'PostFake',
|
||||
name: "PostFake",
|
||||
region_id: regionId,
|
||||
provider_id: "manual",
|
||||
data: {
|
||||
},
|
||||
price_type: 'flat_rate',
|
||||
amount: 1000
|
||||
price_type: "flat_rate",
|
||||
amount: 1000,
|
||||
})
|
||||
.then(({ shipping_option }) => {
|
||||
console.log(shipping_option.id);
|
||||
});
|
||||
console.log(shipping_option.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -289,28 +289,28 @@ medusa.admin.shippingOptions.create({
|
||||
|
||||
```tsx
|
||||
fetch(`<SERVER_URL>/admin/shipping-options`, {
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
credentials: "include",
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
name: 'PostFake',
|
||||
name: "PostFake",
|
||||
region_id: regionId,
|
||||
provider_id: "manual",
|
||||
price_type: 'flat_rate',
|
||||
price_type: "flat_rate",
|
||||
data: {
|
||||
},
|
||||
amount: 1000
|
||||
})
|
||||
amount: 1000,
|
||||
}),
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ shipping_option }) => {
|
||||
console.log(shipping_option.id);
|
||||
});
|
||||
console.log(shipping_option.id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="curl" label="cURL">
|
||||
|
||||
```tsx
|
||||
```bash
|
||||
curl -L -X POST '<SERVER_URL>/admin/shipping-options' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||
-H 'Content-Type: application/json' \
|
||||
@@ -360,8 +360,8 @@ You can delete a region by sending a request to the [Delete a Region](/api/admin
|
||||
```tsx
|
||||
medusa.admin.regions.delete(regionId)
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id);
|
||||
});
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
@@ -369,19 +369,19 @@ medusa.admin.regions.delete(regionId)
|
||||
|
||||
```tsx
|
||||
fetch(`<SERVER_URL>/admin/regions/${regionId}`, {
|
||||
credentials: 'include',
|
||||
method: 'DELETE'
|
||||
credentials: "include",
|
||||
method: "DELETE",
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then(({ id, object, deleted }) => {
|
||||
console.log(id);
|
||||
});
|
||||
console.log(id)
|
||||
})
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="curl" label="cURL">
|
||||
|
||||
```tsx
|
||||
```bash
|
||||
curl -L -X DELETE '<SERVER_URL>/admin/regions/<REGION_ID>' \
|
||||
-H 'Authorization: Bearer <API_TOKEN>'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user