From 8818ceecce2b62ee73cc6663edd30769f59c1e92 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 4 Jun 2024 10:37:49 -0400 Subject: [PATCH 1/2] docs(eslint-plugin): [prefer-readonly-parameter-types] mention limitations --- .../docs/rules/prefer-readonly-parameter-types.mdx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx index e01ff6ffbf62..8d561855e10f 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx @@ -402,3 +402,8 @@ function foo(arg: MyType) {} ## When Not To Use It If your project does not attempt to enforce strong immutability guarantees of parameters, you can avoid this rule. + +This rule is very strict on what it considers mutable. +Many types that describe themselves as readonly are considered mutable because they have mutable properties such as arrays or tuples. +To work around these limitations, you might need to use the rule's options. +In particular, the [`allow` option](#allow) can explicitly mark a type as readable. From 886c716e9fb6be52f74f54b177609dfe6ea0b085 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Tue, 4 Jun 2024 11:52:29 -0400 Subject: [PATCH 2/2] as readonly --- .../docs/rules/prefer-readonly-parameter-types.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx index 8d561855e10f..e2ddcef23048 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.mdx @@ -406,4 +406,4 @@ If your project does not attempt to enforce strong immutability guarantees of pa This rule is very strict on what it considers mutable. Many types that describe themselves as readonly are considered mutable because they have mutable properties such as arrays or tuples. To work around these limitations, you might need to use the rule's options. -In particular, the [`allow` option](#allow) can explicitly mark a type as readable. +In particular, the [`allow` option](#allow) can explicitly mark a type as readonly.