-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulehelp wantedExtra attention is neededExtra attention is neededpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Repro
{
"rules": {
"@typescript-eslint/dot-notation": ["error"]
}
}
interface GameSettings {
// Known up-front properties
speed: "fast" | "medium" | "slow";
quality: "high" | "low";
// Assume anything unknown to the interface
// is a string.
[key: string]: string;
}
declare const settings: GameSettings;
// good
settings.speed;
settings.quality;
// required to satisfy noPropertyAccessFromIndexSignature, but causes a dot-notation error
settings['username'];
We should add detection for the noPropertyAccessFromIndexSignature
, and add logic so that it allows indexed access in the same cases.
This will allow you to use both this rule and the compiler option simultaneously.
sindresorhus, EdJoPaTo, rvitaliy, k-yle, DetachHead and 4 more
Metadata
Metadata
Assignees
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulehelp wantedExtra attention is neededExtra attention is neededpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin