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

@@ -7,7 +7,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
};
@@ -12,7 +12,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
@@ -38,13 +37,7 @@ module.exports = (env, argv) => {
libraryTarget: 'umd',
filename: pkg.main,
},
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
],
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+3 -9
View File
@@ -19,14 +19,12 @@ const cs3d = {
};
const dicomsr = {
sopClassHandler:
'@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
sopClassHandler: '@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
viewport: '@ohif/extension-cornerstone-dicom-sr.viewportModule.dicom-sr',
};
const dicomvideo = {
sopClassHandler:
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
@@ -134,11 +132,7 @@ function modeFactory({ modeConfiguration }) {
]);
},
onModeExit: ({ servicesManager }) => {
const {
toolGroupService,
measurementService,
toolbarService,
} = servicesManager.services;
const { toolGroupService, measurementService, toolbarService } = servicesManager.services;
toolGroupService.destroy();
},
@@ -7,7 +7,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
};
@@ -40,13 +40,7 @@ module.exports = (env, argv) => {
libraryExport: 'default',
filename: pkg.main,
},
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
],
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+10 -20
View File
@@ -14,22 +14,18 @@ const ohif = {
};
const tracked = {
measurements:
'@ohif/extension-measurement-tracking.panelModule.trackedMeasurements',
measurements: '@ohif/extension-measurement-tracking.panelModule.trackedMeasurements',
thumbnailList: '@ohif/extension-measurement-tracking.panelModule.seriesList',
viewport:
'@ohif/extension-measurement-tracking.viewportModule.cornerstone-tracked',
viewport: '@ohif/extension-measurement-tracking.viewportModule.cornerstone-tracked',
};
const dicomsr = {
sopClassHandler:
'@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
sopClassHandler: '@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
viewport: '@ohif/extension-cornerstone-dicom-sr.viewportModule.dicom-sr',
};
const dicomvideo = {
sopClassHandler:
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
@@ -39,8 +35,7 @@ const dicompdf = {
};
const dicomSeg = {
sopClassHandler:
'@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
sopClassHandler: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
viewport: '@ohif/extension-cornerstone-dicom-seg.viewportModule.dicom-seg',
panel: '@ohif/extension-cornerstone-dicom-seg.panelModule.panelSegmentation',
};
@@ -68,12 +63,8 @@ function modeFactory() {
* Lifecycle hooks
*/
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
const {
measurementService,
toolbarService,
toolGroupService,
customizationService,
} = servicesManager.services;
const { measurementService, toolbarService, toolGroupService, customizationService } =
servicesManager.services;
measurementService.clearMeasurements();
@@ -147,13 +138,12 @@ function modeFactory() {
series: [],
},
isValidMode: function({ modalities }) {
isValidMode: function ({ modalities }) {
const modalities_list = modalities.split('\\');
// Exclude non-image modalities
return !!modalities_list.filter(
modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1
).length;
return !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length;
},
routes: [
{
+3 -16
View File
@@ -1,9 +1,4 @@
function initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
toolGroupId
) {
function initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, toolGroupId) {
const utilityModule = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.utilityModule.tools'
);
@@ -178,10 +173,7 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
{ toolName: toolNames.Angle },
{ toolName: toolNames.SegmentationDisplay },
],
disabled: [
{ toolName: toolNames.Crosshairs },
{ toolName: toolNames.ReferenceLines },
],
disabled: [{ toolName: toolNames.Crosshairs }, { toolName: toolNames.ReferenceLines }],
// enabled
// disabled
@@ -215,12 +207,7 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
}
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
'default'
);
initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, 'default');
initSRToolGroup(extensionManager, toolGroupService, commandsManager);
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
}
@@ -7,7 +7,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
};
+1 -7
View File
@@ -39,13 +39,7 @@ module.exports = (env, argv) => {
libraryExport: 'default',
filename: pkg.main,
},
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
],
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+9 -16
View File
@@ -14,22 +14,18 @@ const ohif = {
};
const tracked = {
measurements:
'@ohif/extension-measurement-tracking.panelModule.trackedMeasurements',
measurements: '@ohif/extension-measurement-tracking.panelModule.trackedMeasurements',
thumbnailList: '@ohif/extension-measurement-tracking.panelModule.seriesList',
viewport:
'@ohif/extension-measurement-tracking.viewportModule.cornerstone-tracked',
viewport: '@ohif/extension-measurement-tracking.viewportModule.cornerstone-tracked',
};
const dicomsr = {
sopClassHandler:
'@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
sopClassHandler: '@ohif/extension-cornerstone-dicom-sr.sopClassHandlerModule.dicom-sr',
viewport: '@ohif/extension-cornerstone-dicom-sr.viewportModule.dicom-sr',
};
const dicomvideo = {
sopClassHandler:
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
@@ -39,16 +35,14 @@ const dicompdf = {
};
const dicomSeg = {
sopClassHandler:
'@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
sopClassHandler: '@ohif/extension-cornerstone-dicom-seg.sopClassHandlerModule.dicom-seg',
viewport: '@ohif/extension-cornerstone-dicom-seg.viewportModule.dicom-seg',
panel: '@ohif/extension-cornerstone-dicom-seg.panelModule.panelSegmentation',
};
const dicomRt = {
viewport: '@ohif/extension-cornerstone-dicom-rt.viewportModule.dicom-rt',
sopClassHandler:
'@ohif/extension-cornerstone-dicom-rt.sopClassHandlerModule.dicom-rt',
sopClassHandler: '@ohif/extension-cornerstone-dicom-rt.sopClassHandlerModule.dicom-rt',
};
const extensionDependencies = {
@@ -176,13 +170,12 @@ function modeFactory({ modeConfiguration }) {
series: [],
},
isValidMode: function({ modalities }) {
isValidMode: function ({ modalities }) {
const modalities_list = modalities.split('\\');
// Exclude non-image modalities
return !!modalities_list.filter(
modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1
).length;
return !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length;
},
routes: [
{
+3 -16
View File
@@ -1,9 +1,4 @@
function initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
toolGroupId
) {
function initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, toolGroupId) {
const utilityModule = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.utilityModule.tools'
);
@@ -183,10 +178,7 @@ function initMPRToolGroup(extensionManager, toolGroupService, commandsManager) {
{ toolName: toolNames.PlanarFreehandROI },
{ toolName: toolNames.SegmentationDisplay },
],
disabled: [
{ toolName: toolNames.Crosshairs },
{ toolName: toolNames.ReferenceLines },
],
disabled: [{ toolName: toolNames.Crosshairs }, { toolName: toolNames.ReferenceLines }],
// enabled
// disabled
@@ -246,12 +238,7 @@ function initVolume3DToolGroup(extensionManager, toolGroupService) {
}
function initToolGroups(extensionManager, toolGroupService, commandsManager) {
initDefaultToolGroup(
extensionManager,
toolGroupService,
commandsManager,
'default'
);
initDefaultToolGroup(extensionManager, toolGroupService, commandsManager, 'default');
initSRToolGroup(extensionManager, toolGroupService, commandsManager);
initMPRToolGroup(extensionManager, toolGroupService, commandsManager);
initVolume3DToolGroup(extensionManager, toolGroupService);
+4 -2
View File
@@ -1,8 +1,10 @@
{
"plugins": ["prettier-plugin-tailwindcss"],
"trailingComma": "es5",
"printWidth": 80,
"printWidth": 100,
"proseWrap": "always",
"tabWidth": 2,
"semi": true,
"singleQuote": true
"singleQuote": true,
"arrowParens": "avoid"
}
-3
View File
@@ -3,13 +3,10 @@ const webpackCommon = require('./../../../.webpack/webpack.base.js');
const SRC_DIR = path.join(__dirname, '../src');
const DIST_DIR = path.join(__dirname, '../dist');
const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
};
+1 -7
View File
@@ -39,13 +39,7 @@ module.exports = (env, argv) => {
libraryExport: 'default',
filename: pkg.main,
},
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
],
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+3 -3
View File
@@ -10,7 +10,7 @@ module.exports = {
modules: 'commonjs',
debug: false,
},
"@babel/preset-typescript",
'@babel/preset-typescript',
],
'@babel/preset-react',
],
@@ -26,7 +26,7 @@ module.exports = {
// WebPack handles ES6 --> Target Syntax
['@babel/preset-env', { modules: false }],
'@babel/preset-react',
"@babel/preset-typescript",
'@babel/preset-typescript',
],
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
},
@@ -35,7 +35,7 @@ module.exports = {
// WebPack handles ES6 --> Target Syntax
['@babel/preset-env', { modules: false }],
'@babel/preset-react',
"@babel/preset-typescript",
'@babel/preset-typescript',
],
plugins: ['react-hot-loader/babel'],
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'],
+4 -11
View File
@@ -16,8 +16,7 @@ export const cornerstone = {
};
const dicomvideo = {
sopClassHandler:
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
@@ -52,10 +51,7 @@ function modeFactory({ modeConfiguration }) {
toolbarService.init(extensionManager);
toolbarService.addButtons(toolbarButtons);
toolbarService.createButtonSection('primary', [
'MeasurementTools',
'dragPan',
]);
toolbarService.createButtonSection('primary', ['MeasurementTools', 'dragPan']);
},
onModeExit: ({ servicesManager }) => {
@@ -89,13 +85,10 @@ function modeFactory({ modeConfiguration }) {
leftPanels: [ohif.leftPanel],
leftPanelDefaultClosed: true, // we have problem with rendering thumbnails for microscopy images
rightPanelDefaultClosed: true, // we do not have the save microscopy measurements yet
rightPanels: [
'@ohif/extension-dicom-microscopy.panelModule.measure',
],
rightPanels: ['@ohif/extension-dicom-microscopy.panelModule.measure'],
viewports: [
{
namespace:
'@ohif/extension-dicom-microscopy.viewportModule.microscopy-dicom',
namespace: '@ohif/extension-dicom-microscopy.viewportModule.microscopy-dicom',
displaySetsToDisplay: [
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySopClassHandler',
'@ohif/extension-dicom-microscopy.sopClassHandlerModule.DicomMicroscopySRSopClassHandler',
-1
View File
@@ -7,7 +7,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
return webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
};
+1 -8
View File
@@ -14,7 +14,6 @@ const ENTRY = {
app: `${SRC_DIR}/index.js`,
};
module.exports = (env, argv) => {
const commonConfig = webpackCommon(env, argv, { SRC_DIR, DIST_DIR, ENTRY });
@@ -41,13 +40,7 @@ module.exports = (env, argv) => {
libraryExport: 'default',
filename: pkg.main,
},
externals: [
/\b(vtk.js)/,
/\b(dcmjs)/,
/\b(gl-matrix)/,
/^@ohif/,
/^@cornerstonejs/,
],
externals: [/\b(vtk.js)/, /\b(dcmjs)/, /\b(gl-matrix)/, /^@ohif/, /^@cornerstonejs/],
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
+8 -23
View File
@@ -43,12 +43,8 @@ function modeFactory({ modeConfiguration }) {
* Lifecycle hooks
*/
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
const {
toolbarService,
toolGroupService,
hangingProtocolService,
displaySetService,
} = servicesManager.services;
const { toolbarService, toolGroupService, hangingProtocolService, displaySetService } =
servicesManager.services;
const utilityModule = extensionManager.getModuleEntry(
'@ohif/extension-cornerstone.utilityModule.tools'
@@ -99,9 +95,7 @@ function modeFactory({ modeConfiguration }) {
// For fusion toolGroup we need to add the volumeIds for the crosshairs
// since in the fusion viewport we don't want both PT and CT to render MIP
// when slabThickness is modified
const {
displaySetMatchDetails,
} = hangingProtocolService.getMatchDetails();
const { displaySetMatchDetails } = hangingProtocolService.getMatchDetails();
setCrosshairsConfiguration(
displaySetMatchDetails,
@@ -143,22 +137,16 @@ function modeFactory({ modeConfiguration }) {
'getPTVOIRange',
'get PT VOI based on corrected or not',
props => {
const ptDisplaySet = props.find(
imageSet => imageSet.Modality === 'PT'
);
const ptDisplaySet = props.find(imageSet => imageSet.Modality === 'PT');
if (!ptDisplaySet) {
return;
}
const { imageId } = ptDisplaySet.images[0];
const imageIdScalingFactor = MetadataProvider.get(
'scalingModule',
imageId
);
const imageIdScalingFactor = MetadataProvider.get('scalingModule', imageId);
const isSUVAvailable =
imageIdScalingFactor && imageIdScalingFactor.suvbw;
const isSUVAvailable = imageIdScalingFactor && imageIdScalingFactor.suvbw;
if (isSUVAvailable) {
return {
@@ -196,16 +184,13 @@ function modeFactory({ modeConfiguration }) {
const isValid =
modalities_list.includes('CT') &&
modalities_list.includes('PT') &&
!invalidModalities.some(modality =>
modalities_list.includes(modality)
) &&
!invalidModalities.some(modality => modalities_list.includes(modality)) &&
// This is study is a 4D study with PT and CT and not a 3D study for the tmtv
// mode, until we have a better way to identify 4D studies we will use the
// StudyInstanceUID to identify the study
// Todo: when we add the 4D mode which comes with a mechanism to identify
// 4D studies we can use that
study.studyInstanceUid !==
'1.3.6.1.4.1.12842.1.1.14.3.20220915.105557.468.2963630849';
study.studyInstanceUid !== '1.3.6.1.4.1.12842.1.1.14.3.20220915.105557.468.2963630849';
// there should be both CT and PT modalities and the modality should not be SM
return isValid;
+5 -24
View File
@@ -66,34 +66,19 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
},
};
toolGroupService.createToolGroupAndAddTools(
toolGroupIds.CT,
tools,
toolsConfig
);
toolGroupService.createToolGroupAndAddTools(toolGroupIds.CT, tools, toolsConfig);
toolGroupService.createToolGroupAndAddTools(
toolGroupIds.PT,
{
active: tools.active,
passive: [
...tools.passive,
{ toolName: 'RectangleROIStartEndThreshold' },
],
passive: [...tools.passive, { toolName: 'RectangleROIStartEndThreshold' }],
enabled: tools.enabled,
disabled: tools.disabled,
},
toolsConfig
);
toolGroupService.createToolGroupAndAddTools(
toolGroupIds.Fusion,
tools,
toolsConfig
);
toolGroupService.createToolGroupAndAddTools(
toolGroupIds.default,
tools,
toolsConfig
);
toolGroupService.createToolGroupAndAddTools(toolGroupIds.Fusion, tools, toolsConfig);
toolGroupService.createToolGroupAndAddTools(toolGroupIds.default, tools, toolsConfig);
const mipTools = {
active: [
@@ -117,11 +102,7 @@ function _initToolGroups(toolNames, Enums, toolGroupService, commandsManager) {
},
};
toolGroupService.createToolGroupAndAddTools(
toolGroupIds.MIP,
mipTools,
mipToolsConfig
);
toolGroupService.createToolGroupAndAddTools(toolGroupIds.MIP, mipTools, mipToolsConfig);
}
function initMPRToolGroup(toolNames, Enums, toolGroupService, commandsManager) {
+2 -5
View File
@@ -298,15 +298,12 @@ const toolbarButtons = [
icon: 'tool-create-threshold',
label: 'Rectangle ROI Threshold',
commands: [
..._createCommands('setToolActive', 'RectangleROIStartEndThreshold', [
toolGroupIds.PT,
]),
..._createCommands('setToolActive', 'RectangleROIStartEndThreshold', [toolGroupIds.PT]),
{
commandName: 'displayNotification',
commandOptions: {
title: 'RectangleROI Threshold Tip',
text:
'RectangleROI Threshold tool should be used on PT Axial Viewport',
text: 'RectangleROI Threshold tool should be used on PT Axial Viewport',
type: 'info',
},
},
@@ -13,9 +13,7 @@ export default function setCrosshairsConfiguration(
}
const { SeriesInstanceUID } = matchDetails;
const displaySets = displaySetService.getDisplaySetsForSeries(
SeriesInstanceUID
);
const displaySets = displaySetService.getDisplaySetsForSeries(SeriesInstanceUID);
const toolConfig = toolGroupService.getToolConfiguration(
toolGroupIds.Fusion,
@@ -14,9 +14,7 @@ export default function setFusionActiveVolume(
const { SeriesInstanceUID } = matchDetails;
const displaySets = displaySetService.getDisplaySetsForSeries(
SeriesInstanceUID
);
const displaySets = displaySetService.getDisplaySetsForSeries(SeriesInstanceUID);
if (!displaySets || displaySets.length === 0) {
return;