-
-
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 rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
I would expect the rule to accept all built-in types that are considered read-only. The rules check objects, arrays, and tuples. However, it considers ReadonlySet
and ReadonlyMap
as objects resulting in false positive.
Repro
{
"rules": {
"@typescript-eslint/prefer-readonly-parameter-types": ["error", {
"checkParameterProperties": true
}]
}
}
const x = (data: ReadonlySet<string>): void => {};
const y = (data: ReadonlyMap<string, string>): void => {};
Expected Result
Pass linting because the types used are read-only.
Actual Result
Fails because the type itself has a few methods that are not defined read-only (because they are methods, not properties with function values).
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.24.0 |
@typescript-eslint/parser |
2.24.0 |
TypeScript |
3.8.3 |
ESLint |
6.8.0 |
node |
12.15.0 |
yarn |
1.22.4 |
markatom, sindresorhus, ostrowr and RebeccaStevens
Metadata
Metadata
Assignees
Labels
enhancement: plugin rule optionNew rule option for an existing eslint-plugin ruleNew rule option for an existing eslint-plugin rulepackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin