stenciljs/eslint-plugin

bug: `props-must-be-readonly` reports error although mutable is set when attribute is set via constant value

Open

#196 建立於 2026年3月26日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (37 fork)auto 404
Bug: ValidatedHelp Wanted

倉庫指標

Star
 (71 star)
PR 合併指標
 (PR 指標待抓取)

描述

Prerequisites

Stencil ESLint Version

1.2.0

Current Behavior

When declaring a @Prop via enum or constant, the props-must-be-readonly is reporting an error although mutable was set to true.

@Prop({ reflect: true, attribute: Attribute.withPadding, mutable: true }) withPadding: boolean = false;

=>

  26:77  error  Class properties decorated with @Prop() should be readonly  stencil/props-must-be-readonly

In comparison, when setting the attribute directly without an enum or const, it works as expected (no error is reported)

 @Prop({ reflect: true, attribute: 'with-padding', mutable: true }) withPadding: boolean = false;

Expected Behavior

The @Prop declaration

@Prop({ reflect: true, attribute: Attribute.withPadding, mutable: true }) withPadding: boolean = false;

should not throw an error, as mutable is set to true (cf. docs).

Steps to Reproduce

  • Declare a property as above
  • Run the linting rules with props-must-be-readonly enabled

Code Reproduction URL

https://github.com/pinussilvestrus/test-stencil/commit/0d943e601dd76a51bd819527802f6d6d4f77985c

Additional Information

No response

貢獻者指南