Registry /
testing / eslint-plugin-complexity
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 export (plugin object)
✓ import complexity from 'eslint-plugin-complexity'
✗ const complexity = require('eslint-plugin-complexity')
ESLint plugins are typically used via plugins array in config, not direct import in code.
Flat config (ESLint 9+)
✓ import complexity from 'eslint-plugin-complexity';
export default [ { plugins: { complexity }, rules: { 'complexity/comment': 'warn' } } ]
✗ module.exports = { plugins: ['complexity'], rules: { 'complexity/comment': 'warn' } }
With flat config, import the plugin object and assign to plugins property.
Legacy .eslintrc config
✓ module.exports = { plugins: ['complexity'], rules: { 'complexity/comment': 'warn' } }
✗ import complexity from 'eslint-plugin-complexity';
export default { plugins: { complexity }, rules: { 'complexity/comment': 'warn' } }
Legacy config uses string in plugins array; flat config uses object.
Configures ESLint to warn when function cyclomatic complexity exceeds 10 using the comment rule.
module.exports = {
plugins: ['complexity'],
rules: {
'complexity/comment': ['warn', { max: 10 }]
}
};
Errors
Common errors & fixes
Configuration for rule "complexity/comment" is invalid: Value "{max:10}" should be object.
Configuration of rule 'complexity/comment' is not an object with max property.
fixUse { max: 10 } with quotes: 'complexity/comment': ['warn', { max: 10 }] ESLint couldn't find the plugin "eslint-plugin-complexity".
Plugin not installed or not listed in plugins array correctly.
fixRun npm i eslint-plugin-complexity -D and add 'complexity' to plugins array in config.
Audit
Dependencies
eslintrequiredpeer dependency required to use the plugin