Skip to content

Commit

Permalink
Merge pull request #11 from opensight-cv/fix-lint
Browse files Browse the repository at this point in the history
Fix linting finally
  • Loading branch information
132ikl authored Dec 5, 2020
2 parents fbcfe52 + 8d4cf7f commit 267bb65
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 53 deletions.
15 changes: 2 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
},
extends: [
"plugin:vue/recommended",
"@vue/airbnb",
"@vue/typescript/recommended",

"@vue/prettier/recommended",
Expand All @@ -14,17 +13,7 @@ module.exports = {
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-restricted-syntax": [
"off",
{
selector: "ForOfStatement",
},
],
// Why the heck is this not default airbnb
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
// Broken with typescript (still)
"no-unused-vars": "off",
"no-continue": "off",
"no-multi-assign": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
},
};
1 change: 0 additions & 1 deletion src/components/baklava-options-plugin/optionPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-unresolved, import/extensions */
/*
Eslint has problems with importing ts modules for some reason &
the setting that's supposed to fix it doesn't work:
Expand Down
6 changes: 4 additions & 2 deletions src/components/node-editor/ContextMenuOpsi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</template>

<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
import { Component, Vue } from "vue-property-decorator";
import { Components } from "@baklavajs/plugin-renderer-vue";
import ClickOutside from "v-click-outside";
Expand All @@ -40,7 +40,8 @@ import ClickOutside from "v-click-outside";
},
})
export default class ContextMenu extends Components.ContextMenu {
onClickOutside(event: MouseEvent) {
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
onClickOutside(e: MouseEvent) {
if (this.value) {
this.$emit("input", false);
}
Expand All @@ -54,6 +55,7 @@ export default class ContextMenu extends Components.ContextMenu {
isActive: true,
};
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
onContextOutside(e: MouseEvent) {
if (this.value) {
this.$emit("input", false);
Expand Down
12 changes: 0 additions & 12 deletions src/components/node-editor/EditorOpsi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,8 @@
<script lang="ts">
import { Component, Watch } from "vue-property-decorator";
// eslint-disable-next-line import/no-unresolved, import/extensions
import {
IEditor,
INode,
ITransferConnection,
INodeInterface,
ITemporaryConnection,
TemporaryConnectionState,
// eslint-disable-next-line import/no-unresolved, import/extensions
} from "@baklavajs/core/dist/baklavajs-core/types";
import { Editor } from "@baklavajs/plugin-renderer-vue";
// eslint-disable-next-line import/no-unresolved, import/extensions
import { IMenuItem } from "@baklavajs/plugin-renderer-vue/dist/baklavajs-plugin-renderer-vue/src/components/ContextMenu.vue";
// eslint-disable-next-line import/no-unresolved, import/extensions
import { IViewNode } from "@baklavajs/plugin-renderer-vue/dist/baklavajs-plugin-renderer-vue/types";
@Component
Expand Down
3 changes: 0 additions & 3 deletions src/components/node-editor/NodeOpsi.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ import { Component } from "vue-property-decorator";
import { Components } from "@baklavajs/plugin-renderer-vue";
// eslint-disable-next-line import/no-unresolved, import/extensions
import { IViewNode } from "@baklavajs/plugin-renderer-vue/dist/baklavajs-plugin-renderer-vue/types";
@Component
Expand Down Expand Up @@ -172,8 +171,6 @@ export default class NodeViewOpsi extends Components.Node {
// Set the node options based on the original node
for (const option of Object.entries(nodeSave.options)) {
const [name, value] = option[1];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
node.setOptionValue(name, value);
}
Expand Down
6 changes: 0 additions & 6 deletions src/components/node-editor/nodeTreeSerialize.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Connection, Editor, NodeInterface, NodeOption, Node } from "@baklavajs/core";
import { Input, Link, Nodetree } from "@/api/nodeSchema";
import { ViewPlugin } from "@baklavajs/plugin-renderer-vue";
// eslint-disable-next-line import/no-unresolved, import/extensions
import { IViewNode } from "@baklavajs/plugin-options-vue/dist/baklavajs-plugin-renderer-vue/types";

function linkFromNodeInterface(intf: NodeInterface): Link {
Expand Down Expand Up @@ -80,9 +79,7 @@ export function saveNodetree(editor: Editor, view: ViewPlugin): Nodetree {
}

export function loadNodeTree(editor: Editor, view: ViewPlugin, nodetree: Nodetree) {
// eslint-disable-next-line no-param-reassign
view.panning = nodetree.extras.panning ?? view.panning;
// eslint-disable-next-line no-param-reassign
view.scaling = nodetree.extras.scaling ?? view.scaling;

for (let i = editor.connections.length - 1; i >= 0; i--) {
Expand Down Expand Up @@ -111,13 +108,11 @@ export function loadNodeTree(editor: Editor, view: ViewPlugin, nodetree: Nodetre
nodeMap.set(node.id, node);

for (const [name, value] of Object.entries(n.settings)) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
node.options.get(name)!.value = value;
}

for (const [name, value] of Object.entries(n.inputs)) {
if (value.value) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
node.interfaces.get(`in-${name}`)!.value = value.value;
} else if (value.link) {
const arr = linkMap.get(node) ?? [];
Expand All @@ -137,7 +132,6 @@ export function loadNodeTree(editor: Editor, view: ViewPlugin, nodetree: Nodetre
for (const [node, linkArr] of linkMap) {
for (const { fromName, fromId, toName } of linkArr) {
const toInterface = node.getInterface(toName);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const fromInterface = nodeMap.get(fromId)!.getInterface(fromName);

editor.addConnection(fromInterface, toInterface);
Expand Down
3 changes: 1 addition & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import "@/styles/node.scss";

import App from "@/App.vue";

// eslint-disable-next-line
import vClickOutside from "v-click-outside"
import vClickOutside from "v-click-outside";

Vue.use(vClickOutside);

Expand Down
15 changes: 1 addition & 14 deletions src/views/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ export default Vue.extend({
};
},
async created() {
/* eslint-disable @typescript-eslint/no-explicit-any */
this.viewPlugin.components.node = NodeOpsi as any;
this.viewPlugin.components.nodeInterface = NodeInterfaceOpsi as any;
this.viewPlugin.components.contextMenu = ContextMenuOpsi as any;
/* eslint-enable @typescript-eslint/no-explicit-any */
this.editor.use(this.viewPlugin);
this.editor.use(this.interfacePlugin);
Expand All @@ -57,8 +55,6 @@ export default Vue.extend({
});
const nodetree = await getNodetree();
// eslint-disable-next-line no-console
console.log(nodetree);
loadNodeTree(this.editor, this.viewPlugin, nodetree);
this.editor.nodes.forEach((node) => {
Expand All @@ -77,16 +73,7 @@ export default Vue.extend({
},
methods: {
async save() {
const updatedNodetree = saveNodetree(this.editor, this.viewPlugin);
// eslint-disable-next-line no-console
console.log(updatedNodetree);
// eslint-disable-next-line no-console
console.log(JSON.stringify(updatedNodetree));
// eslint-disable-next-line no-console
console.log(await postNodetree(updatedNodetree));
// eslint-disable-next-line no-console
console.log(await getNodetree());
return postNodetree(saveNodetree(this.editor, this.viewPlugin));
},
},
});
Expand Down

0 comments on commit 267bb65

Please sign in to comment.