Skip to content

Commit f84d2b4

Browse files
authored
chore: Enable optional chaining lint (#4426)
1 parent db85c28 commit f84d2b4

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

eslint.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ export default defineConfig(
7373
'no-empty': 'warn',
7474
'no-irregular-whitespace': 'warn',
7575
'no-prototype-builtins': 'warn',
76-
'no-unsafe-optional-chaining': 'warn',
7776
'prefer-const': 'error',
7877
},
7978
},

src/command-pallette/CommandPalletteUI/handlers/clusterResourceHandler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function createResults(context: CommandPaletteContext): Result[] {
335335
}
336336
}
337337

338-
let resources = resourceCache[resourceType];
338+
let resources = resourceCache[resourceType] || [];
339339

340340
if (typeof resources !== 'object') {
341341
//@ts-expect-error TODO: handle type in Result
@@ -373,13 +373,13 @@ function createResults(context: CommandPaletteContext): Result[] {
373373
//special case for namespace overview
374374
if (resourceType === 'namespaces' && namespacesOverviewCase) {
375375
return [
376-
...resources?.map((item) =>
376+
...resources.map((item) =>
377377
makeListItem(item, matchedNode, context, false),
378378
),
379379
];
380380
}
381381
return [
382-
...resources?.map((item) =>
382+
...resources.map((item) =>
383383
makeListItem(item, matchedNode, context, true),
384384
),
385385
];

src/resources/Namespaces/YamlUpload/useUploadResources.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export function useUploadResources(
159159
const fetchResources = useCallback(() => {
160160
if (filteredResources?.length) {
161161
setLastOperationState(OPERATION_STATE_WAITING);
162-
for (const [index, resource] of filteredResources?.entries()) {
162+
for (const [index, resource] of filteredResources.entries()) {
163163
updateState(index, STATE_WAITING);
164164
fetchApiGroup(resource, index);
165165
}

0 commit comments

Comments
 (0)