Skip to content

Commit

Permalink
devx: speed up organize imports (#1929)
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity authored Dec 21, 2024
1 parent 6b5ee7b commit a66df3d
Show file tree
Hide file tree
Showing 57 changed files with 95 additions and 266 deletions.
6 changes: 5 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"trailingComma": "es5",
"plugins": ["prettier-plugin-packagejson", "prettier-plugin-tailwindcss"],
"plugins": [
"prettier-plugin-packagejson",
"prettier-plugin-organize-imports",
"prettier-plugin-tailwindcss"
],
"tailwindFunctions": ["clsx", "cn", "cva"]
}
17 changes: 15 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
{
"search.exclude": {
".vscode": true,
"pnpm-lock.yaml": true,
"**/.pnp.*": true,
"**/.yarn": true
"**/.yarn": true,
"**/node_modules": true,
"**/dist": true,
"**/build": true,
"**/out": true,
"**/lib": true,
"**/.next": true,
"**/storybook-static": true,
"**/generated": true,
"**/__test__/**/fixtures": true,
"**/__test__/**/output": true,
"**/__snapshots__/**": true,
"tests": true
},
"typescript.enablePromptUseWorkspaceTsdk": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": [
"source.fixAll",
"source.organizeImports",
"source.sortMembers",
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand Down
2 changes: 0 additions & 2 deletions clis/generator-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals --disable-console-intercept",
"test:update": "vitest -u --run --passWithNoTests --globals --disable-console-intercept"
},
Expand All @@ -38,7 +37,6 @@
"esbuild": "0.20.2",
"eslint": "^9",
"execa": "^9.5.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"tmp-promise": "^3.0.3",
"tsup": "^8.3.5",
Expand Down
2 changes: 0 additions & 2 deletions clis/vercel-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"vercel-scripts": "pnpm tsx src/cli.ts"
},
"dependencies": {
Expand All @@ -25,7 +24,6 @@
"@types/yargs": "^17.0.32",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"tsx": "^4.7.1",
"typescript": "4.9.5",
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default tseslint.config(
"fern/**",
],
},

eslint.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
Expand Down Expand Up @@ -60,7 +61,7 @@ export default tseslint.config(
}),

