- Primary Language: TypeScript 5.8.3
- Target: ES2022 with CommonJS module system
- VS Code API: vscode 1.76.0
- Bundler: Webpack 5 with
ts-loader - Key Libraries:
@trustify-da/trustify-da-javascript-client,web-tree-sitter,openid-client,mustache
- Linter: ESLint 8.51.0 with
@typescript-eslintplugins - Formatter: Prettier (single quotes)
- File header:
'use strict';required at top of every file - Semicolons: Always required (
@typescript-eslint/semi: ['error', 'always']) - Quotes: Single quotes enforced (
@typescript-eslint/quotes: ['error', 'single']) - Curly braces: Required (
curly: 'error') - No
var:no-var: 'error' - No require imports:
@typescript-eslint/no-require-imports: 'error' - Equality: Strict equality required except for null (
eqeqeq: ['warn', 'always', { 'null': 'never' }])
- Classes/Interfaces/Enums: PascalCase (
Vulnerability,Config,DependencyProvider) - Interfaces: PascalCase with descriptive prefix (
CANotificationData) - Functions/Methods/Variables: camelCase (
imageAnalysisService(),parseImageReference(),mockUri) - Constants: UPPER_CASE (
DEFAULT_RHDA_REPORT_FILE_PATH,EXTENSION_QUALIFIED_ID) - Enum members: UPPER_CASE (
VERSION,UTM_SOURCE) - Private members:
private readonlyprefix - File names: camelCase (
caNotification.ts,codeActionHandler.ts) or ecosystem names (pom.xml.ts,package.json.ts)
src/
├── extension.ts # Main entry point
├── constants.ts # Enums and constants
├── config.ts # Configuration class
├── vulnerability.ts # Vulnerability data class
├── exhortServices.ts # Trustify DA Javascript client functions
├── utils.ts # Utility functions
├── providers/ # Manifest file parsers (per ecosystem)
│ ├── pom.xml.ts
│ ├── package.json.ts
│ ├── build.gradle.ts
│ ├── requirements.txt.ts
│ ├── go.mod.ts
│ └── docker.ts
├── imageAnalysis/ # OCI image analysis feature
└── dependencyAnalysis/ # Dependency analysis feature
test/
├── *.test.ts # Test files mirror src with .test.ts suffix
└── resources/ # Test fixtures
- Error chaining: Traverse
error.causechain for root cause - Dual messages:
buildNotificationErrorMessage()(user-facing) andbuildLogErrorMessage()(detailed with stdout/stderr) - Type casting:
asfor error handling (error.cause as Error) - Switch on status codes: HTTP response status handling via switch statements
- Framework: Mocha 10.8.2 with TDD UI (
suite()/test()) - Assertions: Chai 4.3.10 with
expect()syntax, plussinon-chai - Mocking: Sinon 16.1.0 for stubs/spies
- Coverage: nyc 17.0.0
- Test naming:
"should [expected behavior]" - Mock pattern: Mock classes defined within test suites
- Mock data typing: Use
Partial<T>with the real type instead ofRecord<string, number>or similar loose types for mock data, so typos in field names are caught at compile time - Test scripts:
npm run test-compile && node ./out/test/runTest.js
- Conventional Commits (configured via
.conventional-changelog-config.js) - Types:
feat,fix,docs,style,refactor,perf,test,chore - Changelog sections: enhancement, fixes, documentation, style, refactor, performance, tests, chore
- Package manager: npm with
package-lock.json - Bundling: Webpack bundles to
dist/extension.js(CommonJS) - VS Code: Peer dependency, externalized
- Node built-ins: Externalized (fs, path, os, crypto, child_process)
- Output:
.vsixpackages for VS Code marketplace - Key scoped packages:
@trustify-da/*,@vscode/*,@typescript-eslint/*,@xml-tools/*