Skip to content

Commit

Permalink
style: update lint style (#1092)
Browse files Browse the repository at this point in the history
re-lint files after update of Prettier v3

mostly changes to trailing commas
  • Loading branch information
odinr authored Aug 2, 2023
1 parent bd63135 commit 419141a
Show file tree
Hide file tree
Showing 255 changed files with 996 additions and 902 deletions.
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "es5",
"semi": true,
"tabWidth": 4
}
2 changes: 1 addition & 1 deletion cookbooks/app-react-ag-grid/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const App = (): JSX.Element => {

const columnDefs = useMemo(
() => [{ field: 'make' }, { field: 'model' }, { field: 'price' }],
[]
[],
);

const addRow = useCallback(() => {
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/app-react-bookmark-advanced/src/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const Create = () => {
.filter(
(b) =>
b.appKey ===
'fusion-framework-cookbook-app-react-bookmark-advanced'
'fusion-framework-cookbook-app-react-bookmark-advanced',
)
.map((bookmark) => (
<div key={bookmark.id} style={{ display: 'flex' }}>
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/app-react-bookmark-advanced/src/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Provider: FC<PropsWithChildren<unknown>> = ({ children }) => {
const { getAllBookmarks } = useBookmark();

const { currentBookmark } = useCurrentBookmark(
useCallback(() => state.payload, [state.payload])
useCallback(() => state.payload, [state.payload]),
);

const updateState = useCallback((cb: (state: BookmarkState) => Partial<BookmarkState>) => {
Expand Down
4 changes: 2 additions & 2 deletions cookbooks/app-react-bookmark/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ export const App = () => {
(newState: () => Partial<BookmarkState>) => {
setState((s) => ({ ...s, ...newState() }));
},
[setState]
[setState],
);
const currentBookmark = useCurrentBookmark<MyBookmark>(
useCallback(() => state.payload, [state.payload])
useCallback(() => state.payload, [state.payload]),
);

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions cookbooks/app-react-context/src/useRelatedContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useModuleCurrentContext } from '@equinor/fusion-framework-react-module-
* will create util functions for related context
*/
export const useRelatedContext = (
type?: string[]
type?: string[],
): ReturnType<typeof useObservableState<ContextItem[]>> => {
const { currentContext } = useModuleCurrentContext();
const provider = useAppModule<ContextModule>('context');
Expand All @@ -21,7 +21,7 @@ export const useRelatedContext = (
item: currentContext,
filter: { type },
});
}, [provider, currentContext])
}, [provider, currentContext]),
);
};

Expand Down
4 changes: 2 additions & 2 deletions cookbooks/app-react-people/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ export const App = () => {
},
key: (args) => JSON.stringify(args),
}),
[peopleHttpClient]
[peopleHttpClient],
);

const { idle, next, value$ } = useDebounceQuery(peopleQuery, { debounce: 1000 });

