From 81fd60b9d871d26cc8384fca4cb9c2758015fcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josh=20Goldberg=20=E2=9C=A8?= Date: Wed, 5 Jun 2024 09:11:20 -0400 Subject: [PATCH] docs(eslint-plugin): [prefer-readonly-parameter-types] mention limitations (#9260) * docs(eslint-plugin): [prefer-readonly-parameter-types] mention limitations * as readonly --- .../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 e01ff6ffbf6..e2ddcef2304 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 readonly.