{
files: ["**/*.test.ts", "**/*.test.tsx"],
files: ["**/*.test.{ts,tsx}"],
plugins: {
vitest,
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@
"js-yaml": "^4.1.0",
"jsonc-parser": "~2.2.1",
"lint-staged": "^13.0.3",
"organize-imports-cli": "^0.10.0",
"playwright": "^1.47.1",
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"prettier-plugin-tailwindcss": "^0.6.9",
"react": "^18",
"rollup": "^4.22.4",
Expand Down
2 changes: 0 additions & 2 deletions packages/commons/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -70,7 +69,6 @@
"@types/ua-parser-js": "^0.7.39",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
8 changes: 4 additions & 4 deletions packages/commons/core-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export {
visitObject,
type ObjectPropertiesVisitor,
} from "./ObjectPropertiesVisitor";
export { addPrefixToString } from "./addPrefixToString";
export { assertNever, assertNeverNoThrow } from "./assertNever";
export { assertVoidNoThrow } from "./assertVoidNoThrow";
Expand All @@ -13,6 +9,10 @@ export { EMPTY_ARRAY, EMPTY_OBJECT } from "./empty";
export { formatUtc } from "./formatUtc";
export { identity } from "./identity";
export { assertNonNullish, isNonNullish } from "./isNonNullish";
export {
visitObject,
type ObjectPropertiesVisitor,
} from "./ObjectPropertiesVisitor";
export { entries, type Entries } from "./objects/entries";
export { isPlainObject } from "./objects/isPlainObject";
export { keys } from "./objects/keys";
Expand Down
2 changes: 0 additions & 2 deletions packages/commons/fdr-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -40,7 +39,6 @@
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
2 changes: 0 additions & 2 deletions packages/commons/github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -44,7 +43,6 @@
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"simple-git": "^3.24.0",
"stylelint": "^16.1.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/commons/loadable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -37,7 +36,6 @@
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
2 changes: 0 additions & 2 deletions packages/commons/react-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -43,7 +42,6 @@
"@types/react": "^18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
2 changes: 1 addition & 1 deletion packages/fdr-sdk/src/api-definition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export * from "./lang";
export * from "./latest";
export * from "./migrators/v1ToV2";
export * from "./prune";
export * from "./snippets/SnippetHttpRequest";
export * from "./snippets/curl";
export * from "./snippets/SnippetHttpRequest";
export * from "./status-message";
export * from "./transformer";
export * from "./types";
Expand Down
14 changes: 7 additions & 7 deletions packages/fdr-sdk/src/navigation/versions/latest/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
export * from "../../../client/generated/api/resources/commons";
export * from "../../../client/generated/api/resources/navigation/resources/latest/types";
export * from "./getChildren";
export * from "./getPageId";
export * from "./isApiReferenceNode";
export * from "./isSidebarRootNode";
export * from "./isTabbedNode";
export * from "./isUnversionedNode";
export * from "./isVersionNode";
export * from "./NavigationNode";
export * from "./NavigationNodeApiLeaf";
export * from "./NavigationNodeLeaf";
Expand All @@ -12,13 +19,6 @@ export * from "./NavigationNodeSection";
export * from "./NavigationNodeSectionOverview";
export * from "./NavigationNodeWithMetadata";
export * from "./NavigationNodeWithRedirect";
export * from "./getChildren";
export * from "./getPageId";
export * from "./isApiReferenceNode";
export * from "./isSidebarRootNode";
export * from "./isTabbedNode";
export * from "./isUnversionedNode";
export * from "./isVersionNode";
export * from "./slugjoin";
export * from "./toDefaultSlug";
export * from "./traverseBF";
Expand Down
12 changes: 6 additions & 6 deletions packages/fdr-sdk/src/navigation/versions/v1/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
export * from "../../../client/generated/api/resources/commons";
export * from "../../../client/generated/api/resources/navigation/resources/v1/types";
export * from "./convertAvailability";
export * from "./converters/ApiReferenceNavigationConverter";
export * from "./converters/SlugGenerator";
export * from "./converters/toRootNode";
export * from "./followRedirect";
export * from "./getPageId";
export * from "./NavigationNode";
export * from "./NavigationNodeApiLeaf";
export * from "./NavigationNodeLeaf";
Expand All @@ -11,12 +17,6 @@ export * from "./NavigationNodeSection";
export * from "./NavigationNodeSectionOverview";
export * from "./NavigationNodeWithMetadata";
export * from "./NavigationNodeWithRedirect";
export * from "./convertAvailability";
export * from "./converters/ApiReferenceNavigationConverter";
export * from "./converters/SlugGenerator";
export * from "./converters/toRootNode";
export * from "./followRedirect";
export * from "./getPageId";
export * from "./slugjoin";
export * from "./toDefaultSlug";
export * from "./traverseDF";
2 changes: 0 additions & 2 deletions packages/fern-docs/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -41,7 +40,6 @@
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
2 changes: 0 additions & 2 deletions packages/fern-docs/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand Down Expand Up @@ -82,7 +81,6 @@
"eslint": "^9",
"glslify-import": "^3.1.0",
"glslify-loader": "^2.0.0",
"organize-imports-cli": "^0.10.0",
"postcss": "^8.4.33",
"prettier": "^3.4.2",
"raw-loader": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fern-docs/bundle/src/server/DocsLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
} from "@fern-api/fdr-sdk/api-definition";
import * as FernNavigation from "@fern-api/fdr-sdk/navigation";
import type { AuthEdgeConfig } from "@fern-docs/auth";
import { getAuthEdgeConfig } from "@fern-docs/edge-config";
import { ApiDefinitionLoader } from "@fern-docs/cache";
import { getAuthEdgeConfig } from "@fern-docs/edge-config";
import { getAuthState, type AuthState } from "./auth/getAuthState";
import { loadWithUrl } from "./loadWithUrl";
import { pruneWithAuthState } from "./withRbac";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FernNavigation } from "@fern-api/fdr-sdk";
import { TRACK_LOAD_DOCS_PERFORMANCE } from "@fern-docs/utils";
import { DocsPage } from "@fern-docs/ui";
import { TRACK_LOAD_DOCS_PERFORMANCE } from "@fern-docs/utils";
import { GetServerSidePropsResult } from "next/types";
import { ComponentProps } from "react";
import { track } from "./analytics/posthog";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FernNavigation } from "@fern-api/fdr-sdk";
import { COOKIE_FERN_TOKEN } from "@fern-docs/utils";
import { type DocsPage } from "@fern-docs/ui";
import { COOKIE_FERN_TOKEN } from "@fern-docs/utils";
import type { NextApiRequestCookies } from "next/dist/server/api-utils";
import type { GetServerSidePropsResult } from "next/types";
import type { ComponentProps } from "react";
Expand Down
2 changes: 1 addition & 1 deletion packages/fern-docs/bundle/src/server/loadWithUrl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIResponse, FdrAPI } from "@fern-api/fdr-sdk/client/types";
import { withoutStaging } from "@fern-docs/utils";
import { provideRegistryService } from "@fern-docs/ui";
import { withoutStaging } from "@fern-docs/utils";

