SonarSource / SonarTS

Static code analyzer for TypeScript
GNU Lesser General Public License v3.0
761 stars 53 forks source link

Bug: S1854: Linter shouldn't accept the variable used as the object key as dead storage. #888

Closed vmikhav closed 4 years ago

vmikhav commented 4 years ago

I want to report a bug.

SonarQube version: 7.1 (build 11001)

Rule key: typescript:S1854 (Dead stores should be removed)

Reproducer

// sound = 'meow' | 'woof'
const report = {'cat': 0, 'dog': 0};
let key = 'cat';
if (sound === 'woof') {
  key = 'dog';
}
report[key]++;

Expected behavior Linter shouldn't accept the variable used as the object key as dead storage.

saberduck commented 4 years ago

hello @vmikhav , we are not maintaining this plugin anymore, as we migrated TypeScript analysis to SonarJS plugin. Can you try it to analyze with SonarJS? Though, you will need to upgrade SonarQube at least to the 7.9 LTS version.