lint(curly): consistent use of curly brackets in codebase (#3584)
This commit is contained in:
1 parent
9ae3d9f769
commit
5d435424e2
113 files changed
+1501
-1056
No files matched your search
@@ -4,6 +4,8 @@ const originalConsoleError = console.error;
|
||||
// JSDom's CSS Parser has limited support for certain features
|
||||
// This supresses error warnings caused by it
|
||||
console.error = function(msg) {
|
||||
if (_.startsWith(msg, 'Error: Could not parse CSS stylesheet')) return;
|
||||
if (_.startsWith(msg, 'Error: Could not parse CSS stylesheet')) {
|
||||
return;
|
||||
}
|
||||
originalConsoleError(msg);
|
||||
};
|
||||
@@ -103,7 +103,9 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
|
||||
const modesById = new Set();
|
||||
for (let i = 0; i < loadedModes.length; i++) {
|
||||
let mode = loadedModes[i];
|
||||
if (!mode) continue;
|
||||
if (!mode) {
|
||||
continue;
|
||||
}
|
||||
const { id } = mode;
|
||||
|
||||
if (mode.modeFactory) {
|
||||
@@ -116,10 +118,14 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
|
||||
mode = mode.modeFactory({ modeConfiguration });
|
||||
}
|
||||
|
||||
if (modesById.has(id)) continue;
|
||||
if (modesById.has(id)) {
|
||||
continue;
|
||||
}
|
||||
// Prevent duplication
|
||||
modesById.add(id);
|
||||
if (!mode || typeof mode !== 'object') continue;
|
||||
if (!mode || typeof mode !== 'object') {
|
||||
continue;
|
||||
}
|
||||
appConfig.loadedModes.push(mode);
|
||||
}
|
||||
// Hack alert - don't touch the original modes definition,
|
||||
|
||||
@@ -145,7 +145,9 @@ function ViewerViewportGrid(props) {
|
||||
const { unsubscribe } = measurementService.subscribe(
|
||||
MeasurementService.EVENTS.JUMP_TO_MEASUREMENT_LAYOUT,
|
||||
({ viewportIndex, measurement, isConsumed }) => {
|
||||
if (isConsumed) return;
|
||||
if (isConsumed) {
|
||||
return;
|
||||
}
|
||||
// This occurs when no viewport has elected to consume the event
|
||||
// so we need to change layouts into a layout which can consume
|
||||
// the event.
|
||||
@@ -292,7 +294,9 @@ function ViewerViewportGrid(props) {
|
||||
});
|
||||
|
||||
const onInteractionHandler = event => {
|
||||
if (isActive) return;
|
||||
if (isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default class FileLoader {
|
||||
fileType;
|
||||
loadFile(file, imageId) { }
|
||||
getDataset(image, imageId) { }
|
||||
getStudies(dataset, imageId) { }
|
||||
loadFile(file, imageId) {}
|
||||
getDataset(image, imageId) {}
|
||||
getStudies(dataset, imageId) {}
|
||||
}
|
||||
@@ -11,8 +11,12 @@ type StudyMetadata = Types.StudyMetadata;
|
||||
* @returns - compare a and b, returning 1 if a<b -1 if a>b and defaultCompare otherwise
|
||||
*/
|
||||
const compare = (a, b, defaultCompare = 0): number => {
|
||||
if (a === b) return defaultCompare;
|
||||
if (a < b) return 1;
|
||||
if (a === b) {
|
||||
return defaultCompare;
|
||||
}
|
||||
if (a < b) {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
@@ -49,7 +53,9 @@ const getStudiesfromDisplaySets = (displaysets): StudyMetadata[] => {
|
||||
* in the original order, as specified.
|
||||
*/
|
||||
const getStudiesFromUIDs = (studyUids: string[]): StudyMetadata[] => {
|
||||
if (!studyUids?.length) return;
|
||||
if (!studyUids?.length) {
|
||||
return;
|
||||
}
|
||||
return studyUids.map(uid => DicomMetadataStore.getStudy(uid));
|
||||
};
|
||||
|
||||
|
||||
@@ -361,32 +361,35 @@ function WorkList({
|
||||
query.append('configUrl', filterValues.configUrl);
|
||||
}
|
||||
query.append('StudyInstanceUIDs', studyInstanceUid);
|
||||
return mode.displayName && (
|
||||
<Link
|
||||
className={isValidMode ? '' : 'cursor-not-allowed'}
|
||||
key={i}
|
||||
to={`${dataPath ? '../../' : ''}${mode.routeName}${dataPath ||
|
||||
''}?${query.toString()}`}
|
||||
onClick={event => {
|
||||
// In case any event bubbles up for an invalid mode, prevent the navigation.
|
||||
// For example, the event bubbles up when the icon embedded in the disabled button is clicked.
|
||||
if (!isValidMode) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}}
|
||||
// to={`${mode.routeName}/dicomweb?StudyInstanceUIDs=${studyInstanceUid}`}
|
||||
>
|
||||
{/* TODO revisit the completely rounded style of buttons used for launching a mode from the worklist later - for now use LegacyButton*/}
|
||||
<LegacyButton
|
||||
rounded="full"
|
||||
variant={isValidMode ? 'contained' : 'disabled'}
|
||||
disabled={!isValidMode}
|
||||
endIcon={<Icon name="launch-arrow" />} // launch-arrow | launch-info
|
||||
onClick={() => {}}
|
||||
return (
|
||||
mode.displayName && (
|
||||
<Link
|
||||
className={isValidMode ? '' : 'cursor-not-allowed'}
|
||||
key={i}
|
||||
to={`${dataPath ? '../../' : ''}${
|
||||
mode.routeName
|
||||
}${dataPath || ''}?${query.toString()}`}
|
||||
onClick={event => {
|
||||
// In case any event bubbles up for an invalid mode, prevent the navigation.
|
||||
// For example, the event bubbles up when the icon embedded in the disabled button is clicked.
|
||||
if (!isValidMode) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}}
|
||||
// to={`${mode.routeName}/dicomweb?StudyInstanceUIDs=${studyInstanceUid}`}
|
||||
>
|
||||
{t(`Modes:${mode.displayName}`)}
|
||||
</LegacyButton>
|
||||
</Link>
|
||||
{/* TODO revisit the completely rounded style of buttons used for launching a mode from the worklist later - for now use LegacyButton*/}
|
||||
<LegacyButton
|
||||
rounded="full"
|
||||
variant={isValidMode ? 'contained' : 'disabled'}
|
||||
disabled={!isValidMode}
|
||||
endIcon={<Icon name="launch-arrow" />} // launch-arrow | launch-info
|
||||
onClick={() => {}}
|
||||
>
|
||||
{t(`Modes:${mode.displayName}`)}
|
||||
</LegacyButton>
|
||||
</Link>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user