Skip to content

Commit

Permalink
fix: ignore state properties in attribute rule 43081j#202 (43081j#203)
Browse files Browse the repository at this point in the history
Allows properties with `state: true` to have non-lowercase names without an attribute being specified
  • Loading branch information
HerrDietz authored May 28, 2024
1 parent fb4dcfe commit ba7794c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/rules/attribute-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const rule: Rule.RuleModule = {
const propertyMap = getPropertyMap(node);

for (const [prop, propConfig] of propertyMap.entries()) {
if (!propConfig.attribute) {
if (!propConfig.attribute || propConfig.state) {
continue;
}

Expand Down
9 changes: 8 additions & 1 deletion src/test/rules/attribute-names_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ ruleTester.run('attribute-names', rule, {
};
}
}`,
`class Foo extends Litelement {
`class Foo extends LitElement {
static get properties() {
return {
internalState: {type: String, state: true}
};
}
}`,
`class Foo extends LitElement {
static get properties() {
return {
camelCase: {type: String, attribute: 'lowercase'}
Expand Down

0 comments on commit ba7794c

Please sign in to comment.