-
Notifications
You must be signed in to change notification settings - Fork 874
Various tooling changes for Lite #12763
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
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
5cf8586
Fix broken references
OliverJAsh 4b579ae
Use `defineConfig` as per ESLint docs
OliverJAsh 66dc736
Format (via pnpm)
OliverJAsh 83345ff
Switch to tsgo
OliverJAsh 88b1079
Enable `noUncheckedIndexedAccess`
OliverJAsh 5544c75
Enable `noImplicitReturns`
OliverJAsh 815bc8d
Add React Compiler
OliverJAsh f8131da
Add React DevTools
OliverJAsh b85a7a7
Enable `eslint-plugin-react-hooks`
OliverJAsh f55a2ac
Use Oxlint
OliverJAsh ba782d4
Add oxlint-tsgolint to root for VS Code extension
OliverJAsh 4245286
Fix new Oxlint errors
OliverJAsh a36e418
Add React Query
OliverJAsh 2cd0151
Format
OliverJAsh f5c91df
Fix position of IPC handler registrations
OliverJAsh 8b64e92
Remove redundant wrappers
OliverJAsh f1999a4
Remove return types
OliverJAsh 529d114
Remove redundant async/await
OliverJAsh 4c39b62
Sort
OliverJAsh 8768557
Add endpoints to Electron
OliverJAsh f8b641c
Named params
OliverJAsh 1e12b28
Infer
OliverJAsh a649cda
Assert
OliverJAsh 4027f1b
Methods -> properties
OliverJAsh 5d7865a
Remove redundant async/await
OliverJAsh 9f79b38
Add endpoints to Electron
OliverJAsh 2ddd1c7
Use subpath imports
OliverJAsh ea06e01
Add agents for Lite
OliverJAsh 08c82d2
VS Code: migrate deprecated config
OliverJAsh 541cd98
VS Code: add config for `typescriptreact` files
OliverJAsh 6e53e59
VS Code: configure cts as ts
OliverJAsh a4d62b9
Update docs
OliverJAsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| { | ||
| "$schema": "./node_modules/oxlint/configuration_schema.json", | ||
| "jsPlugins": [ | ||
| // The builtin plugin isn't 1:1 at time of writing. | ||
| { "name": "react-hooks-js", "specifier": "eslint-plugin-react-hooks" }, | ||
| { "name": "react-query-js", "specifier": "@tanstack/eslint-plugin-query" } | ||
| ], | ||
OliverJAsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "plugins": ["eslint", "jsx-a11y", "oxc", "react", "typescript", "unicorn"], | ||
| "rules": { | ||
| "arrow-body-style": ["error", "as-needed"], | ||
| "default-param-last": "error", | ||
| "no-cond-assign": ["warn", "always"], | ||
| "curly": ["warn", "multi"], | ||
| "no-console": "warn", | ||
| "no-fallthrough": "error", | ||
| "no-param-reassign": "error", | ||
| "prefer-template": "warn", | ||
| "oxc/no-barrel-file": ["warn", { "threshold": 0 }], | ||
| "unicorn/no-document-cookie": "warn", | ||
| "unicorn/prefer-number-properties": "error", | ||
| "react/button-has-type": "error", | ||
| "react/jsx-boolean-value": "warn", | ||
| "react/jsx-fragments": "warn", | ||
| "react/jsx-no-useless-fragment": "warn", | ||
| "react/no-array-index-key": "warn", | ||
| "react/no-danger": "error", | ||
| // Temporarily disabled during the POC phase | ||
| // "react/only-export-components": "error", | ||
| "react/self-closing-comp": "warn", | ||
| "typescript/array-type": ["warn", { "default": "generic" }], | ||
| "typescript/ban-ts-comment": "warn", | ||
| "typescript/parameter-properties": "error", | ||
| "typescript/no-explicit-any": "error", | ||
| "typescript/no-inferrable-types": "warn", | ||
| "typescript/no-non-null-assertion": "warn", | ||
| "typescript/no-unnecessary-condition": "warn", | ||
| "typescript/no-unnecessary-template-expression": "warn", | ||
| "typescript/restrict-template-expressions": [ | ||
| "warn", | ||
| { | ||
| "allowAny": false, | ||
| "allowNullish": false, | ||
| "allowRegExp": false | ||
| } | ||
| ], | ||
| "typescript/restrict-plus-operands": [ | ||
| "error", | ||
| { | ||
| "allowAny": false, | ||
| "allowBoolean": false, | ||
| "allowNullish": false, | ||
| "allowNumberAndString": false, | ||
| "allowRegExp": false | ||
| } | ||
| ], | ||
| // "always" flags for lack of await outside of async functions, unlike ESLint: | ||
| // https://github.com/oxc-project/oxc/issues/18452 | ||
| "typescript/return-await": ["error", "error-handling-correctness-only"], | ||
| "typescript/strict-boolean-expressions": [ | ||
| "warn", | ||
| { | ||
| "allowString": false, | ||
| "allowNumber": false, | ||
| "allowNullableBoolean": true | ||
| } | ||
| ], | ||
| "typescript/await-thenable": "error", | ||
| "typescript/no-misused-promises": "error", | ||
| "typescript/no-floating-promises": "error", | ||
| "typescript/no-misused-spread": "error", | ||
| "typescript/no-unsafe-argument": "error", | ||
| "typescript/no-unsafe-assignment": "error", | ||
| "typescript/no-unsafe-call": "error", | ||
| "typescript/no-unsafe-member-access": "error", | ||
| "typescript/no-unsafe-return": "error", | ||
| "typescript/unbound-method": "error", | ||
|
|
||
| // Default config has catch violations. | ||
| "no-unused-vars": [ | ||
| "warn", | ||
| { | ||
| "caughtErrorsIgnorePattern": "^_", | ||
| // These are the defaults that are unset by diverging our config at all. | ||
| "argsIgnorePattern": "^_", | ||
| "varsIgnorePattern": "^_" | ||
| } | ||
| ], | ||
|
|
||
| // Lots of false positives on sums. | ||
| "react/jsx-key": "off", | ||
|
|
||
| // Enable the recommended rules in the JS plugin as per: | ||
| // https://react.dev/reference/eslint-plugin-react-hooks#recommended | ||
| "react-hooks-js/exhaustive-deps": "error", | ||
| "react-hooks-js/rules-of-hooks": "error", | ||
| "react-hooks-js/component-hook-factories": "error", | ||
| "react-hooks-js/config": "error", | ||
| "react-hooks-js/error-boundaries": "error", | ||
| "react-hooks-js/gating": "error", | ||
| "react-hooks-js/globals": "error", | ||
| "react-hooks-js/immutability": "error", | ||
| "react-hooks-js/incompatible-library": "error", | ||
| "react-hooks-js/preserve-manual-memoization": "error", | ||
| "react-hooks-js/purity": "error", | ||
| "react-hooks-js/refs": "error", | ||
| "react-hooks-js/set-state-in-effect": "error", | ||
| "react-hooks-js/set-state-in-render": "error", | ||
| "react-hooks-js/static-components": "error", | ||
| "react-hooks-js/unsupported-syntax": "error", | ||
| "react-hooks-js/use-memo": "error", | ||
|
|
||
| // Enable the recommended rules in the JS plugin. | ||
| "react-query-js/exhaustive-deps": "error", | ||
| "react-query-js/no-rest-destructuring": "warn", | ||
| "react-query-js/stable-query-client": "error", | ||
| "react-query-js/no-unstable-deps": "error", | ||
| "react-query-js/infinite-query-property-order": "error" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| ## Typechecking | ||
|
|
||
| Typechecking is the fastest way to validate that everything is okay. Always run this **exact** command to typecheck: | ||
|
|
||
| ```console | ||
| $ pnpm -F @gitbutler/lite check | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,165 @@ | ||
| import type { ProjectForFrontend, RefInfo } from "@gitbutler/but-sdk"; | ||
| import type { | ||
| ApplyOutcome, | ||
| AssignmentRejection, | ||
| BranchDetails, | ||
| BranchListing, | ||
| BranchListingFilter, | ||
| HunkAssignmentRequest, | ||
| CommitDetails, | ||
| DiffSpec, | ||
| InsertSide, | ||
| ProjectForFrontend, | ||
| RelativeTo, | ||
| RefInfo, | ||
| TreeChange, | ||
| TreeChanges, | ||
| UICommitCreateResult, | ||
| UICommitInsertBlankResult, | ||
| UICommitMoveResult, | ||
| UICommitRewordResult, | ||
| UIMoveChangesResult, | ||
| UnifiedPatch, | ||
| WorktreeChanges, | ||
| } from "@gitbutler/but-sdk"; | ||
|
|
||
| export interface AssignHunkParams { | ||
| projectId: string; | ||
| assignments: Array<HunkAssignmentRequest>; | ||
| } | ||
|
|
||
| export interface ApplyParams { | ||
| projectId: string; | ||
| existingBranch: string; | ||
| } | ||
|
|
||
| export interface BranchDetailsParams { | ||
| projectId: string; | ||
| branchName: string; | ||
| remote: string | null; | ||
| } | ||
|
|
||
| export interface BranchDiffParams { | ||
| projectId: string; | ||
| branch: string; | ||
| } | ||
|
|
||
| export interface CommitAmendParams { | ||
| projectId: string; | ||
| commitId: string; | ||
| changes: Array<DiffSpec>; | ||
| } | ||
|
|
||
| export interface CommitDetailsWithLineStatsParams { | ||
| projectId: string; | ||
| commitId: string; | ||
| } | ||
|
|
||
| export interface CommitCreateParams { | ||
| projectId: string; | ||
| relativeTo: RelativeTo; | ||
| side: InsertSide; | ||
| changes: Array<DiffSpec>; | ||
| message: string; | ||
| } | ||
|
|
||
| export interface CommitMoveChangesBetweenParams { | ||
| projectId: string; | ||
| sourceCommitId: string; | ||
| destinationCommitId: string; | ||
| changes: Array<DiffSpec>; | ||
| } | ||
|
|
||
| export interface CommitMoveParams { | ||
| projectId: string; | ||
| subjectCommitId: string; | ||
| anchorCommitId: string; | ||
| side: InsertSide; | ||
| } | ||
|
|
||
| export interface CommitMoveToBranchParams { | ||
| projectId: string; | ||
| subjectCommitId: string; | ||
| anchorRef: string; | ||
| } | ||
|
|
||
| export interface CommitInsertBlankParams { | ||
| projectId: string; | ||
| relativeTo: RelativeTo; | ||
| side: InsertSide; | ||
| } | ||
|
|
||
| export interface CommitRewordParams { | ||
| projectId: string; | ||
| commitId: string; | ||
| message: string; | ||
| } | ||
|
|
||
| export interface CommitUncommitChangesParams { | ||
| projectId: string; | ||
| commitId: string; | ||
| changes: Array<DiffSpec>; | ||
| assignTo: string | null; | ||
| } | ||
|
|
||
| export interface TreeChangeDiffParams { | ||
| projectId: string; | ||
| change: TreeChange; | ||
| } | ||
|
|
||
| export interface UnapplyStackParams { | ||
| projectId: string; | ||
| stackId: string; | ||
| } | ||
|
|
||
| export interface LiteElectronApi { | ||
| ping(input: string): Promise<string>; | ||
| getVersion(): Promise<string>; | ||
| listProjects(): Promise<ProjectForFrontend[]>; | ||
| headInfo(projectId: string): Promise<RefInfo>; | ||
| apply: (params: ApplyParams) => Promise<ApplyOutcome>; | ||
| assignHunk: (params: AssignHunkParams) => Promise<Array<AssignmentRejection>>; | ||
| branchDetails: (params: BranchDetailsParams) => Promise<BranchDetails>; | ||
OliverJAsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| branch_diff: (params: BranchDiffParams) => Promise<TreeChanges>; | ||
OliverJAsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| changesInWorktree: (projectId: string) => Promise<WorktreeChanges>; | ||
| commitAmend: (params: CommitAmendParams) => Promise<UICommitCreateResult>; | ||
| commitCreate: (params: CommitCreateParams) => Promise<UICommitCreateResult>; | ||
| commitDetailsWithLineStats: (params: CommitDetailsWithLineStatsParams) => Promise<CommitDetails>; | ||
| commitInsertBlank: (params: CommitInsertBlankParams) => Promise<UICommitInsertBlankResult>; | ||
| commitMove: (params: CommitMoveParams) => Promise<UICommitMoveResult>; | ||
| commitMoveToBranch: (params: CommitMoveToBranchParams) => Promise<UICommitMoveResult>; | ||
| commitReword: (params: CommitRewordParams) => Promise<UICommitRewordResult>; | ||
| commitMoveChangesBetween: ( | ||
| params: CommitMoveChangesBetweenParams, | ||
| ) => Promise<UIMoveChangesResult>; | ||
| commitUncommitChanges: (params: CommitUncommitChangesParams) => Promise<UIMoveChangesResult>; | ||
| getVersion: () => Promise<string>; | ||
| headInfo: (projectId: string) => Promise<RefInfo>; | ||
| listBranches: ( | ||
| projectId: string, | ||
| filter: BranchListingFilter | null, | ||
| ) => Promise<Array<BranchListing>>; | ||
| listProjects: () => Promise<Array<ProjectForFrontend>>; | ||
| ping: (input: string) => Promise<string>; | ||
| treeChangeDiffs: (params: TreeChangeDiffParams) => Promise<UnifiedPatch | null>; | ||
| unapplyStack: (params: UnapplyStackParams) => Promise<void>; | ||
| } | ||
|
|
||
| export const liteIpcChannels = { | ||
| ping: "lite:ping", | ||
| apply: "workspace:apply", | ||
| assignHunk: "workspace:assign-hunk", | ||
| branchDetails: "workspace:branch-details", | ||
| branchDiff: "workspace:branch-diff", | ||
| changesInWorktree: "workspace:changes-in-worktree", | ||
| commitAmend: "workspace:commit-amend", | ||
| commitCreate: "workspace:commit-create", | ||
| commitDetailsWithLineStats: "workspace:commit-details-with-line-stats", | ||
| commitInsertBlank: "workspace:commit-insert-blank", | ||
| commitMove: "workspace:commit-move", | ||
| commitMoveToBranch: "workspace:commit-move-to-branch", | ||
| commitReword: "workspace:commit-reword", | ||
| commitMoveChangesBetween: "workspace:commit-move-changes-between", | ||
| commitUncommitChanges: "workspace:commit-uncommit-changes", | ||
| getVersion: "lite:get-version", | ||
| listProjects: "projects:list", | ||
| headInfo: "workspace:head-info", | ||
| listBranches: "workspace:list-branches", | ||
| listProjects: "projects:list", | ||
| ping: "lite:ping", | ||
| treeChangeDiffs: "workspace:tree-change-diffs", | ||
| unapplyStack: "workspace:unapply-stack", | ||
| } as const; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.