chore(prettier): full repo linting and code reformatting once and for all (#3627)

This commit is contained in:
Alireza authored and GitHub committed 2023-09-01 16:19:39 -04:00
1 parent 01500a2d4c
commit 9045ddaedc
656 files changed
+21737 -20628

No files matched your search

@@ -11,7 +11,7 @@ const extensionManager = {
registeredExtensionIds: [],
moduleEntries: {},
getModuleEntry: function(id) {
getModuleEntry: function (id) {
return this.moduleEntries[id];
},
};
@@ -20,7 +20,7 @@ const commandsManager = {};
const ohifOverlayItem = {
id: 'ohif.overlayItem',
content: function(props) {
content: function (props) {
return {
label: this.label,
value: props[this.attribute],
@@ -59,29 +59,27 @@ describe('CustomizationService.ts', () => {
it('configurationRegistered', () => {
configuration.testItem = testItem;
customizationService.init(extensionManager);
expect(customizationService.getGlobalCustomization('testItem')).toBe(
testItem
);
expect(customizationService.getGlobalCustomization('testItem')).toBe(testItem);
});
it('defaultRegistered', () => {
extensionManager.registeredExtensionIds.push('@testExtension');
extensionManager.moduleEntries[
'@testExtension.customizationModule.default'
] = { name: 'default', value: [testItem] };
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
name: 'default',
value: [testItem],
};
customizationService.init(extensionManager);
expect(customizationService.getGlobalCustomization('testItem')).toBe(
testItem
);
expect(customizationService.getGlobalCustomization('testItem')).toBe(testItem);
});
});
describe('customizationType', () => {
it('inherits type', () => {
extensionManager.registeredExtensionIds.push('@testExtension');
extensionManager.moduleEntries[
'@testExtension.customizationModule.default'
] = { name: 'default', value: [ohifOverlayItem] };
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
name: 'default',
value: [ohifOverlayItem],
};
configuration.testItem = testItem;
customizationService.init(extensionManager);
@@ -96,9 +94,10 @@ describe('CustomizationService.ts', () => {
it('inline default inherits type', () => {
extensionManager.registeredExtensionIds.push('@testExtension');
extensionManager.moduleEntries[
'@testExtension.customizationModule.default'
] = { name: 'default', value: [ohifOverlayItem] };
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
name: 'default',
value: [ohifOverlayItem],
};
configuration.testItem = testItem;
customizationService.init(extensionManager);
@@ -121,20 +120,17 @@ describe('CustomizationService.ts', () => {
describe('mode customization', () => {
it('onModeEnter can add extensions', () => {
extensionManager.registeredExtensionIds.push('@testExtension');
extensionManager.moduleEntries[
'@testExtension.customizationModule.default'
] = { name: 'default', value: [ohifOverlayItem] };
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
name: 'default',
value: [ohifOverlayItem],
};
customizationService.init(extensionManager);
expect(
customizationService.getModeCustomization('testItem')
).toBeUndefined();
expect(customizationService.getModeCustomization('testItem')).toBeUndefined();
customizationService.addModeCustomizations([testItem]);
expect(
customizationService.getGlobalCustomization('testItem')
).toBeUndefined();
expect(customizationService.getGlobalCustomization('testItem')).toBeUndefined();
const item = customizationService.getModeCustomization('testItem');
@@ -147,16 +143,15 @@ describe('CustomizationService.ts', () => {
it('global customizations override modes', () => {
extensionManager.registeredExtensionIds.push('@testExtension');
extensionManager.moduleEntries[
'@testExtension.customizationModule.default'
] = { name: 'default', value: [ohifOverlayItem] };
extensionManager.moduleEntries['@testExtension.customizationModule.default'] = {
name: 'default',
value: [ohifOverlayItem],
};
configuration.testItem = testItem;
customizationService.init(extensionManager);
// Add a mode customization that would otherwise fail below
customizationService.addModeCustomizations([
{ ...testItem, label: 'other' },
]);
customizationService.addModeCustomizations([{ ...testItem, label: 'other' }]);
const item = customizationService.getModeCustomization('testItem');
@@ -107,10 +107,7 @@ export default class CustomizationService extends PubSubService {
return this.modeCustomizations;
}
public setModeCustomization(
customizationId: string,
customization: Customization
): void {
public setModeCustomization(customizationId: string, customization: Customization): void {
this.modeCustomizations[customizationId] = merge(
this.modeCustomizations[customizationId] || {},
customization
@@ -155,10 +152,7 @@ export default class CustomizationService extends PubSubService {
}
public hasModeCustomization(customizationId: string) {
return (
this.globalCustomizations[customizationId] ||
this.modeCustomizations[customizationId]
);
return this.globalCustomizations[customizationId] || this.modeCustomizations[customizationId];
}
/**
* get is an alias for getModeCustomization, as it is the generic getter
@@ -186,9 +180,7 @@ export default class CustomizationService extends PubSubService {
return customization;
}
const parent = this.getCustomization(customizationType);
const result = parent
? Object.assign(Object.create(parent), customization)
: customization;
const result = parent ? Object.assign(Object.create(parent), customization) : customization;
// Execute an nested type information
return result.transform?.(this) || result;
}
@@ -213,10 +205,7 @@ export default class CustomizationService extends PubSubService {
* the modes. They include things like settings for the search screen.
* Reset does NOT clear global customizations.
*/
getGlobalCustomization(
id: string,
defaultValue?: Customization
): Customization | void {
getGlobalCustomization(id: string, defaultValue?: Customization): Customization | void {
return this.transform(this.globalCustomizations[id] ?? defaultValue);
}
@@ -225,15 +214,10 @@ export default class CustomizationService extends PubSubService {
this._broadcastGlobalCustomizationModified();
}
protected setConfigGlobalCustomization(
configuration: AppConfigCustomization
): void {
protected setConfigGlobalCustomization(configuration: AppConfigCustomization): void {
this.globalCustomizations = {};
const keys = flattenNestedStrings(configuration.globalCustomizations);
this.readCustomizationTypes(
v => keys[v.name] && v.customization,
this.globalCustomizations
);
this.readCustomizationTypes(v => keys[v.name] && v.customization, this.globalCustomizations);
// TODO - iterate over customizations, loading them from the extension
// manager.
@@ -264,10 +248,7 @@ export default class CustomizationService extends PubSubService {
this.addReferences(value, isGlobal);
} else {
const useId = value.id || id;
this[isGlobal ? 'setGlobalCustomization' : 'setModeCustomization'](
useId as string,
value
);
this[isGlobal ? 'setGlobalCustomization' : 'setModeCustomization'](useId as string, value);
}
}