@eventcatalog/linter 1.0.0 → 1.0.1

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.
Files changed (90) hide show
  1. package/README.md +1 -1
  2. package/package.json +14 -17
  3. package/dist/cli/index.d.ts +0 -3
  4. package/dist/cli/index.d.ts.map +0 -1
  5. package/dist/cli/index.js +0 -73
  6. package/dist/cli/index.js.map +0 -1
  7. package/dist/config/index.d.ts +0 -29
  8. package/dist/config/index.d.ts.map +0 -1
  9. package/dist/config/index.js +0 -207
  10. package/dist/config/index.js.map +0 -1
  11. package/dist/index.d.ts +0 -8
  12. package/dist/index.d.ts.map +0 -1
  13. package/dist/index.js +0 -24
  14. package/dist/index.js.map +0 -1
  15. package/dist/parser/index.d.ts +0 -17
  16. package/dist/parser/index.d.ts.map +0 -1
  17. package/dist/parser/index.js +0 -43
  18. package/dist/parser/index.js.map +0 -1
  19. package/dist/reporters/index.d.ts +0 -16
  20. package/dist/reporters/index.d.ts.map +0 -1
  21. package/dist/reporters/index.js +0 -155
  22. package/dist/reporters/index.js.map +0 -1
  23. package/dist/scanner/index.d.ts +0 -14
  24. package/dist/scanner/index.d.ts.map +0 -1
  25. package/dist/scanner/index.js +0 -102
  26. package/dist/scanner/index.js.map +0 -1
  27. package/dist/schemas/channel.d.ts +0 -389
  28. package/dist/schemas/channel.d.ts.map +0 -1
  29. package/dist/schemas/channel.js +0 -20
  30. package/dist/schemas/channel.js.map +0 -1
  31. package/dist/schemas/common.d.ts +0 -550
  32. package/dist/schemas/common.d.ts.map +0 -1
  33. package/dist/schemas/common.js +0 -144
  34. package/dist/schemas/common.js.map +0 -1
  35. package/dist/schemas/data-store.d.ts +0 -348
  36. package/dist/schemas/data-store.d.ts.map +0 -1
  37. package/dist/schemas/data-store.js +0 -17
  38. package/dist/schemas/data-store.js.map +0 -1
  39. package/dist/schemas/domain.d.ts +0 -381
  40. package/dist/schemas/domain.d.ts.map +0 -1
  41. package/dist/schemas/domain.js +0 -13
  42. package/dist/schemas/domain.js.map +0 -1
  43. package/dist/schemas/entity.d.ts +0 -382
  44. package/dist/schemas/entity.d.ts.map +0 -1
  45. package/dist/schemas/entity.js +0 -24
  46. package/dist/schemas/entity.js.map +0 -1
  47. package/dist/schemas/flow.d.ts +0 -733
  48. package/dist/schemas/flow.d.ts.map +0 -1
  49. package/dist/schemas/flow.js +0 -70
  50. package/dist/schemas/flow.js.map +0 -1
  51. package/dist/schemas/index.d.ts +0 -3815
  52. package/dist/schemas/index.d.ts.map +0 -1
  53. package/dist/schemas/index.js +0 -50
  54. package/dist/schemas/index.js.map +0 -1
  55. package/dist/schemas/message.d.ts +0 -1076
  56. package/dist/schemas/message.d.ts.map +0 -1
  57. package/dist/schemas/message.js +0 -17
  58. package/dist/schemas/message.js.map +0 -1
  59. package/dist/schemas/service.d.ts +0 -417
  60. package/dist/schemas/service.d.ts.map +0 -1
  61. package/dist/schemas/service.js +0 -15
  62. package/dist/schemas/service.js.map +0 -1
  63. package/dist/schemas/team.d.ts +0 -45
  64. package/dist/schemas/team.d.ts.map +0 -1
  65. package/dist/schemas/team.js +0 -20
  66. package/dist/schemas/team.js.map +0 -1
  67. package/dist/schemas/user.d.ts +0 -48
  68. package/dist/schemas/user.d.ts.map +0 -1
  69. package/dist/schemas/user.js +0 -21
  70. package/dist/schemas/user.js.map +0 -1
  71. package/dist/types/index.d.ts +0 -82
  72. package/dist/types/index.d.ts.map +0 -1
  73. package/dist/types/index.js +0 -3
  74. package/dist/types/index.js.map +0 -1
  75. package/dist/validators/best-practices-validator.d.ts +0 -4
  76. package/dist/validators/best-practices-validator.d.ts.map +0 -1
  77. package/dist/validators/best-practices-validator.js +0 -63
  78. package/dist/validators/best-practices-validator.js.map +0 -1
  79. package/dist/validators/index.d.ts +0 -8
  80. package/dist/validators/index.d.ts.map +0 -1
  81. package/dist/validators/index.js +0 -41
  82. package/dist/validators/index.js.map +0 -1
  83. package/dist/validators/reference-validator.d.ts +0 -15
  84. package/dist/validators/reference-validator.d.ts.map +0 -1
  85. package/dist/validators/reference-validator.js +0 -432
  86. package/dist/validators/reference-validator.js.map +0 -1
  87. package/dist/validators/schema-validator.d.ts +0 -5
  88. package/dist/validators/schema-validator.d.ts.map +0 -1
  89. package/dist/validators/schema-validator.js +0 -62
  90. package/dist/validators/schema-validator.js.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A comprehensive linter for EventCatalog that validates frontmatter schemas and resource references to ensure your event-driven architecture documentation is correct and consistent.