const { value: results } = useObservableSelectorState(
value$,
useCallback((x) => x.value.results, [value$])
useCallback((x) => x.value.results, [value$]),
);

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/AppConfigurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { AppModules } from './types';
*/
export interface IAppConfigurator<
TModules extends Array<AnyModule> | unknown = unknown,
TRef extends FusionModulesInstance = FusionModulesInstance
TRef extends FusionModulesInstance = FusionModulesInstance,
> extends IModulesConfigurator<AppModules<TModules>, TRef> {
/**
* [optional]
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface IAppConfigurator<

export class AppConfigurator<
TModules extends Array<AnyModule> | unknown = unknown,
TRef extends FusionModulesInstance = FusionModulesInstance
TRef extends FusionModulesInstance = FusionModulesInstance,
>
extends ModulesConfigurator<AppModules<TModules>, TRef>
implements IAppConfigurator<TModules, TRef>
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/configure-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export const configureModules =
<
TModules extends Array<AnyModule> | never,
TRef extends Fusion = Fusion,
TEnv extends AppEnv = AppEnv
TEnv extends AppEnv = AppEnv,
>(
cb?: AppModuleInitiator<TModules, TRef, TEnv>
cb?: AppModuleInitiator<TModules, TRef, TEnv>,
): ((args: { fusion: TRef; env: TEnv }) => Promise<AppModulesInstance<TModules>>) =>
/**
*
Expand All @@ -44,7 +44,7 @@ export const configureModules =
await Promise.resolve(cb(configurator, args));
}
const modules = (await configurator.initialize(
args.fusion.modules
args.fusion.modules,
// TODO
)) as unknown as AppModulesInstance<TModules>;

Expand Down
8 changes: 4 additions & 4 deletions packages/app/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export type AppEnv<TConfig = unknown, TProps = unknown> = {
export type AppModuleInitiator<
TModules extends Array<AnyModule> | unknown = unknown,
TRef extends Fusion = Fusion,
TEnv = AppEnv
TEnv = AppEnv,
> = (
configurator: IAppConfigurator<TModules, TRef['modules']>,
args: { fusion: TRef; env: TEnv }
args: { fusion: TRef; env: TEnv },
) => void | Promise<void>;

/**
Expand All @@ -58,7 +58,7 @@ export type AppModuleInitiator<
export type AppModuleInit<
TModules extends Array<AnyModule> | unknown,
TRef extends Fusion = Fusion,
TEnv = AppEnv
TEnv = AppEnv,
> = (
cb: AppModuleInitiator<TModules, TRef, TEnv>
cb: AppModuleInitiator<TModules, TRef, TEnv>,
) => (args: { fusion: TRef; env: TEnv }) => Promise<AppModulesInstance<TModules>>;
8 changes: 4 additions & 4 deletions packages/cli/src/dev-portal/AppLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import EquinorLoader from './EquinorLoader';
* when the appKey changes, this component will try to initialize the referred application
* and render it.
*/
export const AppLoader = (props: { appKey: string }) => {
export const AppLoader = (props: { readonly appKey: string }) => {
const { appKey } = props;
const fusion = useFramework<[AppModule]>();

Expand All @@ -32,7 +32,7 @@ export const AppLoader = (props: { appKey: string }) => {
// TODO change to `useCurrentApp`
/** observe and use the current selected application from framework */
const { value: currentApp } = useObservableState(
useMemo(() => fusion.modules.app.current$, [fusion.modules.app])
useMemo(() => fusion.modules.app.current$, [fusion.modules.app]),
);

useEffect(() => {
Expand All @@ -56,7 +56,7 @@ export const AppLoader = (props: { appKey: string }) => {
next: ({ manifest, script, config }) => {
/** generate basename for application */
const [basename] = window.location.pathname.match(
/\/?apps\/[a-z|-]+(\/)?/g
/\/?apps\/[a-z|-]+(\/)?/g,
) ?? [''];

/** create a 'private' element for the application */
Expand Down Expand Up @@ -86,7 +86,7 @@ export const AppLoader = (props: { appKey: string }) => {
/** set error if initialization of application fails */
setError(err);
},
})
}),
);

/** teardown application when hook unmounts */
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/BookMarkSideSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useHasBookmark } from '@equinor/fusion-framework-react-module-bookmark/
import { SideSheet } from '@equinor/fusion-react-side-sheet';

type BookmarkSideSheetProps = {
isOpen: boolean;
readonly isOpen: boolean;
onClose(): void;
};

Expand Down
14 changes: 7 additions & 7 deletions packages/cli/src/dev-portal/ContextSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ const useQueryContext = (): [
ContextResolver,
(e: ContextSelectEvent) => void,
ContextResultItem,
() => void
() => void,
] => {
/* Framework modules */
const framework = useFramework();

// TODO change to `useCurrentContext`
/* Current context observable */
const { value: currentContext } = useObservableState(
useMemo(() => framework.modules.context.currentContext$, [framework.modules.context])
useMemo(() => framework.modules.context.currentContext$, [framework.modules.context]),
);

/* Set currentContext as initialResult in dropdown */
const preselected: ContextResult = useMemo(
() => (currentContext ? mapper([currentContext]) : noPreselect),
[currentContext]
[currentContext],
);

/* context provider state */
Expand All @@ -93,7 +93,7 @@ const useQueryContext = (): [
setProvider(contextProvider);
}
},
[setProvider]
[setProvider],
);

/** clear the app provider */
Expand Down Expand Up @@ -146,19 +146,19 @@ const useQueryContext = (): [
},
initialResult: preselected,
}),
[provider, preselected]
[provider, preselected],
);

/* Callback for setting current context to selected item id. */
const setContext = useCallback(
(e: ContextSelectEvent): void => {
if (e.nativeEvent.detail?.selected.length) {
framework.modules.context.setCurrentContextByIdAsync(
e.nativeEvent.detail.selected[0].id
e.nativeEvent.detail.selected[0].id,
);
}
},
[framework]
[framework],
);

