From b48c64ce4bdca30f027f87529674c2eb5bf2a7ca Mon Sep 17 00:00:00 2001 From: niknah Date: Sat, 4 Apr 2026 18:57:57 +1100 Subject: [PATCH] Upgraded eslint to v10 --- .eslintrc.js | 21 --------------------- README.md | 2 ++ example/comfyui_quick_conn.js | 3 --- example/quick_conn.js | 1 - js/CircuitBoardLines.js | 21 ++++++++------------- js/QuickConnection.js | 20 +++++++------------- js/quick_conn_start.js | 3 ++- package.json | 6 +++++- pyproject.toml | 2 +- 9 files changed, 25 insertions(+), 54 deletions(-) delete mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 25a40ba..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - env: { - browser: true, - es2021: true, - }, - extends: [ - 'airbnb-base', - ], - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - }, - rules: { - indent: ['error', 'tab'], - 'no-tabs': 'off', - 'import/extensions': 'off', - 'prefer-rest-params': 'off', // allow use of arguments - 'no-continue': 'off', - 'no-restricted-syntax': 'off', - }, -}; diff --git a/README.md b/README.md index 0e59b2a..a70603b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ python -m http.server ## Changelog +* 2026-04-04 v1.0.29: Added adjustable numbers for line / node spacing +* 2026-03-30 v1.0.27: Catch errors and continue, so we don't stop any other things that are supposed to happen [#31] * 2026-03-28 v1.0.26: Fix for show/hide links button not working [#31] * 2026-03-10 v1.0.25: Missing round corners some times. Funny line when two nodes are close together. * 2025-08-29 v1.0.21: Changes to get subgraphs working. diff --git a/example/comfyui_quick_conn.js b/example/comfyui_quick_conn.js index 2d81354..c399526 100644 --- a/example/comfyui_quick_conn.js +++ b/example/comfyui_quick_conn.js @@ -1,5 +1,4 @@ /* eslint camelcase:0 */ -/* eslint import/extensions: [0, { : 'always' }] */ /* eslint no-else-return:0 */ /* eslint max-classes-per-file:0 */ @@ -8,7 +7,6 @@ import { LGraph, LiteGraph, LGraphCanvas, -// eslint-disable-next-line import/no-unresolved } from './links/comfyui_litegraph.js'; import { QuickConnection } from './QuickConnection.js'; import { CircuitBoardLines } from './CircuitBoardLines.js'; @@ -51,7 +49,6 @@ window.LGraphCanvas = LGraphCanvas; return o.toFixed(3); } else if (o.constructor === Array) { let str = '['; - // eslint-disable-next-line no-plusplus for (let i = 0; i < o.length; ++i) { str += this.toString(o[i]) + (i + 1 !== o.length ? ',' : ''); } diff --git a/example/quick_conn.js b/example/quick_conn.js index b1f1933..98b7347 100644 --- a/example/quick_conn.js +++ b/example/quick_conn.js @@ -2,7 +2,6 @@ /* global LGraph */ /* global LiteGraph */ /* eslint camelcase:0 */ -/* eslint import/extensions: [0, { : "always" }] */ import { QuickConnection } from './QuickConnection.js'; import { CircuitBoardLines } from './CircuitBoardLines.js'; diff --git a/js/CircuitBoardLines.js b/js/CircuitBoardLines.js index 7df6581..a2eedd2 100644 --- a/js/CircuitBoardLines.js +++ b/js/CircuitBoardLines.js @@ -1,7 +1,6 @@ /* eslint max-classes-per-file: 0 */ /* eslint no-tabs: 0 */ /* eslint no-underscore-dangle:0 */ -/* eslint import/prefer-default-export:0 */ /* eslint prefer-rest-params:0 */ /* eslint curly:0 */ /* eslint no-plusplus:0 */ @@ -20,8 +19,6 @@ const INSIDE = 1; const OUTSIDE = 0; function clipT(num, denom, c) { - /* eslint-disable one-var,no-param-reassign,prefer-destructuring,operator-linebreak */ - /* eslint-disable one-var-declaration-per-line,nonblock-statement-body-position,curly */ const tE = c[0], tL = c[1]; if (Math.abs(denom) < EPSILON) return num < 0; @@ -49,8 +46,6 @@ function clipT(num, denom, c) { * @return {number} */ function liangBarsky(a, b, box, da, db) { - /* eslint-disable one-var,no-param-reassign,prefer-destructuring,operator-linebreak */ - /* eslint-disable one-var-declaration-per-line */ const x1 = a[0], y1 = a[1]; const x2 = b[0], y2 = b[1]; const dx = x2 - x1; @@ -389,7 +384,7 @@ class MapLinks { // console.log('is blocked check',isBlocked, blockedNodeId); if (isBlocked[blockedNodeId] > 3) { // Blocked too many times, let's return the direct path - console.log('CircuitBoardLines: Too many blocked, node id:', blockedNodeId, 'output', outputXY, 'input', inputXY); // eslint-disable-line no-console + console.log('CircuitBoardLines: Too many blocked, node id:', blockedNodeId, 'output', outputXY, 'input', inputXY); isBlocked.blocked = true; return [outputXY, inputXY]; } @@ -459,7 +454,7 @@ class MapLinks { mapLinks(nodesByExecution) { const graphLinks = this.canvas.graph.links; if (!graphLinks) { - console.error('Missing graph.links', this.canvas.graph); // eslint-disable-line no-console + console.error('Missing graph.links', this.canvas.graph); return; } @@ -611,7 +606,7 @@ class MapLinks { } if (this.debug) - console.log('last calc time', this.lastCalcTime); // eslint-disable-line no-console + console.log('last calc time', this.lastCalcTime); // console.log('nodesbyright', this.nodesByRight); // Uncomment this to test timeout on draws // this.lastCalcTime = 250; @@ -620,11 +615,11 @@ class MapLinks { // draw the links calculated from mapLinks() drawLinks(ctx) { if (!this.canvas.default_connection_color_byType || !this.canvas.default_connection_color) { - console.error('Missing canvas.default_connection_color_byType', this.canvas); // eslint-disable-line no-console + console.error('Missing canvas.default_connection_color_byType', this.canvas); return; } if (this.debug) - console.log('paths', this.paths); // eslint-disable-line no-console + console.log('paths', this.paths); ctx.save(); const currentNodeIds = this.canvas.selected_nodes || {}; @@ -823,7 +818,7 @@ class EyeButton { static getEyeButton() { const eyeButtons = document.querySelectorAll('.pi-eye,.pi-eye-slash'); if (eyeButtons.length > 1) { - console.log('found too many eye buttons', eyeButtons); // eslint-disable-line no-console + console.log('found too many eye buttons', eyeButtons); } return eyeButtons[0]; } @@ -917,7 +912,7 @@ export class CircuitBoardLines { this.lastDrawTimeout = setTimeout(() => { this.lastDrawTimeout = null; window.requestAnimationFrame(() => { - console.log('redraw timeout'); // eslint-disable-line no-console + console.log('redraw timeout'); this.canvas.setDirty(true, true); this.skipNextRecalcTimeout = true; this.canvas.draw(true, true); @@ -952,7 +947,7 @@ export class CircuitBoardLines { try { this.mapLinks.mapLinks(nodesByExecution); } catch (e) { - console.error('mapLinks error', e); // eslint-disable-line no-console + console.error('mapLinks error', e); } } diff --git a/js/QuickConnection.js b/js/QuickConnection.js index a69fa0e..af8f49f 100644 --- a/js/QuickConnection.js +++ b/js/QuickConnection.js @@ -1,5 +1,4 @@ /* eslint no-tabs: 0 */ -/* eslint import/prefer-default-export:0 */ /* eslint no-underscore-dangle:0 */ /* eslint no-plusplus:0 */ /* eslint prefer-rest-params:0 */ @@ -95,7 +94,7 @@ export class QuickConnection { this.graph = canvas.graph; this.canvas = canvas; if (!this.canvas.canvas) { - console.error('no canvas', this.canvas); // eslint-disable-line no-console + console.error('no canvas', this.canvas); } else { this.canvas.canvas.addEventListener('litegraph:canvas', (e) => { const { detail } = e; @@ -113,7 +112,7 @@ export class QuickConnection { try { this.onDrawOverlay(ctx); } catch (e) { - console.error('onDrawOverlayCrash', e, ctx); // eslint-disable-line no-console + console.error('onDrawOverlayCrash', e, ctx); } }); @@ -129,7 +128,6 @@ export class QuickConnection { pointermove: true, pointerup: true, }; - // eslint-disable-line no-unused-vars window.addEventListener = function newAddEventListener(name, func, opts) { if (uncaptureEvents[name] && opts?.capture) { const newArgs = Array.from(arguments); @@ -153,7 +151,7 @@ export class QuickConnection { origEventFunc.__id = ++origEventsReplacementId; origEventsReplacement[origEventFunc.__id] = newFunc; } - } catch(e) { + } catch (e) { console.error('QuickConnections.newAddEventListener crash'); console.error(e); } @@ -170,12 +168,12 @@ export class QuickConnection { if (funcId) { const newEventFunc = origEventsReplacement[funcId]; if (!newEventFunc) { - console.warn('Could not find replaced event to remove, id:', funcId, arguments); // eslint-disable-line no-console + console.warn('Could not find replaced event to remove, id:', funcId, arguments); } else { newArgs[1] = newEventFunc; } } - } catch(e) { + } catch (e) { console.error('QuickConnections.newAddEventListener crash'); console.error(e); } @@ -243,7 +241,6 @@ export class QuickConnection { } } else { // output - // eslint-disable-next-line no-lonely-if if (connectionInfo.node.connect) { connectionInfo.node.connect( connectionInfo.slot, @@ -271,7 +268,6 @@ export class QuickConnection { return accepting; } const addToAccepting = (arr, node) => { - // eslint-disable-next-line eqeqeq if (node.mode == 4) { // bypassed return; @@ -332,7 +328,7 @@ export class QuickConnection { return; } if (!this.canvas) { - console.error('no canvas or mouse yet', this.canvas); // eslint-disable-line no-console + console.error('no canvas or mouse yet', this.canvas); return; } @@ -477,11 +473,9 @@ export class QuickConnection { boxRect = rRect.slice(0); } else { if (boxRect[0] > rRect[0]) { - // eslint-disable-next-line prefer-destructuring boxRect[0] = rRect[0]; } if (boxRect[2] < rRect[2]) { - // eslint-disable-next-line prefer-destructuring boxRect[2] = rRect[2]; } boxRect[3] += rRect[3]; @@ -541,7 +535,7 @@ export class QuickConnection { const aNode = acceptingNode.node; // const destPos = new Float32Array(2); if (!aNode?.getOutputPos || !aNode.getInputPos) { - console.warn('Node has no getInputPos/getOutputPos', aNode); // eslint-disable-line no-console + console.warn('Node has no getInputPos/getOutputPos', aNode); } else { const destPos = isInput ? aNode.getOutputPos(acceptingNode.connection_slot_index) diff --git a/js/quick_conn_start.js b/js/quick_conn_start.js index 7623dbf..cd89c45 100644 --- a/js/quick_conn_start.js +++ b/js/quick_conn_start.js @@ -1,7 +1,8 @@ /* eslint quotes:0 */ /* eslint prefer-spread:0 */ +/* global LiteGraph */ +/* eslint operator-linebreak:0 */ -// eslint-disable-next-line import/no-unresolved import { app } from "../../scripts/app.js"; import { QuickConnection } from "./QuickConnection.js"; import { CircuitBoardLines } from './CircuitBoardLines.js'; diff --git a/package.json b/package.json index 7423e45..cd92431 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "type": "module", "scripts": { "example": "bash example/run_example.sh", "docs": "bash example/make_docs.sh", @@ -6,7 +7,10 @@ }, "dependencies": { "@comfyorg/litegraph": ">=0.7.47", - "eslint-config-airbnb-base": "^15.0.0", "litegraph.js": ">=0.7.18" + }, + "devDependencies": { + "@eslint/js": "^10.0.1", + "eslint": "^10.2.0" } } diff --git a/pyproject.toml b/pyproject.toml index 616eb3d..91c7261 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "quick-connections" description = "Quick connections, Circuit board connections" -version = "1.0.28" +version = "1.0.29" license = {text = "MIT License"} [project.urls]