export type LoadWithUrlResponse = APIResponse<
FdrAPI.docs.v2.read.LoadDocsForUrlResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { DocsV1Read } from "@fern-api/fdr-sdk";
import type * as FernNavigation from "@fern-api/fdr-sdk/navigation";
import { FeatureFlags } from "@fern-docs/utils";
import { resolveDocsContent, type DocsContent } from "@fern-docs/ui";
import { getMdxBundler } from "@fern-docs/ui/bundlers";
import { FeatureFlags } from "@fern-docs/utils";
import { AuthState } from "./auth/getAuthState";
import { withPrunedNavigation } from "./withPrunedNavigation";

Expand Down
2 changes: 0 additions & 2 deletions packages/fern-docs/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"test": "vitest --run --passWithNoTests --globals"
},
"dependencies": {
Expand All @@ -46,7 +45,6 @@
"@types/node": "^18.7.18",
"depcheck": "^1.4.3",
"eslint": "^9",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.4.2",
"stylelint": "^16.1.0",
"typescript": "^5",
Expand Down
2 changes: 1 addition & 1 deletion packages/fern-docs/cache/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./ApiDefinitionLoader";
export * from "./MarkdownLoader";
export * from "./DocsLoader";
export * from "./MarkdownLoader";
2 changes: 0 additions & 2 deletions packages/fern-docs/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"lint:eslint:fix": "pnpm lint:eslint --fix",
"lint:style": "stylelint 'src/**/*.scss' --allow-empty-input --max-warnings 0",
"lint:style:fix": "pnpm lint:style --fix",
"organize-imports": "organize-imports-cli tsconfig.json",
"storybook": "storybook dev -p 6006",
"test": "vitest --run --passWithNoTests --globals --disable-console-intercept"
},
Expand Down Expand Up @@ -107,7 +106,6 @@
"eslint": "^9",
"eslint-plugin-storybook": "^0.8.0",
"jsdom": "^24.0.0",
"organize-imports-cli": "^0.10.0",
"postcss-import": "^16.0.1",
"prettier": "^3.4.2",
"react-test-renderer": "^18",
Expand Down
6 changes: 3 additions & 3 deletions packages/fern-docs/components/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export * from "./badges";
export * from "./BuiltWithFern";
export * from "./cn";
export * from "./colors";
export * from "./CopyToClipboardButton";
export * from "./Empty";
export * from "./FernAudioPlayer";
Expand All @@ -24,8 +27,5 @@ export * from "./FernTextarea";
export * from "./FernToast";
export * from "./FernTooltip";
export * from "./FontAwesomeIcon";
export * from "./badges";
export * from "./cn";
export * from "./colors";
export * from "./kbd";
export * from "./util/shared-component-types";
Loading

0 comments on commit a66df3d

Please sign in to comment.