mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 09:19:43 +00:00
Add ESLint unicorn plugin (#627)
Rules disabled by default to allow incremental integration.
This commit is contained in:
@@ -632,11 +632,11 @@ export class LiteGraphGlobal {
|
||||
// used to create nodes from wrapping functions
|
||||
getParameterNames(func: (...args: any) => any): string[] {
|
||||
return (func + "")
|
||||
.replace(/[/][/].*$/gm, "") // strip single-line comments
|
||||
.replace(/\/\/.*$/gm, "") // strip single-line comments
|
||||
.replace(/\s+/g, "") // strip white space
|
||||
.replace(/[/][*][^/*]*[*][/]/g, "") // strip multi-line comments /**/
|
||||
.replace(/\/\*[^*/]*\*\//g, "") // strip multi-line comments /**/
|
||||
.split("){", 1)[0]
|
||||
.replace(/^[^(]*[(]/, "") // extract the parameters
|
||||
.replace(/^[^(]*\(/, "") // extract the parameters
|
||||
.replace(/=[^,]+/g, "") // strip any ES6 defaults
|
||||
.split(",")
|
||||
.filter(Boolean) // split & filter [""]
|
||||
|
||||
@@ -127,7 +127,7 @@ export class NumberWidget extends BaseWidget implements INumericWidget {
|
||||
// Handle center click - show prompt
|
||||
canvas.prompt("Value", this.value, (v: string) => {
|
||||
// Check if v is a valid equation or a number
|
||||
if (/^[0-9+\-*/()\s]+|\d+\.\d+$/.test(v)) {
|
||||
if (/^[\d\s()*+/-]+|\d+\.\d+$/.test(v)) {
|
||||
// Solve the equation if possible
|
||||
try {
|
||||
v = eval(v)
|
||||
|
||||
Reference in New Issue
Block a user