mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 06:47:33 +00:00
[Refactor] Prefer includes over indexOf -1 (#646)
Enables ESLint auto-fix rule.
This commit is contained in:
@@ -71,7 +71,6 @@ export default tseslint.config(
|
||||
"unicorn/prefer-structured-clone": "off",
|
||||
"unicorn/prefer-switch": "off",
|
||||
"unicorn/prefer-ternary": "off",
|
||||
"unicorn/prefer-includes": "off",
|
||||
|
||||
// Disable rules
|
||||
"unicorn/consistent-function-scoping": "off",
|
||||
|
||||
@@ -836,7 +836,7 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
: base_category + category_name + "/"
|
||||
|
||||
let name = category_name
|
||||
if (name.indexOf("::") != -1)
|
||||
if (name.includes("::"))
|
||||
// in case it has a namespace like "shader::math/rand" it hides the namespace
|
||||
name = name.split("::")[1]
|
||||
|
||||
@@ -6493,8 +6493,8 @@ export class LGraphCanvas implements ConnectionColorContext {
|
||||
if (filter && ctor.filter != filter) return false
|
||||
if (
|
||||
(!options.show_all_if_empty || str) &&
|
||||
type.toLowerCase().indexOf(str) === -1 &&
|
||||
(!ctor.title || ctor.title.toLowerCase().indexOf(str) === -1)
|
||||
!type.toLowerCase().includes(str) &&
|
||||
(!ctor.title || !ctor.title.toLowerCase().includes(str))
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ export class LiteGraphGlobal {
|
||||
type_b = type_b.toLowerCase()
|
||||
|
||||
// For nodes supporting multiple connection types
|
||||
if (type_a.indexOf(",") == -1 && type_b.indexOf(",") == -1)
|
||||
if (!type_a.includes(",") && !type_b.includes(","))
|
||||
return type_a == type_b
|
||||
|
||||
// Check all permutations to see if one is valid
|
||||
|
||||
Reference in New Issue
Block a user