mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-10 01:50:08 +00:00
[Cleanup] Update ESLint rules with stricter auto-fixes (#614)
Stylistic plugin falls short in a few areas when it comes to consistent lists and chaining. Replaced some key rules with antfu's personal variants. `eslint` can now be run repo-wide without params.
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
||||
npm run build
|
||||
- name: Run lint
|
||||
run: |
|
||||
npm run lint
|
||||
npm run lint:ci
|
||||
- name: Run typecheck
|
||||
run: |
|
||||
npm run typecheck
|
||||
|
||||
@@ -20,6 +20,7 @@ const antfuLint = {
|
||||
}
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: [".*/**", "dist/**", "scripts/**"] },
|
||||
{ files: ["**/*.{js,mjs,ts,mts}"] },
|
||||
eslint.configs.recommended,
|
||||
...tseslint.configs.recommendedTypeChecked,
|
||||
@@ -131,10 +132,6 @@ export default tseslint.config(
|
||||
"error",
|
||||
{ consistent: true, multiline: true },
|
||||
],
|
||||
"@stylistic/object-curly-newline": [
|
||||
"error",
|
||||
{ consistent: true, multiline: true },
|
||||
],
|
||||
// "@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
||||
// "@stylistic/object-property-newline": "error",
|
||||
"@stylistic/one-var-declaration-per-line": "error",
|
||||
@@ -226,6 +223,7 @@ export default tseslint.config(
|
||||
{
|
||||
rules: {
|
||||
"antfu/consistent-chaining": "error",
|
||||
"antfu/consistent-list-newline": "error",
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
"watch": "vite build --watch",
|
||||
"release": "node scripts/release.js",
|
||||
"test": "vitest",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint src --fix",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix",
|
||||
"lint:ci": "eslint src",
|
||||
"format": "prettier --check './src/*.{js,ts,tsx,vue,mts}'",
|
||||
"format:fix": "prettier --write './src/*.{js,ts,tsx,vue,mts}'"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { describe } from "vitest"
|
||||
|
||||
import { LGraph } from "@/litegraph"
|
||||
|
||||
import { dirtyTest } from "./testExtensions"
|
||||
|
||||
describe("LGraph configure()", () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { describe } from "vitest"
|
||||
|
||||
import { LGraph, LiteGraph } from "@/litegraph"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe("LGraph", () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { describe, expect } from "vitest"
|
||||
|
||||
import { LGraphGroup } from "@/litegraph"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe("LGraphGroup", () => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { describe, expect } from "vitest"
|
||||
|
||||
import { LGraphNode } from "@/litegraph"
|
||||
import { NodeInputSlot, NodeOutputSlot } from "@/NodeSlot"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe("LGraphNode", () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { describe } from "vitest"
|
||||
|
||||
import { LGraph } from "@/litegraph"
|
||||
|
||||
import { dirtyTest } from "./testExtensions"
|
||||
|
||||
describe("LGraph (constructor only)", () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { describe, expect } from "vitest"
|
||||
|
||||
import { LLink } from "@/litegraph"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe("LLink", () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { serializeSlot } from "@/NodeSlot"
|
||||
import { describe, expect, it } from "vitest"
|
||||
|
||||
import { INodeInputSlot, INodeOutputSlot } from "@/interfaces"
|
||||
import { serializeSlot } from "@/NodeSlot"
|
||||
|
||||
describe("NodeSlot", () => {
|
||||
describe("serializeSlot", () => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { describe, expect } from "vitest"
|
||||
|
||||
import { clamp, LGraphCanvas, LiteGraph } from "@/litegraph"
|
||||
import { LiteGraphGlobal } from "@/LiteGraphGlobal"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe.concurrent("Litegraph module", () => {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { describe } from "vitest"
|
||||
import { LGraph, LGraphGroup, LGraphNode } from "@/litegraph"
|
||||
import { test } from "./testExtensions"
|
||||
import type { ISerialisedGraph } from "@/types/serialisation"
|
||||
|
||||
import { describe } from "vitest"
|
||||
|
||||
import { LGraph, LGraphGroup, LGraphNode } from "@/litegraph"
|
||||
|
||||
import { test } from "./testExtensions"
|
||||
|
||||
describe("LGraph Serialisation", () => {
|
||||
test("can (de)serialise node / group titles", ({ expect, minimalGraph }) => {
|
||||
const nodeTitle = "Test Node"
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { test as baseTest } from "vitest"
|
||||
import type { ISerialisedGraph, SerialisableGraph } from "../src/types/serialisation"
|
||||
|
||||
import { test as baseTest } from "vitest"
|
||||
|
||||
import { LGraph } from "@/LGraph"
|
||||
import { basicSerialisableGraph, minimalSerialisableGraph, oldSchemaGraph } from "./assets/testGraphs"
|
||||
import { LiteGraph } from "@/litegraph"
|
||||
|
||||
import { basicSerialisableGraph, minimalSerialisableGraph, oldSchemaGraph } from "./assets/testGraphs"
|
||||
|
||||
interface LitegraphFixtures {
|
||||
minimalGraph: LGraph
|
||||
minimalSerialisableGraph: SerialisableGraph
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { type SpaceRequest, distributeSpace } from "@/utils/spaceDistribution"
|
||||
|
||||
import { distributeSpace, type SpaceRequest } from "@/utils/spaceDistribution"
|
||||
|
||||
describe("distributeSpace", () => {
|
||||
it("should distribute space according to minimum sizes when space is limited", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference types='vitest' />
|
||||
import { defineConfig } from "vite"
|
||||
import path from "path"
|
||||
import { defineConfig } from "vite"
|
||||
import dts from "vite-plugin-dts"
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
Reference in New Issue
Block a user