Closed iocanel closed 10 months ago
There are typescript errors to be fixed
src/scaffolder/QuarkusExtensionList.tsx:153:9 - error TS2322: Type 'string[]' is not assignable to type '{ id: string; name: string; }[]'.
Type 'string' is not assignable to type '{ id: string; name: string; }'.
153 defaultValue: quarkusExtensions && quarkusExtensions.length > 0 ? [quarkusExtensions[0].name] : [],
~~~~~~~~~~~~
../../node_modules/@material-ui/lab/useAutocomplete/useAutocomplete.d.ts:233:3
233 defaultValue?: Value<T, Multiple, DisableClearable, FreeSolo>;
~~~~~~~~~~~~
The expected type comes from property 'defaultValue' which is declared here on type 'UseAutocompleteProps<{ id: string; name: string; }, true, undefined, undefined>'
src/scaffolder/QuarkusExtensionList.tsx:153:23 - error TS2448: Block-scoped variable 'quarkusExtensions' used before its declaration.
153 defaultValue: quarkusExtensions && quarkusExtensions.length > 0 ? [quarkusExtensions[0].name] : [],
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:174:9
174 const quarkusExtensions: QuarkusExtensionType[] = [];
~~~~~~~~~~~~~~~~~
'quarkusExtensions' is declared here.
src/scaffolder/QuarkusExtensionList.tsx:153:23 - error TS2454: Variable 'quarkusExtensions' is used before being assigned.
153 defaultValue: quarkusExtensions && quarkusExtensions.length > 0 ? [quarkusExtensions[0].name] : [],
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:153:44 - error TS2448: Block-scoped variable 'quarkusExtensions' used before its declaration.
153 defaultValue: quarkusExtensions && quarkusExtensions.length > 0 ? [quarkusExtensions[0].name] : [],
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:174:9
174 const quarkusExtensions: QuarkusExtensionType[] = [];
~~~~~~~~~~~~~~~~~
'quarkusExtensions' is declared here.
src/scaffolder/QuarkusExtensionList.tsx:153:76 - error TS2448: Block-scoped variable 'quarkusExtensions' used before its declaration.
153 defaultValue: quarkusExtensions && quarkusExtensions.length > 0 ? [quarkusExtensions[0].name] : [],
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:174:9
174 const quarkusExtensions: QuarkusExtensionType[] = [];
~~~~~~~~~~~~~~~~~
'quarkusExtensions' is declared here.
src/scaffolder/QuarkusExtensionList.tsx:155:18 - error TS2448: Block-scoped variable 'quarkusExtensions' used before its declaration.
155 options: quarkusExtensions,
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:174:9
174 const quarkusExtensions: QuarkusExtensionType[] = [];
~~~~~~~~~~~~~~~~~
'quarkusExtensions' is declared here.
src/scaffolder/QuarkusExtensionList.tsx:155:18 - error TS2454: Variable 'quarkusExtensions' is used before being assigned.
155 options: quarkusExtensions,
~~~~~~~~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:168:26 - error TS18048: 'uiSchema' is possibly 'undefined'.
168 const codeQuarkusUrl = uiSchema['ui:options']?.codeQuarkusUrl ?? 'https://stage.code.quarkus.io';
~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:170:18 - error TS18048: 'uiSchema' is possibly 'undefined'.
170 const filter = uiSchema['ui:options']?.filter ?? {};
~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:171:38 - error TS[233](https://github.com/q-shift/backstage-plugins/actions/runs/7660921492/job/20879266233?pr=19#step:3:240)9: Property 'extensions' does not exist on type 'string | number | boolean | object'.
Property 'extensions' does not exist on type 'string'.
171 const filteredExtensions = filter?.extensions ?? [];
~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:172:38 - error TS2339: Property 'categories' does not exist on type 'string | number | boolean | object'.
Property 'categories' does not exist on type 'string'.
172 const filteredCategories = filter?.categories ?? [];
~~~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:173:36 - error TS2339: Property 'keywords' does not exist on type 'string | number | boolean | object'.
Property 'keywords' does not exist on type 'string'.
173 const filteredKeywords = filter?.keywords ?? [];
~~~~~~~~
src/scaffolder/QuarkusExtensionList.tsx:177:118 - error TS7006: Parameter 'regex' implicitly has an 'any' type.
177 const matchingCateogory = !filteredCategories || filteredCategories.length == 0 || filteredCategories.some(regex => !e.category || e.category.match(regex));
~~~~~
src/scaffolder/QuarkusExtensionList.tsx:178:113 - error TS7006: Parameter 'regex' implicitly has an 'any' type.
178 const matchingName = !filteredExtensions || filteredExtensions.length == 0 || filteredExtensions.some(regex => e.id.match(regex));
~~~~~
src/scaffolder/QuarkusExtensionList.tsx:179:111 - error TS7006: Parameter 'regex' implicitly has an 'any' type.
179 const matchingKeywords = !filteredKeywords || filteredKeywords.length == 0 || filteredKeywords.some(regex => !e.keywords || e.keywords.some(keyword => keyword.match(regex)));
The pull request allows PE to define filtering rules for extension. Also, it removes hard coded default extensions.