Skip to content

Commit

Permalink
Revive eslint-plugin-unused-imports (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzyl authored Dec 12, 2024
1 parent eb27b54 commit 9d35a1f
Show file tree
Hide file tree
Showing 41 changed files with 39 additions and 112 deletions.
15 changes: 15 additions & 0 deletions .changeset/hungry-eagles-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@osdk/widget-client.unstable": patch
"@osdk/foundry-sdk-generator": patch
"@osdk/generator-converters": patch
"@osdk/client.unstable": patch
"@osdk/shared.test": patch
"@osdk/generator": patch
"@osdk/client": patch
"@osdk/maker": patch
"@osdk/oauth": patch
"@osdk/react": patch
"@osdk/api": patch
---

Remove unused imports
4 changes: 4 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import * as typescriptEslintParser from "@typescript-eslint/parser";
import originalHeaderPlugin from "eslint-plugin-header";
import * as importPlugin from "eslint-plugin-import";
import unusedImports from "eslint-plugin-unused-imports";
import * as tseslint from "typescript-eslint";

export default tseslint.config(
Expand All @@ -31,6 +32,7 @@ export default tseslint.config(
plugins: {
header: getHeaderPlugin(),
import: importPlugin,
"unused-imports": unusedImports,
},
languageOptions: {
parser: typescriptEslintParser,
Expand Down Expand Up @@ -88,6 +90,8 @@ export default tseslint.config(
"import/no-unresolved": "off",
"import/no-named-as-default": "off", // this used to be an error but the plugin isnt updated for 9
"no-console": "error",

"unused-imports/no-unused-imports": "error",
},
settings: {
"import/parsers": {
Expand Down
3 changes: 1 addition & 2 deletions packages/api/src/aggregate/WhereClause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
import type { BBox, Point, Polygon } from "geojson";
import type {
ObjectOrInterfaceDefinition,
PropertyKeys,
} from "../ontology/ObjectOrInterface.js";
import type {
CompileTimeMetadata,
ObjectMetadata,
} from "../ontology/ObjectTypeDefinition.js";
import type { IsNever } from "../OsdkObjectFrom.js";
import type { ArrayFilter } from "./ArrayFilter.js";
import type { BaseFilter, BaseFilterOptions } from "./BaseFilter.js";
import type { BaseFilter } from "./BaseFilter.js";
import type { BooleanFilter } from "./BooleanFilter.js";
import type { DatetimeFilter } from "./DatetimeFilter.js";
import type { GeoFilter } from "./GeoFilter.js";
Expand Down
1 change: 0 additions & 1 deletion packages/api/src/object/FetchPageArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

import type { InterfaceDefinition } from "../ontology/InterfaceDefinition.js";
import type {
ObjectOrInterfaceDefinition,
PropertyKeys,
Expand Down
5 changes: 1 addition & 4 deletions packages/api/src/ontology/QueryDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*/

import type { OsdkMetadata } from "../OsdkMetadata.js";
import type {
ObjectTypeDefinition,
ReleaseStatus,
} from "./ObjectTypeDefinition.js";
import type { ObjectTypeDefinition } from "./ObjectTypeDefinition.js";

export interface QueryMetadata {
type: "query";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/

import type { BaseTypeDataValue } from "./BaseTypeDataValue.js";
import type { BinaryTypeDataValue } from "./BinaryTypeDataValue.js";
import type { BooleanTypeDataValue } from "./BooleanTypeDataValue.js";
import type { ByteTypeDataValue } from "./ByteTypeDataValue.js";
import type { DateTypeDataValue } from "./DateTypeDataValue.js";
import type { DecimalTypeDataValue } from "./DecimalTypeDataValue.js";
Expand Down
5 changes: 1 addition & 4 deletions packages/client/src/createClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ import {
__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet,
__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe,
} from "@osdk/api/unstable";
import {
OntologiesV2,
OntologyObjectSets,
} from "@osdk/internal.foundry.ontologiesv2";
import { OntologyObjectSets } from "@osdk/internal.foundry.ontologiesv2";
import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
import { symbolClientContext } from "@osdk/shared.client2";
import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
Expand Down
7 changes: 0 additions & 7 deletions packages/client/src/createGeotimeSeriesProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@
import type {
GeotimeSeriesProperty,
TimeSeriesPoint,
TimeSeriesProperty,
TimeSeriesQuery,
} from "@osdk/api";
import { TimeseriesDurationMapping } from "@osdk/api";
import type { TimeRange } from "@osdk/internal.foundry.core";
import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
import type { MinimalClient } from "./MinimalClientContext.js";
import {
iterateReadableStream,
parseStreamedResponse,
} from "./util/streamutils.js";
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";

export class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point>
Expand Down
6 changes: 0 additions & 6 deletions packages/client/src/createTimeseriesProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@ import type {
TimeSeriesProperty,
TimeSeriesQuery,
} from "@osdk/api";
import { TimeseriesDurationMapping } from "@osdk/api";
import type { TimeRange } from "@osdk/internal.foundry.core";
import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
import type { MinimalClient } from "./MinimalClientContext.js";
import {
iterateReadableStream,
parseStreamedResponse,
} from "./util/streamutils.js";
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";

export class TimeSeriesPropertyImpl<T extends number | string>
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/object/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { Osdk, PropertyKeys } from "@osdk/api";
import type { Osdk } from "@osdk/api";
import { $Objects, $ontologyRid, Employee } from "@osdk/client.test.ontology";
import { apiServer, stubData, withoutRid } from "@osdk/shared.test";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
Expand Down
1 change: 0 additions & 1 deletion packages/client/src/objectSet/InterfaceObjectSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
$ontologyRid,
Employee,
FooInterface,
Office,
} from "@osdk/client.test.ontology";
import { apiServer } from "@osdk/shared.test";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
Expand Down
5 changes: 1 addition & 4 deletions packages/client/src/objectSet/ObjectSet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
*/

import type {
Augments,
CompileTimeMetadata,
ConvertProps,
FetchPageArgs,
InterfaceDefinition,
ObjectSet,
Osdk,
PropertyKeys,
Result,
} from "@osdk/api";
import { isOk, WhereClause } from "@osdk/api";
import { isOk } from "@osdk/api";
import {
$ontologyRid,
BarInterface,
Expand All @@ -44,7 +42,6 @@ import {
} from "vitest";
import type {
ApiNameAsString,
IsNever,
JustProps,
PropMapToInterface,
PropMapToObject,
Expand Down
4 changes: 0 additions & 4 deletions packages/client/src/objectSet/ObjectSetListenerWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ import WebSocket from "isomorphic-ws";
import invariant from "tiny-invariant";
import type { Logger } from "../Logger.js";
import type { ClientCacheKey, MinimalClient } from "../MinimalClientContext.js";
import {
convertWireToOsdkObjects,
convertWireToOsdkObjects2,
} from "../object/convertWireToOsdkObjects.js";

const MINIMUM_RECONNECT_DELAY_MS = 5 * 1000;

Expand Down
1 change: 0 additions & 1 deletion packages/client/src/objectSet/createObjectSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import type {
AsyncIterArgs,
Augments,
BaseObjectSet,
FetchPageResult,
LinkedType,
LinkNames,
Expand Down
10 changes: 1 addition & 9 deletions packages/client/src/util/datetimeConverters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
*/

import { register, unregister } from "timezone-mock";
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
expect,
it,
} from "vitest";
import { afterAll, beforeAll, describe, expect, it } from "vitest";
import {
extractDate,
extractDateInLocalTime,
Expand Down
3 changes: 1 addition & 2 deletions packages/client/src/util/timeseriesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
*/

import type { TimeSeriesQuery } from "@osdk/api";
import { TimeseriesDurationMapping, TimeSeriesPoint } from "@osdk/api";
import { TimeseriesDurationMapping } from "@osdk/api";
import type { TimeRange } from "@osdk/internal.foundry.core";
import invariant from "tiny-invariant";
import { iterateReadableStream, parseStreamedResponse } from "./streamutils.js";

export function getTimeRange(body: TimeSeriesQuery): TimeRange {
Expand Down
7 changes: 1 addition & 6 deletions packages/e2e.sandbox.catchall/src/demoStrictness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
* limitations under the License.
*/

import type { Osdk } from "@osdk/api";
import {
BoundariesUsState,
Employee,
FooInterface,
} from "@osdk/e2e.generated.catchall";
import { BoundariesUsState } from "@osdk/e2e.generated.catchall";
import { expectType } from "ts-expect";
import { client } from "./client.js";

Expand Down
9 changes: 2 additions & 7 deletions packages/e2e.sandbox.catchall/src/runInterfacesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@
* limitations under the License.
*/

import type { ConvertProps, Osdk } from "@osdk/api";
import {
Employee,
FooInterface,
OsdkTestObject,
} from "@osdk/e2e.generated.catchall";
import type { Osdk } from "@osdk/api";
import { FooInterface, OsdkTestObject } from "@osdk/e2e.generated.catchall";
import invariant from "tiny-invariant";
import type { TypeOf } from "ts-expect";
import { expectType } from "ts-expect";
import type { InterfaceObjectSet } from "../../api/build/esm/objectSet/ObjectSet.js";
import { client } from "./client.js";

export async function runInterfacesTest() {
Expand Down
5 changes: 1 addition & 4 deletions packages/e2e.sandbox.catchall/src/runQueriesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
* limitations under the License.
*/

import {
$Queries,
getNamesOfCustomersFromCountry,
} from "@osdk/e2e.generated.catchall";
import { getNamesOfCustomersFromCountry } from "@osdk/e2e.generated.catchall";
import { client } from "./client.js";

export async function runQueriesTest() {
Expand Down
2 changes: 0 additions & 2 deletions packages/e2e.sandbox.catchall/src/runSubscriptionsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/

import {
__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,
__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet,
__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe,
} from "@osdk/api/unstable";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e.sandbox.catchall/src/typeChecks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { ObjectSet, Osdk, PageResult } from "@osdk/api";
import type { Osdk, PageResult } from "@osdk/api";
import type { Client } from "@osdk/client";
// import type { ObjectSet$Employee } from "@osdk/e2e.generated.catchall";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { Outlet, useNavigate } from "react-router-dom";
import { Outlet } from "react-router-dom";
import { publicOauthClient } from "./client.js";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import css from "./Layout.module.css";

interface LayoutProps {
children?: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { execa, execaNode } from "execa";
import { execa } from "execa";
import { describe, expect, it } from "vitest";

describe("foundry-sdk-generator", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import type { ModuleFormat, RollupBuild } from "rollup";
import { rollup } from "rollup";
import nodePolyfill from "rollup-plugin-polyfill-node";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import type { ObjectMetadata } from "@osdk/api";
import type {
Icon,
ObjectTypeFullMetadata,
PropertyApiName,
PropertyV2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import invariant from "tiny-invariant";
import { extractNamespace } from "../GenerateContext/EnhancedBase.js";
import { EnhancedInterfaceType } from "../GenerateContext/EnhancedInterfaceType.js";
import type { EnhancedOntologyDefinition } from "../GenerateContext/EnhancedOntologyDefinition.js";
import { ForeignType } from "../GenerateContext/ForeignType.js";
import { propertyJsdoc } from "../shared/propertyJsdoc.js";
import { deleteUndefineds } from "../util/deleteUndefineds.js";
import { stringify } from "../util/stringify.js";
import type { Identifiers } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
Expand Down
3 changes: 0 additions & 3 deletions packages/maker/src/api/defineOntology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ import type {
OntologyIr,
OntologyIrInterfaceType,
OntologyIrInterfaceTypeBlockDataV2,
OntologyIrOntologyBlockDataV2,
OntologyIrSharedPropertyType,
OntologyIrSharedPropertyTypeBlockDataV2,
OntologyIrStructFieldType,
OntologyIrType,
OntologyIrValueTypeBlockData,
OntologyIrValueTypeBlockDataEntry,
StructFieldType,
Type,
} from "@osdk/client.unstable";
import type {
InterfaceType,
Expand Down
6 changes: 1 addition & 5 deletions packages/maker/src/api/defineValueType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import type {
} from "@osdk/client.unstable";
import invariant from "tiny-invariant";
import { ontologyDefinition } from "./defineOntology.js";
import type {
PropertyTypeType,
ValueTypeDefinitionVersion,
ValueTypeType,
} from "./types.js";
import type { ValueTypeDefinitionVersion, ValueTypeType } from "./types.js";

type ZipBaseAndConstraint<Base, Constraint> = {
[PropertyType in (BaseType["type"] & DataConstraint["type"])]: Base extends
Expand Down
1 change: 0 additions & 1 deletion packages/maker/src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type {
OntologyIrInterfaceType,
SharedPropertyTypeGothamMapping,
StructFieldType,
Type,
ValueTypeApiName,
ValueTypeDataConstraint,
ValueTypeDisplayMetadata,
Expand Down
9 changes: 1 addition & 8 deletions packages/oauth/src/AuthorizationServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
* limitations under the License.
*/

import {
afterAll,
beforeAll,
describe,
expect,
expectTypeOf,
it,
} from "vitest";
import { describe, expect, it } from "vitest";

import { createAuthorizationServer } from "./common.js";

Expand Down
1 change: 0 additions & 1 deletion packages/oauth/src/publicOauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
vi,
} from "vitest";

import crypto from "node:crypto";
import * as commonJs from "./common.js";
import { LocalStorageState } from "./common.js";
import { createPublicOauthClient } from "./createPublicOauthClient.js";
Expand Down
Loading

0 comments on commit 9d35a1f

Please sign in to comment.