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:
@@ -212,7 +212,7 @@ To pass a plugin its configurations on a Medusa server, you have to add it to th
|
||||
|
||||
```jsx title=medusa-config.js
|
||||
const plugins = [
|
||||
//...
|
||||
// ...
|
||||
{
|
||||
resolve: `medusa-plugin-custom`,
|
||||
options: {
|
||||
@@ -225,19 +225,23 @@ const plugins = [
|
||||
Then, you can have access to your plugin configuration in the constructor of services in your plugin:
|
||||
|
||||
```jsx title=src/service/test.ts
|
||||
//In a service in your plugin
|
||||
constructor({}, options) {
|
||||
//options contains plugin configurations
|
||||
this.name = options.name
|
||||
// In a service in your plugin
|
||||
class MyService extends TransactionBaseService {
|
||||
constructor(container, options) {
|
||||
super(container)
|
||||
// options contains plugin configurations
|
||||
this.name = options.name
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
You can also have access to the configurations in endpoints in your plugin:
|
||||
|
||||
```jsx title=src/api/index.ts
|
||||
//in an endpoint in your plugin
|
||||
// in an endpoint in your plugin
|
||||
export default (rootDirectory, options) => {
|
||||
//options contain the plugin configurations
|
||||
// options contain the plugin configurations
|
||||
const router = Router()
|
||||
|
||||
router.get("/hello-world", (req, res) => {
|
||||
@@ -293,10 +297,10 @@ Then, add your plugin into the array of plugins in `medusa-config.js`:
|
||||
|
||||
```jsx title=medusa-config.js
|
||||
const plugins = [
|
||||
//...
|
||||
// ...
|
||||
{
|
||||
resolve: `medusa-plugin-custom`,
|
||||
//if your plugin has configurations
|
||||
// if your plugin has configurations
|
||||
options: {
|
||||
name: "My Store",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user