Skip to content

Commit

Permalink
array and assocarray interace type are case insensitive (#129)
Browse files Browse the repository at this point in the history
Co-authored-by: Bronley Plumb <[email protected]>
  • Loading branch information
RokuAndrii and TwitchBronBron authored Aug 23, 2024
1 parent 05626c6 commit 992c644
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/plugins/codeStyle/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ describe('codeStyle', () => {
} as any);
const actual = fmtDiagnostics(diagnostics);
const expected = [
`06:LINT3024:Avoid using field type 'assocarray'`
`06:LINT3024:Avoid using field type 'assocarray'`,
`07:LINT3024:Avoid using field type 'assocarray'`
];
expect(actual).deep.equal(expected);
});
Expand All @@ -561,7 +562,8 @@ describe('codeStyle', () => {
} as any);
const actual = fmtDiagnostics(diagnostics);
const expected = [
`04:LINT3025:Avoid using field type 'array'`
`04:LINT3025:Avoid using field type 'array'`,
`08:LINT3025:Avoid using field type 'array'`
];
expect(actual).deep.equal(expected);
});
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/codeStyle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class CodeStyle {
if (tag.text === 'field') {
const typeAttribute = attributes.find(({ key }) => key.text === 'type');

const typeValue = typeAttribute?.value.text;
const typeValue = typeAttribute?.value.text?.toLowerCase();
if (typeValue === 'array' && validateArrayComponentFieldType) {
diagnostics.push(
messages.noArrayFieldType(
Expand Down
2 changes: 2 additions & 0 deletions test/project1/components/interfaceTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
<field id="test" type="array" />
<field id="test2" type="node" />
<field id="test3" type="assocarray" />
<field id="test3" type="assocArray" />
<field id="test" type="arRay" />
</interface>
</component>

0 comments on commit 992c644

Please sign in to comment.