Skip to content

Commit 517528b

Browse files
fix linting issues
1 parent aaf9af0 commit 517528b

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

dash-renderer/src/actions/dependencies.js

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,21 @@ function findDuplicateOutputs(outputs, head, dispatchError, outStrs, outObjs) {
364364
}
365365

366366
function checkInOutOverlap(out, inputs) {
367-
const {id: outId, property: outProp} = out;
367+
const {id: outId, property: outProp} = out;
368368
return inputs.some(in_ => {
369-
const {id: inId, property: inProp} = in_;
370-
if (outProp !== inProp || typeof outId !== typeof inId) {
369+
const {id: inId, property: inProp} = in_;
370+
if (outProp !== inProp || typeof outId !== typeof inId) {
371371
return false;
372-
}
373-
if (typeof outId === 'string') {
374-
if (outId === inId) {
372+
}
373+
if (typeof outId === 'string') {
374+
if (outId === inId) {
375375
return true;
376-
}
377-
} else if (wildcardOverlap(in_, [out])) {
378-
return true;
379376
}
380-
});
377+
} else if (wildcardOverlap(in_, [out])) {
378+
return true;
379+
}
380+
return false;
381+
});
381382
}
382383

383384
function findMismatchedWildcards(outputs, inputs, state, head, dispatchError) {
@@ -738,22 +739,22 @@ export function computeGraphs(dependencies, dispatchError) {
738739
}
739740

740741
/* multiGraph is used only for testing circularity
741-
*
742+
*
742743
* Each component+property that is used as an input or output is added as a node
743744
* to a directed graph with a dependency from each input to each output. The
744745
* function triggerDefaultState in index.js then checks this graph for circularity.
745-
*
746+
*
746747
* In order to allow the same component+property to be both an input and output
747748
* of the same callback, a two pass approach is used.
748-
*
749+
*
749750
* In the first pass, the graph is built up normally with the exception that
750-
* in cases where an output is also an input to the same callback a special
751+
* in cases where an output is also an input to the same callback a special
751752
* "output" node is added and the dependencies target this output node instead.
752753
* For example, if `slider.value` is both an input and an output, then the a new
753754
* node `slider.value__output` will be added with a dependency from `slider.value`
754755
* to `slider.value__output`. Splitting the input and output into separate nodes
755756
* removes the circularity.
756-
*
757+
*
757758
* In order to still detect other forms of circularity, it is necessary to do a
758759
* second pass and add the new output nodes as a dependency in any *other* callbacks
759760
* where the original node was an input. Continuing the example, any other callback
@@ -762,18 +763,18 @@ export function computeGraphs(dependencies, dispatchError) {
762763
* and outputs for each callback are stored during the first pass.
763764
*/
764765

765-
const outputTag = "__output";
766+
const outputTag = '__output';
766767
const duplicateOutputs = [];
767768
const cbIn = [];
768769
const cbOut = [];
769770

770-
function addInputToMulti(inIdProp, outIdProp, firstPass=true) {
771+
function addInputToMulti(inIdProp, outIdProp, firstPass = true) {
771772
multiGraph.addNode(inIdProp);
772773
multiGraph.addDependency(inIdProp, outIdProp);
773774
// only store callback inputs and outputs during the first pass
774-
if (firstPass){
775-
cbIn[cbIn.length-1].push(inIdProp);
776-
cbOut[cbOut.length-1].push(outIdProp);
775+
if (firstPass) {
776+
cbIn[cbIn.length - 1].push(inIdProp);
777+
cbOut[cbOut.length - 1].push(outIdProp);
777778
}
778779
}
779780

@@ -821,10 +822,10 @@ export function computeGraphs(dependencies, dispatchError) {
821822
if (typeof outId === 'object') {
822823
const outIdList = makeAllIds(outId, {});
823824
outIdList.forEach(id => {
824-
let tempOutIdProp = {id, property};
825+
const tempOutIdProp = {id, property};
825826
let outIdName = combineIdAndProp(tempOutIdProp);
826827
// if this output is also an input, add `outputTag` to the name
827-
if (alsoInput){
828+
if (alsoInput) {
828829
duplicateOutputs.push(tempOutIdProp);
829830
outIdName += outputTag;
830831
}
@@ -834,7 +835,7 @@ export function computeGraphs(dependencies, dispatchError) {
834835
} else {
835836
let outIdName = combineIdAndProp(outIdProp);
836837
// if this output is also an input, add `outputTag` to the name
837-
if (alsoInput){
838+
if (alsoInput) {
838839
duplicateOutputs.push(outIdProp);
839840
outIdName += outputTag;
840841
}
@@ -853,17 +854,17 @@ export function computeGraphs(dependencies, dispatchError) {
853854
});
854855
});
855856

856-
// second pass for adding new output nodes as dependencies where needed
857+
// second pass for adding new output nodes as dependencies where needed
857858
duplicateOutputs.forEach(dupeOutIdProp => {
858-
let originalName = combineIdAndProp(dupeOutIdProp);
859-
let newName = originalName.concat(outputTag);
860-
for (var cnt=0; cnt<cbIn.length; cnt++){
859+
const originalName = combineIdAndProp(dupeOutIdProp);
860+
const newName = originalName.concat(outputTag);
861+
for (var cnt = 0; cnt < cbIn.length; cnt++) {
861862
// check if input to the callback
862-
if (cbIn[cnt].some(inName=>(inName==originalName))){
863+
if (cbIn[cnt].some(inName => inName === originalName)) {
863864
/* make sure it's not also an output of the callback
864865
* (this will be the original callback)
865866
*/
866-
if(!cbOut[cnt].some(outName=>(outName==newName))){
867+
if (!cbOut[cnt].some(outName => outName === newName)) {
867868
cbOut[cnt].forEach(outName => {
868869
addInputToMulti(newName, outName, false);
869870
});

0 commit comments

Comments
 (0)