Skip to content

Commit d407b8c

Browse files
committed
Revert "Fix linting issues (7) — prefer-destructuring"
This reverts commit 2006fc8.
1 parent 58cd04d commit d407b8c

File tree

10 files changed

+28
-19
lines changed

10 files changed

+28
-19
lines changed

Diff for: ui/eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const config = defineConfig([
88
...createConfig(opts),
99
{
1010
rules: {
11+
'prefer-destructuring': 'off',
1112
'jsx-a11y/anchor-is-valid': 'off',
1213
'jsx-a11y/control-has-associated-label': 'off',
1314
'promise/always-return': 'off',

Diff for: ui/src/actions/sampleview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export function addShape(shapeData = {}, successCb = null) {
230230
return async (dispatch) => {
231231
try {
232232
const json = await sendAddOrUpdateShapes([shapeData]);
233-
const [shape] = json.shapes;
233+
const shape = json.shapes[0];
234234
dispatch(addShapeAction(shape));
235235

236236
if (successCb) {

Diff for: ui/src/components/PeriodicTable/PeriodicTable.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class PeriodicTable extends React.Component {
1212
onClickHandler(e) {
1313
if (e.target.id) {
1414
const el = document.querySelector(`#${this.state.selectedElement}`);
15-
const [cell] = e.target.children;
15+
const cell = e.target.children[0];
1616

1717
if (el) {
1818
el.children[0].className = styles.element;

Diff for: ui/src/components/SSXChip/SSXChip.jsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,20 @@ export default class SSXChip extends React.Component {
328328
initChipCanvas() {
329329
const currentChipLayout =
330330
this.props.chipLayoutList[this.props.currentLayoutName];
331-
const [chipConfig] = currentChipLayout.sections;
331+
const chipConfig = currentChipLayout.sections[0];
332332

333333
const numRows = chipConfig.number_of_rows;
334334
const numCols = chipConfig.number_of_collumns;
335-
const [blockSizeX, blockSizeY] = chipConfig.block_size;
335+
const blockSizeX = chipConfig.block_size[0];
336+
const blockSizeY = chipConfig.block_size[0];
336337
const rowLabels = chipConfig.row_labels;
337338
const colLabels = chipConfig.column_lables;
338339

339-
const [offset, spacing] = chipConfig.block_spacing;
340-
const [numTargetsX, numTargetsY] = chipConfig.targets_per_block;
340+
const offset = chipConfig.block_spacing[0];
341+
const spacing = chipConfig.block_spacing[0];
342+
343+
const numTargetsX = chipConfig.targets_per_block[0];
344+
const numTargetsY = chipConfig.targets_per_block[1];
341345

342346
const canvasWidth = numCols * (blockSizeX + spacing) + offset + blockSizeX;
343347
const canvasHeight = numRows * (blockSizeY + spacing) + offset + blockSizeY;

Diff for: ui/src/components/SampleQueue/CharacterisationTaskItem.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default class TaskItem extends Component {
8888
if (tasks.length <= 1) {
8989
delete data.diffractionPlan[0].run_number;
9090
delete data.diffractionPlan[0].sampleID;
91-
const [{ type, parameters }] = data.diffractionPlan;
91+
const { type, parameters } = data.diffractionPlan[0];
9292

9393
this.props.showForm(
9494
type,

Diff for: ui/src/components/SampleView/shapes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ export function makeImageOverlay(iR, ppMm, bP, bSh, bSi, cCP, dP, canvas) {
432432
imageOverlay.push(...makeCross(point, iR, canvas.width, canvas.height));
433433
}
434434
if (dP.length === 2) {
435-
const [point1, point2] = dP;
435+
const point1 = dP[0];
436+
const point2 = dP[1];
436437
imageOverlay.push(...makeDistanceLine(point1, point2, iR, ppMm, 'red', 2));
437438
}
438439
return imageOverlay;

Diff for: ui/src/components/Tasks/validate.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ function validate(values, props) {
6565
}
6666

6767
if (props.acqParametersLimits.exposure_time) {
68-
const [exptimemin, exptimemax] = props.acqParametersLimits.exposure_time;
68+
const exptimemin = props.acqParametersLimits.exposure_time[0];
69+
const exptimemax = props.acqParametersLimits.exposure_time[1];
6970
if (
7071
values.exp_time === '' ||
7172
Number.parseFloat(values.exp_time, 10) > exptimemax ||

Diff for: ui/src/containers/ConfirmCollectDialog.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,14 @@ export class ConfirmCollectDialog extends React.Component {
303303
</thead>
304304
<tbody id="table-body">
305305
{tasks.map((task) => {
306-
const { parameters } =
307-
task.type === 'Interleaved'
308-
? task.parameters.wedges[0]
309-
: task;
310-
306+
let { parameters } = task;
311307
const sample = this.props.sampleGrid.sampleList[task.sampleID];
312308
const sampleName = `${sample.sampleName} - ${sample.proteinAcronym}`;
313309

310+
if (task.type === 'Interleaved') {
311+
parameters = task.parameters.wedges[0].parameters;
312+
}
313+
314314
return (
315315
<OverlayTrigger
316316
key={task.queueID}

Diff for: ui/src/containers/GphlWorkflowParametersDialog.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ function GphlWorkflowParametersDialog(props) {
9191
dataDict[key] = removeExtraDecimal(value.default, value.type);
9292
});
9393
if (formData.ui_schema.indexing_solution) {
94-
const [initIndex] =
95-
formData.ui_schema.indexing_solution[uiOptions].select_cell;
94+
const initIndex =
95+
formData.ui_schema.indexing_solution[uiOptions].select_cell[0];
9696
setSelected([initIndex]);
9797
dataDict.indexing_solution =
9898
formData.ui_schema.indexing_solution[uiOptions].content[0][initIndex];

Diff for: ui/src/containers/SampleGridTableContainer.jsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ class SampleGridTableContainer extends React.Component {
434434
this.props.showGenericContextMenu(true, contextMenuID, e.pageX, e.pageY);
435435
}
436436

437-
const [selectedList] = this.getSampleListFilteredByCellPuck(cell, puck);
437+
const selectedList = this.getSampleListFilteredByCellPuck(cell, puck)[0];
438438

439439
this.sampleGridItemsSelectedHandler(e, selectedList);
440440
e.stopPropagation();
@@ -443,9 +443,11 @@ class SampleGridTableContainer extends React.Component {
443443
renderItemsControls(cell, puck) {
444444
let icon = <BsSquare size="0.9em" />;
445445
let pickSample = true;
446-
447446
const filterList = this.getSampleListFilteredByCellPuck(cell, puck);
448-
const [allPuckSample, allPuckSampleCheck, puckCode] = filterList;
447+
448+
const allPuckSample = filterList[0];
449+
const allPuckSampleCheck = filterList[1];
450+
const puckCode = filterList[2];
449451

450452
if (allPuckSample.length === allPuckSampleCheck.length) {
451453
icon = <BsCheck2Square size="0.9em" />;

0 commit comments

Comments
 (0)