Skip to content

dependencyUniqueness

Reports dependency names that are declared more than once in package.json.

✅ This rule is included in the package-json logical presets.

This rule reports dependency names that are repeated in the same package.json dependency collection. It also reports dependency names repeated from dependencies into devDependencies or peerDependencies.

{
"dependencies": {
"left-pad": "^1.3.0",
"left-pad": "^1.3.0"
}
}
{
"dependencies": {
"left-pad": "^1.3.0"
},
"devDependencies": {
"left-pad": "^1.3.0"
}
}

If your package intentionally repeats dependency names across dependency collections, such as to mirror a runtime dependency into peerDependencies, this rule might not be for you. Doing so is generally unnecessary with most mainstream package managers, but other tooling might add in the need to do so.

Made with ❤️‍🔥 around the world by the Flint team and contributors.