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.