Skip to main content

unused-internal-properties

Disallow object properties that are defined but never read.

Targeted pattern scope

This rule targets object literal properties.

What this rule reports

This rule reports properties that are declared but never consumed.

Why this rule exists

Dead properties make object shapes noisy and increase long-term maintenance cost.

❌ Incorrect

const data = {
used: 1,
unused: 2,
};

console.log(data.used);

✅ Correct

const data = {
used: 1,
alsoUsed: 2,
};

console.log(data.used + data.alsoUsed);

Behavior and migration notes

This rule forwards options and behavior to unicorn/no-unused-properties.

Additional examples

const result = {
id: 1,
debug: true,
};
console.log(result.id);
// ❌ `debug` is never read

const resultFixed = {
id: 1,
debug: true,
};
console.log(resultFixed.id, resultFixed.debug);
// ✅ valid

ESLint flat config example

import etcMisc from "eslint-plugin-etc-misc";

export default [
{
plugins: { "etc-misc": etcMisc },
rules: {
"etc-misc/unused-internal-properties": "error",
},
},
];

When not to use it

Disable this rule when object literals intentionally include reserved fields for external contracts.

Package documentation

Rule catalog ID: R077

Further reading

Adoption resources

  • Start at warning level in CI, then move to error after cleanup.
  • Use focused codemods/autofix batches per package or directory.