Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prefer-readonly-parameter-types] IndexSignature internals don't violate the rule #3714

Closed
3 tasks done
RebeccaStevens opened this issue Aug 7, 2021 · 1 comment · Fixed by #4417
Closed
3 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@RebeccaStevens
Copy link
Contributor

I wasn't sure if this was intentional behavior or not so I thought I may as well open an issue on it.

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

{
  "rules": {
    "@typescript-eslint/prefer-readonly-parameter-type": "error"
  }
}
type Foo = {
  readonly [key: string]: {
    groups: string[];
  };
};

function foo(arg: Foo) {}

Expected Result

The PropertySignature in the IndexSignature is not readonly and thus the rule should be violated.

Actual Result

No rule violation.

Versions

package version
@typescript-eslint/eslint-plugin 4.29.0
@typescript-eslint/parser 4.29.0
TypeScript 4.3.5
ESLint 7.27.0
node 16.4.0
@RebeccaStevens RebeccaStevens added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Aug 7, 2021
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Aug 16, 2021
@bradzacher bradzacher changed the title [prefer-readonly-parameter-type] IndexSignature internals don't violate the rule [prefer-readonly-parameter-types] IndexSignature internals don't violate the rule Aug 16, 2021
@kmin-jeong
Copy link
Contributor

can I try it?

@JoshuaKGoldberg JoshuaKGoldberg added the accepting prs Go ahead, send a pull request that resolves this issue label Oct 25, 2021
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 9, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 9, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 9, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 9, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 9, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 10, 2022
RebeccaStevens added a commit to RebeccaStevens/typescript-eslint that referenced this issue Jan 10, 2022
bradzacher pushed a commit that referenced this issue Jan 17, 2022
…eadonly (#4417)

* fix(type-utils): make isTypeReadonly's options param optional

fix #4410

* test(type-utils): add basic tests for isTypeReadonly

* test(type-utils): add test for IndexSignature internals

* fix(type-utils): check IndexSignature internals when checking isTypeReadonly

fix #3714

* perf(type-utils): don't test IndexSignature key for readonlyness as it will always be readonly

Co-authored-by: Josh Goldberg <joshuakgoldberg@outlook.com>
lonyele pushed a commit to lonyele/typescript-eslint that referenced this issue Feb 12, 2022
…eadonly (typescript-eslint#4417)

* fix(type-utils): make isTypeReadonly's options param optional

fix typescript-eslint#4410

* test(type-utils): add basic tests for isTypeReadonly

* test(type-utils): add test for IndexSignature internals

* fix(type-utils): check IndexSignature internals when checking isTypeReadonly

fix typescript-eslint#3714

* perf(type-utils): don't test IndexSignature key for readonlyness as it will always be readonly

Co-authored-by: Josh Goldberg <joshuakgoldberg@outlook.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
4 participants