4
4
 
5
- [![npm version](https://badge.fury.io/js/eventcatalog-linter.svg)](https://badge.fury.io/js/eventcatalog-linter)
5
+ [![npm version](https://badge.fury.io/js/@eventcatalog%2Flinter.svg)](https://badge.fury.io/js/@eventcatalog%2Flinter)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
8
  ## 🚀 Features
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@eventcatalog/linter",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A linter for EventCatalog to validate frontmatter and resource references",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/event-catalog/linter.git"
7
+ "url": "https://github.com/event-catalog/eventcatalog"
8
8
  },
9
- "main": "dist/index.js",
9
+ "main": "./dist/index.js",
10
+ "module": "./dist/index.mjs",
11
+ "types": "./dist/index.d.ts",
10
12
  "bin": {
11
13
  "eventcatalog-linter": "./dist/cli/index.js"
12
14
  },
@@ -30,17 +32,15 @@
30
32
  "gray-matter": "^4.0.3",
31
33
  "ora": "^8.0.1",
32
34
  "semver": "^7.7.2",
33
- "zod": "^3.25.76"
35
+ "zod": "^3.25.76",
36
+ "@eventcatalog/sdk": "2.13.0"
34
37
  },
35
38
  "devDependencies": {
36
- "@changesets/cli": "^2.27.7",
37
39
  "@types/node": "^20.10.5",
38
- "@typescript-eslint/eslint-plugin": "^6.15.0",
39
- "@typescript-eslint/parser": "^6.15.0",
40
40
  "prettier": "^3.3.3",
41
- "tsx": "^4.7.0",
41
+ "tsup": "^8.1.0",
42
42
  "typescript": "^5.3.3",
43
- "vitest": "^1.1.0"
43
+ "vitest": "^3.2.4"
44
44
  },
45
45
  "files": [
46
46
  "dist"
@@ -49,14 +49,11 @@
49
49
  "node": ">=16.0.0"
50
50
  },
51
51
  "scripts": {
52
- "build": "tsc",
53
- "dev": "tsx watch src/cli/index.ts",
54
- "test": "vitest",
55
- "test:watch": "vitest --watch",
56
- "typecheck": "tsc --noEmit",
52
+ "build": "tsup",
53
+ "build:bin": "tsup",
54
+ "test": "vitest --run",
55
+ "test:ci": "vitest --run",
57
56
  "format": "prettier --write .",
58
- "format:diff": "prettier --list-different .",
59
- "changeset": "changeset",
60
- "release": "changeset publish"
57
+ "format:diff": "prettier --list-different ."
61
58
  }
62
59
  }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
package/dist/cli/index.js DELETED
@@ -1,73 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const commander_1 = require("commander");
8
- const chalk_1 = __importDefault(require("chalk"));
9
- const ora_1 = __importDefault(require("ora"));
10
- const path_1 = __importDefault(require("path"));
11
- const scanner_1 = require("../scanner");
12
- const parser_1 = require("../parser");
13
- const validators_1 = require("../validators");
14
- const reporters_1 = require("../reporters");
15
- const config_1 = require("../config");
16
- const program = new commander_1.Command();
17
- program
18
- .name('eventcatalog-linter')
19
- .description('Lint your EventCatalog for frontmatter and reference validation')
20
- .version('0.1.0')
21
- .argument('[directory]', 'EventCatalog directory to lint', '.')
22
- .option('-v, --verbose', 'Show verbose output', false)
23
- .option('--fail-on-warning', 'Exit with non-zero code on warnings', false)
24
- .action(async (directory, options) => {
25
- const rootDir = path_1.default.resolve(directory);
26
- const spinner = (0, ora_1.default)('Loading configuration...').start();
27
- try {
28
- // Load configuration
29
- const config = (0, config_1.loadConfig)(rootDir);
30
- const dependencies = (0, config_1.loadEventCatalogConfig)(rootDir);
31
- spinner.text = 'Scanning EventCatalog files...';
32
- const allFiles = await (0, scanner_1.scanCatalogFiles)(rootDir);
33
- // Filter out ignored files
34
- const files = allFiles.filter((file) => !(0, config_1.shouldIgnoreFile)(file.relativePath, config.ignorePatterns || []));
35
- const ignoredCount = allFiles.length - files.length;
36
- if (ignoredCount > 0) {
37
- spinner.text = `Found ${files.length} catalog files (${ignoredCount} ignored)`;
38
- }
39
- else {
40
- spinner.text = `Found ${files.length} catalog files`;
41
- }
42
- if (files.length === 0) {
43
- spinner.warn('No EventCatalog files found');
44
- process.exit(0);
45
- }
46
- spinner.text = 'Parsing frontmatter...';
47
- const { parsed, errors: parseErrors } = await (0, parser_1.parseAllFiles)(files);
48
- spinner.text = 'Validating catalog...';
49
- const rawValidationErrors = (0, validators_1.validateCatalog)(parsed, dependencies);
50
- // Apply rule configuration to each file's errors
51
- const validationErrors = parsed.flatMap((parsedFile) => {
52
- const fileErrors = rawValidationErrors.filter((error) => error.file === parsedFile.file.relativePath);
53
- const effectiveRules = (0, config_1.getEffectiveRules)(parsedFile.file.relativePath, config);
54
- return (0, config_1.applyRuleSeverity)(fileErrors, effectiveRules);
55
- });
56
- spinner.stop();
57
- const summary = (0, reporters_1.reportErrors)(validationErrors, parseErrors, options.verbose);
58
- // Show scan summary
59
- if (summary.totalErrors === 0) {
60
- console.log(chalk_1.default.dim(`\n ${files.length} files checked`));
61
- }
62
- if (summary.totalErrors > 0 || (options.failOnWarning && summary.totalWarnings > 0)) {
63
- process.exit(1);
64
- }
65
- }
66
- catch (error) {
67
- spinner.fail('An error occurred');
68
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
69
- process.exit(1);
70
- }
71
- });
72
- program.parse();
73
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,8CAAsB;AACtB,gDAAwB;AACxB,wCAA8C;AAC9C,sCAA0C;AAC1C,8CAAgD;AAChD,4CAA4C;AAE5C,sCAAuH;AAEvH,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,qBAAqB,CAAC;KAC3B,WAAW,CAAC,iEAAiE,CAAC;KAC9E,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,aAAa,EAAE,gCAAgC,EAAE,GAAG,CAAC;KAC9D,MAAM,CAAC,eAAe,EAAE,qBAAqB,EAAE,KAAK,CAAC;KACrD,MAAM,CAAC,mBAAmB,EAAE,qCAAqC,EAAE,KAAK,CAAC;KACzE,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,OAA+B,EAAE,EAAE;IACnE,MAAM,OAAO,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC,0BAA0B,CAAC,CAAC,KAAK,EAAE,CAAC;IAExD,IAAI,CAAC;QACH,qBAAqB;QACrB,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACnC,MAAM,YAAY,GAAG,IAAA,+BAAsB,EAAC,OAAO,CAAC,CAAC;QAErD,OAAO,CAAC,IAAI,GAAG,gCAAgC,CAAC;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC;QAEjD,2BAA2B;QAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAA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,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,EAAE,CAAC;QAEf,MAAM,OAAO,GAAG,IAAA,wBAAY,EAAC,gBAAgB,EAAE,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAE7E,oBAAoB;QACpB,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC;YACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -1,29 +0,0 @@
1
- import { ValidationError } from '../types';
2
- export type RuleSeverity = 'error' | 'warn' | 'off';
3
- export interface RuleConfig {
4
- severity: RuleSeverity;
5
- options?: Record<string, any>;
6
- }
7
- export interface ConfigOverride {
8
- files: string[];
9
- rules: Record<string, RuleSeverity | [RuleSeverity, Record<string, any>]>;
10
- }
11
- export interface LinterConfig {
12
- rules: Record<string, RuleSeverity | [RuleSeverity, Record<string, any>]>;
13
- ignorePatterns?: string[];
14
- overrides?: ConfigOverride[];
15
- }
16
- export declare const DEFAULT_IGNORE_PATTERNS: string[];
17
- export declare const DEFAULT_RULES: Record<string, RuleSeverity>;
18
- export interface DependencyEntry {
19
- id: string;
20
- version?: string;
21
- }
22
- export type CatalogDependencies = Record<string, DependencyEntry[]>;
23
- export declare const loadEventCatalogConfig: (rootDir: string) => CatalogDependencies;
24
- export declare const loadConfig: (rootDir: string) => LinterConfig;
25
- export declare const parseRuleConfig: (rule: RuleSeverity | [RuleSeverity, Record<string, any>]) => RuleConfig;
26
- export declare const shouldIgnoreFile: (filePath: string, ignorePatterns: string[]) => boolean;
27
- export declare const getEffectiveRules: (filePath: string, config: LinterConfig) => Record<string, RuleConfig>;
28
- export declare const applyRuleSeverity: (errors: ValidationError[], rules: Record<string, RuleConfig>) => ValidationError[];
29
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;CAC3E;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1E,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,EAAwB,CAAC;AAErE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAoBtD,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;AAepE,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,KAAG,mBA+BxD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,KAAG,YAiC5C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAG,UAW1F,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,gBAAgB,MAAM,EAAE,KAAG,OAgB7E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,EAAE,QAAQ,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAwBnG,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,EAAE,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAG,eAAe,EAmB/G,CAAC"}
@@ -1,207 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.applyRuleSeverity = exports.getEffectiveRules = exports.shouldIgnoreFile = exports.parseRuleConfig = exports.loadConfig = exports.loadEventCatalogConfig = exports.DEFAULT_RULES = exports.DEFAULT_IGNORE_PATTERNS = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- exports.DEFAULT_IGNORE_PATTERNS = ['dependencies/**'];
10
- exports.DEFAULT_RULES = {
11
- 'schema/required-fields': 'error',
12
- 'schema/valid-semver': 'error',
13
- 'schema/valid-email': 'error',
14
- 'refs/owner-exists': 'error',
15
- 'refs/valid-version-range': 'error',
16
- 'refs/resource-exists': 'error',
17
- 'refs/channel-exists': 'error',
18
- 'refs/container-exists': 'error',
19
- 'refs/orphan-messages': 'warn',
20
- 'best-practices/summary-required': 'error',
21
- 'best-practices/owner-required': 'error',
22
- 'best-practices/description-required': 'warn',
23
- 'best-practices/schema-required': 'warn',
24
- 'naming/service-id-format': 'error',
25
- 'naming/event-id-format': 'error',
26
- 'versions/consistent-format': 'error',
27
- 'versions/no-deprecated': 'error',
28
- 'versions/no-deprecated-references': 'warn',
29
- 'structure/duplicate-resource-ids': 'error',
30
- };
31
- const PLURAL_TO_SINGULAR = {
32
- events: 'event',
33
- commands: 'command',
34
- queries: 'query',
35
- services: 'service',
36
- domains: 'domain',
37
- entities: 'entity',
38
- channels: 'channel',
39
- flows: 'flow',
40
- users: 'user',
41
- teams: 'team',
42
- };
43
- const loadEventCatalogConfig = (rootDir) => {
44
- const configPath = path_1.default.join(rootDir, 'eventcatalog.config.js');
45
- if (!fs_1.default.existsSync(configPath)) {
46
- return {};
47
- }
48
- try {
49
- delete require.cache[require.resolve(configPath)];
50
- const config = require(configPath);
51
- if (!config.dependencies || typeof config.dependencies !== 'object') {
52
- return {};
53
- }
54
- const dependencies = {};
55
- for (const [pluralKey, entries] of Object.entries(config.dependencies)) {
56
- const singularType = PLURAL_TO_SINGULAR[pluralKey];
57
- if (!singularType || !Array.isArray(entries))
58
- continue;
59
- dependencies[singularType] = entries
60
- .filter((entry) => entry && typeof entry.id === 'string')
61
- .map((entry) => ({ id: entry.id, version: entry.version }));
62
- }
63
- return dependencies;
64
- }
65
- catch (error) {
66
- console.warn(`Warning: Could not load eventcatalog.config.js: ${error instanceof Error ? error.message : String(error)}`);
67
- return {};
68
- }
69
- };
70
- exports.loadEventCatalogConfig = loadEventCatalogConfig;
71
- const loadConfig = (rootDir) => {
72
- const configPath = path_1.default.join(rootDir, '.eventcatalogrc.js');
73
- if (!fs_1.default.existsSync(configPath)) {
74
- // Return default config if no config file exists
75
- return {
76
- rules: exports.DEFAULT_RULES,
77
- ignorePatterns: exports.DEFAULT_IGNORE_PATTERNS,
78
- overrides: [],
79
- };
80
- }
81
- try {
82
- // Clear module cache to ensure fresh load
83
- delete require.cache[require.resolve(configPath)];
84
- const config = require(configPath);
85
- // Merge with defaults
86
- const mergedConfig = {
87
- rules: { ...exports.DEFAULT_RULES, ...config.rules },
88
- ignorePatterns: [...exports.DEFAULT_IGNORE_PATTERNS, ...(config.ignorePatterns || [])],
89
- overrides: config.overrides || [],
90
- };
91
- return mergedConfig;
92
- }
93
- catch (error) {
94
- console.warn(`Warning: Could not load .eventcatalogrc.js: ${error instanceof Error ? error.message : String(error)}`);
95
- return {
96
- rules: exports.DEFAULT_RULES,
97
- ignorePatterns: exports.DEFAULT_IGNORE_PATTERNS,
98
- overrides: [],
99
- };
100
- }
101
- };
102
- exports.loadConfig = loadConfig;
103
- const parseRuleConfig = (rule) => {
104
- if (Array.isArray(rule)) {
105
- return {
106
- severity: rule[0],
107
- options: rule[1],
108
- };
109
- }
110
- return {
111
- severity: rule,
112
- options: {},
113
- };
114
- };
115
- exports.parseRuleConfig = parseRuleConfig;
116
- const shouldIgnoreFile = (filePath, ignorePatterns) => {
117
- if (!ignorePatterns || ignorePatterns.length === 0) {
118
- return false;
119
- }
120
- const normalizedPath = filePath.replace(/\\/g, '/');
121
- for (const pattern of ignorePatterns) {
122
- // Simple glob matching for now
123
- const regex = new RegExp(pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*'));
124
- if (regex.test(normalizedPath)) {
125
- return true;
126
- }
127
- }
128
- return false;
129
- };
130
- exports.shouldIgnoreFile = shouldIgnoreFile;
131
- const getEffectiveRules = (filePath, config) => {
132
- let effectiveRules = { ...config.rules };
133
- // Apply overrides
134
- if (config.overrides) {
135
- for (const override of config.overrides) {
136
- const matchesFile = override.files.some((pattern) => {
137
- const regex = new RegExp(pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*'));
138
- return regex.test(filePath);
139
- });
140
- if (matchesFile) {
141
- effectiveRules = { ...effectiveRules, ...override.rules };
142
- }
143
- }
144
- }
145
- // Parse rules into RuleConfig objects
146
- const parsedRules = {};
147
- for (const [ruleName, ruleValue] of Object.entries(effectiveRules)) {
148
- parsedRules[ruleName] = (0, exports.parseRuleConfig)(ruleValue);
149
- }
150
- return parsedRules;
151
- };
152
- exports.getEffectiveRules = getEffectiveRules;
153
- const applyRuleSeverity = (errors, rules) => {
154
- const result = [];
155
- for (const error of errors) {
156
- // Map validation errors to rule names
157
- const ruleName = mapErrorToRuleName(error);
158
- const rule = rules[ruleName];
159
- if (!rule || rule.severity === 'off') {
160
- continue; // Skip disabled rules
161
- }
162
- result.push({
163
- ...error,
164
- severity: rule.severity === 'warn' ? 'warning' : 'error',
165
- });
166
- }
167
- return result;
168
- };
169
- exports.applyRuleSeverity = applyRuleSeverity;
170
- const mapErrorToRuleName = (error) => {
171
- // Use explicit rule if set by the validator
172
- if (error.rule) {
173
- return error.rule;
174
- }
175
- // Map validation errors to rule names based on the error type and content
176
- if (error.type === 'schema') {
177
- // Check field-specific rules first
178
- if (error.field === 'summary') {
179
- return 'best-practices/summary-required';
180
- }
181
- if (error.field === 'owners') {
182
- return 'best-practices/owner-required';
183
- }
184
- // Check message content for specific validation types
185
- if (error.message.includes('email') || error.message.includes('Invalid email')) {
186
- return 'schema/valid-email';
187
- }
188
- if (error.message.includes('version') || error.message.includes('semantic')) {
189
- return 'schema/valid-semver';
190
- }
191
- if (error.message.includes('Required') || error.message.includes('Expected')) {
192
- return 'schema/required-fields';
193
- }
194
- return 'schema/required-fields';
195
- }
196
- if (error.type === 'reference') {
197
- if (error.message.includes('user') || error.message.includes('team')) {
198
- return 'refs/owner-exists';
199
- }
200
- if (error.message.includes('version')) {
201
- return 'refs/valid-version-range';
202
- }
203
- return 'refs/resource-exists';
204
- }
205
- return 'schema/required-fields';
206
- };
207
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAqBX,QAAA,uBAAuB,GAAa,CAAC,iBAAiB,CAAC,CAAC;AAExD,QAAA,aAAa,GAAiC;IACzD,wBAAwB,EAAE,OAAO;IACjC,qBAAqB,EAAE,OAAO;IAC9B,oBAAoB,EAAE,OAAO;IAC7B,mBAAmB,EAAE,OAAO;IAC5B,0BAA0B,EAAE,OAAO;IACnC,sBAAsB,EAAE,OAAO;IAC/B,qBAAqB,EAAE,OAAO;IAC9B,uBAAuB,EAAE,OAAO;IAChC,sBAAsB,EAAE,MAAM;IAC9B,iCAAiC,EAAE,OAAO;IAC1C,+BAA+B,EAAE,OAAO;IACxC,qCAAqC,EAAE,MAAM;IAC7C,gCAAgC,EAAE,MAAM;IACxC,0BAA0B,EAAE,OAAO;IACnC,wBAAwB,EAAE,OAAO;IACjC,4BAA4B,EAAE,OAAO;IACrC,wBAAwB,EAAE,OAAO;IACjC,mCAAmC,EAAE,MAAM;IAC3C,kCAAkC,EAAE,OAAO;CAC5C,CAAC;AASF,MAAM,kBAAkB,GAA2B;IACjD,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,QAAQ;IACjB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;CACd,CAAC;AAEK,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAuB,EAAE;IAC7E,MAAM,UAAU,G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I,KAAK,WAAW,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrE,OAAO,mBAAmB,CAAC;QAC7B,CAAC;QACD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACtC,OAAO,0BAA0B,CAAC;QACpC,CAAC;QACD,OAAO,sBAAsB,CAAC;IAChC,CAAC;IAED,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export * from './types';
2
- export * from './schemas';
3
- export * from './scanner';
4
- export * from './parser';
5
- export * from './validators';
6
- export * from './reporters';
7
- export * from './config';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/index.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
- __exportStar(require("./schemas"), exports);
19
- __exportStar(require("./scanner"), exports);
20
- __exportStar(require("./parser"), exports);
21
- __exportStar(require("./validators"), exports);
22
- __exportStar(require("./reporters"), exports);
23
- __exportStar(require("./config"), exports);
24
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB"}
@@ -1,17 +0,0 @@
1
- import { CatalogFile } from '../scanner';
2
- export interface ParsedFile {
3
- file: CatalogFile;
4
- frontmatter: Record<string, unknown>;
5
- content: string;
6
- raw: string;
7
- }
8
- export interface ParseError {
9
- file: CatalogFile;
10
- error: Error;
11
- }
12
- export declare const parseFrontmatter: (file: CatalogFile) => Promise<ParsedFile | ParseError>;
13
- export declare const parseAllFiles: (files: CatalogFile[]) => Promise<{
14
- parsed: ParsedFile[];
15
- errors: ParseError[];
16
- }>;
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,eAAO,MAAM,gBAAgB,GAAU,MAAM,WAAW,KAAG,OAAO,CAAC,UAAU,GAAG,UAAU,CAiBzF,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,OAAO,WAAW,EAAE,KACnB,OAAO,CAAC;IACT,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAeA,CAAC"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parseAllFiles = exports.parseFrontmatter = void 0;
7
- const promises_1 = __importDefault(require("fs/promises"));
8
- const gray_matter_1 = __importDefault(require("gray-matter"));
9
- const parseFrontmatter = async (file) => {
10
- try {
11
- const fileContent = await promises_1.default.readFile(file.path, 'utf-8');
12
- const { data, content } = (0, gray_matter_1.default)(fileContent);
13
- return {
14
- file,
15
- frontmatter: data,
16
- content,
17
- raw: fileContent,
18
- };
19
- }
20
- catch (error) {
21
- return {
22
- file,
23
- error: error instanceof Error ? error : new Error(String(error)),
24
- };
25
- }
26
- };
27
- exports.parseFrontmatter = parseFrontmatter;
28
- const parseAllFiles = async (files) => {
29
- const results = await Promise.all(files.map(exports.parseFrontmatter));
30
- const parsed = [];
31
- const errors = [];
32
- for (const result of results) {
33
- if ('error' in result) {
34
- errors.push(result);
35
- }
36
- else {
37
- parsed.push(result);
38
- }
39
- }
40
- return { parsed, errors };
41
- };
42
- exports.parseAllFiles = parseAllFiles;
43
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA6B;AAC7B,8DAAiC;AAe1B,MAAM,gBAAgB,GAAG,KAAK,EAAE,IAAiB,EAAoC,EAAE;IAC5F,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1D,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAA,qBAAM,EAAC,WAAW,CAAC,CAAC;QAE9C,OAAO;YACL,IAAI;YACJ,WAAW,EAAE,IAAI;YACjB,OAAO;YACP,GAAG,EAAE,WAAW;SACjB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAjBW,QAAA,gBAAgB,oBAiB3B;AAEK,MAAM,aAAa,GAAG,KAAK,EAChC,KAAoB,EAInB,EAAE;IACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,wBAAgB,CAAC,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AApBW,QAAA,aAAa,iBAoBxB"}
@@ -1,16 +0,0 @@
1
- import { ValidationError } from '../types';
2
- import { ParseError } from '../parser';
3
- export interface ReportSummary {
4
- totalErrors: number;
5
- totalWarnings: number;
6
- schemaErrors: number;
7
- referenceErrors: number;
8
- parseErrors: number;
9
- filesChecked: number;
10
- filesWithErrors: number;
11
- }
12
- export declare const formatError: (error: ValidationError, showFilename?: boolean) => string;
13
- export declare const formatParseError: (error: ParseError, showFilename?: boolean) => string;
14
- export declare const groupErrorsByFile: (errors: ValidationError[]) => Map<string, ValidationError[]>;
15
- export declare const reportErrors: (validationErrors: ValidationError[], parseErrors: ParseError[], verbose?: boolean) => ReportSummary;
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,eAAe,EAAE,eAAc,OAAc,KAAG,MAelF,CAAC;AAsBF,eAAO,MAAM,gBAAgB,GAAI,OAAO,UAAU,EAAE,eAAc,OAAc,KAAG,MAWlF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,EAAE,KAAG,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAW1F,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,kBAAkB,eAAe,EAAE,EACnC,aAAa,UAAU,EAAE,EACzB,UAAS,OAAe,KACvB,aAyFF,CAAC"}