Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ module.exports = {
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'max-len': ['off'],
'import/prefer-default-export': ['off'],
// Required for _to, _id, _key, etc. from Arango
'no-underscore-dangle': ['off'],
// Required for data loading/processing and D3-style mutating callbacks
'no-param-reassign': ['error', { props: false }],
'no-underscore-dangle': ['error', { allow: ['_id', '_from', '_to'] }],
},

parserOptions: {
Expand Down
1 change: 0 additions & 1 deletion src/components/MultiLink/Legend.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
/* eslint-disable vue/no-mutating-props */
import Vue, { PropType } from 'vue';
import { min, max } from 'd3-array';
import { select } from 'd3-selection';
Expand Down
9 changes: 6 additions & 3 deletions src/components/MultiLink/MultiLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ export default Vue.extend({
simulationLinks(): SimulationLink[] | null {
if (this.network !== null) {
return this.network.edges.map((link: Link) => {
link.source = link._from;
link.target = link._to;
return (link as SimulationLink);
const newLink: SimulationLink = { ...link, source: link._from, target: link._to };
return newLink;
});
}
return null;
Expand Down Expand Up @@ -197,7 +196,9 @@ export default Vue.extend({
nodes.forEach((node) => {
// If the position is not defined for x or y, generate it
if (node.x === undefined || node.y === undefined) {
// eslint-disable-next-line no-param-reassign
Comment thread
waxlamp marked this conversation as resolved.
node.x = Math.random() * this.svgDimensions.width;
// eslint-disable-next-line no-param-reassign
node.y = Math.random() * this.svgDimensions.height;
}
});
Expand All @@ -215,7 +216,9 @@ export default Vue.extend({
event.preventDefault();

const moveFn = (evt: Event) => {
// eslint-disable-next-line no-param-reassign
node.x = (evt as MouseEvent).clientX - this.svgOffset.x - (this.markerSize / 2);
// eslint-disable-next-line no-param-reassign
node.y = (evt as MouseEvent).clientY - this.svgOffset.y - (this.markerSize / 2);
this.$forceUpdate();
};
Expand Down
14 changes: 9 additions & 5 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,16 @@ const {
},

setNestedVariables(state, nestedVariables: NestedVariables) {
// Remove duplicates from the nested variables
nestedVariables.bar = [...new Set(nestedVariables.bar)];
nestedVariables.glyph = [...new Set(nestedVariables.glyph)];
const newNestedVars = {
...nestedVariables,
bar: [...new Set(nestedVariables.bar)],
glyph: [...new Set(nestedVariables.glyph)],
};

// Allow only 2 variables for the glyphs
nestedVariables.glyph.length = nestedVariables.glyph.length > 2 ? 2 : nestedVariables.glyph.length;
newNestedVars.glyph.length = Math.min(2, newNestedVars.glyph.length);

state.nestedVariables = nestedVariables;
state.nestedVariables = newNestedVars;
},

setLinkVariables(state, linkVariables: LinkStyleVariables) {
Expand Down Expand Up @@ -322,7 +324,9 @@ const {

if (context.state.network !== null) {
context.state.network.nodes.forEach((n: Node) => {
// eslint-disable-next-line no-param-reassign
Comment thread
waxlamp marked this conversation as resolved.
n.fx = null;
// eslint-disable-next-line no-param-reassign
n.fy = null;
});
commit.startSimulation();
Expand Down