Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "^5.3.1",
"babel-loader": "^8.2.5",
"eslint": "^7.32.0",
"eslint": "^8.57.1",
"eslint-config-airbnb": "^19.0.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-react": "^7.27.0",
"eslint-plugin-react-hooks": "^4.3.0",
"find-up": "^5.0.0",
Expand All @@ -69,7 +69,7 @@
"jsonc-parser": "^3.2.0",
"lodash": "^4.17.23",
"minimatch": "^3.1.2",
"prettier": "^2.4.1",
"prettier": "^3.8.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-redux": "^8.0.5",
Expand Down
5 changes: 4 additions & 1 deletion packages/common/src/errors/ErrorWithCause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { CustomError } from './CustomError';
* This shouldn't be needed once https://github.com/tc39/proposal-error-cause receives widespread support.
*/
export class ErrorWithCause extends CustomError {
constructor(message: string, readonly cause: unknown) {
constructor(
message: string,
readonly cause: unknown,
) {
super(message);
}
}
4 changes: 2 additions & 2 deletions packages/eslint-plugin-internal/src/configs/base-node.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:node/recommended'],
extends: ['airbnb-base', 'plugin:promise/recommended', 'plugin:n/recommended'],

parserOptions: {
ecmaVersion: 2021,
Expand All @@ -15,7 +15,7 @@ module.exports = {
...require('./all-bases').settings,
},

plugins: ['promise', 'node', 'lodash'],
plugins: ['promise', 'n', 'lodash'],

rules: require('../rules/all-bases'),
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module.exports = {
'global-require': 'off',

// Disallow require() expressions which import extraneous modules
'node/no-extraneous-require': 'off',
'n/no-extraneous-require': 'off',

// Disallow require() expressions which import private modules
'node/no-unpublished-require': 'off',
'n/no-unpublished-require': 'off',
};
2 changes: 1 addition & 1 deletion packages/lib-core/src/runtime/PluginLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class PluginLoader implements PluginLoaderInterface {
};
}

const pluginBuildHash = isRemoteManifest ? manifest.buildHash ?? uuidv4() : uuidv4();
const pluginBuildHash = isRemoteManifest ? (manifest.buildHash ?? uuidv4()) : uuidv4();

let loadedExtensions = manifest.extensions.map<LoadedExtension>((e, index) => ({
...cloneDeepOnlyCloneableValues(e),
Expand Down
30 changes: 15 additions & 15 deletions packages/lib-core/src/types/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,14 @@ export type EncodedCodeRef = { $codeRef: string };
*/
export type CodeRef<TValue = unknown> = () => Promise<TValue>;

export type CodeRefsToValues<T> = T extends CodeRef<infer TValue>
? TValue
: T extends (infer U)[]
? CodeRefsToValues<U>[]
: T extends object
? MapCodeRefsToValues<T>
: T;
export type CodeRefsToValues<T> =
T extends CodeRef<infer TValue>
? TValue
: T extends (infer U)[]
? CodeRefsToValues<U>[]
: T extends object
? MapCodeRefsToValues<T>
: T;

export type MapCodeRefsToValues<T extends object> = {
[K in keyof T]: CodeRefsToValues<T[K]>;
Expand All @@ -91,10 +92,10 @@ export type MapCodeRefsToValues<T extends object> = {
export type CodeRefsToEncodedCodeRefs<T> = T extends CodeRef
? EncodedCodeRef
: T extends (infer U)[]
? CodeRefsToEncodedCodeRefs<U>[]
: T extends object
? MapCodeRefsToEncodedCodeRefs<T>
: T;
? CodeRefsToEncodedCodeRefs<U>[]
: T extends object
? MapCodeRefsToEncodedCodeRefs<T>
: T;

export type MapCodeRefsToEncodedCodeRefs<T extends object> = {
[K in keyof T]: CodeRefsToEncodedCodeRefs<T[K]>;
Expand All @@ -103,10 +104,9 @@ export type MapCodeRefsToEncodedCodeRefs<T extends object> = {
/**
* Infer the properties type from extension type `T`.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ExtractExtensionProperties<T> = T extends Extension<any, infer TProperties>
? TProperties
: never;
export type ExtractExtensionProperties<T> =
// eslint-disable-next-line @typescript-eslint/no-explicit-any
T extends Extension<any, infer TProperties> ? TProperties : never;

/**
* Modify `TExtension` type by replacing `CodeRef<T>` property values with `T` values.
Expand Down
6 changes: 5 additions & 1 deletion packages/lib-core/src/utils/basic-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { CustomError, applyDefaults } from '@monorepo/common';
import type { ResourceFetch } from '../types/fetch';

class FetchError extends CustomError {
constructor(message: string, readonly status: number, readonly response: Response) {
constructor(
message: string,
readonly status: number,
readonly response: Response,
) {
super(message);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/lib-utils/src/k8s/hooks/useK8sModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const getK8sModel = (
): K8sModelCommon => {
const kindReference = transformGroupVersionKindToReference(k8sGroupVersionKind);
return kindReference
? k8s?.getIn(['RESOURCES', 'models', kindReference]) ??
k8s?.getIn(['RESOURCES', 'models', getGroupVersionKindForReference(kindReference).kind])
? (k8s?.getIn(['RESOURCES', 'models', kindReference]) ??
k8s?.getIn(['RESOURCES', 'models', getGroupVersionKindForReference(kindReference).kind]))
: undefined;
};

Expand Down
7 changes: 3 additions & 4 deletions packages/lib-utils/src/k8s/hooks/usePrevious.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { useRef, useEffect } from 'react';
export const usePrevious = <P = unknown>(value: P, deps?: unknown[]): P | undefined => {
const ref = useRef<P>();

useEffect(() => {
ref.current = value;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps || [value]);
// prettier-ignore
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => { ref.current = value; }, deps || [value]);

return ref.current;
};
3 changes: 1 addition & 2 deletions packages/lib-webpack/src/webpack/DynamicRemotePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ export class DynamicRemotePlugin implements WebpackPluginInstance {
});
} catch (e) {
throw new Error(
`Invalid ${DynamicRemotePlugin.name} options:\n` +
(e as ValidationError).errors.join('\n'),
`Invalid ${DynamicRemotePlugin.name} options:\n` + (e as ValidationError).errors.join('\n'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/lib-webpack/src/yup-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { object, string } from 'yup';
import {
extensionArraySchema,
pluginRuntimeMetadataSchema,
recordStringStringSchema
recordStringStringSchema,
} from '@openshift/dynamic-plugin-sdk/src/shared-webpack';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { ErrorBoundaryFallbackProps } from './ErrorBoundary';
const trimEmptyLines = (text: string) => text.replace(/^\s*\n/gm, '');

const ErrorBoundaryFallback: FC<ErrorBoundaryFallbackProps> = ({ error, errorInfo }) => (
// eslint-disable-next-line camelcase
<Flex direction={{ default: 'column' }} style={{ padding: t_global_spacer_md.value }}>
<FlexItem>
<Content component="h1">Oh no! Something went wrong.</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const LabelWithTooltipIcon: FC<LabelWithTooltipIconProps> = ({ label, tooltipCon
<FlexItem>{label}</FlexItem>
<FlexItem>
<Tooltip content={tooltipContent}>
{/* eslint-disable-next-line camelcase */}
<InfoCircleIcon color={t_global_icon_color_status_info_default.var} />
</Tooltip>
</FlexItem>
Expand Down
1 change: 1 addition & 0 deletions packages/sample-app/src/shared-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ export const getSharedScope = () => {
throw new Error('Attempt to access share scope object before its initialization');
}

// eslint-disable-next-line camelcase
return __webpack_share_scopes__[SHARED_SCOPE_NAME];
};
Loading