Skip to content

Resolve all eslint warnings #48197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export const FieldDateTime = ({ name, ...rest }: FlexibleFormElementProps & Inpu
onChange={(event) => handleChange(event.target.value)}
size="sm"
type={rest.type}
// eslint-disable-next-line @typescript-eslint/no-base-to-string
value={param.value !== null && param.value !== undefined ? String(param.value).slice(0, 16) : ""}
value={JSON.stringify(param.value ?? "").slice(0, 16)}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export const FieldMultilineText = ({ name }: FlexibleFormElementProps) => {
onChange={(event) => handleChange(event.target.value)}
rows={6}
size="sm"
// eslint-disable-next-line @typescript-eslint/no-base-to-string
value={String(param.value ?? "")}
value={JSON.stringify(param.value ?? "")}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ export const FieldNumber = ({ name }: FlexibleFormElementProps) => {
name={`element_${name}`}
onValueChange={(event) => handleChange(event.value)}
size="sm"
// eslint-disable-next-line @typescript-eslint/no-base-to-string
value={String(param.value ?? "")}
value={JSON.stringify(param.value ?? "")}
>
<NumberInputField />
</NumberInputRoot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export const FieldString = ({ name }: FlexibleFormElementProps) => {
}}
placeholder={param.schema.examples ? "Start typing to see options." : undefined}
size="sm"
// eslint-disable-next-line @typescript-eslint/no-base-to-string
value={String(param.value ?? "")}
value={JSON.stringify(param.value ?? "")}
/>
{param.schema.examples ? (
<datalist id={`list_${name}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export const HiddenInput = ({ name }: FlexibleFormElementProps) => {
id={`element_${name}`}
name={`element_${name}`}
type="hidden"
// eslint-disable-next-line @typescript-eslint/no-base-to-string
value={String(param.value ?? "")}
value={JSON.stringify(param.value ?? "")}
/>
</VisuallyHidden>
);
Expand Down
26 changes: 26 additions & 0 deletions airflow-core/src/airflow/ui/src/components/ui/Menu/Menu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { Menu as ChakraMenu } from "@chakra-ui/react";

import { Content } from "./MenuContent";

export const Menu = {
...ChakraMenu,
Content,
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type MenuContentProps = {
readonly portalRef?: React.RefObject<HTMLElement>;
} & ChakraMenu.ContentProps;

const Content = forwardRef<HTMLDivElement, MenuContentProps>((props, ref) => {
export const Content = forwardRef<HTMLDivElement, MenuContentProps>((props, ref) => {
const { portalled = true, portalRef, ...rest } = props;

return (
Expand All @@ -35,8 +35,3 @@ const Content = forwardRef<HTMLDivElement, MenuContentProps>((props, ref) => {
</Portal>
);
});

export const Menu = {
...ChakraMenu,
Content,
};
20 changes: 20 additions & 0 deletions airflow-core/src/airflow/ui/src/components/ui/Menu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export * from "./Menu";
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
import { Toaster as ChakraToaster, Portal, Spinner, Stack, Toast, createToaster } from "@chakra-ui/react";
import { Toaster as ChakraToaster, Portal, Spinner, Stack, Toast } from "@chakra-ui/react";

export const toaster = createToaster({
pauseOnPageIdle: true,
placement: "bottom-end",
});
import { toaster } from "./createToaster";

export const Toaster = () => (
<Portal>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { createToaster } from "@chakra-ui/react";

export const toaster = createToaster({
pauseOnPageIdle: true,
placement: "bottom-end",
});
21 changes: 21 additions & 0 deletions airflow-core/src/airflow/ui/src/components/ui/Toaster/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export * from "./Toaster";
export * from "./createToaster";
27 changes: 27 additions & 0 deletions airflow-core/src/airflow/ui/src/context/openGroups/Context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { createContext } from "react";

export type OpenGroupsContextType = {
openGroupIds: Array<string>;
setOpenGroupIds: (groupIds: Array<string>) => void;
toggleGroupId: (groupId: string) => void;
};

export const OpenGroupsContext = createContext<OpenGroupsContextType | undefined>(undefined);
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
import { createContext, useCallback, useMemo, type PropsWithChildren } from "react";
import { useCallback, useMemo, type PropsWithChildren } from "react";
import { useLocalStorage } from "usehooks-ts";

export type OpenGroupsContextType = {
openGroupIds: Array<string>;
setOpenGroupIds: (groupIds: Array<string>) => void;
toggleGroupId: (groupId: string) => void;
};

export const OpenGroupsContext = createContext<OpenGroupsContextType | undefined>(undefined);
import { OpenGroupsContext, type OpenGroupsContextType } from "./Context";

type Props = {
readonly dagId: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

export * from "./OpenGroupsProvider";
export * from "./useOpenGroups";
export * from "./Context";
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { useContext } from "react";

import { OpenGroupsContext, type OpenGroupsContextType } from "./OpenGroupsProvider";
import { OpenGroupsContext, type OpenGroupsContextType } from "./Context";

export const useOpenGroups = (): OpenGroupsContextType => {
const context = useContext(OpenGroupsContext);
Expand Down
26 changes: 26 additions & 0 deletions airflow-core/src/airflow/ui/src/context/timezone/Context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { createContext } from "react";

export type TimezoneContextType = {
selectedTimezone: string;
setSelectedTimezone: (timezone: string) => void;
};

export const TimezoneContext = createContext<TimezoneContextType | undefined>(undefined);
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
import { createContext, useMemo, type PropsWithChildren } from "react";
import { useMemo, type PropsWithChildren } from "react";
import { useLocalStorage } from "usehooks-ts";

import { useConfig } from "src/queries/useConfig";

export type TimezoneContextType = {
selectedTimezone: string;
setSelectedTimezone: (timezone: string) => void;
};

export const TimezoneContext = createContext<TimezoneContextType | undefined>(undefined);
import { TimezoneContext, type TimezoneContextType } from "./Context";

const TIMEZONE_KEY = "timezone";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

export * from "./TimezoneProvider";
export * from "./useTimezone";
export * from "./Context";
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { useContext } from "react";

import { TimezoneContext, type TimezoneContextType } from "./TimezoneProvider";
import { TimezoneContext, type TimezoneContextType } from "./Context";

export const useTimezone = (): TimezoneContextType => {
const context = useContext(TimezoneContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const RenderedTemplates = () => {
<Table.Body>
{Object.entries(taskInstance?.rendered_fields ?? {}).map(([key, value]) => {
if (value !== null && value !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
const renderedValue: string = typeof value === "object" ? JSON.stringify(value) : String(value);
const renderedValue = JSON.stringify(value);

return (
<Table.Row key={key}>
Expand Down