gund / eslint-plugin-deprecation

ESLint rule that reports usage of deprecated code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variables in deconstructors that match a deprecated property name are incorrectly reported as deprecated

ST-DDT opened this issue · comments

The second required disable comment shouldn't be needed/the lint error is reported incorrectly.

function demo(
  options: {
    /**
     * @deprecated
     */
    deprecated?: boolean;
    replacement?: boolean;
  } = {}
): boolean {
  const {
    // eslint-disable-next-line deprecation/deprecation
    deprecated = false,
    // eslint-disable-next-line deprecation/deprecation
    replacement = deprecated,
  } = options;
  return replacement;
}

As you can see VSCode's code highlighting shows that the second line is not deprecated/striked-through:

grafik

Because it references a local variable instead of the deprecated property.


The first disable comment is expected/required as per #74.