Registry /
testing / stylelint-codeframe-formatter
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import formatter from 'stylelint-codeframe-formatter'
✗ const { default: formatter } = require('stylelint-codeframe-formatter')
ESM default export; CommonJS users can use require('stylelint-codeframe-formatter') directly, but this is the ESM way.
formatter
✓ const formatter = require('stylelint-codeframe-formatter')
✗ const formatter = require('stylelint-codeframe-formatter').default
CommonJS require returns the default export directly; do not access .default in CJS.
formatter as default import in TypeScript
✓ import formatter from 'stylelint-codeframe-formatter'
✗ import * as formatter from 'stylelint-codeframe-formatter'
TypeScript uses default import; namespace import may cause runtime issues.
Demonstrates installing the formatter, using it via Stylelint CLI, and integrating programmatically with lint results.
// Install: npm install stylelint stylelint-codeframe-formatter --save-dev
// Use with Stylelint CLI:
// stylelint --custom-formatter node_modules/stylelint-codeframe-formatter/index.js "src/**/*.css"
// Or programmatically (ESM):
import formatter from 'stylelint-codeframe-formatter';
import stylelint from 'stylelint';
const result = await stylelint.lint({
files: 'src/**/*.css',
formatter: formatter,
});
console.log(result.output);
Errors
Common errors & fixes
Error: Cannot find module 'stylelint-codeframe-formatter'
Package not installed or not in node_modules.
fixRun: npm install stylelint-codeframe-formatter --save-dev
The constructor must be a function that returns an object or the formatter expects to be a function
Using namespace import (import * as) instead of default import in ESM.
fixUse: import formatter from 'stylelint-codeframe-formatter'
stylelint-codeframe-formatter: Failed to display codeframe: Cannot read property 'type' of null
Issue with empty result or malformed node (fixed in v1.0.6).
Audit
Dependencies
stylelintrequiredPeer dependency required to format lint results; the formatter receives data from Stylelint.