/* Clear current context */
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/EquinorLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StarProgress } from '@equinor/fusion-react-progress-indicator';
export const EquinorLoader = ({
children,
text,
}: React.PropsWithChildren<{ text: string }>): JSX.Element => {
}: React.PropsWithChildren<{ readonly text: string }>): JSX.Element => {
return (
<div
style={{
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/ErrorViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ErrorViewer = ({ error }: { error: Error }) => {
export const ErrorViewer = ({ error }: { readonly error: Error }) => {
return (
<>
<div style={{ marginTop: 20, border: '1px solid' }}>
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/FusionLogo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react';

type FusionLogoProps = {
scale?: number;
readonly scale?: number;
};

export const FusionLogo: FC<FusionLogoProps> = ({ scale = 1 }) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const configure = async (config: FrameworkConfigurator) => {
clientId: '9b707e3a-3e90-41ed-a47e-652a1e3b53d0',
redirectUri: '/authentication/login-callback',
},
{ requiresAuth: true }
{ requiresAuth: true },
);

enableAppModule(config);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dev-portal/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ ReactDOM.createRoot(target).render(
<Router />
</Framework>
</ThemeProvider>
</React.StrictMode>
</React.StrictMode>,
);
2 changes: 1 addition & 1 deletion packages/cli/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const render = (el: HTMLElement, args: { env: unknown }) => {
root.render(
<StrictMode>
<Test env={args.env} />
</StrictMode>
</StrictMode>,
);
return () => root.unmount();
};
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/scripts/app-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const loadConfigFromJson = async (file: string): Promise<AppConfig> => {
};

export const loadConfig = async (
path: string
path: string,
): Promise<AppConfig & { configSource?: ConfigSource }> => {
const configSource = getConfigType(path);
const customConfig = await (() => {
Expand Down Expand Up @@ -103,7 +103,7 @@ export const resolveAppConfig = async (): Promise<LocalConfig> => {
name: pkg.name,
main: pkg.main.startsWith('/') ? pkg.main : `/${pkg.main}`,
__DEV__: { root, configSource: appConfig.configSource, portal: appConfig.portalHost },
}
},
);

validateConfig(manifest);
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ app.command('dev')
.option('--portal <string>', 'fusion portal host')
.option(
'-c, --config <file>',
'Use specified config file, see https://vitejs.dev/guide/cli.html#build'
'Use specified config file, see https://vitejs.dev/guide/cli.html#build',
)
.action(async ({ port, portal, config }) => {
const spinner = ora('Loading configuration').start();
Expand All @@ -49,7 +49,7 @@ app.command('dev')
app.command('build')
.option(
'-c, --config <file>',
'Use specified config file, see https://vitejs.dev/guide/cli.html#build'
'Use specified config file, see https://vitejs.dev/guide/cli.html#build',
)
.action(async ({ config }) => {
const spinner = ora('Loading configuration').start();
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/src/scripts/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ export const server = async (config: { viteConfig: UserConfig; appConfig: any })
const response = JSON.parse(responseBuffer.toString('utf8'));
response.environmentName = 'DEVELOPMENT';
response.services = response.services.filter(
(x: { key: string }) => x.key !== 'app'
(x: { key: string }) => x.key !== 'app',
);
response.services.push({
key: 'app',
uri: new URL('/', req.headers.referer).href,
});
return JSON.stringify(response);
}),
})
}),
);

app.get(
Expand All @@ -80,13 +80,13 @@ export const server = async (config: { viteConfig: UserConfig; appConfig: any })
return JSON.stringify(response);
}
return JSON.stringify(
Object.assign(JSON.parse(responseBuffer.toString('utf8')), response)
Object.assign(JSON.parse(responseBuffer.toString('utf8')), response),
);
} else {
return responseBuffer;
}
}),
})
}),
);

app.get(
Expand All @@ -107,13 +107,13 @@ export const server = async (config: { viteConfig: UserConfig; appConfig: any })
return JSON.stringify(response);
}
return JSON.stringify(
Object.assign(JSON.parse(responseBuffer.toString('utf8')), response)
Object.assign(JSON.parse(responseBuffer.toString('utf8')), response),
);
} else {
return responseBuffer;
}
}),
})
}),
);

app.use('*', async (req, res) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/FrameworkConfigurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { FusionModules } from './types';
export class FrameworkConfigurator<
TModules extends Array<AnyModule> = [],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TRef = any
TRef = any,
> extends ModulesConfigurator<FusionModules<TModules>, TRef> {
constructor() {
super([event, auth, http, disco, services, context]);
Expand Down
Loading

0 comments on commit 419141a

Please sign in to comment.