@eventcatalog/core 4.10.13 → 4.10.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-SSSN5FXC.js → chunk-7LWOCX4R.js} +1 -1
- package/dist/{chunk-IIECZFXN.js → chunk-A4JRWRCV.js} +1 -1
- package/dist/{chunk-JHUICVBT.js → chunk-HBVTU6ZP.js} +1 -1
- package/dist/{chunk-PADMH2RJ.js → chunk-I6HUOX4R.js} +1 -1
- package/dist/{chunk-34RMFKFB.js → chunk-Q2ATWE7N.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/docs/api/02-config.md +60 -6
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/02-configuration.md +18 -11
- package/dist/docs/development/authentication/providers/03-setting-up-github.md +29 -0
- package/dist/docs/development/bring-your-own-documentation/custom-pages/02-adding-custom-docs.md +2 -2
- package/dist/docs/development/bring-your-own-documentation/custom-pages/03-components.md +17 -0
- package/dist/docs/development/components/07-resource-references.md +7 -1
- package/dist/docs/development/components/components/05-architecture-graph.md +65 -0
- package/dist/docs/development/components/components/{05-attachments.md → 06-attachments.md} +1 -1
- package/dist/docs/development/components/components/{06-channel-information.md → 07-channel-information.md} +1 -1
- package/dist/docs/development/components/components/{07-custom-properties.md → 08-custom-properties.md} +1 -1
- package/dist/docs/development/components/components/{08-design.md → 09-design.md} +1 -1
- package/dist/docs/development/components/components/{09-entitymap.md → 10-entitymap.md} +1 -1
- package/dist/docs/development/components/components/{10-flow.md → 11-flow.md} +1 -1
- package/dist/docs/development/components/components/{11-link.md → 12-link.md} +1 -1
- package/dist/docs/development/components/components/{12-mermaid-file-loader.md → 13-mermaid-file-loader.md} +13 -1
- package/dist/docs/development/components/components/{13-message-table.md → 14-message-table.md} +1 -1
- package/dist/docs/development/components/components/{14-nodegraph.md → 15-nodegraph.md} +1 -1
- package/dist/docs/development/components/components/{15-openapi.md → 16-openapi.md} +1 -1
- package/dist/docs/development/components/components/{16-prompt.md → 17-prompt.md} +1 -1
- package/dist/docs/development/components/components/{17-remote-schema.md → 18-remote-schema.md} +1 -1
- package/dist/docs/development/components/components/{18-resource-group-table.md → 19-resource-group-table.md} +1 -1
- package/dist/docs/development/components/components/{19-resource-link.md → 20-resource-link.md} +1 -1
- package/dist/docs/development/components/components/{20-schema.md → 21-schema.md} +1 -1
- package/dist/docs/development/components/components/{21-schema-viewer.md → 22-schema-viewer.md} +1 -1
- package/dist/docs/development/components/components/{22-steps.md → 23-steps.md} +1 -1
- package/dist/docs/development/components/components/{23-tabs.md → 24-tabs.md} +1 -1
- package/dist/docs/development/components/components/{24-tiles.md → 25-tiles.md} +1 -1
- package/dist/docs/development/components/components/{25-visibility.md → 26-visibility.md} +1 -1
- package/dist/docs/development/components/diagram-syntax/06-mermaid.md +45 -6
- package/dist/docs/development/customization/04-documentation-sidebar.md +3 -3
- package/dist/docs/development/customization/05-resource-sidebar.md +235 -0
- package/dist/docs/development/customization/09-embed-eventcatalog.md +179 -0
- package/dist/docs/development/customization/_category_.json +1 -1
- package/dist/docs/development/deployment/build-and-deploy.md +4 -0
- package/dist/docs/development/deployment/hosting-options.md +1 -1
- package/dist/docs/development/deployment/link-validation.md +105 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/00-overview.md +76 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/01-setup.md +144 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/_category_.json +10 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/01-configure-rules.md +130 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/02-run-in-ci.md +93 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/03-use-custom-frontmatter.md +81 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/04-reference-external-catalogs.md +51 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/05-fix-common-problems.md +120 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/_category_.json +12 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/01-cli.md +109 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/02-configuration.md +120 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/03-rules.md +287 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/04-versions.md +77 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/05-supported-resources.md +75 -0
- package/dist/docs/development/developer-tools/eventcatalog-linter/reference/_category_.json +12 -0
- package/dist/docs/development/guides/97-architecture-graph.md +78 -0
- package/dist/docs/development/guides/domains/02-create-domain.md +1 -1
- package/dist/docs/development/guides/domains/03-ownership-and-language/02-adding-ubiquitous-language.md +29 -0
- package/dist/docs/development/guides/domains/09-reference.md +10 -0
- package/dist/docs/development/guides/resources/messages/04-message-channels/02-adding-channels.md +2 -2
- package/dist/docs/development/guides/resources/messages/04-message-channels/04-adding-messages-to-services.md +8 -0
- package/dist/docs/development/guides/resources/schemas/03-add-specifications-to-services/01-add-openapi-specifications.md +2 -2
- package/dist/docs/development/guides/resources/schemas/03-add-specifications-to-services/02-add-asyncapi-specifications.md +3 -3
- package/dist/docs/development/guides/systems/05-system-context-maps.md +2 -0
- package/dist/docs/development/license-keys/license-validation.md +7 -3
- package/dist/docs/development/license-keys/overview.md +7 -3
- package/dist/docs/development/upgrading/upgrading.md +3 -3
- package/dist/docs/development/upgrading/v2.md +3 -3
- package/dist/docs/federation/00-overview.md +158 -0
- package/dist/docs/federation/01-first-federation.md +199 -0
- package/dist/docs/federation/_category_.json +12 -0
- package/dist/docs/federation/explanation/_category_.json +12 -0
- package/dist/docs/federation/explanation/how-it-works.md +129 -0
- package/dist/docs/federation/explanation/lockfile-and-cache.md +134 -0
- package/dist/docs/federation/explanation/mvp-status-and-feedback.md +86 -0
- package/dist/docs/federation/explanation/ownership-and-references.md +134 -0
- package/dist/docs/federation/how-to/_category_.json +12 -0
- package/dist/docs/federation/how-to/configure-github-sources.md +156 -0
- package/dist/docs/federation/how-to/configure-validation-rules.md +127 -0
- package/dist/docs/federation/how-to/run-in-ci.md +138 -0
- package/dist/docs/federation/how-to/share-assets-and-components.md +125 -0
- package/dist/docs/federation/how-to/use-local-sources.md +138 -0
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/00-introduction.md +11 -2
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/01-installation.md +11 -3
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/02-plugin-configuration.md +11 -2
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/03-examples.md +11 -1
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/04-configuration.md +11 -1
- package/dist/docs/{plugins/eventcatalog-federation → federation/legacy-federation}/05-setup-team-catalog.md +11 -2
- package/dist/docs/federation/legacy-federation/_category_.json +12 -0
- package/dist/docs/federation/reference/_category_.json +12 -0
- package/dist/docs/federation/reference/cli.md +122 -0
- package/dist/docs/federation/reference/configuration.md +192 -0
- package/dist/docs/federation/reference/diagnostic-rules.md +173 -0
- package/dist/docs/federation/reference/generated-output.md +118 -0
- package/dist/docs/federation/reference/supported-content.md +86 -0
- package/dist/docs/federation/reference/troubleshooting.md +208 -0
- package/dist/docs/plugins/01-intro.md +3 -3
- package/dist/docs/plugins/03-all-plugins.md +2 -2
- package/dist/docs/plugins/asyncapi/00-intro.md +4 -4
- package/dist/docs/plugins/asyncapi/02-plugin-configuration.md +4 -4
- package/dist/docs/plugins/backstage/00-overview.md +53 -0
- package/dist/docs/plugins/backstage/01-get-started.md +95 -0
- package/dist/docs/plugins/backstage/02-embed-entity-tabs.md +109 -0
- package/dist/docs/plugins/backstage/03-add-overview-cards.md +79 -0
- package/dist/docs/plugins/backstage/04-control-theme-and-size.md +54 -0
- package/dist/docs/plugins/backstage/05-migrate-to-annotations.md +49 -0
- package/dist/docs/plugins/backstage/06-configuration.md +85 -0
- package/dist/docs/plugins/backstage/07-components.md +129 -0
- package/dist/docs/plugins/backstage/08-how-embeds-work.md +52 -0
- package/dist/docs/plugins/backstage/_category_.json +4 -3
- package/dist/docs/plugins/eventbridge/00-intro.md +5 -5
- package/dist/docs/plugins/eventbridge/03-api.md +3 -3
- package/dist/docs/plugins/graphql/00-intro.md +2 -2
- package/dist/docs/plugins/graphql/02-plugin-configuration.md +2 -2
- package/dist/docs/plugins/hookdeck/01-intro.md +1 -1
- package/dist/docs/plugins/openapi/00-intro.md +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/components/SchemaExplorer/AvroSchemaViewer.tsx +21 -19
- package/eventcatalog/src/components/SchemaExplorer/JSONSchemaViewer.test.tsx +114 -0
- package/eventcatalog/src/components/SchemaExplorer/JSONSchemaViewer.tsx +107 -86
- package/eventcatalog/src/components/SchemaExplorer/ProtobufSchemaViewer.test.tsx +91 -0
- package/eventcatalog/src/components/SchemaExplorer/ProtobufSchemaViewer.tsx +115 -33
- package/eventcatalog/src/components/SchemaExplorer/SchemaViewerHover.test.tsx +33 -0
- package/eventcatalog/src/components/SchemaExplorer/protobuf-validation.test.ts +84 -0
- package/eventcatalog/src/components/SchemaExplorer/protobuf-validation.ts +149 -0
- package/eventcatalog/src/utils/collections/glob-loader.ts +2 -2
- package/eventcatalog/src/utils/protobuf-schema.ts +211 -16
- package/package.json +8 -8
- package/dist/docs/cli/channels.md +0 -180
- package/dist/docs/cli/commands.md +0 -183
- package/dist/docs/cli/custom-docs.md +0 -78
- package/dist/docs/cli/data-products.md +0 -177
- package/dist/docs/cli/data-stores.md +0 -166
- package/dist/docs/cli/diagrams.md +0 -147
- package/dist/docs/cli/domains.md +0 -280
- package/dist/docs/cli/entities.md +0 -138
- package/dist/docs/cli/events.md +0 -186
- package/dist/docs/cli/export.md +0 -27
- package/dist/docs/cli/governance.md +0 -24
- package/dist/docs/cli/messages.md +0 -69
- package/dist/docs/cli/queries.md +0 -183
- package/dist/docs/cli/services.md +0 -266
- package/dist/docs/cli/snapshots.md +0 -44
- package/dist/docs/cli/teams.md +0 -75
- package/dist/docs/cli/users.md +0 -75
- package/dist/docs/cli/utilities.md +0 -43
- package/dist/docs/development/developer-tools/eventcatalog-linter.md +0 -732
- package/dist/docs/plugins/backstage/00-intro.md +0 -67
- package/dist/docs/plugins/backstage/01-installation.md +0 -242
- package/dist/docs/plugins/backstage/02-api.md +0 -51
- package/dist/docs/plugins/backstage/03-examples.md +0 -12
- package/dist/docs/plugins/eventcatalog-federation/_category_.json +0 -11
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
slug: /development/developer-tools/eventcatalog-linter
|
|
4
|
+
keywords:
|
|
5
|
+
- EventCatalog linter
|
|
6
|
+
- schema validation
|
|
7
|
+
- reference validation
|
|
8
|
+
- CI/CD
|
|
9
|
+
- quality assurance
|
|
10
|
+
sidebar_label: Overview
|
|
11
|
+
title: EventCatalog Linter
|
|
12
|
+
description: Catch broken references, typos, misplaced files and missing metadata in your EventCatalog before they reach a build or a reader.
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
import AddedIn from '@site/src/components/MDX/AddedIn';
|
|
16
|
+
|
|
17
|
+
The EventCatalog Linter is a command-line tool that checks your catalog for the mistakes EventCatalog itself would otherwise ignore or only surface at build time: a service that `sends` an event that doesn't exist, a typo like `owner:` instead of `owners:`, a `schemaPath` that points at nothing, or a file saved in a folder EventCatalog never reads.
|
|
18
|
+
|
|
19
|
+
Run it locally while you write documentation, or in CI so every pull request is checked.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @eventcatalog/linter
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
services/order-service/index.mdx
|
|
27
|
+
6:1 ✖ error Unknown property "owner". Did you mean "owners"? [owner] (schema/unknown-field)
|
|
28
|
+
9:5 ✖ error Referenced event/command/query "OrderCreatd" does not exist. Did you mean "OrderCreated"? [sends[0]] (refs/resource-exists)
|
|
29
|
+
14:1 ⚠ warning Resource should have a markdown description (body content) beyond just frontmatter [description] (best-practices/description-required)
|
|
30
|
+
|
|
31
|
+
✖ 3 problems (2 errors, 1 warning) in 1 file
|
|
32
|
+
178 files checked
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What it checks
|
|
36
|
+
|
|
37
|
+
| Area | Examples |
|
|
38
|
+
|------|----------|
|
|
39
|
+
| **Frontmatter schemas** | Required fields, field types, version formats, unknown or misspelled keys |
|
|
40
|
+
| **References** | Owners, messages, services, domains, channels, containers, flow steps and entity relationships point at resources (and versions) that exist |
|
|
41
|
+
| **Files** | `schemaPath`, `schemas[]`, `specifications`, data product contracts and `public/` icons resolve to real files |
|
|
42
|
+
| **Catalog structure** | Duplicate ids, markdown files in places EventCatalog won't load |
|
|
43
|
+
| **Documentation quality** | Summaries, owners, body content and message schemas are present |
|
|
44
|
+
| **Versioning** | References to deprecated resources |
|
|
45
|
+
|
|
46
|
+
Every finding comes with a `line:column` position, the rule that produced it, and — where the linter can work it out — a suggestion for the fix.
|
|
47
|
+
|
|
48
|
+
## Where to go next
|
|
49
|
+
|
|
50
|
+
- **[Set up the linter](./01-setup.md)** — a guided walk-through from the first run to a CI check. Start here if you haven't used the linter before.
|
|
51
|
+
- **[How-to guides](/docs/development/developer-tools/eventcatalog-linter/how-to)** — recipes for specific jobs: [configure rules](./how-to/01-configure-rules.md), [run in CI](./how-to/02-run-in-ci.md), [allow custom frontmatter](./how-to/03-use-custom-frontmatter.md), [reference resources from other catalogs](./how-to/04-reference-external-catalogs.md), [fix common problems](./how-to/05-fix-common-problems.md).
|
|
52
|
+
- **[Reference](/docs/development/developer-tools/eventcatalog-linter/reference)** — every [CLI option](./reference/01-cli.md), the [configuration file](./reference/02-configuration.md), [all rules](./reference/03-rules.md) with their messages and options, [version formats](./reference/04-versions.md) and the [files the linter scans](./reference/05-supported-resources.md).
|
|
53
|
+
|
|
54
|
+
## What's new
|
|
55
|
+
|
|
56
|
+
<AddedIn version="1.1.17" pkg="@eventcatalog/linter" url="https://github.com/event-catalog/eventcatalog" />
|
|
57
|
+
|
|
58
|
+
The latest release focuses on catching the mistakes people actually make and pointing at exactly where they are:
|
|
59
|
+
|
|
60
|
+
- **Line and column numbers** on every finding, so terminals and editors can jump straight to the problem.
|
|
61
|
+
- **Unknown frontmatter keys** are flagged with "did you mean" suggestions ([`schema/unknown-field`](./reference/03-rules.md#schemaunknown-field)). EventCatalog fails the build on these; the linter now catches them first.
|
|
62
|
+
- **Misplaced files** — `events/OrderCreated.mdx` instead of `events/OrderCreated/index.mdx`, `event/` instead of `events/`, users saved as folders — are reported with the intended location ([`structure/unrecognised-file`](./reference/03-rules.md#structureunrecognised-file)).
|
|
63
|
+
- **Broken file references** — `schemaPath`, specifications, contracts and icons that don't exist ([`refs/file-exists`](./reference/03-rules.md#refsfile-exists)).
|
|
64
|
+
- **Clearer reference errors**: "this resource doesn't exist — did you mean `OrderCreated`?" is now distinct from "this resource exists, but not at version `2.1.0` — available: `2.0.0`, `1.0.0`".
|
|
65
|
+
- **Version formats match EventCatalog**: `1`, `1.2`, `v1` and `V2` are accepted everywhere EventCatalog accepts them.
|
|
66
|
+
- `eventcatalog-linter --init` scaffolds a fully commented config; `--quiet`, `--max-warnings` and `--no-color` were added; progress output stays out of CI logs; the summary reports how many files were actually checked.
|
|
67
|
+
|
|
68
|
+
Read the [rules reference](./reference/03-rules.md) for the full list, or the [original announcement](/blog/eventcatalog-linter) for the background.
|
|
69
|
+
|
|
70
|
+
## Supported resources
|
|
71
|
+
|
|
72
|
+
The linter understands every resource type EventCatalog does: domains and subdomains, systems, services, events, commands, queries, channels, flows, entities, agents, containers, data products, diagrams, ADRs, users and teams — including versioned copies under `versioned/` and content pulled in through federation. See [Supported resources](./reference/05-supported-resources.md) for the exact folders and file names it scans.
|
|
73
|
+
|
|
74
|
+
## Issues?
|
|
75
|
+
|
|
76
|
+
If you have any issues or feedback, please open an issue on [GitHub](https://github.com/event-catalog/eventcatalog/issues) or join our [Discord server](https://eventcatalog.dev/discord).
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 2
|
|
3
|
+
sidebar_label: Setup linter
|
|
4
|
+
title: Set up the linter
|
|
5
|
+
description: Run the EventCatalog Linter for the first time, read its output, fix a problem, create a configuration file, and add the check to CI.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
This guide takes you from a fresh catalog to a linted, CI-checked one: run the linter, read what it reports, fix a problem, create a configuration file, and add a pull-request check. It takes about ten minutes.
|
|
9
|
+
|
|
10
|
+
## What you need
|
|
11
|
+
|
|
12
|
+
- An EventCatalog project. If you don't have one, `npx @eventcatalog/create-eventcatalog@latest my-catalog` creates one with example content.
|
|
13
|
+
- Node.js 18 or later.
|
|
14
|
+
|
|
15
|
+
## 1. Run the linter
|
|
16
|
+
|
|
17
|
+
From the root of your catalog (the folder containing `eventcatalog.config.js`):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx @eventcatalog/linter
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
You don't need to install anything first. The linter scans your `domains/`, `services/`, `events/` and other resource folders, validates every file, and prints what it found:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
✔ No problems found!
|
|
27
|
+
178 files checked
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If your catalog is already clean, congratulations — skip to [step 4](#4-create-a-configuration-file) to see how to customise it. Otherwise, keep reading.
|
|
31
|
+
|
|
32
|
+
## 2. Read the output
|
|
33
|
+
|
|
34
|
+
Let's introduce a couple of mistakes on purpose so there is something to look at. Open any service — for example `services/order-service/index.mdx` — and change `owners:` to `owner:`, then misspell one of the events it sends:
|
|
35
|
+
|
|
36
|
+
```yaml title="services/order-service/index.mdx"
|
|
37
|
+
---
|
|
38
|
+
id: order-service
|
|
39
|
+
name: Order Service
|
|
40
|
+
version: 1.0.0
|
|
41
|
+
summary: Handles orders
|
|
42
|
+
owner:
|
|
43
|
+
- platform-team
|
|
44
|
+
sends:
|
|
45
|
+
- id: OrderCreatd
|
|
46
|
+
---
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Run the linter again:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
services/order-service/index.mdx
|
|
53
|
+
2:1 ✖ error At least one owner is required [owners] (best-practices/owner-required)
|
|
54
|
+
6:1 ✖ error Unknown property "owner". Did you mean "owners"? [owner] (schema/unknown-field)
|
|
55
|
+
9:5 ✖ error Referenced event/command/query "OrderCreatd" does not exist. Did you mean "OrderCreated"? [sends[0]] (refs/resource-exists)
|
|
56
|
+
|
|
57
|
+
✖ 3 problems (3 errors, 0 warnings) in 1 file
|
|
58
|
+
178 files checked
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Each line has the same shape:
|
|
62
|
+
|
|
63
|
+
| Part | Meaning |
|
|
64
|
+
|------|---------|
|
|
65
|
+
| `6:1` | Line and column in the file. Most terminals let you click `path:line:col`. |
|
|
66
|
+
| `✖ error` / `⚠ warning` | Severity. Errors fail the run; warnings don't unless you ask them to. |
|
|
67
|
+
| The message | What is wrong, and a suggestion when the linter can work one out. |
|
|
68
|
+
| `[owner]` | The frontmatter field the finding is about. |
|
|
69
|
+
| `(schema/unknown-field)` | The rule that produced it — look it up in the [rules reference](./reference/rules). |
|
|
70
|
+
|
|
71
|
+
Notice that one typo produced two findings: `owner` is unknown **and** `owners` is missing. That's expected — fixing the typo clears both.
|
|
72
|
+
|
|
73
|
+
## 3. Fix the problems
|
|
74
|
+
|
|
75
|
+
Change `owner` back to `owners` and `OrderCreatd` to `OrderCreated`, then re-run. You should be back to `✔ No problems found!`.
|
|
76
|
+
|
|
77
|
+
That loop — run, read, fix — is how you'll use the linter day to day. Because the message includes the line number and a suggestion, most fixes are a single edit. The [fix common problems](./how-to/fix-common-problems) guide covers the messages you're most likely to meet.
|
|
78
|
+
|
|
79
|
+
## 4. Create a configuration file
|
|
80
|
+
|
|
81
|
+
Defaults are sensible, but every team has its own standards. Let the linter write a starting point for you:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx @eventcatalog/linter --init
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
✔ Created .eventcatalogrc.js
|
|
89
|
+
178 catalog files found, CommonJS config written
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Open `.eventcatalogrc.js`. Every rule is listed with a one-line description and its default severity:
|
|
93
|
+
|
|
94
|
+
```js title=".eventcatalogrc.js"
|
|
95
|
+
module.exports = {
|
|
96
|
+
rules: {
|
|
97
|
+
// Best practices
|
|
98
|
+
// Resources have a summary
|
|
99
|
+
'best-practices/summary-required': 'error',
|
|
100
|
+
// Resources have at least one owner
|
|
101
|
+
'best-practices/owner-required': 'error',
|
|
102
|
+
// Resources have markdown body content beyond the frontmatter
|
|
103
|
+
'best-practices/description-required': 'warn',
|
|
104
|
+
// ...
|
|
105
|
+
},
|
|
106
|
+
ignorePatterns: [],
|
|
107
|
+
overrides: [],
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Try changing one rule. Perhaps your team doesn't want body content to be a warning yet:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
'best-practices/description-required': 'off',
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Run the linter again and the warning is gone. The three values are `'error'`, `'warn'` and `'off'`; the [configure rules guide](./how-to/configure-rules) covers options, ignore patterns and per-folder overrides.
|
|
118
|
+
|
|
119
|
+
## 5. Add the check to your pipeline
|
|
120
|
+
|
|
121
|
+
The linter exits with code `1` when it finds errors, which is all a CI system needs. For GitHub Actions:
|
|
122
|
+
|
|
123
|
+
```yaml title=".github/workflows/lint-catalog.yml"
|
|
124
|
+
name: Lint catalog
|
|
125
|
+
on: [pull_request]
|
|
126
|
+
|
|
127
|
+
jobs:
|
|
128
|
+
lint:
|
|
129
|
+
runs-on: ubuntu-latest
|
|
130
|
+
steps:
|
|
131
|
+
- uses: actions/checkout@v4
|
|
132
|
+
- uses: actions/setup-node@v4
|
|
133
|
+
with:
|
|
134
|
+
node-version: 20
|
|
135
|
+
- run: npx @eventcatalog/linter --max-warnings 0
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`--max-warnings 0` makes warnings fail the build too. If you'd rather let warnings through, drop the flag. In CI the linter automatically keeps its progress spinner out of the logs, so you only see findings. See [Run in CI](./how-to/run-in-ci) for GitLab and other pipelines.
|
|
139
|
+
|
|
140
|
+
## Next steps
|
|
141
|
+
|
|
142
|
+
- [Configure rules](./how-to/configure-rules) for your team's standards, including per-folder overrides.
|
|
143
|
+
- [Reference resources from other catalogs](./how-to/reference-external-catalogs) if your services consume events documented elsewhere.
|
|
144
|
+
- Browse the [rules reference](./reference/rules) to see everything the linter can catch.
|
package/dist/docs/development/developer-tools/eventcatalog-linter/how-to/01-configure-rules.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 1
|
|
3
|
+
sidebar_label: Configure rules
|
|
4
|
+
title: Configure linter rules
|
|
5
|
+
description: Change rule severities, pass rule options, ignore files, and apply different rules to different parts of the catalog.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use this guide when the defaults don't match your team's standards. All configuration lives in a `.eventcatalogrc.js` file in the catalog root; see the [configuration reference](../reference/configuration) for the full shape.
|
|
9
|
+
|
|
10
|
+
## Create the file
|
|
11
|
+
|
|
12
|
+
The fastest start is the scaffold, which lists every rule with its description and default:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @eventcatalog/linter --init
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or write it by hand. Anything you leave out keeps its default, so a config can be as small as one line:
|
|
19
|
+
|
|
20
|
+
```js title=".eventcatalogrc.js"
|
|
21
|
+
module.exports = {
|
|
22
|
+
rules: {
|
|
23
|
+
'best-practices/description-required': 'off',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
:::tip ESM catalogs
|
|
29
|
+
If your catalog's `package.json` has `"type": "module"`, write `export default { ... }` instead of `module.exports = { ... }`. `--init` detects this for you.
|
|
30
|
+
:::
|
|
31
|
+
|
|
32
|
+
## Change a rule's severity
|
|
33
|
+
|
|
34
|
+
Each rule takes one of three values:
|
|
35
|
+
|
|
36
|
+
| Value | Effect |
|
|
37
|
+
|-------|--------|
|
|
38
|
+
| `'error'` | Reported and fails the run (exit code 1) |
|
|
39
|
+
| `'warn'` | Reported but doesn't fail the run, unless you pass `--fail-on-warning` or `--max-warnings` |
|
|
40
|
+
| `'off'` | Not checked |
|
|
41
|
+
|
|
42
|
+
```js title=".eventcatalogrc.js"
|
|
43
|
+
module.exports = {
|
|
44
|
+
rules: {
|
|
45
|
+
'best-practices/owner-required': 'warn', // soften
|
|
46
|
+
'refs/orphan-messages': 'error', // tighten
|
|
47
|
+
'best-practices/schema-required': 'off', // disable
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Rule names are listed in the [rules reference](../reference/rules).
|
|
53
|
+
|
|
54
|
+
## Pass options to a rule
|
|
55
|
+
|
|
56
|
+
Some rules accept options. Use the array form `[severity, options]`:
|
|
57
|
+
|
|
58
|
+
```js title=".eventcatalogrc.js"
|
|
59
|
+
module.exports = {
|
|
60
|
+
rules: {
|
|
61
|
+
'schema/unknown-field': ['error', { allow: ['costCenter', 'legacy*'] }],
|
|
62
|
+
'refs/file-exists': ['error', { icons: false }],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The [rules reference](../reference/rules) documents which rules take options and what they mean.
|
|
68
|
+
|
|
69
|
+
## Ignore files
|
|
70
|
+
|
|
71
|
+
`ignorePatterns` skips files entirely — they are neither validated nor counted:
|
|
72
|
+
|
|
73
|
+
```js title=".eventcatalogrc.js"
|
|
74
|
+
module.exports = {
|
|
75
|
+
ignorePatterns: ['drafts/**', 'domains/Legacy/**'],
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`dependencies/**` is always ignored (it's where EventCatalog writes mocked external resources).
|
|
80
|
+
|
|
81
|
+
:::note
|
|
82
|
+
Patterns are matched against the path relative to the catalog root, and `**/` at the very start of a pattern currently requires at least one leading folder — write `drafts/**` rather than `**/drafts/**` to ignore a top-level `drafts` folder.
|
|
83
|
+
:::
|
|
84
|
+
|
|
85
|
+
## Apply different rules to different folders
|
|
86
|
+
|
|
87
|
+
`overrides` re-configures rules for files matching a glob. Later overrides win over earlier ones, and all of them win over the top-level `rules`:
|
|
88
|
+
|
|
89
|
+
```js title=".eventcatalogrc.js"
|
|
90
|
+
module.exports = {
|
|
91
|
+
rules: {
|
|
92
|
+
'best-practices/owner-required': 'error',
|
|
93
|
+
},
|
|
94
|
+
overrides: [
|
|
95
|
+
{
|
|
96
|
+
files: ['domains/Legacy/**'],
|
|
97
|
+
rules: {
|
|
98
|
+
'best-practices/owner-required': 'warn',
|
|
99
|
+
'best-practices/summary-required': 'off',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
files: ['**/containers/**'],
|
|
104
|
+
rules: {
|
|
105
|
+
'best-practices/description-required': 'off',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Options work inside overrides too: `'schema/unknown-field': ['warn', { allow: ['legacyId'] }]`.
|
|
113
|
+
|
|
114
|
+
## Which rules to keep strict
|
|
115
|
+
|
|
116
|
+
Rules fall into two groups. `schema/*`, `refs/*` and `structure/*` findings mean EventCatalog will fail the build, drop data or mis-render something — keep those as `'error'`. `best-practices/*`, `refs/orphan-messages` and `versions/no-deprecated-references` are documentation-quality opinions; tune them to your team's standards, and use overrides to relax them for legacy areas while enforcing them for new content.
|
|
117
|
+
|
|
118
|
+
## Check what's in effect
|
|
119
|
+
|
|
120
|
+
The config merges with the defaults at load time. If a rule doesn't behave the way you expect:
|
|
121
|
+
|
|
122
|
+
1. Check the rule name against the [rules reference](../reference/rules) — a misspelled rule name is silently ignored.
|
|
123
|
+
2. Check whether an override matches the file; overrides are applied in order.
|
|
124
|
+
3. Run with `--quiet` to confirm whether a finding is an error or a warning.
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [Configuration reference](../reference/configuration)
|
|
129
|
+
- [Rules reference](../reference/rules)
|
|
130
|
+
- [Allow custom frontmatter](./use-custom-frontmatter)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 2
|
|
3
|
+
sidebar_label: Run in CI
|
|
4
|
+
title: Run the linter in CI
|
|
5
|
+
description: Fail pull requests on catalog problems with GitHub Actions, GitLab CI, or any pipeline that can run npx.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use this guide to make the linter a required check on every change to your catalog.
|
|
9
|
+
|
|
10
|
+
## How the linter signals failure
|
|
11
|
+
|
|
12
|
+
- Exit code `1` when any **error** is reported, or when warnings exceed `--max-warnings`.
|
|
13
|
+
- Exit code `0` otherwise, including when only warnings are reported.
|
|
14
|
+
- Progress output (the spinner) is written to stderr and switched off automatically when the process is not attached to a terminal or `CI=true` is set, so logs contain only findings.
|
|
15
|
+
|
|
16
|
+
Pick the strictness you want:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @eventcatalog/linter # fail on errors only
|
|
20
|
+
npx @eventcatalog/linter --max-warnings 0 # fail on any warning too
|
|
21
|
+
npx @eventcatalog/linter --max-warnings 10 # tolerate up to 10 warnings
|
|
22
|
+
npx @eventcatalog/linter --quiet # hide warnings from the log entirely
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`--fail-on-warning` is the same as `--max-warnings 0`.
|
|
26
|
+
|
|
27
|
+
## GitHub Actions
|
|
28
|
+
|
|
29
|
+
```yaml title=".github/workflows/lint-catalog.yml"
|
|
30
|
+
name: Lint catalog
|
|
31
|
+
on:
|
|
32
|
+
pull_request:
|
|
33
|
+
push:
|
|
34
|
+
branches: [main]
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
lint:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-node@v4
|
|
42
|
+
with:
|
|
43
|
+
node-version: 20
|
|
44
|
+
- run: npx @eventcatalog/linter --max-warnings 0
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If the catalog lives in a subfolder of the repository, pass the path: `npx @eventcatalog/linter ./catalog`.
|
|
48
|
+
|
|
49
|
+
## GitLab CI
|
|
50
|
+
|
|
51
|
+
```yaml title=".gitlab-ci.yml"
|
|
52
|
+
lint-catalog:
|
|
53
|
+
stage: test
|
|
54
|
+
image: node:20
|
|
55
|
+
script:
|
|
56
|
+
- npx @eventcatalog/linter --max-warnings 0
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Pin the version
|
|
60
|
+
|
|
61
|
+
`npx @eventcatalog/linter` resolves the latest release every time. For reproducible builds, add it to your catalog's `package.json` and run the local copy:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm install --save-dev @eventcatalog/linter
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```json title="package.json"
|
|
68
|
+
{
|
|
69
|
+
"scripts": {
|
|
70
|
+
"lint": "eventcatalog-linter --max-warnings 0"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Then use `npm run lint` in the pipeline. The version is bumped through your normal dependency-update process.
|
|
76
|
+
|
|
77
|
+
## Run before every commit
|
|
78
|
+
|
|
79
|
+
If you use a pre-commit tool such as Husky or lefthook, call the same script. The linter checks the whole catalog rather than only changed files, which keeps reference checks accurate — a change to one service can break a reference in another.
|
|
80
|
+
|
|
81
|
+
## Keep CI green while you adopt the linter
|
|
82
|
+
|
|
83
|
+
On an existing catalog the first run may report a lot. Two approaches that work well:
|
|
84
|
+
|
|
85
|
+
1. **Start permissive, tighten over time.** Set noisy rules to `'warn'` in `.eventcatalogrc.js`, run with `--max-warnings <current count>`, and lower the number as you fix things.
|
|
86
|
+
2. **Scope by folder.** Use [`overrides`](./configure-rules#apply-different-rules-to-different-folders) to relax rules for legacy areas while enforcing them fully for new content.
|
|
87
|
+
|
|
88
|
+
Either way, keep `schema/*`, `refs/*` and `structure/*` as errors — those are the findings that mean EventCatalog will silently drop or fail to build something.
|
|
89
|
+
|
|
90
|
+
## Related
|
|
91
|
+
|
|
92
|
+
- [CLI reference](../reference/cli) — every option and exit code
|
|
93
|
+
- [Configure rules](./configure-rules)
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 3
|
|
3
|
+
sidebar_label: Allow custom frontmatter
|
|
4
|
+
title: Allow custom frontmatter fields
|
|
5
|
+
description: Add your own metadata to resources without tripping the unknown-field rule.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use this guide when you need extra fields in frontmatter — a cost centre, a data classification, a Jira key — and the linter reports them as unknown.
|
|
9
|
+
|
|
10
|
+
## Why the linter complains
|
|
11
|
+
|
|
12
|
+
EventCatalog validates frontmatter against a schema and rejects top-level keys it doesn't know at build time. The linter's [`schema/unknown-field`](../reference/rules#schemaunknown-field) rule mirrors that, so a typo like `owner:` is caught before the build, and so is any custom field:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
services/order-service/index.mdx
|
|
16
|
+
8:1 ✖ error Unknown property "costCenter". Custom properties must start with "x-". [costCenter] (schema/unknown-field)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Option 1: use the `x-` prefix (recommended)
|
|
20
|
+
|
|
21
|
+
EventCatalog reserves the `x-` prefix for custom properties. Both EventCatalog and the linter accept any key that starts with it, at any level of the frontmatter:
|
|
22
|
+
|
|
23
|
+
```yaml title="services/order-service/index.mdx"
|
|
24
|
+
---
|
|
25
|
+
id: order-service
|
|
26
|
+
name: Order Service
|
|
27
|
+
version: 1.0.0
|
|
28
|
+
x-cost-center: CC-1234
|
|
29
|
+
x-jira-project: ORD
|
|
30
|
+
sends:
|
|
31
|
+
- id: OrderCreated
|
|
32
|
+
x-internal: true
|
|
33
|
+
---
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Custom properties are rendered in the catalog and available to your own components — see [Custom properties on resources](/docs/development/customization/custom-properties).
|
|
37
|
+
|
|
38
|
+
## Option 2: allow specific keys
|
|
39
|
+
|
|
40
|
+
If you can't rename a field yet, tell the rule to ignore it. `allow` takes exact key names or `prefix*` patterns and applies to both the top-level and nested rules:
|
|
41
|
+
|
|
42
|
+
```js title=".eventcatalogrc.js"
|
|
43
|
+
module.exports = {
|
|
44
|
+
rules: {
|
|
45
|
+
'schema/unknown-field': ['error', { allow: ['costCenter', 'legacy*'] }],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
:::warning
|
|
51
|
+
Allowed keys are still unknown to EventCatalog. Top-level ones will fail `eventcatalog build`; nested ones are silently ignored. Treat `allow` as a stepping stone to the `x-` prefix, not a destination.
|
|
52
|
+
:::
|
|
53
|
+
|
|
54
|
+
## Turn off the suggestions
|
|
55
|
+
|
|
56
|
+
The rule adds "Did you mean …?" hints and tells you when a key belongs to a different resource type. To keep only the bare message:
|
|
57
|
+
|
|
58
|
+
```js title=".eventcatalogrc.js"
|
|
59
|
+
module.exports = {
|
|
60
|
+
rules: {
|
|
61
|
+
'schema/unknown-field': ['error', { suggestions: false }],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Relax nested-field checks
|
|
67
|
+
|
|
68
|
+
Unknown keys inside nested objects (`sends[0].too`) are reported by a separate rule, [`schema/unknown-nested-field`](../reference/rules#schemaunknown-nested-field), which defaults to `warn` because EventCatalog ignores them rather than failing. Adjust it independently:
|
|
69
|
+
|
|
70
|
+
```js title=".eventcatalogrc.js"
|
|
71
|
+
module.exports = {
|
|
72
|
+
rules: {
|
|
73
|
+
'schema/unknown-nested-field': 'off',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Related
|
|
79
|
+
|
|
80
|
+
- [Custom properties on resources](/docs/development/customization/custom-properties)
|
|
81
|
+
- [Rules reference: schema rules](../reference/rules#schema-validation)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
sidebar_position: 4
|
|
3
|
+
sidebar_label: Reference external catalogs
|
|
4
|
+
title: Reference resources documented in other catalogs
|
|
5
|
+
description: Stop the linter reporting missing resources when a service sends or receives messages that another team documents.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Use this guide when your catalog references resources that live somewhere else — typically another team's catalog — and the linter reports them as missing:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
services/order-service/index.mdx
|
|
12
|
+
11:9 ✖ error Referenced event/command/query "PaymentAuthorised" does not exist [receives[0]] (refs/resource-exists)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Declare the resources as dependencies
|
|
16
|
+
|
|
17
|
+
EventCatalog lets you list external resources in the `dependencies` section of `eventcatalog.config.js`. EventCatalog renders a placeholder page for each one, and the linter treats them as existing:
|
|
18
|
+
|
|
19
|
+
```js title="eventcatalog.config.js"
|
|
20
|
+
export default {
|
|
21
|
+
// ...
|
|
22
|
+
dependencies: {
|
|
23
|
+
events: [
|
|
24
|
+
{ id: 'PaymentAuthorised' },
|
|
25
|
+
{ id: 'PaymentDeclined', version: '2.0.0' },
|
|
26
|
+
],
|
|
27
|
+
services: [{ id: 'payment-service' }],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Without a `version`, the dependency satisfies any reference to that id (it behaves like `latest`).
|
|
33
|
+
- With a `version`, references must match that version, using the same [matching rules](../reference/versions) as local resources.
|
|
34
|
+
- Dependency messages are never reported as orphans.
|
|
35
|
+
|
|
36
|
+
Any resource type can be listed: `events`, `commands`, `queries`, `services`, `domains`, `systems`, `channels`, `flows`, `entities`, `containers`, `data-products`, `diagrams`, `agents`, `adrs`, `users`, `teams`.
|
|
37
|
+
|
|
38
|
+
The linter reads `eventcatalog.config.js` from the directory you point it at. Both CommonJS and ES module configs are supported on current Node.js versions; if the file can't be loaded, the linter prints a warning and continues without dependencies.
|
|
39
|
+
|
|
40
|
+
## Federated content
|
|
41
|
+
|
|
42
|
+
If you use [EventCatalog Federation](/docs/federation/overview), resources materialised under `federated/<catalog>/` are scanned like local ones. Owners, services and messages from federated catalogs resolve without any extra configuration.
|
|
43
|
+
|
|
44
|
+
## Ignore the generated `dependencies` folder
|
|
45
|
+
|
|
46
|
+
EventCatalog writes placeholder files for dependencies into a `dependencies/` folder. The linter ignores that folder by default, so you don't need to add it to `ignorePatterns`.
|
|
47
|
+
|
|
48
|
+
## Related
|
|
49
|
+
|
|
50
|
+
- [Mocking out dependencies (legacy federation guide)](/docs/federation/legacy-federation/setup-team-catalog#mocking-out-dependencies-in-your-catalog)
|
|
51
|
+
- [Version formats and matching](../reference/versions)
|