Registry / devops / flaglint

flaglint

JSON →
library0.6.0jsnpmunverified

FlagLint (v0.6.0) is a CLI tool that scans LaunchDarkly Node.js SDK usage and generates safe, reviewable migration diffs to OpenFeature. It inventories all direct calls (boolVariation, stringVariation, etc.), reports dynamic keys and unguarded patterns, and provides a CI gate to prevent new vendor-coupled flag access. Released under MIT, it supports both ESM and CJS imports from launchdarkly-node-server-sdk and @launchdarkly/node-server-sdk. Key differentiators: argument-order error detection, automated migration with --apply, and zero-runtime dependencies (only Node >=20 required).

npm install flaglint
INSTALL
IMPORT
SIG · FLAGLINT
F
flaglint
devopsjavascriptv0.6.0
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.

FlagLint
import { FlagLint } from 'flaglint'
const FlagLint = require('flaglint')
ESM-only; FlagLint is the default export used programmatically, but typical usage is via npx CLI.
CLI (npx)
npx flaglint scan ./src
npx flaglint --scan ./src
CLI commands are subcommands (scan, migrate, audit, validate), not flags.
scan result (programmatic)
import { scan } from 'flaglint'; const result = await scan('./src');
const { scan } = require('flaglint'); const result = scan('./src');
scan is an async named export; CJS require() breaks as of v0.6.0.

Complete workflow: scan LaunchDarkly usage, preview migration diff, apply rewrite, and enforce no-direct-calls in CI.

// Step 1: Scan a project for LaunchDarkly SDK calls npx flaglint scan ./src // Step 2: Preview the migration diff npx flaglint migrate ./src --dry-run // Step 3: Apply migration (only guarded calls) npx flaglint migrate ./src --apply // Step 4: Add CI gate to prevent new direct calls npx flaglint validate --no-direct-launchdarkly ./src echo 'Exit code reflects pass/fail.'
Debug
Known issues
breakingv0.6.0 drops support for Node <20. Update engines if using older Node versions.
fix
Upgrade to Node >=20.
affects: >=0.6.0
deprecatedCJS require() is not supported; only ESM imports work.
fix
Use import syntax or npx CLI.
affects: >=0.6.0
gotchaMigration --apply rewrites only statically explicit calls. Dynamic keys, detail methods, and bulk calls are reported but not auto-fixed.
fix
Review dynamic-key calls manually; use --dry-run first.
affects: >=0.0.0
gotchaThe tool does not handle LaunchDarkly client initialization or OpenFeature provider setup—you must add provider setup scaffolding manually.
fix
Follow the inline guidance in the migration diff or read the docs for provider setup.
affects: >=0.0.0
gotchaFlagLint only supports server-side LaunchDarkly Node SDKs (launchdarkly-node-server-sdk, @launchdarkly/node-server-sdk). Client-side/mobile SDKs are not supported.
fix
Use a different migration strategy for client-side SDKs.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'flaglint'
Trying to require('flaglint') in a CommonJS environment.
fix
Use ESM: add "type": "module" in package.json or use .mjs extension. Or use npx flaglint.
TypeError: scan is not a function
Importing { scan } from 'flaglint' incorrectly when using default export.
fix
Use import { scan } from 'flaglint' or import FlagLint from 'flaglint' and call new FlagLint().scan().
flaglint: command not found
Running npx incorrectly or package not installed globally.
fix
Use npx flaglint (without install) or install globally with npm i -g flaglint.
Upgrade
Version history
0.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
14
OpenAI (training)
1
Resources
flaglint — npm install flaglint · libregistry