Registry / testing / diagnost-core

diagnost-core

JSON →
library0.2.1jsnpmunverified

Core diagnostic engine for Astro projects. Provides project discovery, lint rules, filter pipeline, and score calculation. Current stable version is 0.2.1. Released irregularly as part of the Diagnost project. Key differentiator: built specifically for the Astro ecosystem with type-safe rule definitions and composable filter pipelines. Unlike generic linters, it understands Astro project structure and component boundaries.

npm install diagnost-core
INSTALL
IMPORT
SIG · DIAGNOST-CORE
D
diagnost-core
testingjavascriptv0.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createEngine
import { createEngine } from 'diagnost-core'
const createEngine = require('diagnost-core');
Package is ESM-only; use dynamic import() if CommonJS environment is required.
LintRule
import { LintRule } from 'diagnost-core'
TypeScript type for defining custom lint rules. Should only be used as a type import if not needed at runtime.
FilterPipeline
import type { FilterPipeline } from 'diagnost-core'
import { FilterPipeline } from 'diagnost-core'
FilterPipeline is an interface; use type-only import in TypeScript to avoid emitting JavaScript.

Creates a diagnostic engine, registers a custom lint rule, and runs it against the Astro project in the current directory.

import { createEngine } from 'diagnost-core'; const engine = createEngine({ projectRoot: '.', rules: [ { name: 'example-rule', check: (project) => { // Example rule that always passes return []; }, }, ], }); const results = await engine.run(); console.log(results);
Debug
Known issues
breakingVersion 0.x may have breaking changes without major version bumps.
fix
Pin exact version and test upgrades thoroughly.
affects: >=0.0.0
gotchaESM-only package - require() will fail unless using dynamic import.
fix
Use import syntax or dynamic import() in CommonJS files.
affects: >=0.1.0
gotchaEngine creation is synchronous but engine.run() is async - forgetting await leads to unresolved Promise.
fix
Always await engine.run() or handle the returned Promise.
affects: >=0.1.0
gotchaNo built-in rules are included by default; all rules must be configured manually.
fix
Provide an array of rule objects to createEngine or use a separate package for default rules.
affects: >=0.1.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module 'diagnost-core' from '...' not supported.
Trying to require an ESM-only package in a CommonJS context.
fix
Change to dynamic import: `const { createEngine } = await import('diagnost-core');`
TypeError: engine.run is not a function
Engine created incorrectly or not awaited due to async nature.
fix
Ensure createEngine returns an engine object with run method. Run `const engine = createEngine(...);` then `await engine.run();`
Uncaught TypeError: Cannot read properties of undefined (reading 'rules')
Missing or invalid options passed to createEngine.
fix
Pass an object with a 'rules' property as an array. Example: `createEngine({ rules: [] })`
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
astrooptionalRequired to inspect and analyze Astro project configurations and components.
Agent activity
6 hits · last 30 days
node
6
Resources
diagnost-core — npm install diagnost-core · libregistry