From a33647218b77a0934017f8008a6df61c7298ace1 Mon Sep 17 00:00:00 2001 From: akovtko Date: Fri, 23 Aug 2024 16:25:40 +0300 Subject: [PATCH] array and assocarray interace type are case insensitive --- src/plugins/codeStyle/index.spec.ts | 6 ++++-- src/plugins/codeStyle/index.ts | 2 +- test/project1/components/interfaceTest.xml | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/codeStyle/index.spec.ts b/src/plugins/codeStyle/index.spec.ts index 6913355..c7d9036 100644 --- a/src/plugins/codeStyle/index.spec.ts +++ b/src/plugins/codeStyle/index.spec.ts @@ -545,7 +545,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); }); @@ -560,7 +561,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); }); diff --git a/src/plugins/codeStyle/index.ts b/src/plugins/codeStyle/index.ts index 7643a45..641635e 100644 --- a/src/plugins/codeStyle/index.ts +++ b/src/plugins/codeStyle/index.ts @@ -48,7 +48,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( diff --git a/test/project1/components/interfaceTest.xml b/test/project1/components/interfaceTest.xml index d788517..77d3ed8 100644 --- a/test/project1/components/interfaceTest.xml +++ b/test/project1/components/interfaceTest.xml @@ -4,5 +4,7 @@ + +