-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
USER STORYkind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.
Description
The following pattern is currently not flagged by the valid-api rule but has the unexpected behavior that the foo public property is not accessible from the template. (original issue)
import { LightningElement, api } from 'lwc';
export default class App extends LightningElement {
@api foo = 1;
set foo(value) {}
get foo() {}
}We should restrict the combination of public property with a getter/setter.
This can either be achieved by:
- adding a new ESLint rule dedicated to this case, eg:
api-accessor-shadow - or enhance the
valid-apiESLint rule to handle this case. However, we need to ensure that thevalid-apiESLint stays backward compatible because the rule is used to validate the component when compiled on the platform. In this case, we will add this new check behind a config.
{
"@lwc/lwc/valid-api": [
"error",
{ "disallowAccessorShadow": true }
]
}ekashida
Metadata
Metadata
Assignees
Labels
USER STORYkind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.