Skip to content

Commit

Permalink
chore(deps): update dependency eslint to v9 (gradio-app#8121)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency eslint to v9

* update deps + fix things

* add changeset

* fix preview

* add changeset

* lockfile

* format

* add changeset

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
3 people authored May 3, 2024
1 parent 1435d1d commit f5b710c
Show file tree
Hide file tree
Showing 38 changed files with 3,346 additions and 3,496 deletions.
24 changes: 24 additions & 0 deletions .changeset/brave-coats-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@gradio/annotatedimage": minor
"@gradio/app": minor
"@gradio/audio": minor
"@gradio/chatbot": minor
"@gradio/client": minor
"@gradio/dataframe": minor
"@gradio/gallery": minor
"@gradio/highlightedtext": minor
"@gradio/image": minor
"@gradio/imageeditor": minor
"@gradio/multimodaltextbox": minor
"@gradio/preview": minor
"@gradio/storybook": minor
"@gradio/textbox": minor
"@gradio/tootils": minor
"@gradio/upload": minor
"@gradio/video": minor
"gradio": minor
"gradio_test": minor
"website": minor
---

feat:chore(deps): update dependency eslint to v9
4 changes: 2 additions & 2 deletions .changeset/changeset.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ const changelogFunctions = {
.map((userFromSummary) => `@${userFromSummary}`)
.join(", ")
: user_link
? user_link[1]
: links.user;
? user_link[1]
: links.user;

const prefix = [
links.pull === null ? "" : `${links.pull}`,
Expand Down
2 changes: 1 addition & 1 deletion .config/basevite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default defineConfig(({ mode }) => {
},
plugins: [
svelte({
inspector: true,
inspector: false,
compilerOptions: {
dev: !production
},
Expand Down
40 changes: 24 additions & 16 deletions .config/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import globals from "globals";
import ts_plugin from "@typescript-eslint/eslint-plugin";
import js_plugin from "@eslint/js";
import jsdoc from "eslint-plugin-jsdoc";

import typescriptParser from "@typescript-eslint/parser";
import sveltePlugin from "eslint-plugin-svelte";
Expand All @@ -16,6 +17,13 @@ const js_rules_disabled = Object.fromEntries(
Object.keys(js_plugin.configs.all.rules).map((rule) => [rule, "off"])
);

const jsdoc_rules_disabled = Object.fromEntries(
Object.keys(jsdoc.configs.recommended.rules).map((rule) => [
`jsdoc/${rule}`,
"off"
])
);

const js_rules = {
...js_rules_disabled,
"no-console": ["error", { allow: ["warn", "error", "debug", "info"] }],
Expand All @@ -24,22 +32,11 @@ const js_rules = {
"no-extra-boolean-cast": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"valid-jsdoc": "error",
"array-callback-return": "error",
complexity: "error",
"no-else-return": "error",
"no-useless-return": "error",
"no-undef": "error",
"valid-jsdoc": [
"error",
{
requireReturn: false,
requireParamDescription: true,
requireReturnDescription: true,
requireReturnType: false,
requireParamType: false
}
]
"no-undef": "error"
};

const ts_rules = {
Expand All @@ -55,6 +52,12 @@ const ts_rules = {
"@typescript-eslint/no-inferrable-types": "error"
};

const jsdoc_rules = {
...jsdoc_rules_disabled,
"jsdoc/require-param-description": "error",
"jsdoc/require-returns-description": "error"
};

const { browser, es2021, node } = globals;

export default [
Expand Down Expand Up @@ -85,9 +88,10 @@ export default [
},

plugins: {
"eslint:recommended": js_plugin
"eslint:recommended": js_plugin,
jsdoc
},
rules: js_rules
rules: { ...js_rules, ...jsdoc_rules }
},

{
Expand All @@ -107,11 +111,13 @@ export default [

plugins: {
"@typescript-eslint": ts_plugin,
"eslint:recommended": js_plugin
"eslint:recommended": js_plugin,
jsdoc
},
rules: {
...ts_rules,
...js_rules,
...jsdoc_rules,
"no-undef": "off"
}
},
Expand Down Expand Up @@ -140,11 +146,13 @@ export default [
plugins: {
svelte: sveltePlugin,
"@typescript-eslint": ts_plugin,
"eslint:recommended": js_plugin
"eslint:recommended": js_plugin,
jsdoc
},
rules: {
...ts_rules,
...js_rules,
...jsdoc_rules,
...sveltePlugin.configs.recommended.rules,
"svelte/no-at-html-tags": "off",
"no-undef": "off"
Expand Down
2 changes: 1 addition & 1 deletion .config/playwright-ct.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig({

/* Port to use for Playwright component endpoint. */
ctPort: 3100,
ctViteConfig: config({ mode: "development" })
ctViteConfig: config({ mode: "development", command: "build" })
},
testMatch: "*.component.spec.ts",

Expand Down
5 changes: 1 addition & 4 deletions .config/setup_vite_tests.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import type { TestingLibraryMatchers } from "@testing-library/jest-dom/matchers";
import matchers from "@testing-library/jest-dom/matchers";
import { expect } from "vitest";
import "@testing-library/jest-dom/vitest";

declare module "vitest" {
interface Assertion<T = any>
extends jest.Matchers<void, T>,
TestingLibraryMatchers<T, void> {}
}

expect.extend(matchers);
2 changes: 1 addition & 1 deletion client/js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface ApiInfo<T extends ApiData | JsApiData> {
export interface BlobRef {
path: string[];
type: string | undefined;
blob: Blob | false;
blob: Blob | File | false;
}

export type DataType = string | Buffer | Record<string, any> | any[];
Expand Down
2 changes: 1 addition & 1 deletion client/js/src/utils/handle_blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function handle_blob(
path,
file_url,
type,
name: blob?.name
name: blob instanceof File ? blob?.name : undefined
};
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function highlight(code: string, lang: string | undefined) {
code,
Prism.languages[_lang],
_lang
)}</code></pre>`
)}</code></pre>`
: code;

return highlighted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function highlight(code: string, lang: string | undefined) {
code,
Prism.languages[_lang],
_lang
)}</code></pre>`
)}</code></pre>`
: code;

return highlighted;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function highlight(code: string, lang: string | undefined) {
code,
Prism.languages[_lang],
_lang
)}</code></pre>`
)}</code></pre>`
: code;

return highlighted;
Expand Down
2 changes: 1 addition & 1 deletion js/_website/src/routes/changelog/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function highlight(code: string, lang: string | undefined) {
code,
Prism.languages[_lang],
_lang
)}</code></pre>`
)}</code></pre>`
: code;

return highlighted;
Expand Down
4 changes: 2 additions & 2 deletions js/annotatedimage/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
? null
: `filter: hue-rotate(${Math.round(
(i * 360) / _value?.annotations.length
)}deg);`}
)}deg);`}
/>
{/each}
</div>
Expand All @@ -170,7 +170,7 @@
? color_map[ann.label] + '88'
: `hsla(${Math.round(
(i * 360) / _value.annotations.length
)}, 100%, 50%, 0.3)`}"
)}, 100%, 50%, 0.3)`}"
on:mouseover={() => handle_mouseover(ann.label)}
on:focus={() => handle_mouseover(ann.label)}
on:mouseout={() => handle_mouseout()}
Expand Down
6 changes: 3 additions & 3 deletions js/app/src/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
BUILD_MODE === "dev" || gradio_dev_mode === "dev"
? `http://localhost:${
typeof server_port === "number" ? server_port : 7860
}`
}`
: host || space || src || location.origin;
app = await Client.connect(api_url, {
Expand Down Expand Up @@ -329,8 +329,8 @@
!ready && status.load_status !== "error"
? "pending"
: !ready && status.load_status === "error"
? "error"
: status.load_status;
? "error"
: status.load_status;
$: config && (eager || $intersecting[_id]) && load_demo();
Expand Down
15 changes: 3 additions & 12 deletions js/app/test/kitchen_sink.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { test, expect } from "@gradio/tootils";
import { chromium } from "playwright";

test("test inputs", async ({ page }) => {
const browser = await chromium.launch();
test("test inputs", async ({ page, browser }) => {
const context = await browser.newContext({
permissions: ["camera"]
});
Expand All @@ -24,21 +22,14 @@ test("test inputs", async ({ page }) => {
await expect(number).toHaveValue("10");

// Image Input
const image = await page.locator("input").nth(10);
const image = page.getByTestId("image").nth(0).locator("input");
console.log(image);
await image.setInputFiles("./test/files/cheetah1.jpg");

const uploaded_image = await page.locator("img").nth(0);
const image_data = await uploaded_image.getAttribute("src");
await expect(image_data).toBeTruthy();

// Image Input w/ Cropper
const image_cropper = await page.locator("input").nth(10);
await image_cropper.setInputFiles("./test/files/cheetah1.jpg");

const uploaded_image_cropper = await page.locator("img").nth(0);
const image_data_cropper = await uploaded_image_cropper.getAttribute("src");
await expect(image_data_cropper).toBeTruthy();

// Image Input w/ Webcam
await page.getByRole("button", { name: "Click to Access Webcam" }).click();
await page.getByRole("button", { name: "select input source" }).click();
Expand Down
6 changes: 3 additions & 3 deletions js/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ export default defineConfig(({ mode }) => {
}
}
}
}
}
: {
external: ["./svelte/svelte.js"],
makeAbsoluteExternalsRelative: false
}
}
},

define: {
Expand Down Expand Up @@ -135,7 +135,7 @@ export default defineConfig(({ mode }) => {
resolve_svelte(development && !is_lite),

svelte({
inspector: true,
inspector: false,
compilerOptions: {
dev: true,
discloseVersion: false,
Expand Down
5 changes: 2 additions & 3 deletions js/audio/interactive/InteractiveAudio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@
}
if (stream == null) return;
if (streaming) {
const [{ MediaRecorder, register }, { connect }] = await Promise.all(
module_promises
);
const [{ MediaRecorder, register }, { connect }] =
await Promise.all(module_promises);
await register(await connect());
recorder = new MediaRecorder(stream, { mimeType: "audio/wav" });
recorder.addEventListener("dataavailable", handle_chunk);
Expand Down
2 changes: 1 addition & 1 deletion js/chatbot/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
typeof bot_msg === "string"
? redirect_src_url(bot_msg)
: normalize_messages(bot_msg)
])
])
: [];
export let loading_status: LoadingStatus | undefined = undefined;
Expand Down
2 changes: 1 addition & 1 deletion js/chatbot/shared/ChatBot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
message.file?.alt_text ??
message.file?.orig_name ??
""
}`)}
}`)}
>
{#if typeof message === "string"}
<Markdown
Expand Down
8 changes: 4 additions & 4 deletions js/dataframe/shared/Table.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,17 @@
row_count[1] === "fixed"
? row_count[0]
: data_row_length < row_count[0]
? row_count[0]
: data_row_length
? row_count[0]
: data_row_length
)
.fill(0)
.map((_, i) =>
Array(
col_count[1] === "fixed"
? col_count[0]
: data_row_length > 0
? _values[0].length
: headers.length
? _values[0].length
: headers.length
)
.fill(0)
.map((_, j) => {
Expand Down
2 changes: 1 addition & 1 deletion js/gallery/shared/Gallery.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
: value.map((data) => ({
image: data.image as FileData,
caption: data.caption
}));
}));
let prev_value: GalleryData | null = value;
if (selected_index == null && preview && value?.length) {
Expand Down
4 changes: 2 additions & 2 deletions js/highlightedtext/shared/InteractiveHighlightedtext.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
(active && active !== class_or_confidence)
? ""
: class_or_confidence && _color_map[class_or_confidence]
? _color_map[class_or_confidence].secondary
: ""}
? _color_map[class_or_confidence].secondary
: ""}
class:no-cat={class_or_confidence === null ||
(active && active !== class_or_confidence)}
class:hl={class_or_confidence !== null}
Expand Down
Loading

0 comments on commit f5b710c

Please sign in to comment.