Registry / devops / dbt-doctor-rules

dbt-doctor-rules

JSON →
library0.3.2jsnpmunverified

dbt-doctor-rules v0.3.2 provides custom lint rules for dbt-doctor, covering dbt project structure, naming, documentation, sources, and SQL architecture. It runs via the CLI's runCustomRules command with a native SQL parser by default, and optionally supports sqlfluff via --use-sqlfluff. Released under MIT, it is actively maintained with a focus on extensibility and parity with tools like SQLFluff, dbt-checkpoint, dbt-score, and dbt_meta_testing. Requires Node >=22.

npm install dbt-doctor-rules
INSTALL
IMPORT
SIG · DBT-DOCTOR-RULES
D
dbt-doctor-rules
devopsjavascriptv0.3.2
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.

runCustomRules
import { runCustomRules } from 'dbt-doctor-rules'
const runCustomRules = require('dbt-doctor-rules')
Package is ESM-only; CommonJS require will fail. Use named import.
discoverProject
import { discoverProject } from '@dbt-doctor/project-info'
import { discoverProject } from 'dbt-doctor-rules'
discoverProject is in a separate package, not part of dbt-doctor-rules.
Diagnostics type
import type { Diagnostic } from 'dbt-doctor-rules'
import { Diagnostic } from 'dbt-doctor-rules'
Diagnostic is a type, use type import to avoid runtime errors in TypeScript.

Shows how to import and use runCustomRules with a discovered dbt project object to get lint diagnostics.

import { runCustomRules } from 'dbt-doctor-rules'; import { discoverProject } from '@dbt-doctor/project-info'; const project = discoverProject('/path/to/dbt/project'); const diagnostics = runCustomRules({ rootDirectory: '/path/to/dbt/project', project, ignoredTags: new Set(), }); console.log(diagnostics);
Debug
Known issues
gotchaIf you use CommonJS require() to import this package, it will fail because dbt-doctor-rules is ESM-only.
fix
Switch to ESM ("type": "module" in package.json) or use dynamic import: const { runCustomRules } = await import('dbt-doctor-rules');
affects: >=0.1.0
deprecatedThe --use-sqlfluff flag is optional and may be removed in future major versions.
fix
Adopt the native SQL parser rules; if you rely on sqlfluff, pin your version and watch release notes.
affects: >=0.2.0
gotchaIf you forget to pass the project object from discoverProject, runCustomRules will throw a TypeError.
fix
Always call discoverProject from @dbt-doctor/project-info and pass the result as the 'project' option.
affects: >=0.3.0
gotchaThe rootDirectory path must be absolute; relative paths may cause undefined behavior.
fix
Use path.resolve() to convert relative paths to absolute before passing to runCustomRules.
affects: >=0.1.0
gotchaNodes project is required, not optional. Omitting it or passing an empty object will cause a runtime error.
fix
Provide a valid project object obtained from discoverProject().
affects: >=0.3.0
Errors
Common errors & fixes
TypeError: runCustomRules is not a function
Using default import instead of named import, or using CommonJS require.
fix
Use named import: import { runCustomRules } from 'dbt-doctor-rules';
Cannot find module '@dbt-doctor/project-info'
Missing dependency @dbt-doctor/project-info.
fix
Install the peer dependency: npm install @dbt-doctor/project-info
Error: The 'rootDirectory' option must be an absolute path.
Provided relative path instead of absolute path.
fix
Use path.resolve('./relative/path') or provide an absolute path.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
@dbt-doctor/project-infooptionalProvides discoverProject function needed to produce project object for runCustomRules
sqlfluffoptionalOptional dependency for SQL linting via --use-sqlfluff flag
Agent activity
8 hits · last 30 days
node
8
Resources
dbt-doctor-rules — npm install dbt-doctor-rules · libregistry