Remove unnecessary React imports from view code

This commit is contained in:
Koen Vlaswinkel 2023-12-22 11:47:25 +01:00
Родитель 039077467a
Коммит 74568b86b1
136 изменённых файлов: 6 добавлений и 149 удалений

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ReactNode } from "react";
import { styled } from "styled-components";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent, SetStateAction, useCallback } from "react";
import { VSCodeDropdown, VSCodeOption } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
import {
AnalysisMessage,
CodeFlow,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { VSCodeTag } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { CodePaths, CodePathsProps } from "../CodePaths";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ReactNode, forwardRef } from "react";
import { styled } from "styled-components";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
type Props = {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent } from "react";
import { styled } from "styled-components";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { HighlightedRegion } from "../../../variant-analysis/shared/analysis-result";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { VSCodeLink } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { formatDecimal } from "../../common/number";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useMemo } from "react";
import { Dropdown } from "./Dropdown";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Codicon } from "./icon";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
type Size = "x-small" | "small" | "medium" | "large" | "x-large";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render, screen } from "@testing-library/react";
import { Alert } from "../Alert";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render, screen } from "@testing-library/react";
import StarCount from "../StarCount";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
type Props = {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Codicon } from "./Codicon";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { Codicon } from "./Codicon";
type Props = {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Codicon } from "./Codicon";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Codicon } from "./Codicon";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useState, useEffect } from "react";
import { styled } from "styled-components";

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
interface Props {
availableResultSets: string[];
currentResultSetName: string;

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
import {
SetComparisonQueryInfoMessage,
SetComparisonsMessage,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as sarif from "sarif";
import { AlertTable } from "../results/AlertTable";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { sendTelemetry } from "../common/telemetry";
import { Column, Row } from "../../common/raw-result-types";
import RawTableHeader from "../results/RawTableHeader";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { WebviewDefinition } from "../webview-definition";
import { Compare } from "./Compare";

Просмотреть файл

@ -1,6 +1,5 @@
import * as React from "react";
import { styled } from "styled-components";
import { useState } from "react";
import { useEffect, useState } from "react";
import { useTelemetryOnChange } from "../common/telemetry";
import { CodeFlowsDropdown } from "../common/CodePaths/CodeFlowsDropdown";
@ -41,7 +40,7 @@ export const DataFlowPaths = ({
const { codeFlows, ruleDescription, message, severity } = dataFlowPaths;
React.useEffect(() => {
useEffect(() => {
// Make sure to update the selected code flow if the data flow paths change
setSelectedCodeFlow(dataFlowPaths.codeFlows[0]);
}, [dataFlowPaths]);

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useEffect, useState } from "react";
import { ToDataFlowPathsMessage } from "../../common/interface-types";
import { DataFlowPaths as DataFlowPathsDomainModel } from "../../variant-analysis/shared/data-flow-paths";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { DataFlowPaths, DataFlowPathsProps } from "../DataFlowPaths";
import { createMockDataFlowPaths } from "../../../../test/factories/variant-analysis/shared/data-flow-paths";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import {
DataFlowPathsView,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { WebviewDefinition } from "../webview-definition";
import { DataFlowPathsView } from "./DataFlowPathsView";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ResponsiveContainer } from "../common/ResponsiveContainer";
export const MethodAlreadyModeled = () => {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { ModelingStatus } from "../../model-editor/shared/modeling-status";
import { ModelingStatusIndicator } from "../model-editor/ModelingStatusIndicator";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Method } from "../../model-editor/method";
import { ModeledMethod } from "../../model-editor/modeled-method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useEffect, useMemo, useState } from "react";
import { MethodModeling } from "./MethodModeling";
import { getModelingStatus } from "../../model-editor/shared/modeling-status";

Просмотреть файл

@ -1,7 +1,6 @@
import { ModeledMethodValidationError } from "../../model-editor/shared/validation";
import TextButton from "../common/TextButton";
import { Alert } from "../common";
import * as React from "react";
import { useCallback } from "react";
type Props = {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Method } from "../../model-editor/method";
import { ModeledMethod } from "../../model-editor/modeled-method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ResponsiveContainer } from "../common/ResponsiveContainer";
export const NoMethodSelected = () => {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback } from "react";
import { vscode } from "../vscode-api";
import { styled } from "styled-components";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback } from "react";
import { styled } from "styled-components";
import { vscode } from "../vscode-api";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { MethodModeling, MethodModelingProps } from "../MethodModeling";
import { createMethod } from "../../../../test/factories/model-editor/method-factories";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen, waitFor } from "@testing-library/react";
import { createMethod } from "../../../../test/factories/model-editor/method-factories";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { WebviewDefinition } from "../webview-definition";
import { MethodModelingView } from "./MethodModelingView";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { pluralize } from "../../common/word";
import { DataGridCell, DataGridRow } from "../common/DataGrid";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Dropdown } from "../common/Dropdown";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { styled } from "styled-components";
import { Method } from "../../model-editor/method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useMemo } from "react";
import { CallClassification, Method } from "../../model-editor/method";
import { VSCodeTag } from "@vscode/webview-ui-toolkit/react";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { Method } from "../../model-editor/method";

Просмотреть файл

@ -3,7 +3,6 @@ import {
VSCodeLink,
VSCodeProgressRing,
} from "@vscode/webview-ui-toolkit/react";
import * as React from "react";
import {
forwardRef,
useCallback,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import { ToModelEditorMessage } from "../../common/interface-types";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent, useCallback, useMemo } from "react";
import {
ModeledMethod,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent, useCallback, useEffect, useMemo } from "react";
import {
ModeledMethod,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent, useCallback, useMemo } from "react";
import {
ModeledMethod,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ChangeEvent, useCallback } from "react";
import {
calculateNewProvenance,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { MethodRow } from "./MethodRow";
import { Method, canMethodBeModeled } from "../../model-editor/method";
import { ModeledMethod } from "../../model-editor/modeled-method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useMemo } from "react";
import { Method } from "../../model-editor/method";
import { ModeledMethod } from "../../model-editor/modeled-method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { assertNever } from "../../common/helpers-pure";
import { Codicon } from "../common/icon/Codicon";
import { ModelingStatus } from "../../model-editor/shared/modeling-status";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render, screen } from "@testing-library/react";
import { HiddenMethodsRow } from "../HiddenMethodsRow";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { createMethod } from "../../../../test/factories/model-editor/method-factories";
import { LibraryRow, LibraryRowProps } from "../LibraryRow";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { MethodName } from "../MethodName";
import { Method } from "../../../model-editor/method";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import {
getAllByRole,
render as reactRender,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render, screen } from "@testing-library/react";
import { ModelKindDropdown } from "../ModelKindDropdown";
import { userEvent } from "@testing-library/user-event";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { createMethod } from "../../../../test/factories/model-editor/method-factories";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { createMethod } from "../../../../test/factories/model-editor/method-factories";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render, screen } from "@testing-library/react";
import { ModelingStatusIndicator } from "../ModelingStatusIndicator";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { WebviewDefinition } from "../webview-definition";
import { ModelEditor } from "./ModelEditor";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import * as Keys from "./result-keys";
import { className, jumpToLocation } from "./result-table-utils";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import TextButton from "../common/TextButton";
import { chevronDown, chevronRight } from "./octicons";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback } from "react";
import { vscode } from "../vscode-api";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { EmptyQueryResultsMessage } from "./EmptyQueryResultsMessage";
import TextButton from "../common/TextButton";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import * as Keys from "./result-keys";
import { SarifLocation } from "./locations/SarifLocation";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import * as Keys from "./result-keys";
import { selectableZebraStripe } from "./result-table-utils";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import * as Keys from "./result-keys";
import { info, listUnordered } from "./octicons";

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
interface Props {
numTruncatedResults: number;
}

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
import { sendTelemetry } from "../common/telemetry";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { select } from "d3";
import { jumpToLocation } from "./result-table-utils";
import { graphviz, GraphvizOptions } from "d3-graphviz";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ALERTS_TABLE_NAME } from "../../common/interface-types";
import {
alertExtrasClassName,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { className, jumpToLocation } from "./result-table-utils";
import {

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
import { vscode } from "../vscode-api";
import {
RawResultsSortState,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { selectedRowClassName, zebraStripe } from "./result-table-utils";
import RawTableValue from "./RawTableValue";
import { Row } from "../../common/raw-result-types";

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
import { Location } from "./locations/Location";
import { RawNumberValue } from "../common/RawNumberValue";
import { CellValue } from "../../common/raw-result-types";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { ResultSet } from "../../common/interface-types";
import { tableHeaderItemClassName } from "./result-table-utils";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { AlertTable } from "./AlertTable";
import { Graph } from "./Graph";
import { RawTable } from "./RawTable";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import {
DatabaseInfo,
Interpretation,

Просмотреть файл

@ -1,5 +1,4 @@
import * as React from "react";
import { useCallback, useEffect } from "react";
import { useCallback, useEffect, useState } from "react";
import { vscode } from "../vscode-api";
import { openFile, tableHeaderItemClassName } from "./result-table-utils";
import { sendTelemetry } from "../common/telemetry";
@ -62,7 +61,7 @@ const OpenQueryLink = styled(TextButton)`
export function ResultTablesHeader(props: Props) {
const { queryPath, queryName, parsedResultSets, selectedTable } = props;
const [selectedPage, setSelectedPage] = React.useState(
const [selectedPage, setSelectedPage] = useState(
`${parsedResultSets.pageNumber + 1}`,
);
useEffect(() => {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { assertNever, getErrorMessage } from "../../common/helpers-pure";
import {
DatabaseInfo,
@ -18,7 +17,7 @@ import { EventHandlers as EventHandlerList } from "./event-handler-list";
import { ResultTables } from "./ResultTables";
import "./resultsView.css";
import { useCallback, useEffect } from "react";
import { useCallback, useEffect, useState } from "react";
/**
* ResultsApp.tsx
@ -72,7 +71,7 @@ export const onNavigation = new EventHandlerList<NavigateMsg>();
* A minimal state container for displaying results.
*/
export function ResultsApp() {
const [state, setState] = React.useState<ResultsViewState>({
const [state, setState] = useState<ResultsViewState>({
displayedResults: {
resultsInfo: null,
results: null,

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { render as reactRender, screen } from "@testing-library/react";
import { ResultsApp } from "../ResultsApp";
import {

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { WebviewDefinition } from "../webview-definition";
import { ResultsApp } from "./ResultsApp";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useCallback } from "react";
import { jumpToLocation } from "../result-table-utils";
import TextButton from "../../common/TextButton";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { useMemo } from "react";
import { UrlValue } from "../../../common/raw-result-types";

Просмотреть файл

@ -1,5 +1,3 @@
import * as React from "react";
interface Props {
msg?: string;
locationHint?: string;

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import { parseSarifLocation } from "../../../common/sarif-utils";
import { basename } from "../../../common/path";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import * as Sarif from "sarif";
import { parseSarifPlainTextMessage } from "../../../common/sarif-utils";
import { SarifLocation } from "./SarifLocation";

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { styled } from "styled-components";
const Octicon = styled.svg`

Просмотреть файл

@ -1,4 +1,3 @@
import * as React from "react";
import { AnalysisAlert } from "../../variant-analysis/shared/analysis-result";
import { CodePaths, FileCodeSnippet } from "../common";

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше