diff --git a/addons/.eslintrc.js b/addons/.eslintrc.js index 116e963aeee63..9d8ebeacf3d47 100644 --- a/addons/.eslintrc.js +++ b/addons/.eslintrc.js @@ -34,7 +34,7 @@ module.exports = { '@typescript-eslint', // enforce rules of hooks and hook dependencies 'react-hooks', - // Sorting imports is hard... + // Sorting imports is maintained by prettier-plugin-organize-imports 'import', // Allow locally defined custom rules 'rulesdir', @@ -63,17 +63,8 @@ module.exports = { curly: 'error', 'dot-notation': 'error', 'import/no-duplicates': 'error', - 'import/order': [ - 'error', - { - groups: ['type'], - 'newlines-between': 'always', - alphabetize: { - order: 'asc', - caseInsensitive: false, - }, - }, - ], + // Sorting imports is maintained by prettier-plugin-organize-imports + 'import/order': 'off', 'no-await-in-loop': 'error', 'no-bitwise': 'error', 'no-caller': 'error', diff --git a/addons/.prettierrc b/addons/.prettierrc deleted file mode 100644 index 8f0cf641671b3..0000000000000 --- a/addons/.prettierrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "arrowParens": "avoid", - "bracketSpacing": false, - "bracketSameLine": true, - "useTabs": false, - "singleQuote": true, - "tabWidth": 2, - "printWidth": 100, - "trailingComma": "all" -} diff --git a/addons/components/Badge.tsx b/addons/components/Badge.tsx index 3e41b087df31e..8ed0221c60ccc 100644 --- a/addons/components/Badge.tsx +++ b/addons/components/Badge.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type {ReactNode} from 'react'; +import type {ReactProps} from './utils'; import * as stylex from '@stylexjs/stylex'; diff --git a/addons/components/Banner.tsx b/addons/components/Banner.tsx index 44d6bfd3837c6..0f20b05da1f4d 100644 --- a/addons/components/Banner.tsx +++ b/addons/components/Banner.tsx @@ -7,8 +7,8 @@ import type {ReactNode} from 'react'; -import {Tooltip} from './Tooltip'; import * as stylex from '@stylexjs/stylex'; +import {Tooltip} from './Tooltip'; import './Banner.css'; diff --git a/addons/components/Button.tsx b/addons/components/Button.tsx index f22e7e59db3df..47b6dad22290f 100644 --- a/addons/components/Button.tsx +++ b/addons/components/Button.tsx @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +import type {ForwardedRef} from 'react'; import type {ExclusiveOr} from './Types'; import type {ReactProps} from './utils'; -import type {ForwardedRef} from 'react'; -import {layout} from './theme/layout'; -import {colors} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; import {forwardRef, type ReactNode} from 'react'; +import {layout} from './theme/layout'; +import {colors} from './theme/tokens.stylex'; /** * StyleX tries to evaluate CSS variables and store them separately. diff --git a/addons/components/ButtonDropdown.tsx b/addons/components/ButtonDropdown.tsx index 95b8cccb2184f..bf5c7f71c8a8a 100644 --- a/addons/components/ButtonDropdown.tsx +++ b/addons/components/ButtonDropdown.tsx @@ -7,10 +7,10 @@ import type {ReactNode} from 'react'; +import * as stylex from '@stylexjs/stylex'; import {Button, buttonStyles} from './Button'; import {Icon} from './Icon'; import {colors, spacing} from './theme/tokens.stylex'; -import * as stylex from '@stylexjs/stylex'; const styles = stylex.create({ container: { diff --git a/addons/components/ButtonGroup.tsx b/addons/components/ButtonGroup.tsx index 4e39588aeeee4..95b87d3ba3aad 100644 --- a/addons/components/ButtonGroup.tsx +++ b/addons/components/ButtonGroup.tsx @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {colors} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; import React from 'react'; +import {colors} from './theme/tokens.stylex'; const styles = stylex.create({ group: { diff --git a/addons/components/Checkbox.tsx b/addons/components/Checkbox.tsx index 960f53843e90a..b4dd1cd4c8b76 100644 --- a/addons/components/Checkbox.tsx +++ b/addons/components/Checkbox.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type react from 'react'; +import type {ReactProps} from './utils'; -import {layout} from './theme/layout'; -import {spacing} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; import {useEffect, useId, useRef} from 'react'; +import {layout} from './theme/layout'; +import {spacing} from './theme/tokens.stylex'; const cssVarFocusWithinBorder = '--checkbox-focus-within-color'; const styles = stylex.create({ diff --git a/addons/components/Dropdown.tsx b/addons/components/Dropdown.tsx index 677ccff0df261..3377b2ba447e4 100644 --- a/addons/components/Dropdown.tsx +++ b/addons/components/Dropdown.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type {ReactNode} from 'react'; +import type {ReactProps} from './utils'; import * as stylex from '@stylexjs/stylex'; import {useId} from 'react'; diff --git a/addons/components/ErrorNotice.tsx b/addons/components/ErrorNotice.tsx index f337045c94ea6..829e766522454 100644 --- a/addons/components/ErrorNotice.tsx +++ b/addons/components/ErrorNotice.tsx @@ -7,9 +7,9 @@ import type {ReactNode} from 'react'; +import React, {Component, useState} from 'react'; import {Icon} from './Icon'; import {Tooltip} from './Tooltip'; -import React, {useState, Component} from 'react'; import './error-notice.css'; diff --git a/addons/components/Flex.tsx b/addons/components/Flex.tsx index 01943950a62f5..c5d98f6c180c8 100644 --- a/addons/components/Flex.tsx +++ b/addons/components/Flex.tsx @@ -7,8 +7,8 @@ import type {ReactProps} from './utils'; -import {spacing} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; +import {spacing} from './theme/tokens.stylex'; type ContainerProps = ReactProps & {xstyle?: stylex.StyleXStyles}; diff --git a/addons/components/HorizontallyGrowingTextField.tsx b/addons/components/HorizontallyGrowingTextField.tsx index 95418cd5252c7..fd3de22b6fc4d 100644 --- a/addons/components/HorizontallyGrowingTextField.tsx +++ b/addons/components/HorizontallyGrowingTextField.tsx @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type {ForwardedRef} from 'react'; +import type {ReactProps} from './utils'; -import {textFieldStyles} from './TextField'; import * as stylex from '@stylexjs/stylex'; import {forwardRef} from 'react'; +import {textFieldStyles} from './TextField'; const styles = stylex.create({ horizontalGrowContainer: { diff --git a/addons/components/LinkButton.tsx b/addons/components/LinkButton.tsx index b2501cd32ff65..9263b7af7bde4 100644 --- a/addons/components/LinkButton.tsx +++ b/addons/components/LinkButton.tsx @@ -7,8 +7,8 @@ import type {ReactNode} from 'react'; -import {colors, font} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; +import {colors, font} from './theme/tokens.stylex'; const styles = stylex.create({ linkButton: { diff --git a/addons/components/Panels.tsx b/addons/components/Panels.tsx index c5b1b5cb67bc3..df81675439d7d 100644 --- a/addons/components/Panels.tsx +++ b/addons/components/Panels.tsx @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {ColumnAlignmentProps} from './Flex'; import type {ReactNode} from 'react'; +import type {ColumnAlignmentProps} from './Flex'; +import * as stylex from '@stylexjs/stylex'; import {Column, Row} from './Flex'; import {spacing} from './theme/tokens.stylex'; -import * as stylex from '@stylexjs/stylex'; const styles = stylex.create({ tabList: { diff --git a/addons/components/Radio.tsx b/addons/components/Radio.tsx index 8f4ab4b303883..09dfa2a416088 100644 --- a/addons/components/Radio.tsx +++ b/addons/components/Radio.tsx @@ -7,12 +7,12 @@ import type react from 'react'; +import * as stylex from '@stylexjs/stylex'; +import {useId} from 'react'; import {Column} from './Flex'; import {Tooltip} from './Tooltip'; import {layout} from './theme/layout'; import {spacing} from './theme/tokens.stylex'; -import * as stylex from '@stylexjs/stylex'; -import {useId} from 'react'; // stylex doesn't support :checked and :before simultaneously very well import './Radio.css'; diff --git a/addons/components/Subtle.tsx b/addons/components/Subtle.tsx index 57c8cf811861c..40b35cf77d84b 100644 --- a/addons/components/Subtle.tsx +++ b/addons/components/Subtle.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {stylexPropsWithClassName} from './utils'; import * as stylex from '@stylexjs/stylex'; +import {stylexPropsWithClassName} from './utils'; const styles = stylex.create({ subtle: { diff --git a/addons/components/Tag.tsx b/addons/components/Tag.tsx index 74bd619345d18..e72a883e63844 100644 --- a/addons/components/Tag.tsx +++ b/addons/components/Tag.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type {ReactNode} from 'react'; +import type {ReactProps} from './utils'; import * as stylex from '@stylexjs/stylex'; diff --git a/addons/components/TextArea.tsx b/addons/components/TextArea.tsx index ffc5bbe2cbe46..2a37f2177bdbc 100644 --- a/addons/components/TextArea.tsx +++ b/addons/components/TextArea.tsx @@ -7,9 +7,9 @@ import type {ForwardedRef, ReactNode} from 'react'; -import {Column} from './Flex'; import * as stylex from '@stylexjs/stylex'; import {forwardRef, useId} from 'react'; +import {Column} from './Flex'; const styles = stylex.create({ root: { diff --git a/addons/components/TextField.tsx b/addons/components/TextField.tsx index 0485e2fdf8be7..33060a28bf365 100644 --- a/addons/components/TextField.tsx +++ b/addons/components/TextField.tsx @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {ReactProps} from './utils'; import type {ForwardedRef, ReactNode} from 'react'; +import type {ReactProps} from './utils'; -import {Column} from './Flex'; import * as stylex from '@stylexjs/stylex'; import {forwardRef, useId} from 'react'; +import {Column} from './Flex'; export const textFieldStyles = stylex.create({ root: { diff --git a/addons/components/ThemedComponentsRoot.tsx b/addons/components/ThemedComponentsRoot.tsx index f97c6c7202a18..4a5e77db25ea4 100644 --- a/addons/components/ThemedComponentsRoot.tsx +++ b/addons/components/ThemedComponentsRoot.tsx @@ -7,8 +7,8 @@ import type {ReactNode} from 'react'; -import {light} from './theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; +import {light} from './theme/tokens.stylex'; type Writable = {-readonly [P in keyof T]: T[P]}; export function ThemedComponentsRoot({ diff --git a/addons/components/Tooltip.tsx b/addons/components/Tooltip.tsx index 5baeecb0a001b..cb0c3d06f85e8 100644 --- a/addons/components/Tooltip.tsx +++ b/addons/components/Tooltip.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {ExclusiveOr} from './Types'; import type {MouseEvent, ReactNode} from 'react'; +import type {ExclusiveOr} from './Types'; +import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'; import {ViewportOverlay} from './ViewportOverlay'; import {findParentWithClassName} from './utils'; import {getZoomLevel} from './zoom'; -import React, {useLayoutEffect, useEffect, useRef, useState} from 'react'; import './Tooltip.css'; diff --git a/addons/components/Typeahead.tsx b/addons/components/Typeahead.tsx index 287ac94e85080..73197eace31d7 100644 --- a/addons/components/Typeahead.tsx +++ b/addons/components/Typeahead.tsx @@ -8,11 +8,11 @@ import type {TypeaheadResult} from './Types'; import type {ReactProps} from './utils'; +import {useEffect, useRef, useState} from 'react'; import {Icon} from './Icon'; import {Subtle} from './Subtle'; import {TextField} from './TextField'; import {extractTokens, TokensList, tokensToString} from './Tokens'; -import {useRef, useEffect, useState} from 'react'; export function Typeahead({ tokenString, diff --git a/addons/components/__tests__/KeyboardShortcuts.test.tsx b/addons/components/__tests__/KeyboardShortcuts.test.tsx index 9acf969960e3f..4913bb96cc9f3 100644 --- a/addons/components/__tests__/KeyboardShortcuts.test.tsx +++ b/addons/components/__tests__/KeyboardShortcuts.test.tsx @@ -7,11 +7,11 @@ * @jest-environment jsdom */ -import {makeCommandDispatcher, KeyCode, Modifier} from '../KeyboardShortcuts'; -import {render, screen, act} from '@testing-library/react'; import '@testing-library/jest-dom'; +import {act, render, screen} from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import {useCallback, useState} from 'react'; +import {KeyCode, makeCommandDispatcher, Modifier} from '../KeyboardShortcuts'; /* eslint-disable no-bitwise */ diff --git a/addons/components/__tests__/basic.test.tsx b/addons/components/__tests__/basic.test.tsx index b22656f68e8af..f251234f974c8 100644 --- a/addons/components/__tests__/basic.test.tsx +++ b/addons/components/__tests__/basic.test.tsx @@ -5,11 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import {render, screen} from '@testing-library/react'; import {ThemedComponentsRoot} from '../ThemedComponentsRoot'; import {ViewportOverlayRoot} from '../ViewportOverlay'; import ComponentExplorer from '../explorer/ComponentExplorer'; -import {render, screen} from '@testing-library/react'; -import React from 'react'; describe('component library', () => { it('renders component explorer', () => { diff --git a/addons/components/explorer/ComponentExplorer.tsx b/addons/components/explorer/ComponentExplorer.tsx index 2770ae5852c5b..883598c281278 100644 --- a/addons/components/explorer/ComponentExplorer.tsx +++ b/addons/components/explorer/ComponentExplorer.tsx @@ -7,6 +7,8 @@ import type {StyleXVar} from '@stylexjs/stylex/lib/StyleXTypes'; +import * as stylex from '@stylexjs/stylex'; +import {useState, type ReactNode} from 'react'; import {Badge} from '../Badge'; import {Banner, BannerKind} from '../Banner'; import {Button} from '../Button'; @@ -30,8 +32,6 @@ import {Tooltip} from '../Tooltip'; import {Typeahead} from '../Typeahead'; import {layout} from '../theme/layout'; import {colors, font, radius, spacing} from '../theme/tokens.stylex'; -import * as stylex from '@stylexjs/stylex'; -import {useState, type ReactNode} from 'react'; /* eslint-disable no-console */ diff --git a/addons/components/explorer/index.tsx b/addons/components/explorer/index.tsx index 9b2a97dc1e273..3cbb4fb3521d9 100644 --- a/addons/components/explorer/index.tsx +++ b/addons/components/explorer/index.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import 'react'; +import ReactDOM from 'react-dom/client'; import {ThemedComponentsRoot} from '../ThemedComponentsRoot'; import {ViewportOverlayRoot} from '../ViewportOverlay'; import ComponentExplorer from './ComponentExplorer'; -import 'react'; -import ReactDOM from 'react-dom/client'; import './index.css'; diff --git a/addons/components/theme/layout.ts b/addons/components/theme/layout.ts index b08117f3c8a7b..dc737d861cd7c 100644 --- a/addons/components/theme/layout.ts +++ b/addons/components/theme/layout.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {spacing} from './tokens.stylex'; import * as stylex from '@stylexjs/stylex'; +import {spacing} from './tokens.stylex'; export const layout = stylex.create({ flexRow: { diff --git a/addons/isl-server/proxy/__tests__/rmtree.test.ts b/addons/isl-server/proxy/__tests__/rmtree.test.ts index ebb5d284a7b41..41e0e396c9343 100644 --- a/addons/isl-server/proxy/__tests__/rmtree.test.ts +++ b/addons/isl-server/proxy/__tests__/rmtree.test.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import rmtree from '../rmtree'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import {exists} from 'shared/fs'; +import rmtree from '../rmtree'; describe('rmtree', () => { let tmp: string; diff --git a/addons/isl-server/proxy/__tests__/run-proxy.test.ts b/addons/isl-server/proxy/__tests__/run-proxy.test.ts index 45a113a0809d8..f4394f0914252 100644 --- a/addons/isl-server/proxy/__tests__/run-proxy.test.ts +++ b/addons/isl-server/proxy/__tests__/run-proxy.test.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import * as util from 'node:util'; import {readExistingServerFile} from '../existingServerStateFiles'; import * as startServer from '../server'; import * as lifecycle from '../serverLifecycle'; -import {runProxyMain, parseArgs} from '../startServer'; -import * as util from 'node:util'; +import {parseArgs, runProxyMain} from '../startServer'; /* eslint-disable require-await */ diff --git a/addons/isl-server/proxy/existingServerStateFiles.ts b/addons/isl-server/proxy/existingServerStateFiles.ts index 4ec548971b5bb..a2f22179c43da 100644 --- a/addons/isl-server/proxy/existingServerStateFiles.ts +++ b/addons/isl-server/proxy/existingServerStateFiles.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import rmtree from './rmtree'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import {nullthrows} from 'shared/utils'; +import rmtree from './rmtree'; export type ExistingServerInfo = { sensitiveToken: string; diff --git a/addons/isl-server/proxy/server.ts b/addons/isl-server/proxy/server.ts index 5a19e42d3a43b..369cce33a3682 100644 --- a/addons/isl-server/proxy/server.ts +++ b/addons/isl-server/proxy/server.ts @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -import type {ServerPlatform} from '../src/serverPlatform'; import type {PlatformName} from 'isl/src/types'; import type {AddressInfo} from 'node:net'; +import type {ServerPlatform} from '../src/serverPlatform'; -import {repositoryCache} from '../src/RepositoryCache'; -import {CLOSED_AND_SHOULD_NOT_RECONNECT_CODE} from '../src/constants'; -import {onClientConnection} from '../src/index'; -import {areTokensEqual} from './proxyUtils'; import {grammars} from 'isl/src/generated/textmate/TextMateGrammarManifest'; import fs from 'node:fs'; import http from 'node:http'; import path from 'node:path'; import urlModule from 'node:url'; import WebSocket from 'ws'; +import {repositoryCache} from '../src/RepositoryCache'; +import {CLOSED_AND_SHOULD_NOT_RECONNECT_CODE} from '../src/constants'; +import {onClientConnection} from '../src/index'; +import {areTokensEqual} from './proxyUtils'; const ossSmartlogDir = path.join(__dirname, '../../isl'); diff --git a/addons/isl-server/proxy/serverLifecycle.ts b/addons/isl-server/proxy/serverLifecycle.ts index 5c7760a23134b..d742cef17f801 100644 --- a/addons/isl-server/proxy/serverLifecycle.ts +++ b/addons/isl-server/proxy/serverLifecycle.ts @@ -7,9 +7,9 @@ import type {ServerChallengeResponse} from './server'; +import * as http from 'node:http'; import {type ExistingServerInfo, readExistingServerFile} from './existingServerStateFiles'; import {areTokensEqual} from './proxyUtils'; -import * as http from 'node:http'; /** * If it looks like something is serving on `localhost` on the same port, diff --git a/addons/isl-server/proxy/startServer.ts b/addons/isl-server/proxy/startServer.ts index 6bb4605049313..40237b626ff16 100644 --- a/addons/isl-server/proxy/startServer.ts +++ b/addons/isl-server/proxy/startServer.ts @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ +import type {PlatformName} from 'isl/src/types'; +import type {IOType} from 'node:child_process'; import type {ChildProcessResponse} from './child'; import type {StartServerArgs, StartServerResult} from './server'; -import type {IOType} from 'node:child_process'; -import type {PlatformName} from 'isl/src/types'; -import { - ensureExistingServerFolder, - deleteExistingServerFile, - writeExistingServerFile, -} from './existingServerStateFiles'; -import * as lifecycle from './serverLifecycle'; import child_process from 'node:child_process'; import crypto from 'node:crypto'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; +import { + deleteExistingServerFile, + ensureExistingServerFolder, + writeExistingServerFile, +} from './existingServerStateFiles'; +import * as lifecycle from './serverLifecycle'; const DEFAULT_PORT = '3001'; diff --git a/addons/isl-server/rollup.config.mjs b/addons/isl-server/rollup.config.mjs index 0ae11947701b2..5f84b8ed7caf1 100644 --- a/addons/isl-server/rollup.config.mjs +++ b/addons/isl-server/rollup.config.mjs @@ -10,8 +10,8 @@ import cjs from '@rollup/plugin-commonjs'; import nodeResolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; import path from 'node:path'; -import esbuild from 'rollup-plugin-esbuild'; import {fileURLToPath} from 'node:url'; +import esbuild from 'rollup-plugin-esbuild'; // eslint-disable-next-line no-undef const isProduction = process.env.NODE_ENV === 'production'; diff --git a/addons/isl-server/src/CodeReviewProvider.ts b/addons/isl-server/src/CodeReviewProvider.ts index 82f923ddd831e..e965ccf9ea72c 100644 --- a/addons/isl-server/src/CodeReviewProvider.ts +++ b/addons/isl-server/src/CodeReviewProvider.ts @@ -8,16 +8,16 @@ import type {TypeaheadResult} from 'isl-components/Types'; import type {TypeaheadKind} from 'isl/src/CommitInfoView/types'; import type { + ClientToServerMessage, + CodeReviewProviderSpecificClientToServerMessages, + DiffComment, DiffId, DiffSummary, Disposable, - Result, - OperationCommandProgressReporter, - LandInfo, LandConfirmationInfo, - CodeReviewProviderSpecificClientToServerMessages, - ClientToServerMessage, - DiffComment, + LandInfo, + OperationCommandProgressReporter, + Result, ServerToClientMessage, } from 'isl/src/types'; diff --git a/addons/isl-server/src/FileLogger.ts b/addons/isl-server/src/FileLogger.ts index 7df91b67b5b8a..2e21dc99a2243 100644 --- a/addons/isl-server/src/FileLogger.ts +++ b/addons/isl-server/src/FileLogger.ts @@ -7,9 +7,9 @@ import type {Level} from './logger'; -import {Logger} from './logger'; import fs from 'node:fs'; import util from 'node:util'; +import {Logger} from './logger'; /** Logger that outputs to a given filename. * Typically used for browser ISL's server. */ diff --git a/addons/isl-server/src/GeneratedFiles.ts b/addons/isl-server/src/GeneratedFiles.ts index 5084ab197a407..830c1bf8e553c 100644 --- a/addons/isl-server/src/GeneratedFiles.ts +++ b/addons/isl-server/src/GeneratedFiles.ts @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {AbsolutePath, RepoRelativePath} from 'isl/src/types'; import type {Repository} from './Repository'; import type {RepositoryContext} from './serverTypes'; -import type {AbsolutePath, RepoRelativePath} from 'isl/src/types'; -import {Internal} from './Internal'; import {GeneratedStatus} from 'isl/src/types'; import {promises as fs} from 'node:fs'; import pathMod from 'node:path'; import {LRU} from 'shared/LRU'; import {group} from 'shared/utils'; +import {Internal} from './Internal'; export const GENERATED_TAG = '@' + 'generated'; export const PARTIALLY_GENERATED_TAG = '@' + 'partially-generated'; diff --git a/addons/isl-server/src/OperationQueue.ts b/addons/isl-server/src/OperationQueue.ts index 4e5e52c532aa5..b12d6562c72df 100644 --- a/addons/isl-server/src/OperationQueue.ts +++ b/addons/isl-server/src/OperationQueue.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {ServerSideTracker} from './analytics/serverSideTracker'; -import type {RepositoryContext} from './serverTypes'; import type { OperationCommandProgressReporter, OperationProgress, RunnableOperation, } from 'isl/src/types'; import type {Deferred} from 'shared/utils'; +import type {ServerSideTracker} from './analytics/serverSideTracker'; +import type {RepositoryContext} from './serverTypes'; import {clearTrackedCache} from 'shared/LRU'; import {newAbortController} from 'shared/compat'; diff --git a/addons/isl-server/src/Repository.ts b/addons/isl-server/src/Repository.ts index c3105f558d6e0..3ef4eb8cfdd76 100644 --- a/addons/isl-server/src/Repository.ts +++ b/addons/isl-server/src/Repository.ts @@ -5,43 +5,59 @@ * LICENSE file in the root directory of this source tree. */ -import type {CodeReviewProvider} from './CodeReviewProvider'; -import type {KindOfChange, PollKind} from './WatchForChanges'; -import type {TrackEventName} from './analytics/eventNames'; -import type {ConfigLevel, ResolveCommandConflictOutput} from './commands'; -import type {RepositoryContext} from './serverTypes'; import type { + AbsolutePath, + Alert, + ChangedFile, + CodeReviewSystem, + CommitCloudSyncState, CommitInfo, + ConfigName, + CwdInfo, + DiffId, Disposable, - UncommittedChanges, - ChangedFile, - RepoInfo, + FetchedCommits, + FetchedUncommittedChanges, + Hash, + MergeConflicts, OperationCommandProgressReporter, - AbsolutePath, - RunnableOperation, OperationProgress, - DiffId, PageVisibility, - MergeConflicts, - ValidatedRepoInfo, - CodeReviewSystem, - Revset, PreferredSubmitCommand, - FetchedUncommittedChanges, - FetchedCommits, - ShelvedChange, - CommitCloudSyncState, - Hash, - ConfigName, - Alert, + RepoInfo, RepoRelativePath, + Revset, + RunnableOperation, SettableConfigName, + ShelvedChange, StableInfo, - CwdInfo, + UncommittedChanges, + ValidatedRepoInfo, } from 'isl/src/types'; import type {Comparison} from 'shared/Comparison'; -import type {EjecaChildProcess, EjecaOptions, EjecaError} from 'shared/ejeca'; +import type {EjecaChildProcess, EjecaError, EjecaOptions} from 'shared/ejeca'; +import type {CodeReviewProvider} from './CodeReviewProvider'; +import type {KindOfChange, PollKind} from './WatchForChanges'; +import type {TrackEventName} from './analytics/eventNames'; +import type {ConfigLevel, ResolveCommandConflictOutput} from './commands'; +import type {RepositoryContext} from './serverTypes'; +import { + CommandRunner, + CommitCloudBackupStatus, + allConfigNames, + settableConfigNames, +} from 'isl/src/types'; +import fs from 'node:fs'; +import path from 'node:path'; +import {revsetArgsForComparison} from 'shared/Comparison'; +import {LRU} from 'shared/LRU'; +import {RateLimiter} from 'shared/RateLimiter'; +import {TypedEventEmitter} from 'shared/TypedEventEmitter'; +import {ejeca} from 'shared/ejeca'; +import {exists} from 'shared/fs'; +import {removeLeadingPathSep} from 'shared/pathUtils'; +import {notEmpty, nullthrows, randomId} from 'shared/utils'; import {Internal} from './Internal'; import {OperationQueue} from './OperationQueue'; import {PageFocusTracker} from './PageFocusTracker'; @@ -79,22 +95,6 @@ import { isEjecaError, serializeAsyncCall, } from './utils'; -import { - settableConfigNames, - allConfigNames, - CommitCloudBackupStatus, - CommandRunner, -} from 'isl/src/types'; -import fs from 'node:fs'; -import path from 'node:path'; -import {revsetArgsForComparison} from 'shared/Comparison'; -import {LRU} from 'shared/LRU'; -import {RateLimiter} from 'shared/RateLimiter'; -import {TypedEventEmitter} from 'shared/TypedEventEmitter'; -import {ejeca} from 'shared/ejeca'; -import {exists} from 'shared/fs'; -import {removeLeadingPathSep} from 'shared/pathUtils'; -import {notEmpty, randomId, nullthrows} from 'shared/utils'; /** * This class is responsible for providing information about the working copy diff --git a/addons/isl-server/src/RepositoryCache.ts b/addons/isl-server/src/RepositoryCache.ts index c8be851ec9905..9587c83440622 100644 --- a/addons/isl-server/src/RepositoryCache.ts +++ b/addons/isl-server/src/RepositoryCache.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {RepositoryContext} from './serverTypes'; import type {AbsolutePath, RepositoryError, ValidatedRepoInfo} from 'isl/src/types'; +import type {RepositoryContext} from './serverTypes'; -import {Repository} from './Repository'; import {TypedEventEmitter} from 'shared/TypedEventEmitter'; import {ensureTrailingPathSep} from 'shared/pathUtils'; +import {Repository} from './Repository'; /** * Reference-counting access to a {@link Repository}, via a Promise. diff --git a/addons/isl-server/src/ServerToClientAPI.ts b/addons/isl-server/src/ServerToClientAPI.ts index 31f43e47ecae2..5abfe6b70e8d5 100644 --- a/addons/isl-server/src/ServerToClientAPI.ts +++ b/addons/isl-server/src/ServerToClientAPI.ts @@ -5,42 +5,42 @@ * LICENSE file in the root directory of this source tree. */ -import type {ClientConnection} from '.'; -import type {RepositoryReference} from './RepositoryCache'; -import type {ServerSideTracker} from './analytics/serverSideTracker'; -import type {Logger} from './logger'; -import type {ServerPlatform} from './serverPlatform'; -import type {RepositoryContext} from './serverTypes'; import type {TypeaheadResult} from 'isl-components/Types'; import type {Serializable} from 'isl/src/serialize'; import type { - ServerToClientMessage, ClientToServerMessage, + CodeReviewProviderSpecificClientToServerMessages, Disposable, - Result, - MergeConflicts, - RepositoryError, - PlatformSpecificClientToServerMessages, - FileABugProgress, FetchedCommits, FetchedUncommittedChanges, + FileABugProgress, LandInfo, - CodeReviewProviderSpecificClientToServerMessages, + MergeConflicts, + PlatformSpecificClientToServerMessages, + RepositoryError, + Result, + ServerToClientMessage, StableLocationData, } from 'isl/src/types'; import type {EjecaError} from 'shared/ejeca'; import type {ExportStack, ImportedStack} from 'shared/types/stack'; +import type {ClientConnection} from '.'; +import type {RepositoryReference} from './RepositoryCache'; +import type {ServerSideTracker} from './analytics/serverSideTracker'; +import type {Logger} from './logger'; +import type {ServerPlatform} from './serverPlatform'; +import type {RepositoryContext} from './serverTypes'; +import {deserializeFromString, serializeToString} from 'isl/src/serialize'; +import {Readable} from 'node:stream'; +import path from 'path'; +import {beforeRevsetForComparison} from 'shared/Comparison'; +import {base64Decode, notEmpty, randomId} from 'shared/utils'; import {generatedFilesDetector} from './GeneratedFiles'; import {Internal} from './Internal'; import {Repository, absolutePathForFileInRepo} from './Repository'; import {repositoryCache} from './RepositoryCache'; import {firstOfIterable, parseExecJson} from './utils'; -import {serializeToString, deserializeFromString} from 'isl/src/serialize'; -import {Readable} from 'node:stream'; -import path from 'path'; -import {beforeRevsetForComparison, revsetForComparison} from 'shared/Comparison'; -import {randomId, notEmpty, base64Decode} from 'shared/utils'; export type IncomingMessage = ClientToServerMessage; export type OutgoingMessage = ServerToClientMessage; diff --git a/addons/isl-server/src/WatchForChanges.ts b/addons/isl-server/src/WatchForChanges.ts index 6010f89b4656b..edc83987dd2aa 100644 --- a/addons/isl-server/src/WatchForChanges.ts +++ b/addons/isl-server/src/WatchForChanges.ts @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {PageVisibility, RepoInfo} from 'isl/src/types'; import type {PageFocusTracker} from './PageFocusTracker'; import type {Logger} from './logger'; -import type {PageVisibility, RepoInfo} from 'isl/src/types'; -import {stagedThrottler} from './StagedThrottler'; -import {ONE_MINUTE_MS} from './constants'; -import {Watchman} from './watchman'; import fs from 'node:fs/promises'; import path from 'node:path'; import {debounce} from 'shared/debounce'; +import {stagedThrottler} from './StagedThrottler'; +import {ONE_MINUTE_MS} from './constants'; +import {Watchman} from './watchman'; const DEFAULT_POLL_INTERVAL = 5 * ONE_MINUTE_MS; // When the page is hidden, aggressively reduce polling. diff --git a/addons/isl-server/src/__tests__/GeneratedFiles.test.ts b/addons/isl-server/src/__tests__/GeneratedFiles.test.ts index 3211361825c3d..83f5cdaf007e0 100644 --- a/addons/isl-server/src/__tests__/GeneratedFiles.test.ts +++ b/addons/isl-server/src/__tests__/GeneratedFiles.test.ts @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import type {PathLike} from 'node:fs'; +import type {FileHandle} from 'node:fs/promises'; import type {Repository} from '../Repository'; import type {ServerPlatform} from '../serverPlatform'; import type {RepositoryContext} from '../serverTypes'; -import type {PathLike} from 'node:fs'; -import type {FileHandle} from 'node:fs/promises'; -import {GeneratedFilesDetector} from '../GeneratedFiles'; -import {makeServerSideTracker} from '../analytics/serverSideTracker'; import {GeneratedStatus} from 'isl/src/types'; import {promises} from 'node:fs'; import {mockLogger} from 'shared/testUtils'; +import {GeneratedFilesDetector} from '../GeneratedFiles'; +import {makeServerSideTracker} from '../analytics/serverSideTracker'; /* eslint-disable require-await */ diff --git a/addons/isl-server/src/__tests__/OperationQueue.test.ts b/addons/isl-server/src/__tests__/OperationQueue.test.ts index d2014902c7009..4da164178ee19 100644 --- a/addons/isl-server/src/__tests__/OperationQueue.test.ts +++ b/addons/isl-server/src/__tests__/OperationQueue.test.ts @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import type {OperationCommandProgressReporter} from 'isl/src/types'; import type {ServerPlatform} from '../serverPlatform'; import type {RepositoryContext} from '../serverTypes'; -import type {OperationCommandProgressReporter} from 'isl/src/types'; -import {OperationQueue} from '../OperationQueue'; -import {makeServerSideTracker} from '../analytics/serverSideTracker'; import {CommandRunner} from 'isl/src/types'; import {mockLogger} from 'shared/testUtils'; import {defer} from 'shared/utils'; +import {OperationQueue} from '../OperationQueue'; +import {makeServerSideTracker} from '../analytics/serverSideTracker'; const mockTracker = makeServerSideTracker( mockLogger, diff --git a/addons/isl-server/src/__tests__/Repository.test.ts b/addons/isl-server/src/__tests__/Repository.test.ts index 8901763614a6c..7966272c39a3e 100644 --- a/addons/isl-server/src/__tests__/Repository.test.ts +++ b/addons/isl-server/src/__tests__/Repository.test.ts @@ -5,14 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import type {RunnableOperation} from 'isl/src/types'; import type {ResolveCommandConflictOutput} from '../commands'; import type {ServerPlatform} from '../serverPlatform'; import type {RepositoryContext} from '../serverTypes'; -import type {RunnableOperation} from 'isl/src/types'; -import {absolutePathForFileInRepo, Repository} from '../Repository'; -import {makeServerSideTracker} from '../analytics/serverSideTracker'; -import {extractRepoInfoFromUrl, setConfigOverrideForTests} from '../commands'; import {CommandRunner, type MergeConflicts, type ValidatedRepoInfo} from 'isl/src/types'; import fs from 'node:fs'; import os from 'node:os'; @@ -20,6 +17,9 @@ import path from 'node:path'; import * as ejeca from 'shared/ejeca'; import * as fsUtils from 'shared/fs'; import {clone, mockLogger, nextTick} from 'shared/testUtils'; +import {absolutePathForFileInRepo, Repository} from '../Repository'; +import {makeServerSideTracker} from '../analytics/serverSideTracker'; +import {extractRepoInfoFromUrl, setConfigOverrideForTests} from '../commands'; /* eslint-disable require-await */ diff --git a/addons/isl-server/src/__tests__/RepositoryCache.test.ts b/addons/isl-server/src/__tests__/RepositoryCache.test.ts index 4fff95e5eea45..2b827e13baf6b 100644 --- a/addons/isl-server/src/__tests__/RepositoryCache.test.ts +++ b/addons/isl-server/src/__tests__/RepositoryCache.test.ts @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {RepoInfo, RepositoryError} from 'isl/src/types'; import type {Repository} from '../Repository'; import type {Logger} from '../logger'; import type {ServerPlatform} from '../serverPlatform'; import type {RepositoryContext} from '../serverTypes'; -import type {RepoInfo, RepositoryError} from 'isl/src/types'; -import {__TEST__} from '../RepositoryCache'; -import {makeServerSideTracker} from '../analytics/serverSideTracker'; import {mockLogger} from 'shared/testUtils'; import {defer} from 'shared/utils'; +import {__TEST__} from '../RepositoryCache'; +import {makeServerSideTracker} from '../analytics/serverSideTracker'; const {RepositoryCache} = __TEST__; diff --git a/addons/isl-server/src/__tests__/WatchForChanges.ts b/addons/isl-server/src/__tests__/WatchForChanges.ts index 5d70d7fa60411..2890872c7745e 100644 --- a/addons/isl-server/src/__tests__/WatchForChanges.ts +++ b/addons/isl-server/src/__tests__/WatchForChanges.ts @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -import type {Watchman} from '../watchman'; import type {Client} from 'fb-watchman'; import type {RepoInfo} from 'isl/src/types'; +import type {Watchman} from '../watchman'; -import {PageFocusTracker} from '../PageFocusTracker'; -import {WatchForChanges} from '../WatchForChanges'; -import {ONE_MINUTE_MS} from '../constants'; import fs from 'node:fs'; import {TypedEventEmitter} from 'shared/TypedEventEmitter'; import {mockLogger} from 'shared/testUtils'; +import {PageFocusTracker} from '../PageFocusTracker'; +import {WatchForChanges} from '../WatchForChanges'; +import {ONE_MINUTE_MS} from '../constants'; jest.mock('fb-watchman', () => { // make a fake watchman object which returns () => undefined for every property diff --git a/addons/isl-server/src/__tests__/analytics.test.ts b/addons/isl-server/src/__tests__/analytics.test.ts index 9b93d187c614f..5a7a77cd1634f 100644 --- a/addons/isl-server/src/__tests__/analytics.test.ts +++ b/addons/isl-server/src/__tests__/analytics.test.ts @@ -10,12 +10,12 @@ import type {FullTrackData} from '../analytics/types'; import type {ServerPlatform} from '../serverPlatform'; import type {RepositoryContext} from '../serverTypes'; -import {Repository} from '../Repository'; -import {makeServerSideTracker} from '../analytics/serverSideTracker'; -import {setConfigOverrideForTests} from '../commands'; import * as ejeca from 'shared/ejeca'; import {mockLogger} from 'shared/testUtils'; import {defer} from 'shared/utils'; +import {Repository} from '../Repository'; +import {makeServerSideTracker} from '../analytics/serverSideTracker'; +import {setConfigOverrideForTests} from '../commands'; /** Matches any non-empty string */ const anyActualString = expect.stringMatching(/.+/); diff --git a/addons/isl-server/src/__tests__/templates.test.ts b/addons/isl-server/src/__tests__/templates.test.ts index b8322aced12ff..d89fdcded69b1 100644 --- a/addons/isl-server/src/__tests__/templates.test.ts +++ b/addons/isl-server/src/__tests__/templates.test.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {COMMIT_END_MARK, findMaxCommonPathPrefix, parseCommitInfoOutput} from '../templates'; import path from 'path'; import {mockLogger} from 'shared/testUtils'; +import {COMMIT_END_MARK, findMaxCommonPathPrefix, parseCommitInfoOutput} from '../templates'; describe('template parsing', () => { it('parses normal commits', () => { diff --git a/addons/isl-server/src/analytics/environment.ts b/addons/isl-server/src/analytics/environment.ts index 0a9abe1b1c263..0f7dacdbd4895 100644 --- a/addons/isl-server/src/analytics/environment.ts +++ b/addons/isl-server/src/analytics/environment.ts @@ -8,7 +8,7 @@ import type {ApplicationInfo} from './types'; import os from 'node:os'; -import {randomId, nullthrows} from 'shared/utils'; +import {nullthrows, randomId} from 'shared/utils'; export function getUsername(): string { try { diff --git a/addons/isl-server/src/commands.ts b/addons/isl-server/src/commands.ts index ad2044f552e68..5be0150646117 100644 --- a/addons/isl-server/src/commands.ts +++ b/addons/isl-server/src/commands.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {RepositoryContext} from './serverTypes'; import type {EjecaOptions, EjecaReturn} from 'shared/ejeca'; +import type {RepositoryContext} from './serverTypes'; -import {isEjecaError} from './utils'; import {ConflictType, type AbsolutePath, type MergeConflicts} from 'isl/src/types'; import os from 'node:os'; import {ejeca} from 'shared/ejeca'; +import {isEjecaError} from './utils'; export const MAX_FETCHED_FILES_PER_COMMIT = 25; export const MAX_SIMULTANEOUS_CAT_CALLS = 4; diff --git a/addons/isl-server/src/github/githubCodeReviewProvider.ts b/addons/isl-server/src/github/githubCodeReviewProvider.ts index 7f52065aa60ef..a0766d744d105 100644 --- a/addons/isl-server/src/github/githubCodeReviewProvider.ts +++ b/addons/isl-server/src/github/githubCodeReviewProvider.ts @@ -5,6 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import type { + CodeReviewSystem, + DiffComment, + DiffId, + DiffSignalSummary, + Disposable, + Hash, + Result, +} from 'isl/src/types'; import type {CodeReviewProvider} from '../CodeReviewProvider'; import type {Logger} from '../logger'; import type { @@ -20,16 +29,10 @@ import type { YourPullRequestsWithoutMergeQueueQueryData, YourPullRequestsWithoutMergeQueueQueryVariables, } from './generated/graphql'; -import type { - CodeReviewSystem, - DiffSignalSummary, - DiffId, - Disposable, - Result, - DiffComment, - Hash, -} from 'isl/src/types'; +import {TypedEventEmitter} from 'shared/TypedEventEmitter'; +import {debounce} from 'shared/debounce'; +import {notEmpty} from 'shared/utils'; import { MergeQueueSupportQuery, PullRequestCommentsQuery, @@ -39,9 +42,6 @@ import { YourPullRequestsWithoutMergeQueueQuery, } from './generated/graphql'; import queryGraphQL from './queryGraphQL'; -import {TypedEventEmitter} from 'shared/TypedEventEmitter'; -import {debounce} from 'shared/debounce'; -import {notEmpty} from 'shared/utils'; export type GitHubDiffSummary = { type: 'github'; diff --git a/addons/isl-server/src/github/queryGraphQL.ts b/addons/isl-server/src/github/queryGraphQL.ts index 134e7ab277fa4..0b41d702ccf29 100644 --- a/addons/isl-server/src/github/queryGraphQL.ts +++ b/addons/isl-server/src/github/queryGraphQL.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {ejeca} from 'shared/ejeca'; import {Internal} from '../Internal'; import {isEjecaError, isEjecaSpawnError} from '../utils'; -import {ejeca} from 'shared/ejeca'; export default async function queryGraphQL( query: string, diff --git a/addons/isl-server/src/index.ts b/addons/isl-server/src/index.ts index 63b056910e7c2..07edb2680658c 100644 --- a/addons/isl-server/src/index.ts +++ b/addons/isl-server/src/index.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import type {AppMode} from 'isl/src/types'; import type {Logger} from './logger'; import type {ServerPlatform} from './serverPlatform'; -import type {AppMode} from 'isl/src/types'; import {FileLogger} from './FileLogger'; import {Internal} from './Internal'; diff --git a/addons/isl-server/src/serverPlatform.ts b/addons/isl-server/src/serverPlatform.ts index 587002699d575..e16ed777ee11d 100644 --- a/addons/isl-server/src/serverPlatform.ts +++ b/addons/isl-server/src/serverPlatform.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {Repository} from './Repository'; -import type {RepositoryContext} from './serverTypes'; import type { AbsolutePath, PlatformSpecificClientToServerMessages, RepoRelativePath, ServerToClientMessage, } from 'isl/src/types'; +import type {Repository} from './Repository'; +import type {RepositoryContext} from './serverTypes'; import {spawn} from 'node:child_process'; import pathModule from 'node:path'; diff --git a/addons/isl-server/src/serverTypes.ts b/addons/isl-server/src/serverTypes.ts index 907c43c34b1fa..1ab8d0256a635 100644 --- a/addons/isl-server/src/serverTypes.ts +++ b/addons/isl-server/src/serverTypes.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import type {ConfigName} from 'isl/src/types'; import type {ServerSideTracker} from './analytics/serverSideTracker'; import type {Logger} from './logger'; -import type {ConfigName} from 'isl/src/types'; /** * Per-connection context with which to access a repository. diff --git a/addons/isl-server/src/templates.ts b/addons/isl-server/src/templates.ts index 2b29d60f5ffc8..43b2d6d0455b7 100644 --- a/addons/isl-server/src/templates.ts +++ b/addons/isl-server/src/templates.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import type {Logger} from './logger'; import type { ChangedFile, CommitInfo, @@ -18,11 +17,12 @@ import type { StableInfo, SuccessorInfo, } from 'isl/src/types'; +import type {Logger} from './logger'; +import path from 'path'; import {Internal} from './Internal'; import {MAX_FETCHED_FILES_PER_COMMIT} from './commands'; import {fromEntries} from './utils'; -import path from 'path'; export const COMMIT_END_MARK = '<>'; export const NULL_CHAR = '\0'; diff --git a/addons/isl-server/src/utils.ts b/addons/isl-server/src/utils.ts index f3f4960383215..b6dc86199f4c1 100644 --- a/addons/isl-server/src/utils.ts +++ b/addons/isl-server/src/utils.ts @@ -6,7 +6,7 @@ */ import type {CommitInfo, SmartlogCommits} from 'isl/src/types'; -import type {EjecaError, EjecaReturn, EjecaChildProcess} from 'shared/ejeca'; +import type {EjecaChildProcess, EjecaError, EjecaReturn} from 'shared/ejeca'; import os from 'node:os'; import {truncate} from 'shared/utils'; diff --git a/addons/isl-server/src/watchman.ts b/addons/isl-server/src/watchman.ts index ca150e7043329..7be20c78ffe06 100644 --- a/addons/isl-server/src/watchman.ts +++ b/addons/isl-server/src/watchman.ts @@ -7,10 +7,10 @@ import type {Logger} from './logger'; -import {firstOfIterable, serializeAsyncCall, sleep} from './utils'; import watchman from 'fb-watchman'; import {EventEmitter} from 'node:events'; import path from 'node:path'; +import {firstOfIterable, serializeAsyncCall, sleep} from './utils'; export type WatchmanSubscriptionOptions = { fields?: Array; diff --git a/addons/isl/integrationTests/commits.test.tsx b/addons/isl/integrationTests/commits.test.tsx index 49213ed58959b..5c5a62d658414 100644 --- a/addons/isl/integrationTests/commits.test.tsx +++ b/addons/isl/integrationTests/commits.test.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {initRepo} from './setup'; import {act, screen, waitFor, within} from '@testing-library/react'; +import {initRepo} from './setup'; describe('commits integration test', () => { it('shows commits', async () => { diff --git a/addons/isl/integrationTests/mergeConflicts.test.tsx b/addons/isl/integrationTests/mergeConflicts.test.tsx index f14dabff84692..4235106a2523e 100644 --- a/addons/isl/integrationTests/mergeConflicts.test.tsx +++ b/addons/isl/integrationTests/mergeConflicts.test.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {initRepo} from './setup'; import {act, screen, waitFor, within} from '@testing-library/react'; +import {initRepo} from './setup'; describe('merge conflicts integration test', () => { it('shows conflicts, supports resolving, and continuing the operation', async () => { diff --git a/addons/isl/integrationTests/mergeConflictsMultiple.test.tsx b/addons/isl/integrationTests/mergeConflictsMultiple.test.tsx index 4c9a82a31246a..7d47f9af29acb 100644 --- a/addons/isl/integrationTests/mergeConflictsMultiple.test.tsx +++ b/addons/isl/integrationTests/mergeConflictsMultiple.test.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {initRepo} from './setup'; import {act, screen, waitFor, within} from '@testing-library/react'; +import {initRepo} from './setup'; describe('multiple merge conflicts integration test', () => { it('shows conflicts, supports resolving, and continuing the operation', async () => { diff --git a/addons/isl/integrationTests/setup.tsx b/addons/isl/integrationTests/setup.tsx index 9b8a180e389ea..752c7c38139e2 100644 --- a/addons/isl/integrationTests/setup.tsx +++ b/addons/isl/integrationTests/setup.tsx @@ -5,16 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {MessageBusStatus} from '../src/MessageBus'; -import type {Disposable, RepoRelativePath} from '../src/types'; import type {Level} from 'isl-server/src/logger'; import type {ServerPlatform} from 'isl-server/src/serverPlatform'; import type {RepositoryContext} from 'isl-server/src/serverTypes'; import type {TypedEventEmitter} from 'shared/TypedEventEmitter'; import type {EjecaOptions} from 'shared/ejeca'; +import type {MessageBusStatus} from '../src/MessageBus'; +import type {Disposable, RepoRelativePath} from '../src/types'; -import {onClientConnection} from '../../isl-server/src/index'; -import platform from '../src/platform'; import {fireEvent, render, screen} from '@testing-library/react'; import {makeServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; import {runCommand} from 'isl-server/src/commands'; @@ -22,6 +20,8 @@ import {StdoutLogger} from 'isl-server/src/logger'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; +import {onClientConnection} from '../../isl-server/src/index'; +import platform from '../src/platform'; const IS_CI = !!process.env.SANDCASTLE || !!process.env.GITHUB_ACTIONS; diff --git a/addons/isl/integrationTests/uncommittedChanges.test.tsx b/addons/isl/integrationTests/uncommittedChanges.test.tsx index dfa7c2aea003e..827de1a6f65af 100644 --- a/addons/isl/integrationTests/uncommittedChanges.test.tsx +++ b/addons/isl/integrationTests/uncommittedChanges.test.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {initRepo} from './setup'; import {act, screen, waitFor, within} from '@testing-library/react'; +import {initRepo} from './setup'; describe('uncommitted changes integration test', () => { it('shows changed file', async () => { diff --git a/addons/isl/src/AnimatedReorderGroup.tsx b/addons/isl/src/AnimatedReorderGroup.tsx index 379a600bfe517..f7a2d4cbf3086 100644 --- a/addons/isl/src/AnimatedReorderGroup.tsx +++ b/addons/isl/src/AnimatedReorderGroup.tsx @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {prefersReducedMotion} from './mediaQuery'; import deepEqual from 'fast-deep-equal'; -import React, {useRef, useLayoutEffect} from 'react'; +import React, {useLayoutEffect, useRef} from 'react'; +import {prefersReducedMotion} from './mediaQuery'; type ReorderGroupProps = React.HTMLAttributes & { children: React.ReactElement[]; diff --git a/addons/isl/src/App.tsx b/addons/isl/src/App.tsx index 99c6ac8de0c5e..9fbc77375f610 100644 --- a/addons/isl/src/App.tsx +++ b/addons/isl/src/App.tsx @@ -7,12 +7,18 @@ import type {AppMode, RepositoryError} from './types'; +import {Button} from 'isl-components/Button'; +import {ErrorBoundary, ErrorNotice} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {atom, useAtomValue, useSetAtom} from 'jotai'; +import {Suspense, useMemo} from 'react'; +import {useThrottledEffect} from 'shared/hooks'; import {AllProviders} from './AppWrapper'; import {CommandHistoryAndProgress} from './CommandHistoryAndProgress'; import {CommitInfoSidebar} from './CommitInfoView/CommitInfoView'; import {CommitTreeList} from './CommitTreeList'; import {ComparisonViewApp, ComparisonViewModal} from './ComparisonView/ComparisonViewModal'; -import {CwdSelections, availableCwds} from './CwdSelector'; +import {availableCwds, CwdSelections} from './CwdSelector'; import {Drawers} from './Drawers'; import {EmptyState} from './EmptyState'; import {useCommand} from './ISLShortcuts'; @@ -26,12 +32,6 @@ import {t, T} from './i18n'; import platform from './platform'; import {useMainContentWidth} from './responsive'; import {repositoryInfo} from './serverAPIState'; -import {Button} from 'isl-components/Button'; -import {ErrorBoundary, ErrorNotice} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {atom, useAtomValue, useSetAtom} from 'jotai'; -import {Suspense, useMemo} from 'react'; -import {useThrottledEffect} from 'shared/hooks'; import './index.css'; diff --git a/addons/isl/src/AppWrapper.tsx b/addons/isl/src/AppWrapper.tsx index 111ee35254f7d..40ff7ff015d14 100644 --- a/addons/isl/src/AppWrapper.tsx +++ b/addons/isl/src/AppWrapper.tsx @@ -7,6 +7,12 @@ import type {ReactNode} from 'react'; +import {ErrorBoundary} from 'isl-components/ErrorNotice'; +import {ThemedComponentsRoot} from 'isl-components/ThemedComponentsRoot'; +import {ViewportOverlayRoot} from 'isl-components/ViewportOverlay'; +import {Provider, useAtomValue, useStore} from 'jotai'; +import React from 'react'; +import {ContextMenus} from 'shared/ContextMenu'; import {ISLCommandContext} from './ISLShortcuts'; import {SuspenseBoundary} from './SuspenseBoundary'; import {TopLevelToast} from './TopLevelToast'; @@ -20,12 +26,6 @@ import {themeState} from './theme'; import {ModalContainer} from './useModal'; import {usePromise} from './usePromise'; import {isDev, isTest} from './utils'; -import {ErrorBoundary} from 'isl-components/ErrorNotice'; -import {ThemedComponentsRoot} from 'isl-components/ThemedComponentsRoot'; -import {ViewportOverlayRoot} from 'isl-components/ViewportOverlay'; -import {Provider, useAtomValue, useStore} from 'jotai'; -import React from 'react'; -import {ContextMenus} from 'shared/ContextMenu'; export function AllProviders({children}: {children: ReactNode}) { return ( diff --git a/addons/isl/src/Avatar.tsx b/addons/isl/src/Avatar.tsx index 1e112c5a6e7ab..dd3c6af55ba0c 100644 --- a/addons/isl/src/Avatar.tsx +++ b/addons/isl/src/Avatar.tsx @@ -7,12 +7,12 @@ import type {DetailedHTMLProps} from 'react'; +import * as stylex from '@stylexjs/stylex'; +import {useAtomValue} from 'jotai'; import {colors, radius} from '../../components/theme/tokens.stylex'; import serverAPI from './ClientToServerAPI'; import {t} from './i18n'; import {atomFamilyWeak, lazyAtom} from './jotaiUtils'; -import * as stylex from '@stylexjs/stylex'; -import {useAtomValue} from 'jotai'; const avatarUrl = atomFamilyWeak((author: string) => { // Rate limitor for the same author is by lazyAtom and atomFamilyWeak caching. diff --git a/addons/isl/src/Bookmark.tsx b/addons/isl/src/Bookmark.tsx index c8f1eeb1b8476..15409881de617 100644 --- a/addons/isl/src/Bookmark.tsx +++ b/addons/isl/src/Bookmark.tsx @@ -5,18 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {CommitInfo} from './types'; import type {ContextMenuItem} from 'shared/ContextMenu'; +import type {CommitInfo} from './types'; -import {bookmarksDataStorage} from './BookmarksData'; -import {Row} from './ComponentUtils'; -import {tracker} from './analytics'; -import {T, t} from './i18n'; -import {BookmarkCreateOperation} from './operations/BookmarkCreateOperation'; -import {BookmarkDeleteOperation} from './operations/BookmarkDeleteOperation'; -import {useRunOperation} from './operationsState'; -import {latestSuccessorUnlessExplicitlyObsolete} from './successionUtils'; -import {showModal} from './useModal'; import * as stylex from '@stylexjs/stylex'; import {Button} from 'isl-components/Button'; import {Column} from 'isl-components/Flex'; @@ -26,6 +17,15 @@ import {Tooltip} from 'isl-components/Tooltip'; import {useAtomValue} from 'jotai'; import {useState} from 'react'; import {useContextMenu} from 'shared/ContextMenu'; +import {bookmarksDataStorage} from './BookmarksData'; +import {Row} from './ComponentUtils'; +import {tracker} from './analytics'; +import {T, t} from './i18n'; +import {BookmarkCreateOperation} from './operations/BookmarkCreateOperation'; +import {BookmarkDeleteOperation} from './operations/BookmarkDeleteOperation'; +import {useRunOperation} from './operationsState'; +import {latestSuccessorUnlessExplicitlyObsolete} from './successionUtils'; +import {showModal} from './useModal'; const styles = stylex.create({ stable: { diff --git a/addons/isl/src/BookmarksData.tsx b/addons/isl/src/BookmarksData.tsx index 24214e18f97ac..345e785bf1148 100644 --- a/addons/isl/src/BookmarksData.tsx +++ b/addons/isl/src/BookmarksData.tsx @@ -7,11 +7,11 @@ import type {StableLocationData} from './types'; +import {atom} from 'jotai'; import serverAPI from './ClientToServerAPI'; import {localStorageBackedAtom, readAtom, writeAtom} from './jotaiUtils'; import {latestCommits} from './serverAPIState'; import {registerDisposable} from './utils'; -import {atom} from 'jotai'; type BookmarksData = { /** These bookmarks should be hidden from the automatic set of remote bookmarks */ diff --git a/addons/isl/src/BookmarksManager.tsx b/addons/isl/src/BookmarksManager.tsx index 0f343e92b51b6..dd396a7b5cd2f 100644 --- a/addons/isl/src/BookmarksManager.tsx +++ b/addons/isl/src/BookmarksManager.tsx @@ -5,11 +5,26 @@ * LICENSE file in the root directory of this source tree. */ -import type {BookmarkKind} from './Bookmark'; -import type {Result, StableInfo} from './types'; import type {TypeaheadResult} from 'isl-components/Types'; import type {ReactNode} from 'react'; +import type {BookmarkKind} from './Bookmark'; +import type {Result, StableInfo} from './types'; +import * as stylex from '@stylexjs/stylex'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Checkbox} from 'isl-components/Checkbox'; +import {InlineErrorBadge} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {Subtle} from 'isl-components/Subtle'; +import {extractTokens} from 'isl-components/Tokens'; +import {Tooltip} from 'isl-components/Tooltip'; +import {Typeahead} from 'isl-components/Typeahead'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import React, {useState} from 'react'; +import {firstLine, notEmpty} from 'shared/utils'; import {spacing} from '../../components/theme/tokens.stylex'; import {Bookmark} from './Bookmark'; import { @@ -27,21 +42,6 @@ import {Internal} from './Internal'; import {T, t} from './i18n'; import {readAtom} from './jotaiUtils'; import {latestDag} from './serverAPIState'; -import * as stylex from '@stylexjs/stylex'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Checkbox} from 'isl-components/Checkbox'; -import {InlineErrorBadge} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; -import {Subtle} from 'isl-components/Subtle'; -import {extractTokens} from 'isl-components/Tokens'; -import {Tooltip} from 'isl-components/Tooltip'; -import {Typeahead} from 'isl-components/Typeahead'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import React, {useState} from 'react'; -import {firstLine, notEmpty} from 'shared/utils'; const styles = stylex.create({ container: { diff --git a/addons/isl/src/BrowseRepo.ts b/addons/isl/src/BrowseRepo.ts index 7f2a4a6c7ae39..28005572f4137 100644 --- a/addons/isl/src/BrowseRepo.ts +++ b/addons/isl/src/BrowseRepo.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {Hash, RepoRelativePath} from './types'; import type {Comparison} from 'shared/Comparison'; +import type {Hash, RepoRelativePath} from './types'; +import {revsetForComparison} from 'shared/Comparison'; import serverAPI from './ClientToServerAPI'; import {configBackedAtom} from './jotaiUtils'; import platform from './platform'; import {copyAndShowToast, showToast} from './toast'; -import {revsetForComparison} from 'shared/Comparison'; export const supportsBrowseUrlForHash = configBackedAtom( 'fbcodereview.code-browser-url', diff --git a/addons/isl/src/BugButton.tsx b/addons/isl/src/BugButton.tsx index bca86d0162204..6b6d98f99a72c 100644 --- a/addons/isl/src/BugButton.tsx +++ b/addons/isl/src/BugButton.tsx @@ -7,13 +7,6 @@ import type {Heartbeat} from './heartbeat'; -import {Copyable} from './Copyable'; -import {DropdownFields} from './DropdownFields'; -import {Internal} from './Internal'; -import {DEFAULT_HEARTBEAT_TIMEOUT_MS, useHeartbeat} from './heartbeat'; -import {t, T} from './i18n'; -import platform from './platform'; -import {applicationinfo} from './serverAPIState'; import * as stylex from '@stylexjs/stylex'; import {Button} from 'isl-components/Button'; import {Divider} from 'isl-components/Divider'; @@ -22,6 +15,13 @@ import {Icon} from 'isl-components/Icon'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtomValue} from 'jotai'; import {Suspense} from 'react'; +import {Copyable} from './Copyable'; +import {DropdownFields} from './DropdownFields'; +import {Internal} from './Internal'; +import {DEFAULT_HEARTBEAT_TIMEOUT_MS, useHeartbeat} from './heartbeat'; +import {t, T} from './i18n'; +import platform from './platform'; +import {applicationinfo} from './serverAPIState'; import './BugButton.css'; diff --git a/addons/isl/src/BulkActionsMenu.tsx b/addons/isl/src/BulkActionsMenu.tsx index cbba54be09ef0..61de70e5cb0c7 100644 --- a/addons/isl/src/BulkActionsMenu.tsx +++ b/addons/isl/src/BulkActionsMenu.tsx @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {Tooltip} from 'isl-components/Tooltip'; import {CleanupAllButton} from './Cleanup'; import {DropdownFields} from './DropdownFields'; import {useCommandEvent} from './ISLShortcuts'; import {SelectAllButton} from './SelectAllCommits'; import {SuggestedRebaseButton} from './SuggestedRebase'; import {T} from './i18n'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; -import {Tooltip} from 'isl-components/Tooltip'; import './BulkActionsMenu.css'; diff --git a/addons/isl/src/ChangedFile.tsx b/addons/isl/src/ChangedFile.tsx index 63615efddf202..8b5f53ae7d450 100644 --- a/addons/isl/src/ChangedFile.tsx +++ b/addons/isl/src/ChangedFile.tsx @@ -5,15 +5,26 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; +import type {Comparison} from 'shared/Comparison'; import type {Place, UIChangedFile, VisualChangedFileType} from './UncommittedChanges'; import type {UseUncommittedSelection} from './partialSelection'; import type {ChangedFileType, GeneratedStatus} from './types'; -import type {ReactNode} from 'react'; -import type {Comparison} from 'shared/Comparison'; +import {Button} from 'isl-components/Button'; +import {Checkbox} from 'isl-components/Checkbox'; +import {Icon} from 'isl-components/Icon'; +import {isMac} from 'isl-components/OperatingSystem'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; +import React from 'react'; +import {ComparisonType, labelForComparison, revsetForComparison} from 'shared/Comparison'; +import {useContextMenu} from 'shared/ContextMenu'; +import {basename, notEmpty} from 'shared/utils'; import {copyUrlForFile, supportsBrowseUrlForHash} from './BrowseRepo'; import {type ChangedFilesDisplayType} from './ChangedFileDisplayTypePicker'; -import {generatedStatusToLabel, generatedStatusDescription} from './GeneratedFile'; +import {generatedStatusDescription, generatedStatusToLabel} from './GeneratedFile'; import {PartialFileSelectionWithMode} from './PartialFileSelection'; import {SuspenseBoundary} from './SuspenseBoundary'; import {holdingAltAtom, holdingCtrlAtom} from './atoms/keyboardAtoms'; @@ -35,17 +46,6 @@ import {optimisticMergeConflicts} from './previews'; import {copyAndShowToast} from './toast'; import {ConflictType, succeedableRevset} from './types'; import {usePromise} from './usePromise'; -import {Button} from 'isl-components/Button'; -import {Checkbox} from 'isl-components/Checkbox'; -import {Icon} from 'isl-components/Icon'; -import {isMac} from 'isl-components/OperatingSystem'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; -import React from 'react'; -import {labelForComparison, revsetForComparison, ComparisonType} from 'shared/Comparison'; -import {useContextMenu} from 'shared/ContextMenu'; -import {basename, notEmpty} from 'shared/utils'; /** * Is the alt key currently held down, used to show full file paths. diff --git a/addons/isl/src/ChangedFileDisplayTypePicker.tsx b/addons/isl/src/ChangedFileDisplayTypePicker.tsx index 4298fe011481a..77412c315d0d1 100644 --- a/addons/isl/src/ChangedFileDisplayTypePicker.tsx +++ b/addons/isl/src/ChangedFileDisplayTypePicker.tsx @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import {Row} from './ComponentUtils'; -import {t, T} from './i18n'; -import {configBackedAtom} from './jotaiUtils'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {isMac} from 'isl-components/OperatingSystem'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtom} from 'jotai'; import {useContextMenu} from 'shared/ContextMenu'; +import {Row} from './ComponentUtils'; +import {t, T} from './i18n'; +import {configBackedAtom} from './jotaiUtils'; export type ChangedFilesDisplayType = 'short' | 'fullPaths' | 'tree' | 'fish'; diff --git a/addons/isl/src/ChangedFilesWithFetching.tsx b/addons/isl/src/ChangedFilesWithFetching.tsx index 40197d773e22c..f09205b1fad95 100644 --- a/addons/isl/src/ChangedFilesWithFetching.tsx +++ b/addons/isl/src/ChangedFilesWithFetching.tsx @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -import type {Hash, Result, CommitInfo, FilesSample, ChangedFile} from './types'; +import type {ChangedFile, CommitInfo, FilesSample, Hash, Result} from './types'; -import serverAPI from './ClientToServerAPI'; -import {ChangedFiles} from './UncommittedChanges'; -import {t, T} from './i18n'; import {Button} from 'isl-components/Button'; import {Tooltip} from 'isl-components/Tooltip'; -import {useState, useEffect} from 'react'; +import {useEffect, useState} from 'react'; import {ComparisonType} from 'shared/Comparison'; import {LRU} from 'shared/LRU'; +import serverAPI from './ClientToServerAPI'; +import {ChangedFiles} from './UncommittedChanges'; +import {t, T} from './i18n'; // Cache fetches in progress so we don't double fetch const commitFilesCache = new LRU>>(10); diff --git a/addons/isl/src/Cleanup.tsx b/addons/isl/src/Cleanup.tsx index 3acdb48a36a7b..24ca5772d7c59 100644 --- a/addons/isl/src/Cleanup.tsx +++ b/addons/isl/src/Cleanup.tsx @@ -6,20 +6,20 @@ */ import type {UICodeReviewProvider} from './codeReview/UICodeReviewProvider'; -import type {DiffSummary, CommitInfo, Hash} from './types'; +import type {CommitInfo, DiffSummary, Hash} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; +import {nullthrows} from 'shared/utils'; import {OperationDisabledButton} from './OperationDisabledButton'; -import {codeReviewProvider, allDiffSummaries} from './codeReview/CodeReviewInfo'; +import {allDiffSummaries, codeReviewProvider} from './codeReview/CodeReviewInfo'; import {t, T} from './i18n'; import {HideOperation} from './operations/HideOperation'; import {useRunOperation} from './operationsState'; import {type Dag, dagWithPreviews} from './previews'; import {latestSuccessorUnlessExplicitlyObsolete} from './successionUtils'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; -import {nullthrows} from 'shared/utils'; export function isStackEligibleForCleanup( hash: Hash, diff --git a/addons/isl/src/ClientToServerAPI.ts b/addons/isl/src/ClientToServerAPI.ts index 95e0f5b2dc620..9206c8acdf8c2 100644 --- a/addons/isl/src/ClientToServerAPI.ts +++ b/addons/isl/src/ClientToServerAPI.ts @@ -6,11 +6,11 @@ */ import type {MessageBus} from './MessageBus'; -import type {ServerToClientMessage, ClientToServerMessage, Disposable} from './types'; +import type {ClientToServerMessage, Disposable, ServerToClientMessage} from './types'; +import {defer} from 'shared/utils'; import platform from './platform'; import {deserializeFromString, serializeToString} from './serialize'; -import {defer} from 'shared/utils'; export type IncomingMessage = ServerToClientMessage; export type OutgoingMessage = ClientToServerMessage; diff --git a/addons/isl/src/CommandHistoryAndProgress.tsx b/addons/isl/src/CommandHistoryAndProgress.tsx index 968bdfa68b531..172961179d625 100644 --- a/addons/isl/src/CommandHistoryAndProgress.tsx +++ b/addons/isl/src/CommandHistoryAndProgress.tsx @@ -5,10 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {Operation} from './operations/Operation'; import type {ValidatedRepoInfo} from './types'; -import type {ReactNode} from 'react'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Column, Row} from 'isl-components/Flex'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {notEmpty, truncate} from 'shared/utils'; import {Delayed} from './Delayed'; import {LogRenderExposures} from './analytics/LogRenderExposures'; import {codeReviewProvider} from './codeReview/CodeReviewInfo'; @@ -24,14 +32,6 @@ import {repositoryInfo} from './serverAPIState'; import {processTerminalLines} from './terminalOutput'; import {CommandRunner} from './types'; import {short} from './utils'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Column, Row} from 'isl-components/Flex'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {notEmpty, truncate} from 'shared/utils'; import './CommandHistoryAndProgress.css'; diff --git a/addons/isl/src/Commit.tsx b/addons/isl/src/Commit.tsx index e8c3cbaa392f9..e8c1096160487 100644 --- a/addons/isl/src/Commit.tsx +++ b/addons/isl/src/Commit.tsx @@ -5,12 +5,24 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; +import type {ContextMenuItem} from 'shared/ContextMenu'; import type {UICodeReviewProvider} from './codeReview/UICodeReviewProvider'; import type {DagCommitInfo} from './dag/dag'; import type {CommitInfo, SuccessorInfo} from './types'; -import type {ReactNode} from 'react'; -import type {ContextMenuItem} from 'shared/ContextMenu'; +import * as stylex from '@stylexjs/stylex'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtomValue, useSetAtom} from 'jotai'; +import React, {memo} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {useContextMenu} from 'shared/ContextMenu'; +import {MS_PER_DAY} from 'shared/constants'; +import {useAutofocusRef} from 'shared/hooks'; +import {notEmpty, nullthrows} from 'shared/utils'; import {spacing} from '../../components/theme/tokens.stylex'; import {AllBookmarksTruncated, Bookmark, Bookmarks, createBookmarkAtCommit} from './Bookmark'; import {openBrowseUrlForHash, supportsBrowseUrlForHash} from './BrowseRepo'; @@ -46,10 +58,10 @@ import {getAmendToOperation, isAmendToAllowedForCommit} from './operationUtils'; import {GotoOperation} from './operations/GotoOperation'; import {HideOperation} from './operations/HideOperation'; import { + inlineProgressByHash, operationBeingPreviewed, useRunOperation, useRunPreviewedOperation, - inlineProgressByHash, } from './operationsState'; import platform from './platform'; import {CommitPreview, dagWithPreviews, uncommittedChangesWithPreviews} from './previews'; @@ -66,18 +78,6 @@ import {copyAndShowToast} from './toast'; import {succeedableRevset} from './types'; import {showModal} from './useModal'; import {short} from './utils'; -import * as stylex from '@stylexjs/stylex'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtomValue, useSetAtom} from 'jotai'; -import React, {memo} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {useContextMenu} from 'shared/ContextMenu'; -import {MS_PER_DAY} from 'shared/constants'; -import {useAutofocusRef} from 'shared/hooks'; -import {notEmpty, nullthrows} from 'shared/utils'; export const rebaseOffWarmWarningEnabled = localStorageBackedAtom( 'isl.rebase-off-warm-warning-enabled', diff --git a/addons/isl/src/CommitCloud.tsx b/addons/isl/src/CommitCloud.tsx index b2fb26c0d218a..835b7b28f44af 100644 --- a/addons/isl/src/CommitCloud.tsx +++ b/addons/isl/src/CommitCloud.tsx @@ -7,6 +7,16 @@ import type {CommitCloudSyncState, Hash, Result} from './types'; +import {Button} from 'isl-components/Button'; +import {Dropdown} from 'isl-components/Dropdown'; +import {ErrorNotice, InlineErrorBadge} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {TextField} from 'isl-components/TextField'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {useCallback, useEffect, useRef, useState} from 'react'; +import {notEmpty} from 'shared/utils'; import serverAPI from './ClientToServerAPI'; import {Commit} from './Commit'; import {FlexSpacer} from './ComponentUtils'; @@ -22,16 +32,6 @@ import {RelativeDate} from './relativeDate'; import {repoRootAndCwd} from './repositoryData'; import {CommitCloudBackupStatus} from './types'; import {registerDisposable} from './utils'; -import {Button} from 'isl-components/Button'; -import {Dropdown} from 'isl-components/Dropdown'; -import {ErrorNotice, InlineErrorBadge} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {TextField} from 'isl-components/TextField'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {useCallback, useEffect, useRef, useState} from 'react'; -import {notEmpty} from 'shared/utils'; import './CommitCloud.css'; diff --git a/addons/isl/src/CommitInfoView/CommitInfoField.tsx b/addons/isl/src/CommitInfoView/CommitInfoField.tsx index 5b21f4c8b8064..044582766763c 100644 --- a/addons/isl/src/CommitInfoView/CommitInfoField.tsx +++ b/addons/isl/src/CommitInfoView/CommitInfoField.tsx @@ -5,9 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {FieldConfig} from './types'; import type {ReactNode} from 'react'; +import type {FieldConfig} from './types'; +import {Icon} from 'isl-components/Icon'; +import {extractTokens, TokensList} from 'isl-components/Tokens'; +import {Fragment} from 'react'; import {Copyable} from '../Copyable'; import {T} from '../i18n'; import {RenderMarkup} from './RenderMarkup'; @@ -15,9 +18,6 @@ import {SeeMoreContainer} from './SeeMoreContainer'; import {CommitInfoTextArea} from './TextArea'; import {CommitInfoTextField} from './TextField'; import {convertFieldNameToKey, getOnClickToken, Section, SmallCapsTitle} from './utils'; -import {Icon} from 'isl-components/Icon'; -import {extractTokens, TokensList} from 'isl-components/Tokens'; -import {Fragment} from 'react'; export function CommitInfoField({ field, diff --git a/addons/isl/src/CommitInfoView/CommitInfoState.tsx b/addons/isl/src/CommitInfoView/CommitInfoState.tsx index 0872fde956372..69287528774ad 100644 --- a/addons/isl/src/CommitInfoView/CommitInfoState.tsx +++ b/addons/isl/src/CommitInfoView/CommitInfoState.tsx @@ -8,6 +8,8 @@ import type {Hash} from '../types'; import type {CommitMessageFields} from './types'; +import {atom} from 'jotai'; +import {firstLine} from 'shared/utils'; import serverAPI from '../ClientToServerAPI'; import {successionTracker} from '../SuccessionTracker'; import {tracker} from '../analytics'; @@ -22,15 +24,13 @@ import {selectedCommitInfos, selectedCommits} from '../selection'; import {latestHeadCommit} from '../serverAPIState'; import {registerCleanup, registerDisposable} from '../utils'; import { - parseCommitMessageFields, allFieldsBeingEdited, anyEditsMade, applyEditedFields, commitMessageFieldsSchema, mergeCommitMessageFields, + parseCommitMessageFields, } from './CommitMessageFields'; -import {atom} from 'jotai'; -import {firstLine} from 'shared/utils'; export type EditedMessage = Partial; diff --git a/addons/isl/src/CommitInfoView/CommitInfoView.tsx b/addons/isl/src/CommitInfoView/CommitInfoView.tsx index 2510e7d2b7a96..e0387f9a4cdf5 100644 --- a/addons/isl/src/CommitInfoView/CommitInfoView.tsx +++ b/addons/isl/src/CommitInfoView/CommitInfoView.tsx @@ -10,6 +10,24 @@ import type {CommitInfo, DiffId} from '../types'; import type {CommitInfoMode, EditedMessage} from './CommitInfoState'; import type {CommitMessageFields, FieldConfig, FieldsBeingEdited} from './types'; +import deepEqual from 'fast-deep-equal'; +import {Badge} from 'isl-components/Badge'; +import {Banner, BannerKind, BannerTooltip} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Divider} from 'isl-components/Divider'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {Column} from 'isl-components/Flex'; +import {Icon} from 'isl-components/Icon'; +import {RadioGroup} from 'isl-components/Radio'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {useAtomCallback} from 'jotai/utils'; +import {useCallback, useEffect, useMemo} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {useContextMenu} from 'shared/ContextMenu'; +import {usePrevious} from 'shared/hooks'; +import {firstLine, notEmpty, nullthrows} from 'shared/utils'; import {ChangedFilesWithFetching} from '../ChangedFilesWithFetching'; import serverAPI from '../ClientToServerAPI'; import {Commit} from '../Commit'; @@ -65,45 +83,27 @@ import {useModal} from '../useModal'; import {firstOfIterable} from '../utils'; import {CommitInfoField} from './CommitInfoField'; import { - forceNextCommitToEditAllFields, - unsavedFieldsBeingEdited, - diffUpdateMessagesState, commitInfoViewCurrentCommits, commitMode, + diffUpdateMessagesState, editedCommitMessages, + forceNextCommitToEditAllFields, hasUnsavedEditedCommitMessage, + unsavedFieldsBeingEdited, } from './CommitInfoState'; import { - commitMessageFieldsToString, - commitMessageFieldsSchema, - parseCommitMessageFields, - findFieldsBeingEdited, - findEditedDiffNumber, applyEditedFields, + commitMessageFieldsSchema, + commitMessageFieldsToString, editedMessageSubset, + findEditedDiffNumber, + findFieldsBeingEdited, + parseCommitMessageFields, removeNoopEdits, } from './CommitMessageFields'; import {DiffStats, PendingDiffStats} from './DiffStats'; import {FillCommitMessage} from './FillCommitMessage'; import {CommitTitleByline, getFieldToAutofocus, Section, SmallCapsTitle} from './utils'; -import deepEqual from 'fast-deep-equal'; -import {Badge} from 'isl-components/Badge'; -import {Banner, BannerKind, BannerTooltip} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Divider} from 'isl-components/Divider'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {Column} from 'isl-components/Flex'; -import {Icon} from 'isl-components/Icon'; -import {RadioGroup} from 'isl-components/Radio'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {useAtomCallback} from 'jotai/utils'; -import {useCallback, useEffect, useMemo} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {useContextMenu} from 'shared/ContextMenu'; -import {usePrevious} from 'shared/hooks'; -import {firstLine, notEmpty, nullthrows} from 'shared/utils'; import './CommitInfoView.css'; diff --git a/addons/isl/src/CommitInfoView/CommitMessageFields.ts b/addons/isl/src/CommitInfoView/CommitMessageFields.ts index 21449fe5bae67..5d786382ce9d8 100644 --- a/addons/isl/src/CommitInfoView/CommitMessageFields.ts +++ b/addons/isl/src/CommitInfoView/CommitMessageFields.ts @@ -8,13 +8,13 @@ import type {EditedMessage} from './CommitInfoState'; import type {CommitMessageFields, FieldConfig, FieldsBeingEdited} from './types'; +import {atom} from 'jotai'; +import {notEmpty} from 'shared/utils'; import {temporaryCommitTitle} from '../CommitTitle'; import {Internal} from '../Internal'; import {codeReviewProvider} from '../codeReview/CodeReviewInfo'; import {arraysEqual} from '../utils'; import {OSSCommitMessageFieldSchema} from './OSSCommitMessageFieldsSchema'; -import {atom} from 'jotai'; -import {notEmpty} from 'shared/utils'; export function emptyCommitMessageFields(schema: Array): CommitMessageFields { return Object.fromEntries(schema.map(config => [config.key, config.type === 'field' ? [] : ''])); diff --git a/addons/isl/src/CommitInfoView/DiffStats.tsx b/addons/isl/src/CommitInfoView/DiffStats.tsx index be48daa1f9cef..1084c6688dd86 100644 --- a/addons/isl/src/CommitInfoView/DiffStats.tsx +++ b/addons/isl/src/CommitInfoView/DiffStats.tsx @@ -7,16 +7,16 @@ import type {CommitInfo} from '../types'; +import * as stylex from '@stylexjs/stylex'; +import {ErrorBoundary} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; import {Row} from '../ComponentUtils'; import {T, t} from '../i18n'; import { - useFetchSignificantLinesOfCode, useFetchPendingSignificantLinesOfCode, + useFetchSignificantLinesOfCode, } from '../sloc/useFetchSignificantLinesOfCode'; -import * as stylex from '@stylexjs/stylex'; -import {ErrorBoundary} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; type Props = {commit: CommitInfo}; const styles = stylex.create({ diff --git a/addons/isl/src/CommitInfoView/FillCommitMessage.tsx b/addons/isl/src/CommitInfoView/FillCommitMessage.tsx index 8b74e1a6f574a..ee6d214d92c76 100644 --- a/addons/isl/src/CommitInfoView/FillCommitMessage.tsx +++ b/addons/isl/src/CommitInfoView/FillCommitMessage.tsx @@ -9,6 +9,13 @@ import type {CommitInfo} from '../types'; import type {CommitInfoMode} from './CommitInfoState'; import type {CommitMessageFields, FieldConfig} from './types'; +import * as stylex from '@stylexjs/stylex'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {LinkButton} from 'isl-components/LinkButton'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useCallback} from 'react'; +import {useContextMenu} from 'shared/ContextMenu'; import {font, spacing} from '../../../components/theme/tokens.stylex'; import {FlexSpacer} from '../ComponentUtils'; import {Internal} from '../Internal'; @@ -20,25 +27,18 @@ import {dagWithPreviews} from '../previews'; import {layout} from '../stylexUtils'; import {useModal} from '../useModal'; import { - getDefaultEditedCommitMessage, commitMessageTemplate, editedCommitMessages, + getDefaultEditedCommitMessage, } from './CommitInfoState'; import { - parseCommitMessageFields, commitMessageFieldsSchema, - mergeCommitMessageFields, findConflictingFieldsWhenMerging, + mergeCommitMessageFields, mergeOnlyEmptyMessageFields, + parseCommitMessageFields, } from './CommitMessageFields'; import {SmallCapsTitle} from './utils'; -import * as stylex from '@stylexjs/stylex'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {LinkButton} from 'isl-components/LinkButton'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {useCallback} from 'react'; -import {useContextMenu} from 'shared/ContextMenu'; /** * The last entry in a tokenized field value is used as the value being typed in the editor. diff --git a/addons/isl/src/CommitInfoView/GenerateWithAI.tsx b/addons/isl/src/CommitInfoView/GenerateWithAI.tsx index cf8166e0b9872..eb6749cd2ccf7 100644 --- a/addons/isl/src/CommitInfoView/GenerateWithAI.tsx +++ b/addons/isl/src/CommitInfoView/GenerateWithAI.tsx @@ -5,11 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -import type {InternalCommitMessageFields, Result} from '../types'; -import type {FieldNameAndHashKey, HashKey} from './types'; import type {RefObject} from 'react'; import type {Comparison} from 'shared/Comparison'; +import type {InternalCommitMessageFields, Result} from '../types'; +import type {FieldNameAndHashKey, HashKey} from './types'; +import {Button} from 'isl-components/Button'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {TextArea} from 'isl-components/TextArea'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtom, useAtomValue, useSetAtom} from 'jotai'; +import {useCallback} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {InternalFieldName} from 'shared/constants'; +import {useThrottledEffect} from 'shared/hooks'; +import {nullthrows, randomId} from 'shared/utils'; import {Internal} from '../Internal'; import {tracker} from '../analytics'; import {useFeatureFlagSync} from '../featureFlags'; @@ -23,17 +34,6 @@ import { latestCommitMessageFieldsWithEdits, } from './CommitInfoState'; import {convertFieldNameToKey} from './utils'; -import {Button} from 'isl-components/Button'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {TextArea} from 'isl-components/TextArea'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtom, useAtomValue, useSetAtom} from 'jotai'; -import {useCallback} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {InternalFieldName} from 'shared/constants'; -import {useThrottledEffect} from 'shared/hooks'; -import {randomId, nullthrows} from 'shared/utils'; import './GenerateWithAI.css'; diff --git a/addons/isl/src/CommitInfoView/MinHeightTextField.tsx b/addons/isl/src/CommitInfoView/MinHeightTextField.tsx index a76f5a8d69e3e..cb41d21b1ad5f 100644 --- a/addons/isl/src/CommitInfoView/MinHeightTextField.tsx +++ b/addons/isl/src/CommitInfoView/MinHeightTextField.tsx @@ -7,11 +7,11 @@ import type {TextAreaProps} from 'isl-components/TextArea'; -import {assert} from '../utils'; import * as stylex from '@stylexjs/stylex'; import {TextArea} from 'isl-components/TextArea'; -import {forwardRef, type ForwardedRef, useEffect} from 'react'; +import {forwardRef, useEffect, type ForwardedRef} from 'react'; import {notEmpty} from 'shared/utils'; +import {assert} from '../utils'; const styles = stylex.create({ minHeight: { diff --git a/addons/isl/src/CommitInfoView/RenderMarkup.tsx b/addons/isl/src/CommitInfoView/RenderMarkup.tsx index f635ccbeca1b6..0ae311158c159 100644 --- a/addons/isl/src/CommitInfoView/RenderMarkup.tsx +++ b/addons/isl/src/CommitInfoView/RenderMarkup.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import {useAtomValue} from 'jotai'; +import {cached} from 'shared/LRU'; import clientToServerAPI from '../ClientToServerAPI'; import {codeReviewProvider} from '../codeReview/CodeReviewInfo'; import {atomFamilyWeak, lazyAtom} from '../jotaiUtils'; -import {useAtomValue} from 'jotai'; -import {cached} from 'shared/LRU'; import './RenderedMarkup.css'; diff --git a/addons/isl/src/CommitInfoView/SeeMoreContainer.tsx b/addons/isl/src/CommitInfoView/SeeMoreContainer.tsx index 7875e13767020..91842b639595f 100644 --- a/addons/isl/src/CommitInfoView/SeeMoreContainer.tsx +++ b/addons/isl/src/CommitInfoView/SeeMoreContainer.tsx @@ -7,10 +7,10 @@ import type {ReactNode} from 'react'; -import {T} from '../i18n'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; -import {useLayoutEffect, useState, useRef} from 'react'; +import {useLayoutEffect, useRef, useState} from 'react'; +import {T} from '../i18n'; import './SeeMoreContainer.css'; diff --git a/addons/isl/src/CommitInfoView/SuggestedReviewers.tsx b/addons/isl/src/CommitInfoView/SuggestedReviewers.tsx index ac4d15287fbc6..83f3209f0e6d2 100644 --- a/addons/isl/src/CommitInfoView/SuggestedReviewers.tsx +++ b/addons/isl/src/CommitInfoView/SuggestedReviewers.tsx @@ -7,6 +7,10 @@ import type {ReactNode} from 'react'; +import {Icon} from 'isl-components/Icon'; +import {atom, useAtomValue} from 'jotai'; +import {loadable} from 'jotai/utils'; +import {tryJsonParse} from 'shared/utils'; import serverAPI from '../ClientToServerAPI'; import {tracker} from '../analytics'; import {codeReviewProvider} from '../codeReview/CodeReviewInfo'; @@ -15,10 +19,6 @@ import {atomFamilyWeak} from '../jotaiUtils'; import {uncommittedChangesWithPreviews} from '../previews'; import {commitByHash} from '../serverAPIState'; import {commitInfoViewCurrentCommits, commitMode} from './CommitInfoState'; -import {Icon} from 'isl-components/Icon'; -import {atom, useAtomValue} from 'jotai'; -import {loadable} from 'jotai/utils'; -import {tryJsonParse} from 'shared/utils'; import './SuggestedReviewers.css'; diff --git a/addons/isl/src/CommitInfoView/TextArea.tsx b/addons/isl/src/CommitInfoView/TextArea.tsx index e5c6db598eb52..9aae7bb104683 100644 --- a/addons/isl/src/CommitInfoView/TextArea.tsx +++ b/addons/isl/src/CommitInfoView/TextArea.tsx @@ -5,14 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -import type {FieldConfig} from './types'; import type {ReactNode, RefObject} from 'react'; +import type {FieldConfig} from './types'; +import {TextArea} from 'isl-components/TextArea'; +import {useEffect, useRef} from 'react'; +import {InternalFieldName} from 'shared/constants'; import { - useUploadFilesCallback, - ImageDropZone, FilePicker, + ImageDropZone, PendingImageUploads, + useUploadFilesCallback, } from '../ImageUpload'; import {Internal} from '../Internal'; import {useFeatureFlagSync} from '../featureFlags'; @@ -20,9 +23,6 @@ import {insertAtCursor} from '../textareaUtils'; import {GenerateAIButton} from './GenerateWithAI'; import {MinHeightTextField} from './MinHeightTextField'; import {convertFieldNameToKey} from './utils'; -import {TextArea} from 'isl-components/TextArea'; -import {useRef, useEffect} from 'react'; -import {InternalFieldName} from 'shared/constants'; function moveCursorToEnd(element: HTMLTextAreaElement) { element.setSelectionRange(element.value.length, element.value.length); diff --git a/addons/isl/src/CommitInfoView/TextField.tsx b/addons/isl/src/CommitInfoView/TextField.tsx index 0f149a5ca6f11..4e1950ef816bd 100644 --- a/addons/isl/src/CommitInfoView/TextField.tsx +++ b/addons/isl/src/CommitInfoView/TextField.tsx @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {FieldConfig, TypeaheadKind} from './types'; import type {TypeaheadResult} from 'isl-components/Types'; +import type {FieldConfig, TypeaheadKind} from './types'; -import serverApi from '../ClientToServerAPI'; -import {recentReviewers, SuggestedReviewers} from './SuggestedReviewers'; -import {convertFieldNameToKey, getOnClickToken} from './utils'; import {extractTokens} from 'isl-components/Tokens'; import {Typeahead} from 'isl-components/Typeahead'; import {randomId} from 'shared/utils'; +import serverApi from '../ClientToServerAPI'; +import {recentReviewers, SuggestedReviewers} from './SuggestedReviewers'; +import {convertFieldNameToKey, getOnClickToken} from './utils'; export function CommitInfoTextField({ field, diff --git a/addons/isl/src/CommitInfoView/utils.tsx b/addons/isl/src/CommitInfoView/utils.tsx index 4fc09f5ee969f..eacd0923dcf5c 100644 --- a/addons/isl/src/CommitInfoView/utils.tsx +++ b/addons/isl/src/CommitInfoView/utils.tsx @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {CommitInfo} from '../types'; import type {CommitMessageFields, FieldConfig, FieldsBeingEdited} from './types'; -import type {ReactNode} from 'react'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; import {InlineBadge} from '../InlineBadge'; import {YouAreHereLabel} from '../YouAreHereLabel'; import {t, T} from '../i18n'; import platform from '../platform'; import {RelativeDate} from '../relativeDate'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; export function CommitTitleByline({commit}: {commit: CommitInfo}) { const createdByInfo = ( diff --git a/addons/isl/src/CommitTitle.tsx b/addons/isl/src/CommitTitle.tsx index 62db9976dbd25..a3bc45477020c 100644 --- a/addons/isl/src/CommitTitle.tsx +++ b/addons/isl/src/CommitTitle.tsx @@ -7,8 +7,8 @@ import type {Placement} from 'isl-components/Tooltip'; -import {t} from './i18n'; import {Tooltip} from 'isl-components/Tooltip'; +import {t} from './i18n'; type CommitTitleProps = React.HTMLAttributes & { commitMessage: string; diff --git a/addons/isl/src/CommitTreeList.tsx b/addons/isl/src/CommitTreeList.tsx index 2a85bcf8e69f0..12f4daa93c4c4 100644 --- a/addons/isl/src/CommitTreeList.tsx +++ b/addons/isl/src/CommitTreeList.tsx @@ -10,6 +10,10 @@ import type {DagCommitInfo} from './dag/dag'; import type {ExtendedGraphRow} from './dag/render'; import type {Hash} from './types'; +import {Button} from 'isl-components/Button'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {ErrorShortMessages} from 'isl-server/src/constants'; +import {atom, useAtomValue} from 'jotai'; import {Commit, InlineProgressSpan} from './Commit'; import {Center, LargeSpinner} from './ComponentUtils'; import {FetchingAdditionalCommitsRow} from './FetchAdditionalCommitsButton'; @@ -27,15 +31,11 @@ import { selectedCommits, useArrowKeysToChangeSelection, useBackspaceToHideSelected, - useShortcutToRebaseSelected, useCommitCallbacks, + useShortcutToRebaseSelected, } from './selection'; import {commitFetchError, latestUncommittedChangesData} from './serverAPIState'; import {MaybeEditStackModal} from './stackEdit/ui/EditStackModal'; -import {Button} from 'isl-components/Button'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {ErrorShortMessages} from 'isl-server/src/constants'; -import {atom, useAtomValue} from 'jotai'; import './CommitTreeList.css'; diff --git a/addons/isl/src/ComparisonView/ComparisonView.tsx b/addons/isl/src/ComparisonView/ComparisonView.tsx index 4d9b16e5288ce..1ea03385ed29d 100644 --- a/addons/isl/src/ComparisonView/ComparisonView.tsx +++ b/addons/isl/src/ComparisonView/ComparisonView.tsx @@ -5,23 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import type {Result} from '../types'; -import type {Context} from './SplitDiffView/types'; import type {Comparison} from 'shared/Comparison'; import type {ParsedDiff} from 'shared/patch/parse'; +import type {Result} from '../types'; +import type {Context} from './SplitDiffView/types'; -import serverAPI from '../ClientToServerAPI'; -import {EmptyState} from '../EmptyState'; -import {useGeneratedFileStatuses} from '../GeneratedFile'; -import {T, t} from '../i18n'; -import {atomFamilyWeak, atomLoadableWithRefresh, localStorageBackedAtom} from '../jotaiUtils'; -import platform from '../platform'; -import {latestHeadCommit} from '../serverAPIState'; -import {themeState} from '../theme'; -import {GeneratedStatus} from '../types'; -import {SplitDiffView} from './SplitDiffView'; -import {currentComparisonMode} from './atoms'; -import {parsePatchAndFilter, sortFilesByType} from './utils'; import deepEqual from 'fast-deep-equal'; import {Button} from 'isl-components/Button'; import {Dropdown} from 'isl-components/Dropdown'; @@ -33,12 +21,24 @@ import {Tooltip} from 'isl-components/Tooltip'; import {useAtom, useAtomValue, useSetAtom} from 'jotai'; import {useEffect, useMemo, useState} from 'react'; import { - comparisonIsAgainstHead, - labelForComparison, ComparisonType, + comparisonIsAgainstHead, comparisonStringKey, + labelForComparison, } from 'shared/Comparison'; import {group, notEmpty} from 'shared/utils'; +import serverAPI from '../ClientToServerAPI'; +import {EmptyState} from '../EmptyState'; +import {useGeneratedFileStatuses} from '../GeneratedFile'; +import {T, t} from '../i18n'; +import {atomFamilyWeak, atomLoadableWithRefresh, localStorageBackedAtom} from '../jotaiUtils'; +import platform from '../platform'; +import {latestHeadCommit} from '../serverAPIState'; +import {themeState} from '../theme'; +import {GeneratedStatus} from '../types'; +import {SplitDiffView} from './SplitDiffView'; +import {currentComparisonMode} from './atoms'; +import {parsePatchAndFilter, sortFilesByType} from './utils'; import './ComparisonView.css'; diff --git a/addons/isl/src/ComparisonView/ComparisonViewModal.tsx b/addons/isl/src/ComparisonView/ComparisonViewModal.tsx index 88b16af11170a..2493c5d76eed9 100644 --- a/addons/isl/src/ComparisonView/ComparisonViewModal.tsx +++ b/addons/isl/src/ComparisonView/ComparisonViewModal.tsx @@ -7,13 +7,13 @@ import type {ComparisonMode} from './atoms'; -import {useCommand} from '../ISLShortcuts'; -import {Modal} from '../Modal'; -import {currentComparisonMode, dismissComparison, showComparison} from './atoms'; import {Icon} from 'isl-components/Icon'; import {useAtomValue} from 'jotai'; import {lazy, Suspense} from 'react'; import {ComparisonType} from 'shared/Comparison'; +import {useCommand} from '../ISLShortcuts'; +import {Modal} from '../Modal'; +import {currentComparisonMode, dismissComparison, showComparison} from './atoms'; import './ComparisonView.css'; diff --git a/addons/isl/src/ComparisonView/OpenComparisonViewButton.tsx b/addons/isl/src/ComparisonView/OpenComparisonViewButton.tsx index c986c0ab3fb23..6aa51b886e8da 100644 --- a/addons/isl/src/ComparisonView/OpenComparisonViewButton.tsx +++ b/addons/isl/src/ComparisonView/OpenComparisonViewButton.tsx @@ -8,12 +8,12 @@ import type {ReactNode} from 'react'; import type {Comparison} from 'shared/Comparison'; -import {T, t} from '../i18n'; -import {short} from '../utils'; -import {showComparison} from './atoms'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {ComparisonType} from 'shared/Comparison'; +import {T, t} from '../i18n'; +import {short} from '../utils'; +import {showComparison} from './atoms'; export function OpenComparisonViewButton({ comparison, diff --git a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffFileHeader.tsx b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffFileHeader.tsx index 437b1975244e8..50d88d7afbe8e 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffFileHeader.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffFileHeader.tsx @@ -9,12 +9,12 @@ import type {EnsureAssignedTogether} from 'shared/EnsureAssignedTogether'; import type {DiffType} from 'shared/patch/parse'; import type {RepoPath} from 'shared/types/common'; -import {t} from '../../i18n'; -import platform from '../../platform'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {Tooltip} from 'isl-components/Tooltip'; import React from 'react'; +import {t} from '../../i18n'; +import platform from '../../platform'; import './SplitDiffHunk.css'; diff --git a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffHunk.tsx b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffHunk.tsx index e8a1fa8afc1b5..29e951c3736dd 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffHunk.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffHunk.tsx @@ -5,15 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; +import type {Hunk, ParsedDiff} from 'shared/patch/parse'; import type {Result} from '../../types'; import type {TokenizedDiffHunk, TokenizedHunk} from './syntaxHighlightingTypes'; import type {Context, OneIndexedLineNumber} from './types'; -import type {ReactNode} from 'react'; -import type {Hunk, ParsedDiff} from 'shared/patch/parse'; -import SplitDiffRow, {BlankLineNumber} from './SplitDiffRow'; -import {useTableColumnSelection} from './copyFromSelectedColumn'; -import {useTokenizedContents, useTokenizedHunks} from './syntaxHighlighting'; import {diffChars} from 'diff'; import {ErrorNotice} from 'isl-components/ErrorNotice'; import {Icon} from 'isl-components/Icon'; @@ -24,6 +21,9 @@ import { applyTokenizationToLine, createTokenizedIntralineDiff, } from 'shared/createTokenizedIntralineDiff'; +import SplitDiffRow, {BlankLineNumber} from './SplitDiffRow'; +import {useTableColumnSelection} from './copyFromSelectedColumn'; +import {useTokenizedContents, useTokenizedHunks} from './syntaxHighlighting'; const MAX_INPUT_LENGTH_FOR_INTRALINE_DIFF = 300; diff --git a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffRow.tsx b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffRow.tsx index 8b6a9da805450..1fd9f82538822 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffRow.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/SplitDiffRow.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {OneIndexedLineNumber} from './types'; import type {ExclusiveOr} from 'shared/typeUtils'; +import type {OneIndexedLineNumber} from './types'; type Props = { beforeLineNumber: number | null; diff --git a/addons/isl/src/ComparisonView/SplitDiffView/grammar.tsx b/addons/isl/src/ComparisonView/SplitDiffView/grammar.tsx index 6fdc644e0755d..28e003a9a6543 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/grammar.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/grammar.tsx @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {ThemeColor} from '../../theme'; import type {TextMateGrammar} from 'shared/textmate-lib/types'; import type {IGrammar, Registry} from 'vscode-textmate'; +import type {ThemeColor} from '../../theme'; +import createTextMateRegistry from 'shared/textmate-lib/createTextMateRegistry'; +import {nullthrows} from 'shared/utils'; import {grammars} from '../../generated/textmate/TextMateGrammarManifest'; import VSCodeDarkPlusTheme from './VSCodeDarkPlusTheme'; import VSCodeLightPlusTheme from './VSCodeLightPlusTheme'; -import createTextMateRegistry from 'shared/textmate-lib/createTextMateRegistry'; -import {nullthrows} from 'shared/utils'; const grammarCache: Map> = new Map(); export function getGrammar(store: Registry, scopeName: string): Promise { diff --git a/addons/isl/src/ComparisonView/SplitDiffView/index.tsx b/addons/isl/src/ComparisonView/SplitDiffView/index.tsx index 1c070152065e3..a787818d39aa0 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/index.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/index.tsx @@ -7,19 +7,19 @@ import './SplitDiffHunk.css'; -import type {Context} from './types'; import type {ParsedDiff} from 'shared/patch/parse'; +import type {Context} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useState} from 'react'; import {generatedStatusDescription} from '../../GeneratedFile'; import {T, t} from '../../i18n'; import platform from '../../platform'; import {GeneratedStatus} from '../../types'; import {FileHeader, diffTypeToIconType} from './SplitDiffFileHeader'; import {SplitDiffTable} from './SplitDiffHunk'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useState} from 'react'; export function SplitDiffView({ ctx, diff --git a/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlighting.tsx b/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlighting.tsx index f150ac65a5681..314ded5d58f56 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlighting.tsx +++ b/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlighting.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import type {ParsedDiff} from 'shared/patch/parse'; import type { SyntaxWorkerRequest, SyntaxWorkerResponse, + ThemeColor, TokenizedDiffHunks, TokenizedHunk, - ThemeColor, } from './syntaxHighlightingTypes'; -import type {ParsedDiff} from 'shared/patch/parse'; -import {isVscode} from '../../environment'; -import {SynchronousWorker, WorkerApi} from './workerApi'; import {useEffect, useState} from 'react'; import {CancellationToken} from 'shared/CancellationToken'; import {updateTextMateGrammarCSS} from 'shared/textmate-lib/textmateStyles'; +import {isVscode} from '../../environment'; +import {SynchronousWorker, WorkerApi} from './workerApi'; // Syntax highlighting is done in a WebWorker. This file contains APIs // to be called from the main thread, which are delegated to the worker. diff --git a/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlightingWorker.ts b/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlightingWorker.ts index bcb155b103fed..9d109cc70d818 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlightingWorker.ts +++ b/addons/isl/src/ComparisonView/SplitDiffView/syntaxHighlightingWorker.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {IGrammar} from 'vscode-textmate'; import type {ThemeColor} from '../../theme'; import type { SyntaxWorkerRequest, @@ -12,14 +13,13 @@ import type { TokenizedDiffHunks, TokenizedHunk, } from './syntaxHighlightingTypes'; -import type {IGrammar} from 'vscode-textmate'; -import {grammars, languages} from '../../generated/textmate/TextMateGrammarManifest'; -import {getGrammerStore, getGrammar} from './grammar'; import {CancellationToken} from 'shared/CancellationToken'; import FilepathClassifier from 'shared/textmate-lib/FilepathClassifier'; import {tokenizeLines} from 'shared/textmate-lib/tokenize'; import {loadWASM} from 'vscode-oniguruma'; +import {grammars, languages} from '../../generated/textmate/TextMateGrammarManifest'; +import {getGrammar, getGrammerStore} from './grammar'; const URL_TO_ONIG_WASM = './generated/textmate/onig.wasm'; diff --git a/addons/isl/src/ComparisonView/SplitDiffView/types.ts b/addons/isl/src/ComparisonView/SplitDiffView/types.ts index e27b22968967e..0ff002eca8ee3 100644 --- a/addons/isl/src/ComparisonView/SplitDiffView/types.ts +++ b/addons/isl/src/ComparisonView/SplitDiffView/types.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import type {Comparison} from 'shared/Comparison'; import type {ThemeColor} from '../../theme'; import type {Result} from '../../types'; -import type {Comparison} from 'shared/Comparison'; type ContextId = {path: string; comparison: Comparison}; diff --git a/addons/isl/src/ComparisonView/atoms.ts b/addons/isl/src/ComparisonView/atoms.ts index cfca4c5d9e7ec..f057d9082203c 100644 --- a/addons/isl/src/ComparisonView/atoms.ts +++ b/addons/isl/src/ComparisonView/atoms.ts @@ -7,10 +7,10 @@ import type {Comparison} from 'shared/Comparison'; -import {writeAtom} from '../jotaiUtils'; -import platform from '../platform'; import {atom} from 'jotai'; import {ComparisonType} from 'shared/Comparison'; +import {writeAtom} from '../jotaiUtils'; +import platform from '../platform'; export type ComparisonMode = {comparison: Comparison; visible: boolean}; export const currentComparisonMode = atom( diff --git a/addons/isl/src/ComponentUtils.tsx b/addons/isl/src/ComponentUtils.tsx index 0a2fa0271be36..aaad0bc0b3b9c 100644 --- a/addons/isl/src/ComponentUtils.tsx +++ b/addons/isl/src/ComponentUtils.tsx @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import {spacing} from '../../components/theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; import {Icon} from 'isl-components/Icon'; import {notEmpty} from 'shared/utils'; +import {spacing} from '../../components/theme/tokens.stylex'; import './ComponentUtils.css'; diff --git a/addons/isl/src/ConfirmSubmitStack.tsx b/addons/isl/src/ConfirmSubmitStack.tsx index 44eae10550c6a..4bcb37ba9ba4f 100644 --- a/addons/isl/src/ConfirmSubmitStack.tsx +++ b/addons/isl/src/ConfirmSubmitStack.tsx @@ -7,14 +7,6 @@ import type {CommitInfo} from './types'; -import {Commit} from './Commit'; -import {FlexSpacer} from './ComponentUtils'; -import {codeReviewProvider} from './codeReview/CodeReviewInfo'; -import {submitAsDraft, SubmitAsDraftCheckbox} from './codeReview/DraftCheckbox'; -import {t, T} from './i18n'; -import {configBackedAtom, readAtom} from './jotaiUtils'; -import {CommitPreview} from './previews'; -import {useModal} from './useModal'; import {Button} from 'isl-components/Button'; import {Checkbox} from 'isl-components/Checkbox'; import {Divider} from 'isl-components/Divider'; @@ -24,6 +16,14 @@ import {useAtom, useAtomValue} from 'jotai'; import {useState} from 'react'; import {useAutofocusRef} from 'shared/hooks'; import {nullthrows} from 'shared/utils'; +import {Commit} from './Commit'; +import {FlexSpacer} from './ComponentUtils'; +import {codeReviewProvider} from './codeReview/CodeReviewInfo'; +import {submitAsDraft, SubmitAsDraftCheckbox} from './codeReview/DraftCheckbox'; +import {t, T} from './i18n'; +import {configBackedAtom, readAtom} from './jotaiUtils'; +import {CommitPreview} from './previews'; +import {useModal} from './useModal'; import './ConfirmSubmitStack.css'; diff --git a/addons/isl/src/Copyable.tsx b/addons/isl/src/Copyable.tsx index 9a4fbdfbbf278..f565fb5b2fdad 100644 --- a/addons/isl/src/Copyable.tsx +++ b/addons/isl/src/Copyable.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {T} from './i18n'; -import platform from './platform'; import {Icon} from 'isl-components/Icon'; import {Tooltip} from 'isl-components/Tooltip'; import {useEffect, useState} from 'react'; +import {T} from './i18n'; +import platform from './platform'; import './Copyable.css'; diff --git a/addons/isl/src/CwdSelector.tsx b/addons/isl/src/CwdSelector.tsx index c9dc5216db19e..bebeeb813e15a 100644 --- a/addons/isl/src/CwdSelector.tsx +++ b/addons/isl/src/CwdSelector.tsx @@ -7,17 +7,6 @@ import type {AbsolutePath, CwdInfo} from './types'; -import serverAPI from './ClientToServerAPI'; -import {Row} from './ComponentUtils'; -import {DropdownField, DropdownFields} from './DropdownFields'; -import {useCommandEvent} from './ISLShortcuts'; -import {codeReviewProvider} from './codeReview/CodeReviewInfo'; -import {T, t} from './i18n'; -import {writeAtom} from './jotaiUtils'; -import platform from './platform'; -import {serverCwd} from './repositoryData'; -import {repositoryInfo} from './serverAPIState'; -import {registerCleanup, registerDisposable} from './utils'; import {Badge} from 'isl-components/Badge'; import {Button} from 'isl-components/Button'; import {ButtonDropdown} from 'isl-components/ButtonDropdown'; @@ -31,6 +20,17 @@ import {Tooltip} from 'isl-components/Tooltip'; import {atom, useAtomValue} from 'jotai'; import {Suspense} from 'react'; import {basename} from 'shared/utils'; +import serverAPI from './ClientToServerAPI'; +import {Row} from './ComponentUtils'; +import {DropdownField, DropdownFields} from './DropdownFields'; +import {useCommandEvent} from './ISLShortcuts'; +import {codeReviewProvider} from './codeReview/CodeReviewInfo'; +import {T, t} from './i18n'; +import {writeAtom} from './jotaiUtils'; +import platform from './platform'; +import {serverCwd} from './repositoryData'; +import {repositoryInfo} from './serverAPIState'; +import {registerCleanup, registerDisposable} from './utils'; /** * Give the relative path to `path` from `root` diff --git a/addons/isl/src/Diagnostics.tsx b/addons/isl/src/Diagnostics.tsx index ef59070ed95c9..938179ac3f88c 100644 --- a/addons/isl/src/Diagnostics.tsx +++ b/addons/isl/src/Diagnostics.tsx @@ -5,10 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import type {Tracker} from 'isl-server/src/analytics/tracker'; import type {UseUncommittedSelection} from './partialSelection'; import type {CommitInfo, Diagnostic, DiagnosticAllowlist} from './types'; -import type {Tracker} from 'isl-server/src/analytics/tracker'; +import * as stylex from '@stylexjs/stylex'; +import {Checkbox} from 'isl-components/Checkbox'; +import {Column, Row} from 'isl-components/Flex'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtom} from 'jotai'; +import {basename} from 'shared/utils'; import {spacing} from '../../components/theme/tokens.stylex'; import serverAPI from './ClientToServerAPI'; import {Collapsable} from './Collapsable'; @@ -20,14 +28,6 @@ import {localStorageBackedAtom, readAtom} from './jotaiUtils'; import platform from './platform'; import {uncommittedChangesWithPreviews} from './previews'; import {showModal} from './useModal'; -import * as stylex from '@stylexjs/stylex'; -import {Checkbox} from 'isl-components/Checkbox'; -import {Column, Row} from 'isl-components/Flex'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtom} from 'jotai'; -import {basename} from 'shared/utils'; export const shouldWarnAboutDiagnosticsAtom = localStorageBackedAtom( 'isl.warn-about-diagnostics', diff --git a/addons/isl/src/DownloadCommitsMenu.tsx b/addons/isl/src/DownloadCommitsMenu.tsx index bd1b935d042fb..20d0d75f00a89 100644 --- a/addons/isl/src/DownloadCommitsMenu.tsx +++ b/addons/isl/src/DownloadCommitsMenu.tsx @@ -5,6 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {Checkbox} from 'isl-components/Checkbox'; +import {Divider} from 'isl-components/Divider'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {TextField} from 'isl-components/TextField'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtom} from 'jotai'; +import {useEffect, useRef, useState} from 'react'; +import {nullthrows} from 'shared/utils'; import {CommitCloudInfo} from './CommitCloud'; import {DropdownFields} from './DropdownFields'; import {useCommandEvent} from './ISLShortcuts'; @@ -20,18 +31,7 @@ import {RebaseOperation} from './operations/RebaseOperation'; import {useRunOperation} from './operationsState'; import {dagWithPreviews} from './previews'; import {forceFetchCommit} from './serverAPIState'; -import {succeedableRevset, exactRevset} from './types'; -import {Button} from 'isl-components/Button'; -import {Checkbox} from 'isl-components/Checkbox'; -import {Divider} from 'isl-components/Divider'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; -import {TextField} from 'isl-components/TextField'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtom} from 'jotai'; -import {useEffect, useRef, useState} from 'react'; -import {nullthrows} from 'shared/utils'; +import {exactRevset, succeedableRevset} from './types'; import './DownloadCommitsMenu.css'; diff --git a/addons/isl/src/DragToRebase.tsx b/addons/isl/src/DragToRebase.tsx index 1904681653c8f..d8f9562639b01 100644 --- a/addons/isl/src/DragToRebase.tsx +++ b/addons/isl/src/DragToRebase.tsx @@ -7,6 +7,8 @@ import type {CommitInfo} from './types'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useCallback, useEffect, useState} from 'react'; import {t} from './i18n'; import {readAtom, writeAtom} from './jotaiUtils'; import {REBASE_PREVIEW_HASH_PREFIX, RebaseOperation} from './operations/RebaseOperation'; @@ -15,8 +17,6 @@ import {CommitPreview, dagWithPreviews, uncommittedChangesWithPreviews} from './ import {latestDag} from './serverAPIState'; import {latestSuccessorUnlessExplicitlyObsolete} from './successionUtils'; import {succeedableRevset} from './types'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useState, useCallback, useEffect} from 'react'; function isDraggablePreview(previewType?: CommitPreview): boolean { switch (previewType) { diff --git a/addons/isl/src/Drawers.tsx b/addons/isl/src/Drawers.tsx index 540cb3426e951..ab512cf4849ca 100644 --- a/addons/isl/src/Drawers.tsx +++ b/addons/isl/src/Drawers.tsx @@ -8,10 +8,10 @@ import type {ComponentClass} from 'react'; import type {EnsureAssignedTogether} from 'shared/EnsureAssignedTogether'; -import {islDrawerState} from './drawerState'; import {useAtom} from 'jotai'; import {createElement, useCallback, useRef} from 'react'; import {debounce} from 'shared/debounce'; +import {islDrawerState} from './drawerState'; import './Drawers.css'; diff --git a/addons/isl/src/FetchAdditionalCommitsButton.tsx b/addons/isl/src/FetchAdditionalCommitsButton.tsx index fb267204cfbbc..168d38b80b386 100644 --- a/addons/isl/src/FetchAdditionalCommitsButton.tsx +++ b/addons/isl/src/FetchAdditionalCommitsButton.tsx @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtomValue} from 'jotai'; +import {Suspense} from 'react'; import serverAPI from './ClientToServerAPI'; import {commitCloudEnabledAtom} from './CommitCloud'; import {t, T} from './i18n'; @@ -13,11 +18,6 @@ import {CommitCloudSyncOperation} from './operations/CommitCloudSyncOperation'; import {useRunOperation} from './operationsState'; import {useIsOperationRunningOrQueued} from './previews'; import {commitsShownRange, isFetchingAdditionalCommits} from './serverAPIState'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtomValue} from 'jotai'; -import {Suspense} from 'react'; export function FetchingAdditionalCommitsRow() { return ( diff --git a/addons/isl/src/FileTree.tsx b/addons/isl/src/FileTree.tsx index dd80117e4081c..f530b4a30b1f8 100644 --- a/addons/isl/src/FileTree.tsx +++ b/addons/isl/src/FileTree.tsx @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ +import type {Comparison} from 'shared/Comparison'; import type {ChangedFilesDisplayType} from './ChangedFileDisplayTypePicker'; import type {Place, UIChangedFile} from './UncommittedChanges'; import type {UseUncommittedSelection} from './partialSelection'; import type {PathTree} from './pathTree'; -import type {Comparison} from 'shared/Comparison'; -import {File} from './ChangedFile'; -import {buildPathTree, calculateTreeSelectionStates} from './pathTree'; import {Button} from 'isl-components/Button'; import {Checkbox} from 'isl-components/Checkbox'; import {Icon} from 'isl-components/Icon'; import {useMemo, useState} from 'react'; import {mapIterable} from 'shared/utils'; +import {File} from './ChangedFile'; +import {buildPathTree, calculateTreeSelectionStates} from './pathTree'; export function FileTreeFolderHeader({ isCollapsed, diff --git a/addons/isl/src/FocusMode.tsx b/addons/isl/src/FocusMode.tsx index 74c1a6f6b3fbd..089afd347ccda 100644 --- a/addons/isl/src/FocusMode.tsx +++ b/addons/isl/src/FocusMode.tsx @@ -5,12 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {colors} from '../../components/theme/tokens.stylex'; -import {Column} from './ComponentUtils'; -import {useCommand} from './ISLShortcuts'; -import {tracker} from './analytics'; -import {focusMode} from './atoms/FocusModeState'; -import {T} from './i18n'; import * as stylex from '@stylexjs/stylex'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; @@ -18,6 +12,12 @@ import {Kbd} from 'isl-components/Kbd'; import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtom} from 'jotai'; +import {colors} from '../../components/theme/tokens.stylex'; +import {Column} from './ComponentUtils'; +import {useCommand} from './ISLShortcuts'; +import {tracker} from './analytics'; +import {focusMode} from './atoms/FocusModeState'; +import {T} from './i18n'; const styles = stylex.create({ focused: { diff --git a/addons/isl/src/GeneratedFile.tsx b/addons/isl/src/GeneratedFile.tsx index 53500daf91b4d..3b337c5bdb97a 100644 --- a/addons/isl/src/GeneratedFile.tsx +++ b/addons/isl/src/GeneratedFile.tsx @@ -7,14 +7,14 @@ import type {RepoRelativePath} from './types'; +import {atom, useAtomValue} from 'jotai'; +import {useMemo} from 'react'; +import {LRU} from 'shared/LRU'; import serverAPI from './ClientToServerAPI'; import {t} from './i18n'; import {writeAtom} from './jotaiUtils'; import {GeneratedStatus} from './types'; import {registerDisposable} from './utils'; -import {atom, useAtomValue} from 'jotai'; -import {useMemo} from 'react'; -import {LRU} from 'shared/LRU'; export const genereatedFileCache = new LRU(1500); diff --git a/addons/isl/src/HighlightedCommits.tsx b/addons/isl/src/HighlightedCommits.tsx index 29bc3a85c48f4..786dfb41e8e33 100644 --- a/addons/isl/src/HighlightedCommits.tsx +++ b/addons/isl/src/HighlightedCommits.tsx @@ -7,9 +7,9 @@ import type {CommitInfo, Hash} from './types'; -import {atomFamilyWeak} from './jotaiUtils'; import {atom, useSetAtom} from 'jotai'; import {useEffect, useState} from 'react'; +import {atomFamilyWeak} from './jotaiUtils'; export const highlightedCommits = atom>(new Set()); diff --git a/addons/isl/src/ISLShortcuts.tsx b/addons/isl/src/ISLShortcuts.tsx index 939e05ad75dee..f685a1ebbf12f 100644 --- a/addons/isl/src/ISLShortcuts.tsx +++ b/addons/isl/src/ISLShortcuts.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {t} from './i18n'; -import {useModal} from './useModal'; import {Kbd} from 'isl-components/Kbd'; -import {makeCommandDispatcher, KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {KeyCode, makeCommandDispatcher, Modifier} from 'isl-components/KeyboardShortcuts'; import {isMac} from 'isl-components/OperatingSystem'; import {useMemo} from 'react'; import {TypedEventEmitter} from 'shared/TypedEventEmitter'; +import {t} from './i18n'; +import {useModal} from './useModal'; import './ISLShortcuts.css'; diff --git a/addons/isl/src/ImageUpload.tsx b/addons/isl/src/ImageUpload.tsx index 2b26681addabb..b6af3bcc38e3d 100644 --- a/addons/isl/src/ImageUpload.tsx +++ b/addons/isl/src/ImageUpload.tsx @@ -7,18 +7,18 @@ import type {RefObject} from 'react'; -import clientToServerAPI from './ClientToServerAPI'; -import {T, t} from './i18n'; -import {atomFamilyWeak, readAtom, writeAtom} from './jotaiUtils'; -import platform from './platform'; -import {replaceInTextArea, insertAtCursor} from './textareaUtils'; import {Button} from 'isl-components/Button'; import {InlineErrorBadge} from 'isl-components/ErrorNotice'; import {Icon} from 'isl-components/Icon'; import {Tooltip} from 'isl-components/Tooltip'; import {atom, useAtomValue} from 'jotai'; -import {useState, type ReactNode, useId} from 'react'; +import {useId, useState, type ReactNode} from 'react'; import {randomId} from 'shared/utils'; +import clientToServerAPI from './ClientToServerAPI'; +import {T, t} from './i18n'; +import {atomFamilyWeak, readAtom, writeAtom} from './jotaiUtils'; +import platform from './platform'; +import {insertAtCursor, replaceInTextArea} from './textareaUtils'; export type ImageUploadStatus = {id: number; field: string} & ( | {status: 'pending'} diff --git a/addons/isl/src/Link.tsx b/addons/isl/src/Link.tsx index b9c16ed40559e..983e18684320d 100644 --- a/addons/isl/src/Link.tsx +++ b/addons/isl/src/Link.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import platform from './platform'; import * as stylex from '@stylexjs/stylex'; +import platform from './platform'; const styles = stylex.create({ a: { diff --git a/addons/isl/src/LocalWebSocketEventBus.ts b/addons/isl/src/LocalWebSocketEventBus.ts index deed3d10f9000..4cf468a06ecce 100644 --- a/addons/isl/src/LocalWebSocketEventBus.ts +++ b/addons/isl/src/LocalWebSocketEventBus.ts @@ -7,8 +7,8 @@ import type {Disposable, MessageBusStatus, PlatformName} from './types'; -import {logger} from './logger'; import {CLOSED_AND_SHOULD_NOT_RECONNECT_CODE} from 'isl-server/src/constants'; +import {logger} from './logger'; export class LocalWebSocketEventBus { static MAX_RECONNECT_CHECK_TIME_MS = 60000; diff --git a/addons/isl/src/OperationDisabledButton.tsx b/addons/isl/src/OperationDisabledButton.tsx index e3f6a78f1947d..25fd9b127a019 100644 --- a/addons/isl/src/OperationDisabledButton.tsx +++ b/addons/isl/src/OperationDisabledButton.tsx @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -import type {Operation} from './operations/Operation'; import type {PrimitiveAtom} from 'jotai'; import type {ComponentProps} from 'react'; +import type {Operation} from './operations/Operation'; -import {atomFamilyWeak} from './jotaiUtils'; -import {useRunOperation} from './operationsState'; -import {useMostRecentPendingOperation} from './previews'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {atom, useAtom} from 'jotai'; import {isPromise} from 'shared/utils'; +import {atomFamilyWeak} from './jotaiUtils'; +import {useRunOperation} from './operationsState'; +import {useMostRecentPendingOperation} from './previews'; /** * Wrapper around VSCodeButton intended for buttons which runOperations. diff --git a/addons/isl/src/PartialFileSelection.tsx b/addons/isl/src/PartialFileSelection.tsx index facb9c3fd4a43..25fd63a1f35d3 100644 --- a/addons/isl/src/PartialFileSelection.tsx +++ b/addons/isl/src/PartialFileSelection.tsx @@ -8,13 +8,13 @@ import type {ChunkSelectState, LineRegion, SelectLine} from './stackEdit/chunkSelectState'; import type {RangeInfo} from './stackEdit/ui/TextEditable'; -import {t} from './i18n'; -import {TextEditable} from './stackEdit/ui/TextEditable'; import {Set as ImSet} from 'immutable'; import {Checkbox} from 'isl-components/Checkbox'; import {RadioGroup} from 'isl-components/Radio'; import {useRef, useState} from 'react'; import {notEmpty} from 'shared/utils'; +import {t} from './i18n'; +import {TextEditable} from './stackEdit/ui/TextEditable'; import './PartialFileSelection.css'; diff --git a/addons/isl/src/PullButton.tsx b/addons/isl/src/PullButton.tsx index 3a3c97256c387..13e1a2184b497 100644 --- a/addons/isl/src/PullButton.tsx +++ b/addons/isl/src/PullButton.tsx @@ -7,6 +7,11 @@ import type {Operation} from './operations/Operation'; +import {Button} from 'isl-components/Button'; +import {ButtonDropdown} from 'isl-components/ButtonDropdown'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; import {fetchStableLocations} from './BookmarksData'; import {Internal} from './Internal'; import {t, T} from './i18n'; @@ -14,11 +19,6 @@ import {configBackedAtom} from './jotaiUtils'; import {PullOperation} from './operations/PullOperation'; import {useRunOperation} from './operationsState'; import {uncommittedChangesWithPreviews, useMostRecentPendingOperation} from './previews'; -import {Button} from 'isl-components/Button'; -import {ButtonDropdown} from 'isl-components/ButtonDropdown'; -import {Icon} from 'isl-components/Icon'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; import './PullButton.css'; diff --git a/addons/isl/src/RenderDag.tsx b/addons/isl/src/RenderDag.tsx index a5a3be8d644da..421cb537df152 100644 --- a/addons/isl/src/RenderDag.tsx +++ b/addons/isl/src/RenderDag.tsx @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {Dag, DagCommitInfo} from './dag/dag'; import type {ExtendedGraphRow} from './dag/render'; import type {HashSet} from './dag/set'; -import type {ReactNode} from 'react'; +import React from 'react'; import {AnimatedReorderGroup} from './AnimatedReorderGroup'; import {AvatarPattern} from './Avatar'; import {YouAreHereLabel} from './YouAreHereLabel'; import {LinkLine, NodeLine, PadLine} from './dag/render'; -import React from 'react'; import './RenderDag.css'; diff --git a/addons/isl/src/RestackBehavior.tsx b/addons/isl/src/RestackBehavior.tsx index 0c11d3a7bfcb1..1a16afe9298a0 100644 --- a/addons/isl/src/RestackBehavior.tsx +++ b/addons/isl/src/RestackBehavior.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {t, T} from './i18n'; -import {localStorageBackedAtom} from './jotaiUtils'; import {Dropdown} from 'isl-components/Dropdown'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtom} from 'jotai'; +import {t, T} from './i18n'; +import {localStorageBackedAtom} from './jotaiUtils'; export enum AmendRestackBehavior { ALWAYS = 'always', diff --git a/addons/isl/src/SelectAllCommits.tsx b/addons/isl/src/SelectAllCommits.tsx index e226fc0d8254c..8038bec95abfc 100644 --- a/addons/isl/src/SelectAllCommits.tsx +++ b/addons/isl/src/SelectAllCommits.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ -import {useCommand} from './ISLShortcuts'; -import {islDrawerState} from './drawerState'; -import {t, T} from './i18n'; -import {readAtom, writeAtom} from './jotaiUtils'; -import {dagWithPreviews} from './previews'; -import {selectedCommits} from './selection'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {Kbd} from 'isl-components/Kbd'; import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; import {Tooltip} from 'isl-components/Tooltip'; import {useCallback} from 'react'; +import {useCommand} from './ISLShortcuts'; +import {islDrawerState} from './drawerState'; +import {t, T} from './i18n'; +import {readAtom, writeAtom} from './jotaiUtils'; +import {dagWithPreviews} from './previews'; +import {selectedCommits} from './selection'; /** By default, "select all" selects draft, non-obsoleted commits. */ function getSelectAllCommitHashSet(): Set { diff --git a/addons/isl/src/SettingsTooltip.tsx b/addons/isl/src/SettingsTooltip.tsx index 214372c753f16..f11cba090181f 100644 --- a/addons/isl/src/SettingsTooltip.tsx +++ b/addons/isl/src/SettingsTooltip.tsx @@ -8,6 +8,17 @@ import type {ThemeColor} from './theme'; import type {PreferredSubmitCommand} from './types'; +import {Button} from 'isl-components/Button'; +import {Checkbox} from 'isl-components/Checkbox'; +import {Dropdown} from 'isl-components/Dropdown'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; +import {Suspense} from 'react'; +import {nullthrows, tryJsonParse} from 'shared/utils'; import {rebaseOffWarmWarningEnabled} from './Commit'; import {condenseObsoleteStacks} from './CommitTreeList'; import {Column, Row} from './ComponentUtils'; @@ -40,18 +51,7 @@ import platform from './platform'; import {irrelevantCwdDeemphasisEnabled} from './repositoryData'; import {renderCompactAtom, useZoomShortcut, zoomUISettingAtom} from './responsive'; import {repositoryInfo} from './serverAPIState'; -import {useThemeShortcut, themeState} from './theme'; -import {Button} from 'isl-components/Button'; -import {Checkbox} from 'isl-components/Checkbox'; -import {Dropdown} from 'isl-components/Dropdown'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; -import {Suspense} from 'react'; -import {tryJsonParse, nullthrows} from 'shared/utils'; +import {themeState, useThemeShortcut} from './theme'; import './SettingsTooltip.css'; diff --git a/addons/isl/src/ShelvedChanges.tsx b/addons/isl/src/ShelvedChanges.tsx index d53b10a9c89b2..fa20470e90358 100644 --- a/addons/isl/src/ShelvedChanges.tsx +++ b/addons/isl/src/ShelvedChanges.tsx @@ -5,6 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtom} from 'jotai'; +import {useEffect} from 'react'; +import {ComparisonType} from 'shared/Comparison'; import serverAPI from './ClientToServerAPI'; import {OpenComparisonViewButton} from './ComparisonView/OpenComparisonViewButton'; import {FlexSpacer, Row} from './ComponentUtils'; @@ -18,16 +28,6 @@ import {atomLoadableWithRefresh} from './jotaiUtils'; import {DeleteShelveOperation} from './operations/DeleteShelveOperation'; import {UnshelveOperation} from './operations/UnshelveOperation'; import {RelativeDate} from './relativeDate'; -import {Button} from 'isl-components/Button'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtom} from 'jotai'; -import {useEffect} from 'react'; -import {ComparisonType} from 'shared/Comparison'; import './ShelvedChanges.css'; diff --git a/addons/isl/src/StackActions.tsx b/addons/isl/src/StackActions.tsx index 12967e3134ebf..dcb5dd12412a0 100644 --- a/addons/isl/src/StackActions.tsx +++ b/addons/isl/src/StackActions.tsx @@ -8,13 +8,18 @@ import type {DagCommitInfo} from './dag/dag'; import type {Hash} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; +import {type ContextMenuItem, useContextMenu} from 'shared/ContextMenu'; import {CleanupButton, isStackEligibleForCleanup} from './Cleanup'; import {Row} from './ComponentUtils'; import {shouldShowSubmitStackConfirmation, useShowConfirmSubmitStack} from './ConfirmSubmitStack'; import {HighlightCommitsWhileHovering} from './HighlightedCommits'; import {OperationDisabledButton} from './OperationDisabledButton'; import {showSuggestedRebaseForStack, SuggestedRebaseButton} from './SuggestedRebase'; -import {codeReviewProvider, allDiffSummaries} from './codeReview/CodeReviewInfo'; +import {allDiffSummaries, codeReviewProvider} from './codeReview/CodeReviewInfo'; import {SyncStatus, syncStatusAtom} from './codeReview/syncStatus'; import {T, t} from './i18n'; import {IconStack} from './icons/IconStack'; @@ -26,11 +31,6 @@ import {useConfirmUnsavedEditsBeforeSplit} from './stackEdit/ui/ConfirmUnsavedEd import {StackEditIcon} from './stackEdit/ui/StackEditIcon'; import {editingStackIntentionHashes, loadingStackState} from './stackEdit/ui/stackEditState'; import {succeedableRevset} from './types'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip, DOCUMENTATION_DELAY} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; -import {type ContextMenuItem, useContextMenu} from 'shared/ContextMenu'; import './StackActions.css'; diff --git a/addons/isl/src/SubmitSelectionButton.tsx b/addons/isl/src/SubmitSelectionButton.tsx index a7e448087de4f..089ca5c6c1d06 100644 --- a/addons/isl/src/SubmitSelectionButton.tsx +++ b/addons/isl/src/SubmitSelectionButton.tsx @@ -7,6 +7,8 @@ import type {CommitInfo} from './types'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtomValue} from 'jotai'; import {HighlightCommitsWhileHovering} from './HighlightedCommits'; import {OperationDisabledButton} from './OperationDisabledButton'; import {multiSubmitUpdateMessage} from './SubmitUpdateMessageInput'; @@ -16,8 +18,6 @@ import {t, T} from './i18n'; import {readAtom, writeAtom} from './jotaiUtils'; import {dagWithPreviews} from './previews'; import {selectedCommits} from './selection'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtomValue} from 'jotai'; /** * If the selected commits are submittable by the review provider, diff --git a/addons/isl/src/SubmitUpdateMessageInput.tsx b/addons/isl/src/SubmitUpdateMessageInput.tsx index fdff7ae48eb37..781f783b262a3 100644 --- a/addons/isl/src/SubmitUpdateMessageInput.tsx +++ b/addons/isl/src/SubmitUpdateMessageInput.tsx @@ -7,13 +7,13 @@ import type {CommitInfo} from './types'; +import * as stylex from '@stylexjs/stylex'; +import {useAtom, useAtomValue} from 'jotai'; +import {useRef} from 'react'; import {diffUpdateMessagesState} from './CommitInfoView/CommitInfoState'; import {MinHeightTextField} from './CommitInfoView/MinHeightTextField'; import {codeReviewProvider} from './codeReview/CodeReviewInfo'; import {T} from './i18n'; -import * as stylex from '@stylexjs/stylex'; -import {useAtom, useAtomValue} from 'jotai'; -import {useRef} from 'react'; const styles = stylex.create({ full: { diff --git a/addons/isl/src/SuccessionTracker.ts b/addons/isl/src/SuccessionTracker.ts index b5e19c22d20d3..dc1a3e4ad726a 100644 --- a/addons/isl/src/SuccessionTracker.ts +++ b/addons/isl/src/SuccessionTracker.ts @@ -8,10 +8,10 @@ import type {Dag} from './dag/dag'; import type {SmartlogCommits} from './types'; +import {atom} from 'jotai'; import {MutationDag} from './dag/mutation_dag'; import {writeAtom} from './jotaiUtils'; import {registerCleanup} from './utils'; -import {atom} from 'jotai'; type Successions = Array<[oldHash: string, newHash: string]>; type SuccessionCallback = (successions: Successions) => unknown; diff --git a/addons/isl/src/SuggestedRebase.tsx b/addons/isl/src/SuggestedRebase.tsx index fa9e7c44841fe..ac9533a4def2a 100644 --- a/addons/isl/src/SuggestedRebase.tsx +++ b/addons/isl/src/SuggestedRebase.tsx @@ -8,7 +8,15 @@ import type {Operation} from './operations/Operation'; import type {CommitInfo, ExactRevset, Hash, OptimisticRevset, SucceedableRevset} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Kbd} from 'isl-components/Kbd'; +import {Subtle} from 'isl-components/Subtle'; +import {atom} from 'jotai'; +import React from 'react'; +import {useContextMenu} from 'shared/ContextMenu'; import {allCommands} from './ISLShortcuts'; +import './SuggestedRebase.css'; import {tracker} from './analytics'; import {findPublicBaseAncestor} from './getCommitTree'; import {T} from './i18n'; @@ -21,14 +29,6 @@ import {dagWithPreviews} from './previews'; import {RelativeDate} from './relativeDate'; import {commitsShownRange, latestDag} from './serverAPIState'; import {succeedableRevset} from './types'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Kbd} from 'isl-components/Kbd'; -import {Subtle} from 'isl-components/Subtle'; -import {atom} from 'jotai'; -import React from 'react'; -import {useContextMenu} from 'shared/ContextMenu'; -import './SuggestedRebase.css'; /** * Whether a given stack (from its base hash) is eligible for currently suggested rebase. diff --git a/addons/isl/src/TopBar.tsx b/addons/isl/src/TopBar.tsx index f97093f8d87e0..2800aef4a6141 100644 --- a/addons/isl/src/TopBar.tsx +++ b/addons/isl/src/TopBar.tsx @@ -5,6 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {FlexSpacer} from 'isl-components/Flex'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; +import {clearTrackedCache} from 'shared/LRU'; import {BookmarksManagerMenu} from './BookmarksManager'; import {BugButton} from './BugButton'; import {BulkActionsMenu} from './BulkActionsMenu'; @@ -21,12 +27,6 @@ import {DebugToolsButton} from './debug/DebugToolsButton'; import {t} from './i18n'; import {maybeRemoveForgottenOperation, useClearAllOptimisticState} from './operationsState'; import {haveCommitsLoadedYet, haveRemotePath, isFetchingCommits} from './serverAPIState'; -import {Button} from 'isl-components/Button'; -import {FlexSpacer} from 'isl-components/Flex'; -import {Icon} from 'isl-components/Icon'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; -import {clearTrackedCache} from 'shared/LRU'; import './TopBar.css'; diff --git a/addons/isl/src/TopLevelAlert.tsx b/addons/isl/src/TopLevelAlert.tsx index b63e07543c65d..fc75a20084204 100644 --- a/addons/isl/src/TopLevelAlert.tsx +++ b/addons/isl/src/TopLevelAlert.tsx @@ -5,9 +5,16 @@ * LICENSE file in the root directory of this source tree. */ -import type {Alert, AlertSeverity} from './types'; import type {ReactNode} from 'react'; +import type {Alert, AlertSeverity} from './types'; +import * as stylex from '@stylexjs/stylex'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {useEffect} from 'react'; import {colors, font, radius, spacing} from '../../components/theme/tokens.stylex'; import serverAPI from './ClientToServerAPI'; import {Link} from './Link'; @@ -16,13 +23,6 @@ import {T} from './i18n'; import {localStorageBackedAtom, writeAtom} from './jotaiUtils'; import {applicationinfo} from './serverAPIState'; import {layout} from './stylexUtils'; -import * as stylex from '@stylexjs/stylex'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {useEffect} from 'react'; const dismissedAlerts = localStorageBackedAtom<{[key: string]: boolean}>( 'isl.dismissed-alerts', diff --git a/addons/isl/src/TopLevelErrors.tsx b/addons/isl/src/TopLevelErrors.tsx index d82da430a8314..0d063cfc5aa2a 100644 --- a/addons/isl/src/TopLevelErrors.tsx +++ b/addons/isl/src/TopLevelErrors.tsx @@ -5,21 +5,21 @@ * LICENSE file in the root directory of this source tree. */ -import type {MessageBusStatus} from './MessageBus'; -import type {RepoInfo} from './types'; import type {TrackErrorName} from 'isl-server/src/analytics/eventNames'; import type {ReactNode} from 'react'; +import type {MessageBusStatus} from './MessageBus'; +import type {RepoInfo} from './types'; +import {Button} from 'isl-components/Button'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {useAtomValue} from 'jotai'; +import {useThrottledEffect} from 'shared/hooks'; import {Internal} from './Internal'; import {tracker} from './analytics'; import {allDiffSummaries} from './codeReview/CodeReviewInfo'; import {t, T} from './i18n'; import platform from './platform'; import {reconnectingStatus, repositoryInfo} from './serverAPIState'; -import {Button} from 'isl-components/Button'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {useAtomValue} from 'jotai'; -import {useThrottledEffect} from 'shared/hooks'; type TopLevelErrorInfo = { title: ReactNode; diff --git a/addons/isl/src/TopLevelToast.tsx b/addons/isl/src/TopLevelToast.tsx index e71abde771e63..9a631a009fa04 100644 --- a/addons/isl/src/TopLevelToast.tsx +++ b/addons/isl/src/TopLevelToast.tsx @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import {useAtomValue} from 'jotai'; import {AnimatedReorderGroup} from './AnimatedReorderGroup'; import {hideToast, toastQueueAtom} from './toast'; -import {useAtomValue} from 'jotai'; -import './TopLevelToast.css'; import 'isl-components/Tooltip.css'; +import './TopLevelToast.css'; export function TopLevelToast() { const toastQueue = useAtomValue(toastQueueAtom); diff --git a/addons/isl/src/UncommitButton.tsx b/addons/isl/src/UncommitButton.tsx index 7555ed2d5b886..e9158820d7f5b 100644 --- a/addons/isl/src/UncommitButton.tsx +++ b/addons/isl/src/UncommitButton.tsx @@ -5,6 +5,10 @@ * LICENSE file in the root directory of this source tree. */ +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; import {getChangedFilesForHash} from './ChangedFilesWithFetching'; import {codeReviewProvider, diffSummary} from './codeReview/CodeReviewInfo'; import {t, T} from './i18n'; @@ -12,10 +16,6 @@ import {UncommitOperation} from './operations/Uncommit'; import {useRunOperation} from './operationsState'; import platform from './platform'; import {dagWithPreviews} from './previews'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; export function UncommitButton() { const dag = useAtomValue(dagWithPreviews); diff --git a/addons/isl/src/UncommittedChanges.tsx b/addons/isl/src/UncommittedChanges.tsx index 56cc004ad8f9f..7b18b2dbb3d21 100644 --- a/addons/isl/src/UncommittedChanges.tsx +++ b/addons/isl/src/UncommittedChanges.tsx @@ -5,11 +5,25 @@ * LICENSE file in the root directory of this source tree. */ +import type {Comparison} from 'shared/Comparison'; import type {CommitMessageFields} from './CommitInfoView/types'; import type {UseUncommittedSelection} from './partialSelection'; import type {ChangedFile, ChangedFileType, MergeConflicts, RepoRelativePath} from './types'; -import type {Comparison} from 'shared/Comparison'; +import * as stylex from '@stylexjs/stylex'; +import {Badge} from 'isl-components/Badge'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {HorizontallyGrowingTextField} from 'isl-components/HorizontallyGrowingTextField'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; +import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {useDeepMemo} from 'shared/hooks'; +import {minimalDisambiguousPaths} from 'shared/minimalDisambiguousPaths'; +import {group, notEmpty, partition} from 'shared/utils'; import {Avatar} from './Avatar'; import {File} from './ChangedFile'; import { @@ -47,9 +61,9 @@ import {DownwardArrow} from './icons/DownwardIcon'; import {localStorageBackedAtom, readAtom, useAtomGet, writeAtom} from './jotaiUtils'; import { AutoResolveSettingCheckbox, + PartialAbortSettingCheckbox, shouldAutoResolveAllBeforeContinue, shouldPartialAbort, - PartialAbortSettingCheckbox, } from './mergeConflicts/state'; import {AbortMergeOperation} from './operations/AbortMergeOperation'; import {AddRemoveOperation} from './operations/AddRemoveOperation'; @@ -75,20 +89,6 @@ import { import {selectedCommits} from './selection'; import {latestHeadCommit, uncommittedChangesFetchError} from './serverAPIState'; import {GeneratedStatus} from './types'; -import * as stylex from '@stylexjs/stylex'; -import {Badge} from 'isl-components/Badge'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {HorizontallyGrowingTextField} from 'isl-components/HorizontallyGrowingTextField'; -import {Icon} from 'isl-components/Icon'; -import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; -import React, {useCallback, useMemo, useEffect, useRef, useState} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {useDeepMemo} from 'shared/hooks'; -import {minimalDisambiguousPaths} from 'shared/minimalDisambiguousPaths'; -import {group, notEmpty, partition} from 'shared/utils'; import './UncommittedChanges.css'; diff --git a/addons/isl/src/UnsavedFiles.tsx b/addons/isl/src/UnsavedFiles.tsx index 27c7943e8127a..7f0e084f62b9a 100644 --- a/addons/isl/src/UnsavedFiles.tsx +++ b/addons/isl/src/UnsavedFiles.tsx @@ -5,9 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {RepoRelativePath} from './types'; import type {ContextMenuItem} from 'shared/ContextMenu'; +import type {RepoRelativePath} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {atom, useAtomValue} from 'jotai'; +import {useContextMenu} from 'shared/ContextMenu'; +import {minimalDisambiguousPaths} from 'shared/minimalDisambiguousPaths'; import serverAPI from './ClientToServerAPI'; import {Column, Row} from './ComponentUtils'; import {availableCwds} from './CwdSelector'; @@ -16,12 +22,6 @@ import {readAtom, writeAtom} from './jotaiUtils'; import platform from './platform'; import {showModal} from './useModal'; import {registerCleanup, registerDisposable} from './utils'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {atom, useAtomValue} from 'jotai'; -import {useContextMenu} from 'shared/ContextMenu'; -import {minimalDisambiguousPaths} from 'shared/minimalDisambiguousPaths'; /** * A list of files for this repo that are unsaved in the IDE. diff --git a/addons/isl/src/YouAreHereLabel.tsx b/addons/isl/src/YouAreHereLabel.tsx index 563c2aa9b9c66..463e7b5ff03c5 100644 --- a/addons/isl/src/YouAreHereLabel.tsx +++ b/addons/isl/src/YouAreHereLabel.tsx @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import React from 'react'; import {InlineBadge} from './InlineBadge'; import {t} from './i18n'; -import React from 'react'; /** The "(You are here)" blue label. Supports customized styles and children. */ export function YouAreHereLabel(props: {title?: string} & React.HTMLAttributes) { diff --git a/addons/isl/src/__tests__/Bookmarks.test.tsx b/addons/isl/src/__tests__/Bookmarks.test.tsx index f1bd4bd84c84f..15f5687e9855b 100644 --- a/addons/isl/src/__tests__/Bookmarks.test.tsx +++ b/addons/isl/src/__tests__/Bookmarks.test.tsx @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - closeCommitInfoSidebar, TEST_COMMIT_HISTORY, - COMMIT, } from '../testUtils'; -import {fireEvent, render, screen, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; /*eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/BrowseRepoUrl.test.tsx b/addons/isl/src/__tests__/BrowseRepoUrl.test.tsx index 4fbc0a0ea0241..f4e31d4692f38 100644 --- a/addons/isl/src/__tests__/BrowseRepoUrl.test.tsx +++ b/addons/isl/src/__tests__/BrowseRepoUrl.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; import App from '../App'; import platform from '../platform'; import {ignoreRTL} from '../testQueries'; import { closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + openCommitInfoSidebar, simulateCommits, - COMMIT, - simulateRepoConnected, simulateMessageFromServer, + simulateRepoConnected, simulateUncommittedChangedFiles, - openCommitInfoSidebar, } from '../testUtils'; -import {render, screen, fireEvent, act, waitFor} from '@testing-library/react'; describe('Browse repo url', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/ChangedFiles.test.tsx b/addons/isl/src/__tests__/ChangedFiles.test.tsx index 8c90a19407d6f..3f836d2d82ca1 100644 --- a/addons/isl/src/__tests__/ChangedFiles.test.tsx +++ b/addons/isl/src/__tests__/ChangedFiles.test.tsx @@ -7,22 +7,22 @@ import type {ChangedFileType, RepoRelativePath, UncommittedChanges} from '../types'; +import {act, fireEvent, render, screen} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import {defaultChangedFilesDisplayType} from '../ChangedFileDisplayTypePicker'; -import {ignoreRTL, CommitInfoTestUtils} from '../testQueries'; +import {CommitInfoTestUtils, ignoreRTL} from '../testQueries'; import { - expectMessageSentToServer, - simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, closeCommitInfoSidebar, - simulateRepoConnected, + COMMIT, + expectMessageSentToServer, resetTestMessages, + simulateCommits, simulateMessageFromServer, + simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; import {leftPad} from '../utils'; -import {fireEvent, render, screen, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; jest.mock('isl-components/OperatingSystem', () => ({ isMac: true, diff --git a/addons/isl/src/__tests__/ChangedFilesWithFetching.test.tsx b/addons/isl/src/__tests__/ChangedFilesWithFetching.test.tsx index b6f5ff6321809..5d0de22367bd8 100644 --- a/addons/isl/src/__tests__/ChangedFilesWithFetching.test.tsx +++ b/addons/isl/src/__tests__/ChangedFilesWithFetching.test.tsx @@ -7,19 +7,19 @@ import type {ChangedFile, ChangedFileType, RepoRelativePath} from '../types'; +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; import App from '../App'; -import {ignoreRTL, CommitInfoTestUtils} from '../testQueries'; +import {CommitInfoTestUtils, ignoreRTL} from '../testQueries'; import { - expectMessageSentToServer, - simulateCommits, COMMIT, - simulateRepoConnected, + expectMessageNOTSentToServer, + expectMessageSentToServer, resetTestMessages, + simulateCommits, simulateMessageFromServer, - expectMessageNOTSentToServer, + simulateRepoConnected, } from '../testUtils'; import {leftPad} from '../utils'; -import {fireEvent, render, screen, waitFor, act} from '@testing-library/react'; function makeFiles(n: number): Array { return new Array(n).fill(null).map((_, i) => `file${leftPad(i, 3, '0')}.txt`); diff --git a/addons/isl/src/__tests__/ClientToServer.test.ts b/addons/isl/src/__tests__/ClientToServer.test.ts index 39f2a6011b789..016e047a9aaa1 100644 --- a/addons/isl/src/__tests__/ClientToServer.test.ts +++ b/addons/isl/src/__tests__/ClientToServer.test.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {nextTick} from 'shared/testUtils'; import clientToServerAPI from '../ClientToServerAPI'; import {resetTestMessages, simulateMessageFromServer} from '../testUtils'; -import {nextTick} from 'shared/testUtils'; describe('ClientToServer', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/Combine.test.tsx b/addons/isl/src/__tests__/Combine.test.tsx index 8cce24e4da3fe..04824541760ef 100644 --- a/addons/isl/src/__tests__/Combine.test.tsx +++ b/addons/isl/src/__tests__/Combine.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import {CommitInfoTestUtils} from '../testQueries'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, closeCommitInfoSidebar, - TEST_COMMIT_HISTORY, expectMessageNOTSentToServer, + expectMessageSentToServer, openCommitInfoSidebar, + resetTestMessages, + simulateCommits, + TEST_COMMIT_HISTORY, } from '../testUtils'; import {CommandRunner} from '../types'; -import {fireEvent, render, screen, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; /*eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/CommitInfoView.test.tsx b/addons/isl/src/__tests__/CommitInfoView.test.tsx index 67835777c0fc0..851852601e978 100644 --- a/addons/isl/src/__tests__/CommitInfoView.test.tsx +++ b/addons/isl/src/__tests__/CommitInfoView.test.tsx @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import platform from '../platform'; import {CommitInfoTestUtils, CommitTreeListTestUtils, ignoreRTL} from '../testQueries'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, - simulateUncommittedChangedFiles, - simulateMessageFromServer, + expectMessageSentToServer, openCommitInfoSidebar, + resetTestMessages, + simulateCommits, + simulateMessageFromServer, + simulateUncommittedChangedFiles, waitForWithTick, } from '../testUtils'; import {CommandRunner, succeedableRevset} from '../types'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/CommitTreeList.test.tsx b/addons/isl/src/__tests__/CommitTreeList.test.tsx index 6b46f3629ea3d..4b57f0409b9b7 100644 --- a/addons/isl/src/__tests__/CommitTreeList.test.tsx +++ b/addons/isl/src/__tests__/CommitTreeList.test.tsx @@ -5,21 +5,21 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; import App from '../App'; import {CommitInfoTestUtils, ignoreRTL} from '../testQueries'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, closeCommitInfoSidebar, - simulateRepoConnected, + COMMIT, commitInfoIsOpen, + expectMessageSentToServer, openCommitInfoSidebar, + resetTestMessages, + simulateCommits, + simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; import {CommandRunner} from '../types'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; describe('CommitTreeList', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/ComparisonView.test.tsx b/addons/isl/src/__tests__/ComparisonView.test.tsx index 9e38d361400bd..702963c9397d6 100644 --- a/addons/isl/src/__tests__/ComparisonView.test.tsx +++ b/addons/isl/src/__tests__/ComparisonView.test.tsx @@ -7,6 +7,12 @@ import type {RenderResult} from '@testing-library/react'; +import {act, cleanup, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import fs from 'node:fs'; +import path from 'node:path'; +import {ComparisonType} from 'shared/Comparison'; +import {nextTick} from 'shared/testUtils'; +import {nullthrows} from 'shared/utils'; import App from '../App'; import {cancelAllHighlightingTasks} from '../ComparisonView/SplitDiffView/syntaxHighlighting'; import {parsePatchAndFilter, sortFilesByType} from '../ComparisonView/utils'; @@ -21,12 +27,6 @@ import { waitForWithTick, } from '../testUtils'; import {GeneratedStatus} from '../types'; -import {act, screen, render, waitFor, fireEvent, cleanup, within} from '@testing-library/react'; -import fs from 'node:fs'; -import path from 'node:path'; -import {ComparisonType} from 'shared/Comparison'; -import {nextTick} from 'shared/testUtils'; -import {nullthrows} from 'shared/utils'; afterEach(cleanup); diff --git a/addons/isl/src/__tests__/CopyRenameFiles.test.tsx b/addons/isl/src/__tests__/CopyRenameFiles.test.tsx index 9f0d3cef818f8..115d1017fa18b 100644 --- a/addons/isl/src/__tests__/CopyRenameFiles.test.tsx +++ b/addons/isl/src/__tests__/CopyRenameFiles.test.tsx @@ -7,18 +7,18 @@ import type {CommandArg} from '../types'; +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; import App from '../App'; import {ignoreRTL} from '../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, - closeCommitInfoSidebar, simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; -import {fireEvent, render, screen, act, waitFor} from '@testing-library/react'; describe('CopyRenameFiles', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/Delayed.test.tsx b/addons/isl/src/__tests__/Delayed.test.tsx index 38e861a262a0c..e036ede3d1d56 100644 --- a/addons/isl/src/__tests__/Delayed.test.tsx +++ b/addons/isl/src/__tests__/Delayed.test.tsx @@ -7,8 +7,8 @@ import type {RenderResult} from '@testing-library/react'; -import {Delayed} from '../Delayed'; import {act, render, screen} from '@testing-library/react'; +import {Delayed} from '../Delayed'; describe('', () => { let rendered: RenderResult | null = null; diff --git a/addons/isl/src/__tests__/DownloadCommits.test.tsx b/addons/isl/src/__tests__/DownloadCommits.test.tsx index bdbbec666c5f7..671cfc21cf820 100644 --- a/addons/isl/src/__tests__/DownloadCommits.test.tsx +++ b/addons/isl/src/__tests__/DownloadCommits.test.tsx @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import * as utils from 'shared/utils'; import App from '../App'; import { closeCommitInfoSidebar, @@ -16,9 +19,6 @@ import { TEST_COMMIT_HISTORY, } from '../testUtils'; import {CommandRunner} from '../types'; -import {screen, act, render, fireEvent, waitFor} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import * as utils from 'shared/utils'; describe('Download Commits', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/FetchAdditionalCommitsButton.test.tsx b/addons/isl/src/__tests__/FetchAdditionalCommitsButton.test.tsx index fa0ad3314059f..56bb84037e06f 100644 --- a/addons/isl/src/__tests__/FetchAdditionalCommitsButton.test.tsx +++ b/addons/isl/src/__tests__/FetchAdditionalCommitsButton.test.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; +import * as utils from 'shared/utils'; import App from '../App'; import { - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, - simulateRepoConnected, + expectMessageSentToServer, + simulateCommits, simulateMessageFromServer, + simulateRepoConnected, } from '../testUtils'; import {CommandRunner} from '../types'; -import {fireEvent, render, screen, act, waitFor} from '@testing-library/react'; -import * as utils from 'shared/utils'; const allCommits = [ COMMIT('1', 'some public base', '0', {phase: 'public'}), diff --git a/addons/isl/src/__tests__/FillCommitMessage.test.tsx b/addons/isl/src/__tests__/FillCommitMessage.test.tsx index eb3ce69c02e84..c4c03b9a488f9 100644 --- a/addons/isl/src/__tests__/FillCommitMessage.test.tsx +++ b/addons/isl/src/__tests__/FillCommitMessage.test.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import platform from '../platform'; import {CommitInfoTestUtils} from '../testQueries'; import { - expectMessageSentToServer, - simulateCommits, COMMIT, + expectMessageSentToServer, openCommitInfoSidebar, + simulateCommits, simulateMessageFromServer, } from '../testUtils'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/FocusMode.test.tsx b/addons/isl/src/__tests__/FocusMode.test.tsx index 162a15fd323fb..3072da21c5e3d 100644 --- a/addons/isl/src/__tests__/FocusMode.test.tsx +++ b/addons/isl/src/__tests__/FocusMode.test.tsx @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; import App from '../App'; import { - resetTestMessages, closeCommitInfoSidebar, - simulateCommits, COMMIT, dragAndDropCommits, + resetTestMessages, + simulateCommits, } from '../testUtils'; -import {screen, act, render, fireEvent} from '@testing-library/react'; describe('focus mode', () => { const COMMITS = [ diff --git a/addons/isl/src/__tests__/GeneratedFiles.test.tsx b/addons/isl/src/__tests__/GeneratedFiles.test.tsx index 13cb3d21f6d7b..563643b398fb3 100644 --- a/addons/isl/src/__tests__/GeneratedFiles.test.tsx +++ b/addons/isl/src/__tests__/GeneratedFiles.test.tsx @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; import App from '../App'; import {genereatedFileCache} from '../GeneratedFile'; import {__TEST__} from '../UncommittedChanges'; @@ -12,18 +13,17 @@ import {readAtom, writeAtom} from '../jotaiUtils'; import platform from '../platform'; import {ignoreRTL} from '../testQueries'; import { - expectMessageSentToServer, - simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, closeCommitInfoSidebar, - simulateRepoConnected, + COMMIT, + expectMessageSentToServer, + openCommitInfoSidebar, resetTestMessages, + simulateCommits, simulateMessageFromServer, - openCommitInfoSidebar, + simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; import {GeneratedStatus} from '../types'; -import {fireEvent, render, screen, waitFor, act} from '@testing-library/react'; /** Generated `num` files, in the repeating pattern: genereated, partially generated, manual */ async function simulateGeneratedFiles(num: number) { diff --git a/addons/isl/src/__tests__/GitHubPRBadge.test.tsx b/addons/isl/src/__tests__/GitHubPRBadge.test.tsx index 6a6a781e26340..8d16243d433eb 100644 --- a/addons/isl/src/__tests__/GitHubPRBadge.test.tsx +++ b/addons/isl/src/__tests__/GitHubPRBadge.test.tsx @@ -7,19 +7,19 @@ import type {DiffId, DiffSummary} from '../types'; +import {act, fireEvent, render, screen, within} from '@testing-library/react'; import {PullRequestState} from '../../../isl-server/src/github/generated/graphql'; import App from '../App'; import platform from '../platform'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, + expectMessageSentToServer, + resetTestMessages, + simulateCommits, simulateMessageFromServer, suppressReactErrorBoundaryErrorMessages, } from '../testUtils'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; describe('GitHubPRBadge', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/ImageUpload.test.tsx b/addons/isl/src/__tests__/ImageUpload.test.tsx index 916c3eec5d7b1..0a4e7b0cf8e28 100644 --- a/addons/isl/src/__tests__/ImageUpload.test.tsx +++ b/addons/isl/src/__tests__/ImageUpload.test.tsx @@ -7,6 +7,10 @@ import type {CodeReviewSystem} from '../types'; +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import {nextTick} from 'shared/testUtils'; +import * as utils from 'shared/utils'; import App from '../App'; import {CommitInfoTestUtils} from '../testQueries'; import { @@ -19,10 +23,6 @@ import { simulateMessageFromServer, simulateUncommittedChangedFiles, } from '../testUtils'; -import {fireEvent, render, waitFor, screen, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import {nextTick} from 'shared/testUtils'; -import * as utils from 'shared/utils'; describe('Image upload inside TextArea ', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/LocalWebsocketEventBus.test.ts b/addons/isl/src/__tests__/LocalWebsocketEventBus.test.ts index 5a4c1e25d58a5..6eccddc6f4d33 100644 --- a/addons/isl/src/__tests__/LocalWebsocketEventBus.test.ts +++ b/addons/isl/src/__tests__/LocalWebsocketEventBus.test.ts @@ -9,9 +9,9 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-this-alias */ +import type {Writable} from 'shared/typeUtils'; import type {LocalWebSocketEventBus as LocalWebSocketEventBusType} from '../LocalWebSocketEventBus'; import type {PlatformName} from '../types'; -import type {Writable} from 'shared/typeUtils'; const LocalWebSocketEventBus = // eslint-disable-next-line @typescript-eslint/consistent-type-imports diff --git a/addons/isl/src/__tests__/MergeConflicts.test.tsx b/addons/isl/src/__tests__/MergeConflicts.test.tsx index 9771ab8ff8d13..8858ee72dce35 100644 --- a/addons/isl/src/__tests__/MergeConflicts.test.tsx +++ b/addons/isl/src/__tests__/MergeConflicts.test.tsx @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; import App from '../App'; import {mostRecentSubscriptionIds} from '../serverAPIState'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, - closeCommitInfoSidebar, simulateMessageFromServer, + simulateUncommittedChangedFiles, } from '../testUtils'; import {ConflictType} from '../types'; -import {fireEvent, render, screen, act} from '@testing-library/react'; describe('CommitTreeList', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/Shelve.test.tsx b/addons/isl/src/__tests__/Shelve.test.tsx index 05f8aab334016..75ddb17fdc62e 100644 --- a/addons/isl/src/__tests__/Shelve.test.tsx +++ b/addons/isl/src/__tests__/Shelve.test.tsx @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import {ComparisonType} from 'shared/Comparison'; +import {nullthrows} from 'shared/utils'; import App from '../App'; import {ignoreRTL} from '../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, - closeCommitInfoSidebar, - simulateRepoConnected, simulateMessageFromServer, + simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import {ComparisonType} from 'shared/Comparison'; -import {nullthrows} from 'shared/utils'; describe('Shelve', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/SuggestedRebase.test.tsx b/addons/isl/src/__tests__/SuggestedRebase.test.tsx index 36e9f6cb2d237..14e464ed19f20 100644 --- a/addons/isl/src/__tests__/SuggestedRebase.test.tsx +++ b/addons/isl/src/__tests__/SuggestedRebase.test.tsx @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, within} from '@testing-library/react'; import App from '../App'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, + expectMessageSentToServer, + resetTestMessages, + simulateCommits, simulateRepoConnected, } from '../testUtils'; import {succeedableRevset} from '../types'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; describe('Suggested Rebase button', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/Tooltip.test.tsx b/addons/isl/src/__tests__/Tooltip.test.tsx index 31488f09882f5..a18fdc648b403 100644 --- a/addons/isl/src/__tests__/Tooltip.test.tsx +++ b/addons/isl/src/__tests__/Tooltip.test.tsx @@ -7,18 +7,18 @@ import type {ReactNode} from 'react'; +import {act, fireEvent, render, screen, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import {Tooltip} from 'isl-components/Tooltip'; +import {ViewportOverlayRoot} from 'isl-components/ViewportOverlay'; import App from '../App'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, + expectMessageSentToServer, + resetTestMessages, + simulateCommits, } from '../testUtils'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import {Tooltip} from 'isl-components/Tooltip'; -import {ViewportOverlayRoot} from 'isl-components/ViewportOverlay'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/UnsavedFiles.test.tsx b/addons/isl/src/__tests__/UnsavedFiles.test.tsx index e014a2b2d70b2..3077d7c6a347e 100644 --- a/addons/isl/src/__tests__/UnsavedFiles.test.tsx +++ b/addons/isl/src/__tests__/UnsavedFiles.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; +import {nextTick} from 'shared/testUtils'; import App from '../App'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, + expectMessageNOTSentToServer, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, - closeCommitInfoSidebar, - simulateRepoConnected, simulateMessageFromServer, - expectMessageNOTSentToServer, + simulateRepoConnected, + simulateUncommittedChangedFiles, } from '../testUtils'; -import {fireEvent, render, screen, act, waitFor} from '@testing-library/react'; -import {nextTick} from 'shared/testUtils'; describe('UnsavedFiles', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/alerts.test.tsx b/addons/isl/src/__tests__/alerts.test.tsx index e4cad19429fd7..193d0a5215fd9 100644 --- a/addons/isl/src/__tests__/alerts.test.tsx +++ b/addons/isl/src/__tests__/alerts.test.tsx @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; import App from '../App'; import { closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, simulateCommits, - COMMIT, simulateMessageFromServer, simulateRepoConnected, } from '../testUtils'; -import {render, screen, fireEvent, act} from '@testing-library/react'; describe('cwd', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/cwd.test.tsx b/addons/isl/src/__tests__/cwd.test.tsx index 4e1bb5b742754..bc84a5fc63b7a 100644 --- a/addons/isl/src/__tests__/cwd.test.tsx +++ b/addons/isl/src/__tests__/cwd.test.tsx @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, within} from '@testing-library/react'; import App from '../App'; import {__TEST__} from '../repositoryData'; import {CommitTreeListTestUtils} from '../testQueries'; import { closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, simulateMessageFromServer, - resetTestMessages, simulateRepoConnected, } from '../testUtils'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; const {isIrrelevantToCwd} = __TEST__; const {clickGoto} = CommitTreeListTestUtils; diff --git a/addons/isl/src/__tests__/i18n.test.tsx b/addons/isl/src/__tests__/i18n.test.tsx index 0cd8fc08fa965..658e5d91851f2 100644 --- a/addons/isl/src/__tests__/i18n.test.tsx +++ b/addons/isl/src/__tests__/i18n.test.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {I18nSupport, t, T} from '../i18n'; import {render, screen} from '@testing-library/react'; +import {I18nSupport, t, T} from '../i18n'; import '../i18n/en/common.json'; jest.mock( diff --git a/addons/isl/src/__tests__/interactiveSplit.test.tsx b/addons/isl/src/__tests__/interactiveSplit.test.tsx index 24669429c2607..935c09093e8ea 100644 --- a/addons/isl/src/__tests__/interactiveSplit.test.tsx +++ b/addons/isl/src/__tests__/interactiveSplit.test.tsx @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -import type {CodeReviewSystem} from '../types'; import type {DateTuple} from 'shared/types/common'; +import type {CodeReviewSystem} from '../types'; +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import * as utils from 'shared/utils'; import App from '../App'; import { - resetTestMessages, + closeCommitInfoSidebar, + expectMessageNOTSentToServer, expectMessageSentToServer, + resetTestMessages, simulateCommits, - closeCommitInfoSidebar, - TEST_COMMIT_HISTORY, simulateMessageFromServer, - expectMessageNOTSentToServer, + TEST_COMMIT_HISTORY, } from '../testUtils'; import {CommandRunner} from '../types'; -import {fireEvent, render, screen, act, waitFor, within} from '@testing-library/react'; -import * as utils from 'shared/utils'; const EXPORT_STACK_DATA = [ { diff --git a/addons/isl/src/__tests__/jotaiUtils.test.tsx b/addons/isl/src/__tests__/jotaiUtils.test.tsx index d1a50f1bfafe6..58f9c42d66dc8 100644 --- a/addons/isl/src/__tests__/jotaiUtils.test.tsx +++ b/addons/isl/src/__tests__/jotaiUtils.test.tsx @@ -5,27 +5,27 @@ * LICENSE file in the root directory of this source tree. */ +import type {Atom} from 'jotai'; import type {AtomFamilyWeak} from '../jotaiUtils'; import type {Platform} from '../platform'; import type {LocalStorageName} from '../types'; -import type {Atom} from 'jotai'; +import {act, render} from '@testing-library/react'; +import {List} from 'immutable'; +import {Provider, atom, createStore, useAtomValue} from 'jotai'; +import {StrictMode} from 'react'; +import {SelfUpdate} from 'shared/immutableExt'; +import {gc, nextTick} from 'shared/testUtils'; import { atomFamilyWeak, + atomResetOnDepChange, lazyAtom, + localStorageBackedAtomFamily, readAtom, - writeAtom, useAtomGet, useAtomHas, - atomResetOnDepChange, - localStorageBackedAtomFamily, + writeAtom, } from '../jotaiUtils'; -import {render, act} from '@testing-library/react'; -import {List} from 'immutable'; -import {Provider, atom, createStore, useAtomValue} from 'jotai'; -import {StrictMode} from 'react'; -import {SelfUpdate} from 'shared/immutableExt'; -import {gc, nextTick} from 'shared/testUtils'; class Foo extends SelfUpdate> {} diff --git a/addons/isl/src/__tests__/linelog.test.ts b/addons/isl/src/__tests__/linelog.test.ts index e6ff65b0d15d9..2a01fff3a3154 100644 --- a/addons/isl/src/__tests__/linelog.test.ts +++ b/addons/isl/src/__tests__/linelog.test.ts @@ -31,10 +31,10 @@ SOFTWARE. import type {LineIdx, Rev} from '../linelog'; -import {LineLog, executeCache} from '../linelog'; -import {describe, it, expect} from '@jest/globals'; +import {describe, expect, it} from '@jest/globals'; import * as Immutable from 'immutable'; import {splitLines} from 'shared/diff'; +import {LineLog, executeCache} from '../linelog'; describe('LineLog', () => { it('can be empty', () => { diff --git a/addons/isl/src/__tests__/operations.test.tsx b/addons/isl/src/__tests__/operations.test.tsx index 9cb51e75d862b..73dc7239efad2 100644 --- a/addons/isl/src/__tests__/operations.test.tsx +++ b/addons/isl/src/__tests__/operations.test.tsx @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, within} from '@testing-library/react'; +import * as utils from 'shared/utils'; import App from '../App'; import {Internal} from '../Internal'; import {tracker} from '../analytics'; @@ -13,19 +15,17 @@ import {operationList} from '../operationsState'; import {mostRecentSubscriptionIds} from '../serverAPIState'; import {CommitTreeListTestUtils} from '../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, + dragAndDropCommits, expectMessageSentToServer, + expectYouAreHerePointAt, + resetTestMessages, simulateCommits, - closeCommitInfoSidebar, simulateMessageFromServer, - TEST_COMMIT_HISTORY, simulateRepoConnected, - dragAndDropCommits, - COMMIT, - expectYouAreHerePointAt, + TEST_COMMIT_HISTORY, } from '../testUtils'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; -import * as utils from 'shared/utils'; const {clickGoto} = CommitTreeListTestUtils; diff --git a/addons/isl/src/__tests__/operations/amendMessageOperation.test.tsx b/addons/isl/src/__tests__/operations/amendMessageOperation.test.tsx index 7e9ce75feea84..8f5cfa8587471 100644 --- a/addons/isl/src/__tests__/operations/amendMessageOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/amendMessageOperation.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, render, waitFor} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import * as utils from 'shared/utils'; import App from '../../App'; import {CommitInfoTestUtils, CommitTreeListTestUtils} from '../../testQueries'; import { - resetTestMessages, + COMMIT, expectMessageSentToServer, + openCommitInfoSidebar, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, simulateMessageFromServer, - openCommitInfoSidebar, + simulateUncommittedChangedFiles, } from '../../testUtils'; -import {render, waitFor, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import * as utils from 'shared/utils'; describe('AmendMessageOperation', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/operations/amendOperation.test.tsx b/addons/isl/src/__tests__/operations/amendOperation.test.tsx index 88ea730685e36..595676a4f3212 100644 --- a/addons/isl/src/__tests__/operations/amendOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/amendOperation.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, render, waitFor} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import * as utils from 'shared/utils'; import App from '../../App'; import {CommitInfoTestUtils} from '../../testQueries'; import { - resetTestMessages, + COMMIT, expectMessageSentToServer, + openCommitInfoSidebar, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, simulateMessageFromServer, - openCommitInfoSidebar, + simulateUncommittedChangedFiles, } from '../../testUtils'; -import {render, waitFor, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import * as utils from 'shared/utils'; describe('AmendOperation', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/operations/checkoutOperation.test.tsx b/addons/isl/src/__tests__/operations/checkoutOperation.test.tsx index 1d0275e37a8b9..cd1f7178be84d 100644 --- a/addons/isl/src/__tests__/operations/checkoutOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/checkoutOperation.test.tsx @@ -7,20 +7,20 @@ import type {Hash} from '../../types'; +import {act, fireEvent, render, screen} from '@testing-library/react'; +import {nextTick} from 'shared/testUtils'; import App from '../../App'; import platform from '../../platform'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, - expectYouAreHerePointAt, expectMessageNOTSentToServer, + expectMessageSentToServer, + expectYouAreHerePointAt, + resetTestMessages, + simulateCommits, } from '../../testUtils'; import {CommandRunner, succeedableRevset} from '../../types'; -import {fireEvent, render, screen, act} from '@testing-library/react'; -import {nextTick} from 'shared/testUtils'; describe('GotoOperation', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/operations/commitOperation.test.tsx b/addons/isl/src/__tests__/operations/commitOperation.test.tsx index 61ccc4639ee16..cd1893f5392b4 100644 --- a/addons/isl/src/__tests__/operations/commitOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/commitOperation.test.tsx @@ -5,21 +5,21 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import * as utils from 'shared/utils'; import App from '../../App'; import {CommitInfoTestUtils} from '../../testQueries'; import { - resetTestMessages, + COMMIT, expectMessageSentToServer, + openCommitInfoSidebar, + resetTestMessages, simulateCommits, - COMMIT, - simulateUncommittedChangedFiles, simulateMessageFromServer, - openCommitInfoSidebar, + simulateUncommittedChangedFiles, } from '../../testUtils'; import {CommandRunner} from '../../types'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import * as utils from 'shared/utils'; describe('CommitOperation', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/operations/hideOperation.test.tsx b/addons/isl/src/__tests__/operations/hideOperation.test.tsx index 095220fdfc13b..30977ab6d0f2d 100644 --- a/addons/isl/src/__tests__/operations/hideOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/hideOperation.test.tsx @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../../App'; import {CommitInfoTestUtils, CommitTreeListTestUtils} from '../../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - closeCommitInfoSidebar, TEST_COMMIT_HISTORY, - COMMIT, } from '../../testUtils'; import {CommandRunner} from '../../types'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; /*eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/operations/rebaseOperation.test.tsx b/addons/isl/src/__tests__/operations/rebaseOperation.test.tsx index 41a1bade01908..81e7bc479e0fc 100644 --- a/addons/isl/src/__tests__/operations/rebaseOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/rebaseOperation.test.tsx @@ -7,27 +7,27 @@ import type {Hash} from '../../types'; +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; import App from '../../App'; import {Dag, DagCommitInfo} from '../../dag/dag'; import {RebaseOperation} from '../../operations/RebaseOperation'; import {CommitPreview} from '../../previews'; import {ignoreRTL} from '../../testQueries'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, - expectMessageNOTSentToServer, closeCommitInfoSidebar, - TEST_COMMIT_HISTORY, - dragAndDropCommits, - simulateUncommittedChangedFiles, COMMIT, - scanForkedBranchHashes, + dragAndDropCommits, dragCommits, dropCommits, + expectMessageNOTSentToServer, + expectMessageSentToServer, + resetTestMessages, + scanForkedBranchHashes, + simulateCommits, + simulateUncommittedChangedFiles, + TEST_COMMIT_HISTORY, } from '../../testUtils'; import {CommandRunner, succeedableRevset} from '../../types'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; /*eslint-disable @typescript-eslint/no-non-null-assertion */ diff --git a/addons/isl/src/__tests__/operations/revertOperation.test.tsx b/addons/isl/src/__tests__/operations/revertOperation.test.tsx index 7b6fbfcb18458..b21fa0d21d694 100644 --- a/addons/isl/src/__tests__/operations/revertOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/revertOperation.test.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, within} from '@testing-library/react'; +import {nextTick} from 'shared/testUtils'; import App from '../../App'; import platform from '../../platform'; import {CommitInfoTestUtils, CommitTreeListTestUtils, ignoreRTL} from '../../testQueries'; import { - resetTestMessages, + COMMIT, + expectMessageNOTSentToServer, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, simulateUncommittedChangedFiles, - expectMessageNOTSentToServer, } from '../../testUtils'; import {CommandRunner} from '../../types'; -import {fireEvent, render, screen, within, act} from '@testing-library/react'; -import {nextTick} from 'shared/testUtils'; /* eslint-disable require-await */ diff --git a/addons/isl/src/__tests__/operations/uncommitOperation.test.tsx b/addons/isl/src/__tests__/operations/uncommitOperation.test.tsx index 96d48ea8c48be..8fcfd3d22b1ac 100644 --- a/addons/isl/src/__tests__/operations/uncommitOperation.test.tsx +++ b/addons/isl/src/__tests__/operations/uncommitOperation.test.tsx @@ -7,19 +7,19 @@ import type {ChangedFile} from '../../types'; +import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; import App from '../../App'; import platform from '../../platform'; import {CommitTreeListTestUtils, ignoreRTL} from '../../testQueries'; import { - resetTestMessages, - expectMessageSentToServer, - simulateCommits, COMMIT, closeCommitInfoSidebar, + expectMessageSentToServer, + resetTestMessages, + simulateCommits, simulateMessageFromServer, } from '../../testUtils'; import {CommandRunner} from '../../types'; -import {act, fireEvent, render, screen, waitFor} from '@testing-library/react'; const {withinCommitTree} = CommitTreeListTestUtils; diff --git a/addons/isl/src/__tests__/optimisticRevset.test.tsx b/addons/isl/src/__tests__/optimisticRevset.test.tsx index 72dbbc4c3b938..79b0ee293d4ed 100644 --- a/addons/isl/src/__tests__/optimisticRevset.test.tsx +++ b/addons/isl/src/__tests__/optimisticRevset.test.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen, waitFor, within} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import {CommitInfoTestUtils} from '../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, expectMessageSentToServer, + resetTestMessages, simulateCommits, - COMMIT, simulateUncommittedChangedFiles, - closeCommitInfoSidebar, } from '../testUtils'; -import {fireEvent, render, screen, waitFor, within, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; describe('Optimistic Revset', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/persistAtomToConfigEffect.test.tsx b/addons/isl/src/__tests__/persistAtomToConfigEffect.test.tsx index 7577dd52f19b7..3ad802f08706f 100644 --- a/addons/isl/src/__tests__/persistAtomToConfigEffect.test.tsx +++ b/addons/isl/src/__tests__/persistAtomToConfigEffect.test.tsx @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import {act, render, screen} from '@testing-library/react'; import App from '../App'; import platform from '../platform'; import {CommitInfoTestUtils} from '../testQueries'; import { + COMMIT, expectMessageSentToServer, simulateCommits, - COMMIT, simulateRepoConnected, } from '../testUtils'; -import {render, screen, act} from '@testing-library/react'; describe('persistAtomToLocalStorageEffect', () => { const getTemporary = jest.fn(); diff --git a/addons/isl/src/__tests__/selection.test.tsx b/addons/isl/src/__tests__/selection.test.tsx index fc2367ab2ba45..0724ca1fc97b6 100644 --- a/addons/isl/src/__tests__/selection.test.tsx +++ b/addons/isl/src/__tests__/selection.test.tsx @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import {readAtom} from '../jotaiUtils'; import {individualToggleKey, selectedCommits} from '../selection'; import {mostRecentSubscriptionIds} from '../serverAPIState'; -import {CommitTreeListTestUtils, CommitInfoTestUtils} from '../testQueries'; +import {CommitInfoTestUtils, CommitTreeListTestUtils} from '../testQueries'; import { - resetTestMessages, + closeCommitInfoSidebar, + COMMIT, + commitInfoIsOpen, expectMessageSentToServer, + resetTestMessages, simulateCommits, simulateRepoConnected, TEST_COMMIT_HISTORY, - COMMIT, - closeCommitInfoSidebar, - commitInfoIsOpen, } from '../testUtils'; -import {fireEvent, render, screen, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; describe('selection', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/succession.test.tsx b/addons/isl/src/__tests__/succession.test.tsx index 238b9e30e95f8..a188d9cdc2d5c 100644 --- a/addons/isl/src/__tests__/succession.test.tsx +++ b/addons/isl/src/__tests__/succession.test.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import {act, render} from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import App from '../App'; import {__TEST__} from '../CommitInfoView/CommitInfoState'; import {successionTracker} from '../SuccessionTracker'; import {CommitInfoTestUtils} from '../testQueries'; -import {resetTestMessages, expectMessageSentToServer, simulateCommits, COMMIT} from '../testUtils'; -import {render, act} from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; +import {COMMIT, expectMessageSentToServer, resetTestMessages, simulateCommits} from '../testUtils'; describe('succession', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/timer.test.ts b/addons/isl/src/__tests__/timer.test.ts index e9da968e82694..22638336340e4 100644 --- a/addons/isl/src/__tests__/timer.test.ts +++ b/addons/isl/src/__tests__/timer.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {Timer} from '../timer'; import {gc} from 'shared/testUtils'; +import {Timer} from '../timer'; describe('Timer', () => { beforeEach(() => { diff --git a/addons/isl/src/__tests__/toasts.test.tsx b/addons/isl/src/__tests__/toasts.test.tsx index bea6042de6c78..027fc611bdfad 100644 --- a/addons/isl/src/__tests__/toasts.test.tsx +++ b/addons/isl/src/__tests__/toasts.test.tsx @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import {act, fireEvent, render, screen} from '@testing-library/react'; import App from '../App'; import platform from '../platform'; import { @@ -13,7 +14,6 @@ import { resetTestMessages, simulateCommits, } from '../testUtils'; -import {screen, act, fireEvent, render} from '@testing-library/react'; describe('toasts', () => { beforeEach(() => { diff --git a/addons/isl/src/analytics/LogRenderExposures.tsx b/addons/isl/src/analytics/LogRenderExposures.tsx index 5b83d38fe00b3..b3873b0f0429a 100644 --- a/addons/isl/src/analytics/LogRenderExposures.tsx +++ b/addons/isl/src/analytics/LogRenderExposures.tsx @@ -9,8 +9,8 @@ import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; import type {TrackData} from 'isl-server/src/analytics/types'; import type {ReactNode} from 'react'; -import {tracker} from './index'; import {useThrottledEffect} from 'shared/hooks'; +import {tracker} from './index'; /** * Log an analytics event when a component renders the first time. diff --git a/addons/isl/src/analytics/index.ts b/addons/isl/src/analytics/index.ts index 1e6dc43264d15..cb4afe7f027e2 100644 --- a/addons/isl/src/analytics/index.ts +++ b/addons/isl/src/analytics/index.ts @@ -7,8 +7,8 @@ import type {TrackDataWithEventName} from 'isl-server/src/analytics/types'; -import {Internal} from '../Internal'; import {Tracker} from 'isl-server/src/analytics/tracker'; +import {Internal} from '../Internal'; /** Client-side global analytics tracker */ export const tracker = new Tracker(sendDataToServer, {}); diff --git a/addons/isl/src/atoms/experimentalFeatureAtoms.ts b/addons/isl/src/atoms/experimentalFeatureAtoms.ts index 9b75e4f9d8bbc..2185f6e15c2ee 100644 --- a/addons/isl/src/atoms/experimentalFeatureAtoms.ts +++ b/addons/isl/src/atoms/experimentalFeatureAtoms.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {configBackedAtom, localStorageBackedAtom} from '../jotaiUtils'; import {atom} from 'jotai'; +import {configBackedAtom, localStorageBackedAtom} from '../jotaiUtils'; // This config is intended to be controlled remotely. So it's read-only. const remoteExperimentalFeatures = configBackedAtom( diff --git a/addons/isl/src/atoms/keyboardAtoms.ts b/addons/isl/src/atoms/keyboardAtoms.ts index 0f8fe13cb24ff..f80aa29c7d0f7 100644 --- a/addons/isl/src/atoms/keyboardAtoms.ts +++ b/addons/isl/src/atoms/keyboardAtoms.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {atom} from 'jotai'; import {writeAtom} from '../jotaiUtils'; import {registerCleanup} from '../utils'; -import {atom} from 'jotai'; /** Subset of KeyboardEvent. */ export type KeyPress = { diff --git a/addons/isl/src/codeReview/CodeReviewInfo.ts b/addons/isl/src/codeReview/CodeReviewInfo.ts index 0e8b03feac8a0..e3a926d8a2aa7 100644 --- a/addons/isl/src/codeReview/CodeReviewInfo.ts +++ b/addons/isl/src/codeReview/CodeReviewInfo.ts @@ -8,6 +8,10 @@ import type {DiffId, DiffSummary, Hash, PageVisibility, RepoInfo, Result} from '../types'; import type {UICodeReviewProvider} from './UICodeReviewProvider'; +import {atom} from 'jotai'; +import {clearTrackedCache} from 'shared/LRU'; +import {debounce} from 'shared/debounce'; +import {firstLine, nullthrows} from 'shared/utils'; import serverAPI from '../ClientToServerAPI'; import {commitMessageTemplate} from '../CommitInfoView/CommitInfoState'; import { @@ -24,10 +28,6 @@ import {dagWithPreviews} from '../previews'; import {commitByHash, repositoryInfo} from '../serverAPIState'; import {registerCleanup, registerDisposable} from '../utils'; import {GithubUICodeReviewProvider} from './github/github'; -import {atom} from 'jotai'; -import {clearTrackedCache} from 'shared/LRU'; -import {debounce} from 'shared/debounce'; -import {firstLine, nullthrows} from 'shared/utils'; export const codeReviewProvider = atom(get => { const repoInfo = get(repositoryInfo); diff --git a/addons/isl/src/codeReview/DiffBadge.tsx b/addons/isl/src/codeReview/DiffBadge.tsx index 87f60c5e8b787..38c35928fbe1c 100644 --- a/addons/isl/src/codeReview/DiffBadge.tsx +++ b/addons/isl/src/codeReview/DiffBadge.tsx @@ -5,10 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {CommitInfo, DiffId, DiffSummary} from '../types'; import type {UICodeReviewProvider} from './UICodeReviewProvider'; -import type {ReactNode} from 'react'; +import * as stylex from '@stylexjs/stylex'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; +import {Component, lazy, Suspense, useState} from 'react'; import {useShowConfirmSubmitStack} from '../ConfirmSubmitStack'; import {Internal} from '../Internal'; import {Link} from '../Link'; @@ -24,12 +30,6 @@ import {exactRevset} from '../types'; import {codeReviewProvider, diffSummary} from './CodeReviewInfo'; import {openerUrlForDiffUrl} from './github/GitHubUrlOpener'; import {SyncStatus, syncStatusAtom} from './syncStatus'; -import * as stylex from '@stylexjs/stylex'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; -import {Component, lazy, Suspense, useState} from 'react'; import './DiffBadge.css'; diff --git a/addons/isl/src/codeReview/DiffComments.tsx b/addons/isl/src/codeReview/DiffComments.tsx index 2f56c6c83d1a8..7197c82d19de8 100644 --- a/addons/isl/src/codeReview/DiffComments.tsx +++ b/addons/isl/src/codeReview/DiffComments.tsx @@ -5,9 +5,18 @@ * LICENSE file in the root directory of this source tree. */ -import type {DiffId, DiffComment, DiffCommentReaction} from '../types'; import type {ParsedDiff} from 'shared/patch/parse'; +import type {DiffComment, DiffCommentReaction, DiffId} from '../types'; +import * as stylex from '@stylexjs/stylex'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; +import {useEffect} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {group} from 'shared/utils'; import {colors, font, radius, spacing} from '../../../components/theme/tokens.stylex'; import {AvatarImg} from '../Avatar'; import serverAPI from '../ClientToServerAPI'; @@ -20,15 +29,6 @@ import platform from '../platform'; import {RelativeDate} from '../relativeDate'; import {layout} from '../stylexUtils'; import {themeState} from '../theme'; -import * as stylex from '@stylexjs/stylex'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; -import {useEffect} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {group} from 'shared/utils'; const diffCommentData = atomFamilyWeak((diffId: DiffId) => atomLoadableWithRefresh(async () => { diff --git a/addons/isl/src/codeReview/DraftCheckbox.tsx b/addons/isl/src/codeReview/DraftCheckbox.tsx index 0e6f8ace06204..f0cf9f471d613 100644 --- a/addons/isl/src/codeReview/DraftCheckbox.tsx +++ b/addons/isl/src/codeReview/DraftCheckbox.tsx @@ -7,12 +7,12 @@ import type {CommitInfo} from '../types'; -import {t, T} from '../i18n'; -import {configBackedAtom} from '../jotaiUtils'; -import {codeReviewProvider} from './CodeReviewInfo'; import {Checkbox} from 'isl-components/Checkbox'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtom, useAtomValue} from 'jotai'; +import {t, T} from '../i18n'; +import {configBackedAtom} from '../jotaiUtils'; +import {codeReviewProvider} from './CodeReviewInfo'; export const submitAsDraft = configBackedAtom('isl.submitAsDraft', false); diff --git a/addons/isl/src/codeReview/UICodeReviewProvider.ts b/addons/isl/src/codeReview/UICodeReviewProvider.ts index b9338413c4000..cc0adb5a86dc8 100644 --- a/addons/isl/src/codeReview/UICodeReviewProvider.ts +++ b/addons/isl/src/codeReview/UICodeReviewProvider.ts @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {FieldConfig} from '../CommitInfoView/types'; import type {Operation} from '../operations/Operation'; import type {Dag} from '../previews'; import type {CodeReviewSystem, CommitInfo, DiffId, DiffSummary, Hash} from '../types'; import type {SyncStatus} from './syncStatus'; -import type {ReactNode} from 'react'; /** * API to interact with Code Review for Repositories, e.g. GitHub and Phabricator. diff --git a/addons/isl/src/codeReview/github/BranchingPrModal.tsx b/addons/isl/src/codeReview/github/BranchingPrModal.tsx index 280b6243b1fda..5881c5878e061 100644 --- a/addons/isl/src/codeReview/github/BranchingPrModal.tsx +++ b/addons/isl/src/codeReview/github/BranchingPrModal.tsx @@ -9,13 +9,13 @@ import type {Operation} from '../../operations/Operation'; import type {CommitInfo} from '../../types'; import type {GithubUICodeReviewProvider} from './github'; -import {T} from '../../i18n'; -import {showModal} from '../../useModal'; -import {codeReviewProvider} from '../CodeReviewInfo'; import {ErrorNotice} from 'isl-components/ErrorNotice'; import {Icon} from 'isl-components/Icon'; import {useAtomValue} from 'jotai'; import {lazy, Suspense} from 'react'; +import {T} from '../../i18n'; +import {showModal} from '../../useModal'; +import {codeReviewProvider} from '../CodeReviewInfo'; const BranchingPrModalContent = lazy(() => import('./BranchingPrModalContent')); diff --git a/addons/isl/src/codeReview/github/BranchingPrModalContent.tsx b/addons/isl/src/codeReview/github/BranchingPrModalContent.tsx index 34b9ab0ceb840..8a4dd89968936 100644 --- a/addons/isl/src/codeReview/github/BranchingPrModalContent.tsx +++ b/addons/isl/src/codeReview/github/BranchingPrModalContent.tsx @@ -9,13 +9,6 @@ import type {Operation} from '../../operations/Operation'; import type {CommitInfo} from '../../types'; import type {GithubUICodeReviewProvider} from './github'; -import {Avatar} from '../../Avatar'; -import {Commit} from '../../Commit'; -import {Column, FlexSpacer, Row} from '../../ComponentUtils'; -import {T} from '../../i18n'; -import {PushOperation} from '../../operations/PushOperation'; -import {CommitPreview, dagWithPreviews} from '../../previews'; -import {latestSuccessorUnlessExplicitlyObsolete} from '../../successionUtils'; import * as stylex from '@stylexjs/stylex'; import {Badge} from 'isl-components/Badge'; import {Button} from 'isl-components/Button'; @@ -24,6 +17,13 @@ import {Dropdown} from 'isl-components/Dropdown'; import {HorizontallyGrowingTextField} from 'isl-components/HorizontallyGrowingTextField'; import {useAtomValue} from 'jotai'; import {useState} from 'react'; +import {Avatar} from '../../Avatar'; +import {Commit} from '../../Commit'; +import {Column, FlexSpacer, Row} from '../../ComponentUtils'; +import {T} from '../../i18n'; +import {PushOperation} from '../../operations/PushOperation'; +import {CommitPreview, dagWithPreviews} from '../../previews'; +import {latestSuccessorUnlessExplicitlyObsolete} from '../../successionUtils'; const styles = stylex.create({ sectionTitle: { diff --git a/addons/isl/src/codeReview/github/GitHubUrlOpener.ts b/addons/isl/src/codeReview/github/GitHubUrlOpener.ts index fc9e12141f891..6bb1993710eba 100644 --- a/addons/isl/src/codeReview/github/GitHubUrlOpener.ts +++ b/addons/isl/src/codeReview/github/GitHubUrlOpener.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import {atom} from 'jotai'; import {atomFamilyWeak} from '../../jotaiUtils'; import {repositoryInfo} from '../../serverAPIState'; -import {atom} from 'jotai'; /** * Configured pull request domain to view associated pull requests, such as reviewstack.dev. diff --git a/addons/isl/src/codeReview/github/branchPrState.ts b/addons/isl/src/codeReview/github/branchPrState.ts index 28dce1487101a..c617e297c80b4 100644 --- a/addons/isl/src/codeReview/github/branchPrState.ts +++ b/addons/isl/src/codeReview/github/branchPrState.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {codeReviewProvider} from '../CodeReviewInfo'; import {atom} from 'jotai'; +import {codeReviewProvider} from '../CodeReviewInfo'; /** Experimental backdoor setting to get around disabled submit modes. Useful for testing. */ export const overrideDisabledSubmitModes = atom(process.env.NODE_ENV === 'development'); diff --git a/addons/isl/src/codeReview/github/github.tsx b/addons/isl/src/codeReview/github/github.tsx index 58bebe85aec03..fbf2ad4025b84 100644 --- a/addons/isl/src/codeReview/github/github.tsx +++ b/addons/isl/src/codeReview/github/github.tsx @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {ReactNode} from 'react'; import type {Operation} from '../../operations/Operation'; import type { CodeReviewSystem, @@ -15,17 +16,16 @@ import type { } from '../../types'; import type {UICodeReviewProvider} from '../UICodeReviewProvider'; import type {SyncStatus} from '../syncStatus'; -import type {ReactNode} from 'react'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {PullRequestReviewDecision, PullRequestState} from 'isl-server/src/github/generated/graphql'; +import {MS_PER_DAY} from 'shared/constants'; import {OSSCommitMessageFieldSchema} from '../../CommitInfoView/OSSCommitMessageFieldsSchema'; import {Internal} from '../../Internal'; import {t, T} from '../../i18n'; import {GhStackSubmitOperation} from '../../operations/GhStackSubmitOperation'; import {PrSubmitOperation} from '../../operations/PrSubmitOperation'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {PullRequestReviewDecision, PullRequestState} from 'isl-server/src/github/generated/graphql'; -import {MS_PER_DAY} from 'shared/constants'; import './GitHubPRBadge.css'; diff --git a/addons/isl/src/codeReview/syncStatus.tsx b/addons/isl/src/codeReview/syncStatus.tsx index 785d31e23db2e..874dcd544bb97 100644 --- a/addons/isl/src/codeReview/syncStatus.tsx +++ b/addons/isl/src/codeReview/syncStatus.tsx @@ -7,9 +7,9 @@ import type {Hash} from '../types'; +import {atom} from 'jotai'; import {latestCommits} from '../serverAPIState'; import {allDiffSummaries, codeReviewProvider} from './CodeReviewInfo'; -import {atom} from 'jotai'; export enum SyncStatus { InSync = 'inSync', diff --git a/addons/isl/src/dag/base_dag.ts b/addons/isl/src/dag/base_dag.ts index 54bdfd26c2f2d..4af019caedda1 100644 --- a/addons/isl/src/dag/base_dag.ts +++ b/addons/isl/src/dag/base_dag.ts @@ -5,15 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import type {RecordOf} from 'immutable'; import type {Hash} from '../types'; import type {SetLike} from './set'; -import type {RecordOf} from 'immutable'; -import {HashSet} from './set'; -import {Map as ImMap, Record, List} from 'immutable'; +import {Map as ImMap, List, Record} from 'immutable'; import {LRU, cachedMethod} from 'shared/LRU'; import {SelfUpdate} from 'shared/immutableExt'; import {nullthrows} from 'shared/utils'; +import {HashSet} from './set'; /** * Hash-map like container with graph related queries. diff --git a/addons/isl/src/dag/dag.ts b/addons/isl/src/dag/dag.ts index c2f1b0112fa81..b5e398c21ed14 100644 --- a/addons/isl/src/dag/dag.ts +++ b/addons/isl/src/dag/dag.ts @@ -5,11 +5,15 @@ * LICENSE file in the root directory of this source tree. */ +import type {RecordOf} from 'immutable'; import type {Hash} from '../types'; import type {ExtendedGraphRow} from './render'; import type {SetLike} from './set'; -import type {RecordOf} from 'immutable'; +import {Map as ImMap, Set as ImSet, List, Record} from 'immutable'; +import {cachedMethod, LRU} from 'shared/LRU'; +import {SelfUpdate} from 'shared/immutableExt'; +import {group, notEmpty, nullthrows, splitOnce} from 'shared/utils'; import {CommitPreview} from '../previews'; import {BaseDag, type SortProps} from './base_dag'; import {DagCommitInfo} from './dagCommitInfo'; @@ -17,10 +21,6 @@ import {MutationDag} from './mutation_dag'; import {Ancestor, AncestorType, Renderer} from './render'; import {TextRenderer} from './renderText'; import {arrayFromHashes, HashSet} from './set'; -import {List, Record, Map as ImMap, Set as ImSet} from 'immutable'; -import {LRU, cachedMethod} from 'shared/LRU'; -import {SelfUpdate} from 'shared/immutableExt'; -import {group, notEmpty, splitOnce, nullthrows} from 'shared/utils'; /** * Main commit graph type used for preview calculation and queries. diff --git a/addons/isl/src/dag/dagCommitInfo.ts b/addons/isl/src/dag/dagCommitInfo.ts index 808f1d3d354c0..4afe2795a5ef1 100644 --- a/addons/isl/src/dag/dagCommitInfo.ts +++ b/addons/isl/src/dag/dagCommitInfo.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {List, RecordOf} from 'immutable'; import type {CommitPreview, WithPreviewType} from '../previews'; import type {CommitRev} from '../stackEdit/commitStackState'; import type { @@ -15,7 +16,6 @@ import type { StableCommitMetadata, SuccessorInfo, } from '../types'; -import type {RecordOf, List} from 'immutable'; import {Record} from 'immutable'; import {SelfUpdate} from 'shared/immutableExt'; diff --git a/addons/isl/src/dag/renderText.ts b/addons/isl/src/dag/renderText.ts index ed5608c846532..909c83dce32f7 100644 --- a/addons/isl/src/dag/renderText.ts +++ b/addons/isl/src/dag/renderText.ts @@ -8,7 +8,7 @@ import type {Hash} from '../types'; import type {Ancestor} from './render'; -import {PadLine, LinkLine, NodeLine, Renderer} from './render'; +import {LinkLine, NodeLine, PadLine, Renderer} from './render'; /* eslint no-bitwise: 0 */ /* Translated from fbcode/eden/scm/lib/renderdag/src/box_drawing.rs */ diff --git a/addons/isl/src/dag/set.ts b/addons/isl/src/dag/set.ts index 1b8fba38b5d2f..f050e519e1443 100644 --- a/addons/isl/src/dag/set.ts +++ b/addons/isl/src/dag/set.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Hash} from '../types'; import type {List, Seq} from 'immutable'; +import type {Hash} from '../types'; import {OrderedSet as ImSet} from 'immutable'; import {SelfUpdate} from 'shared/immutableExt'; diff --git a/addons/isl/src/debug/ComponentExplorer.tsx b/addons/isl/src/debug/ComponentExplorer.tsx index 0142a27c5ed94..b9a8ea6cda063 100644 --- a/addons/isl/src/debug/ComponentExplorer.tsx +++ b/addons/isl/src/debug/ComponentExplorer.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {T} from '../i18n'; -import {useModal} from '../useModal'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {Suspense, lazy} from 'react'; +import {T} from '../i18n'; +import {useModal} from '../useModal'; const ComponentExplorer = lazy(() => import('isl-components/explorer/ComponentExplorer')); diff --git a/addons/isl/src/debug/DebugToolsButton.tsx b/addons/isl/src/debug/DebugToolsButton.tsx index 35e74767a16e8..b87fc14c2941e 100644 --- a/addons/isl/src/debug/DebugToolsButton.tsx +++ b/addons/isl/src/debug/DebugToolsButton.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {t} from '../i18n'; -import {debugToolsEnabledState} from './DebugToolsState'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtomValue} from 'jotai'; import {lazy, Suspense} from 'react'; +import {t} from '../i18n'; +import {debugToolsEnabledState} from './DebugToolsState'; const DebugToolsMenu = lazy(() => import('./DebugToolsMenu')); diff --git a/addons/isl/src/debug/DebugToolsMenu.tsx b/addons/isl/src/debug/DebugToolsMenu.tsx index b0c811a7e44e0..3cb238104c8c2 100644 --- a/addons/isl/src/debug/DebugToolsMenu.tsx +++ b/addons/isl/src/debug/DebugToolsMenu.tsx @@ -5,10 +5,21 @@ * LICENSE file in the root directory of this source tree. */ -import type {Heartbeat} from '../heartbeat'; import type {ReactNode} from 'react'; import type {ExclusiveOr} from 'shared/typeUtils'; +import type {Heartbeat} from '../heartbeat'; +import * as stylex from '@stylexjs/stylex'; +import {Badge} from 'isl-components/Badge'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Checkbox} from 'isl-components/Checkbox'; +import {InlineErrorBadge} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {useCallback, useEffect, useState} from 'react'; import {colors} from '../../../components/theme/tokens.stylex'; import serverApi, {debugLogMessageTraffic} from '../ClientToServerAPI'; import {Column, Row} from '../ComponentUtils'; @@ -34,17 +45,6 @@ import {showToast} from '../toast'; import {isDev} from '../utils'; import {ComponentExplorerButton} from './ComponentExplorer'; import {readInterestingAtoms, serializeAtomsState} from './getInterestingAtoms'; -import * as stylex from '@stylexjs/stylex'; -import {Badge} from 'isl-components/Badge'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Checkbox} from 'isl-components/Checkbox'; -import {InlineErrorBadge} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {useState, useCallback, useEffect} from 'react'; import './DebugToolsMenu.css'; diff --git a/addons/isl/src/debug/getInterestingAtoms.ts b/addons/isl/src/debug/getInterestingAtoms.ts index 85aa05afebef4..f4ab70c18cdab 100644 --- a/addons/isl/src/debug/getInterestingAtoms.ts +++ b/addons/isl/src/debug/getInterestingAtoms.ts @@ -5,10 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import type {AtomFamilyWeak} from '../jotaiUtils'; import type {Atom} from 'jotai'; import type {Json} from 'shared/typeUtils'; +import type {AtomFamilyWeak} from '../jotaiUtils'; +import {SelfUpdate} from 'shared/immutableExt'; import {editedCommitMessages} from '../CommitInfoView/CommitInfoState'; import {latestSuccessorsMapAtom} from '../SuccessionTracker'; import {allDiffSummaries, codeReviewProvider} from '../codeReview/CodeReviewInfo'; @@ -18,12 +19,11 @@ import {uncommittedSelection} from '../partialSelection'; import {dagWithPreviews} from '../previews'; import {selectedCommits} from '../selection'; import { - repositoryData, latestCommitsData, latestUncommittedChangesData, mergeConflicts, + repositoryData, } from '../serverAPIState'; -import {SelfUpdate} from 'shared/immutableExt'; export type UIStateSnapshot = {[key: string]: Json}; export type AtomsState = {[key: string]: unknown}; diff --git a/addons/isl/src/featureFlags.ts b/addons/isl/src/featureFlags.ts index 41edb364a6019..fda8ead168e4f 100644 --- a/addons/isl/src/featureFlags.ts +++ b/addons/isl/src/featureFlags.ts @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import serverAPI from './ClientToServerAPI'; -import {atomFamilyWeak, readAtom} from './jotaiUtils'; import {atom, useAtomValue} from 'jotai'; import {loadable} from 'jotai/utils'; +import serverAPI from './ClientToServerAPI'; +import {atomFamilyWeak, readAtom} from './jotaiUtils'; /** * Boolean values to enable features via remote config. diff --git a/addons/isl/src/fold.tsx b/addons/isl/src/fold.tsx index 328eae0fb2237..89e33c72c7b04 100644 --- a/addons/isl/src/fold.tsx +++ b/addons/isl/src/fold.tsx @@ -7,6 +7,11 @@ import type {CommitInfo, Hash} from './types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {atom, useAtomValue} from 'jotai'; +import {useCallback} from 'react'; import {editedCommitMessages} from './CommitInfoView/CommitInfoState'; import { applyEditedFields, @@ -26,11 +31,6 @@ import {operationBeingPreviewed, useRunPreviewedOperation} from './operationsSta import {type Dag, dagWithPreviews} from './previews'; import {selectedCommits} from './selection'; import {firstOfIterable} from './utils'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {atom, useAtomValue} from 'jotai'; -import {useCallback} from 'react'; /** * If the selected commits are linear, contiguous, and non-branching, they may be folded together. diff --git a/addons/isl/src/heartbeat.ts b/addons/isl/src/heartbeat.ts index 6897a680e59fc..b01c2464d09ad 100644 --- a/addons/isl/src/heartbeat.ts +++ b/addons/isl/src/heartbeat.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import clientToServerAPI from './ClientToServerAPI'; import {useEffect, useState} from 'react'; import {randomId} from 'shared/utils'; +import clientToServerAPI from './ClientToServerAPI'; export type Heartbeat = | { diff --git a/addons/isl/src/i18n/index.tsx b/addons/isl/src/i18n/index.tsx index 9dc0bc062ae71..5105c5667e12b 100644 --- a/addons/isl/src/i18n/index.tsx +++ b/addons/isl/src/i18n/index.tsx @@ -7,9 +7,9 @@ import type {ReactNode} from 'react'; -import * as en from './en/common.json'; import React, {createContext, useContext, useEffect, useState} from 'react'; import {TypedEventEmitter} from 'shared/TypedEventEmitter'; +import * as en from './en/common.json'; /** * ISO 639-3 language code used to control which translation we use diff --git a/addons/isl/src/icons/IrrelevantCwdIcon.tsx b/addons/isl/src/icons/IrrelevantCwdIcon.tsx index b7142bbfc7650..f1ab2222e95e7 100644 --- a/addons/isl/src/icons/IrrelevantCwdIcon.tsx +++ b/addons/isl/src/icons/IrrelevantCwdIcon.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {IconStack} from './IconStack'; import {Icon} from 'isl-components/Icon'; +import {IconStack} from './IconStack'; export const IrrelevantCwdIcon = () => ( diff --git a/addons/isl/src/index.tsx b/addons/isl/src/index.tsx index fe7afc10a8375..98c680458d942 100644 --- a/addons/isl/src/index.tsx +++ b/addons/isl/src/index.tsx @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import App from './App'; import 'react'; import ReactDOM from 'react-dom/client'; +import App from './App'; // Include CSS variables we use, originally from vscode-webview-ui-toolkit import 'isl-components/theme/themeDarkVariables.css'; diff --git a/addons/isl/src/jotaiUtils.ts b/addons/isl/src/jotaiUtils.ts index 484fecb9ed0ea..4906f18e2d17d 100644 --- a/addons/isl/src/jotaiUtils.ts +++ b/addons/isl/src/jotaiUtils.ts @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ +import type {Atom, Getter, WritableAtom} from 'jotai'; +import type {Json} from 'shared/typeUtils'; import type {Platform} from './platform'; import type {ConfigName, LocalStorageName, SettableConfigName} from './types'; -import type {WritableAtom, Atom, Getter} from 'jotai'; -import type {Json} from 'shared/typeUtils'; -import serverAPI from './ClientToServerAPI'; -import platform from './platform'; -import {assert} from './utils'; import {atom, getDefaultStore, useAtomValue} from 'jotai'; import {loadable} from 'jotai/utils'; import {useMemo} from 'react'; import {RateLimiter} from 'shared/RateLimiter'; import {isPromise} from 'shared/utils'; +import serverAPI from './ClientToServerAPI'; +import platform from './platform'; +import {assert} from './utils'; /** A mutable atom that stores type `T`. */ export type MutAtom = WritableAtom T)], void>; diff --git a/addons/isl/src/linelog.ts b/addons/isl/src/linelog.ts index 3c33b2ad5d35c..db1674b8ba109 100644 --- a/addons/isl/src/linelog.ts +++ b/addons/isl/src/linelog.ts @@ -32,12 +32,12 @@ SOFTWARE. import type {RecordOf, ValueObject} from 'immutable'; import type {LRUWithStats} from 'shared/LRU'; -import {assert} from './utils'; -import {hash, List, Record, Set as ImSet} from 'immutable'; +import {hash, Set as ImSet, List, Record} from 'immutable'; import {cached, cachedMethod, LRU} from 'shared/LRU'; import {diffLines, splitLines} from 'shared/diff'; import {SelfUpdate} from 'shared/immutableExt'; import {nullthrows} from 'shared/utils'; +import {assert} from './utils'; /** Operation code. */ enum Op { @@ -1160,5 +1160,5 @@ function describeInst(inst: Inst): string { } } -export {LineLog, FlattenLine}; -export type {Rev, LineIdx, LineInfo}; +export {FlattenLine, LineLog}; +export type {LineIdx, LineInfo, Rev}; diff --git a/addons/isl/src/mergeConflicts/state.tsx b/addons/isl/src/mergeConflicts/state.tsx index 036dd05c0bae5..14a77504b82d7 100644 --- a/addons/isl/src/mergeConflicts/state.tsx +++ b/addons/isl/src/mergeConflicts/state.tsx @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {Internal} from '../Internal'; -import {T, t} from '../i18n'; -import {localStorageBackedAtom} from '../jotaiUtils'; import {Checkbox} from 'isl-components/Checkbox'; import {Subtle} from 'isl-components/Subtle'; import {Tooltip} from 'isl-components/Tooltip'; import {useAtom} from 'jotai'; +import {Internal} from '../Internal'; +import {T, t} from '../i18n'; +import {localStorageBackedAtom} from '../jotaiUtils'; export const shouldAutoResolveAllBeforeContinue = localStorageBackedAtom( 'isl.auto-resolve-before-continue', diff --git a/addons/isl/src/messageSyncing.tsx b/addons/isl/src/messageSyncing.tsx index 8ced7f443e003..6a8ad5280bc95 100644 --- a/addons/isl/src/messageSyncing.tsx +++ b/addons/isl/src/messageSyncing.tsx @@ -7,9 +7,9 @@ import type {DiffId} from './types'; +import {atom} from 'jotai'; import serverAPI from './ClientToServerAPI'; import {codeReviewProvider} from './codeReview/CodeReviewInfo'; -import {atom} from 'jotai'; /** * In some cases, we need to explicitly disable message syncing after a failure. diff --git a/addons/isl/src/operations/AmendOperation.ts b/addons/isl/src/operations/AmendOperation.ts index 9c27c28c70cdd..93ac9dc0c0781 100644 --- a/addons/isl/src/operations/AmendOperation.ts +++ b/addons/isl/src/operations/AmendOperation.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {ImportAmendCommit, ImportStack} from 'shared/types/stack'; import type {AmendRestackBehavior} from '../RestackBehavior'; import type {PartialSelection} from '../partialSelection'; import type { @@ -13,7 +14,6 @@ import type { UncommittedChangesPreviewContext, } from '../previews'; import type {CommandArg, Hash, RepoRelativePath, UncommittedChanges} from '../types'; -import type {ImportAmendCommit, ImportStack} from 'shared/types/stack'; import {restackBehaviorAtom} from '../RestackBehavior'; import {t} from '../i18n'; diff --git a/addons/isl/src/operations/CommitOperation.ts b/addons/isl/src/operations/CommitOperation.ts index 0a6bb51bf1bdd..e4715629a15fd 100644 --- a/addons/isl/src/operations/CommitOperation.ts +++ b/addons/isl/src/operations/CommitOperation.ts @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {ImportStack} from 'shared/types/stack'; import type {PartialSelection} from '../partialSelection'; import type { ApplyUncommittedChangesPreviewsFuncType, @@ -12,7 +13,6 @@ import type { UncommittedChangesPreviewContext, } from '../previews'; import type {ChangedFile, CommandArg, Hash, RepoRelativePath, UncommittedChanges} from '../types'; -import type {ImportStack} from 'shared/types/stack'; import {DagCommitInfo} from '../dag/dagCommitInfo'; import {t} from '../i18n'; diff --git a/addons/isl/src/operations/DiscardOperation.ts b/addons/isl/src/operations/DiscardOperation.ts index 9938d61aec7a7..a1bfee59bf2d6 100644 --- a/addons/isl/src/operations/DiscardOperation.ts +++ b/addons/isl/src/operations/DiscardOperation.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ +import type {ImportStack} from 'shared/types/stack'; import type {PartialSelection} from '../partialSelection'; import type { ApplyUncommittedChangesPreviewsFuncType, UncommittedChangesPreviewContext, } from '../previews'; import type {RepoRelativePath, UncommittedChanges} from '../types'; -import type {ImportStack} from 'shared/types/stack'; import {t} from '../i18n'; import {Operation} from './Operation'; diff --git a/addons/isl/src/operations/FoldOperation.ts b/addons/isl/src/operations/FoldOperation.ts index f9aab6fe67eba..c608d90a1df5e 100644 --- a/addons/isl/src/operations/FoldOperation.ts +++ b/addons/isl/src/operations/FoldOperation.ts @@ -8,10 +8,10 @@ import type {Dag} from '../previews'; import type {CommitInfo} from '../types'; +import {firstLine} from 'shared/utils'; import {CommitPreview} from '../previews'; import {exactRevset} from '../types'; import {Operation} from './Operation'; -import {firstLine} from 'shared/utils'; /** * Returns [bottom, top] of an array. diff --git a/addons/isl/src/operations/ImportStackOperation.ts b/addons/isl/src/operations/ImportStackOperation.ts index 83197623e7851..4c6c1f0734284 100644 --- a/addons/isl/src/operations/ImportStackOperation.ts +++ b/addons/isl/src/operations/ImportStackOperation.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {Dag} from '../previews'; import type {Hash} from 'shared/types/common'; import type {ExportStack, ImportCommit, ImportStack, Mark} from 'shared/types/stack'; +import type {Dag} from '../previews'; import {DagCommitInfo} from '../dag/dagCommitInfo'; import {HashSet} from '../dag/set'; diff --git a/addons/isl/src/operations/Operation.tsx b/addons/isl/src/operations/Operation.tsx index 8fb38f1c0d36f..a1c5661b3ba4e 100644 --- a/addons/isl/src/operations/Operation.tsx +++ b/addons/isl/src/operations/Operation.tsx @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; import type { ApplyMergeConflictsPreviewsFuncType, ApplyUncommittedChangesPreviewsFuncType, @@ -13,10 +14,9 @@ import type { UncommittedChangesPreviewContext, } from '../previews'; import type {CommandArg, RunnableOperation} from '../types'; -import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; -import {CommandRunner} from '../types'; import {randomId} from 'shared/utils'; +import {CommandRunner} from '../types'; /** * Operations represent commands that mutate the repository, such as rebasing, committing, etc. diff --git a/addons/isl/src/operations/RebaseOperation.ts b/addons/isl/src/operations/RebaseOperation.ts index b4e8c7ca3d84b..f9410410d5ef8 100644 --- a/addons/isl/src/operations/RebaseOperation.ts +++ b/addons/isl/src/operations/RebaseOperation.ts @@ -9,11 +9,11 @@ import type {DagCommitInfo} from '../dag/dagCommitInfo'; import type {Dag} from '../previews'; import type {ExactRevset, Hash, OptimisticRevset, SucceedableRevset} from '../types'; +import deepEqual from 'fast-deep-equal'; import {t} from '../i18n'; import {CommitPreview} from '../previews'; import {latestSuccessor} from '../successionUtils'; import {Operation} from './Operation'; -import deepEqual from 'fast-deep-equal'; export class RebaseOperation extends Operation { constructor( diff --git a/addons/isl/src/operationsState.ts b/addons/isl/src/operationsState.ts index 2bb4fe76b66cb..0fb55cb0093a1 100644 --- a/addons/isl/src/operationsState.ts +++ b/addons/isl/src/operationsState.ts @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ +import type {EnsureAssignedTogether} from 'shared/EnsureAssignedTogether'; import type {Operation} from './operations/Operation'; import type {Disposable, Hash, ProgressStep, ServerToClientMessage} from './types'; -import type {EnsureAssignedTogether} from 'shared/EnsureAssignedTogether'; +import {atom} from 'jotai'; +import {useCallback} from 'react'; +import {defer} from 'shared/utils'; import serverAPI from './ClientToServerAPI'; import {atomFamilyWeak, readAtom, writeAtom} from './jotaiUtils'; import {atomResetOnCwdChange} from './repositoryData'; import {Timer} from './timer'; import {registerCleanup, registerDisposable, short} from './utils'; -import {atom} from 'jotai'; -import {useCallback} from 'react'; -import {defer} from 'shared/utils'; export type OperationInfo = { operation: Operation; diff --git a/addons/isl/src/partialSelection.ts b/addons/isl/src/partialSelection.ts index 94e0113d6f16e..845d5c174a911 100644 --- a/addons/isl/src/partialSelection.ts +++ b/addons/isl/src/partialSelection.ts @@ -5,10 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {RepoRelativePath} from './types'; import type {Hash, RepoPath} from 'shared/types/common'; import type {ExportFile, ImportCommit} from 'shared/types/stack'; +import type {RepoRelativePath} from './types'; +import Immutable from 'immutable'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {RateLimiter} from 'shared/RateLimiter'; +import {SelfUpdate} from 'shared/immutableExt'; import clientToServerAPI from './ClientToServerAPI'; import {t} from './i18n'; import {dagWithPreviews, uncommittedChangesWithPreviews} from './previews'; @@ -16,10 +20,6 @@ import {atomResetOnCwdChange} from './repositoryData'; import {latestUncommittedChangesTimestamp} from './serverAPIState'; import {ChunkSelectState} from './stackEdit/chunkSelectState'; import {assert} from './utils'; -import Immutable from 'immutable'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {RateLimiter} from 'shared/RateLimiter'; -import {SelfUpdate} from 'shared/immutableExt'; type SingleFileSelection = | false /* not selected */ diff --git a/addons/isl/src/pathTree.ts b/addons/isl/src/pathTree.ts index 507c4b1ba2532..ccf0397ae9963 100644 --- a/addons/isl/src/pathTree.ts +++ b/addons/isl/src/pathTree.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {UseUncommittedSelection} from './partialSelection'; import type {RepoPath} from 'shared/types/common'; +import type {UseUncommittedSelection} from './partialSelection'; export type PathTree = Map | T>; /** diff --git a/addons/isl/src/platform.ts b/addons/isl/src/platform.ts index 3cd150de01778..06880633d2455 100644 --- a/addons/isl/src/platform.ts +++ b/addons/isl/src/platform.ts @@ -5,6 +5,9 @@ * LICENSE file in the root directory of this source tree. */ +import type {LazyExoticComponent} from 'react'; +import type {Comparison} from 'shared/Comparison'; +import type {Json} from 'shared/typeUtils'; import type {MessageBus} from './MessageBus'; import type {ThemeColor} from './theme'; import type { @@ -14,9 +17,6 @@ import type { RepoRelativePath, ServerToClientMessage, } from './types'; -import type {LazyExoticComponent} from 'react'; -import type {Comparison} from 'shared/Comparison'; -import type {Json} from 'shared/typeUtils'; import {browserPlatform} from './BrowserPlatform'; diff --git a/addons/isl/src/platform/__tests__/webviewPlatform.test.ts b/addons/isl/src/platform/__tests__/webviewPlatform.test.ts index 86579e1e13360..0bd2b5d553e35 100644 --- a/addons/isl/src/platform/__tests__/webviewPlatform.test.ts +++ b/addons/isl/src/platform/__tests__/webviewPlatform.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {webviewPlatform} from '../webviewPlatform'; import {nullthrows} from 'shared/utils'; +import {webviewPlatform} from '../webviewPlatform'; (window.external as unknown as Record).invoke = jest.fn(); diff --git a/addons/isl/src/platform/browerPlatformImpl.ts b/addons/isl/src/platform/browerPlatformImpl.ts index f87f9f4fc5027..e19f42f4dd5aa 100644 --- a/addons/isl/src/platform/browerPlatformImpl.ts +++ b/addons/isl/src/platform/browerPlatformImpl.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import type {Platform} from '../platform'; -import type {RepoRelativePath, OneIndexedLineNumber, PlatformName} from '../types'; import type {Json} from 'shared/typeUtils'; +import type {Platform} from '../platform'; +import type {OneIndexedLineNumber, PlatformName, RepoRelativePath} from '../types'; import {LocalWebSocketEventBus} from '../LocalWebSocketEventBus'; import {computeInitialParams} from '../urlParams'; diff --git a/addons/isl/src/previews.ts b/addons/isl/src/previews.ts index e393058f9cb54..be01c976c0415 100644 --- a/addons/isl/src/previews.ts +++ b/addons/isl/src/previews.ts @@ -11,25 +11,25 @@ import type {Operation} from './operations/Operation'; import type {OperationInfo, OperationList} from './operationsState'; import type {ChangedFile, CommitInfo, Hash, MergeConflicts, UncommittedChanges} from './types'; +import {atom, useAtom, useAtomValue} from 'jotai'; +import {useEffect} from 'react'; +import {notEmpty, nullthrows} from 'shared/utils'; import {latestSuccessorsMapAtom} from './SuccessionTracker'; import {getTracker} from './analytics/globalTracker'; import {focusMode} from './atoms/FocusModeState'; import {YOU_ARE_HERE_VIRTUAL_COMMIT} from './dag/virtualCommit'; import {getCommitTree, walkTreePostorder} from './getCommitTree'; import {getOpName} from './operations/Operation'; -import {operationBeingPreviewed, queuedOperations, operationList} from './operationsState'; +import {operationBeingPreviewed, operationList, queuedOperations} from './operationsState'; import { - latestUncommittedChanges, latestCommits, + latestCommitsData, latestDag, latestHeadCommit, - mergeConflicts, + latestUncommittedChanges, latestUncommittedChangesData, - latestCommitsData, + mergeConflicts, } from './serverAPIState'; -import {atom, useAtom, useAtomValue} from 'jotai'; -import {useEffect} from 'react'; -import {notEmpty, nullthrows} from 'shared/utils'; export enum CommitPreview { REBASE_ROOT = 'rebase-root', diff --git a/addons/isl/src/repositoryData.ts b/addons/isl/src/repositoryData.ts index 45e8701b6cec7..b6d61f561adb5 100644 --- a/addons/isl/src/repositoryData.ts +++ b/addons/isl/src/repositoryData.ts @@ -7,9 +7,9 @@ import type {CommitInfo, RepoInfo, RepoRelativePath} from './types'; +import {atom, useAtomValue} from 'jotai'; import {atomResetOnDepChange, localStorageBackedAtom} from './jotaiUtils'; import platform from './platform'; -import {atom, useAtomValue} from 'jotai'; export const repositoryData = atom<{info?: RepoInfo; cwd?: string}>({}); diff --git a/addons/isl/src/resetStyle.ts b/addons/isl/src/resetStyle.ts index 6f7df3500858e..55d9080b0a2a1 100644 --- a/addons/isl/src/resetStyle.ts +++ b/addons/isl/src/resetStyle.ts @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -import {isWindows, isMac} from 'isl-components/OperatingSystem'; +import {isMac, isWindows} from 'isl-components/OperatingSystem'; // https://github.com/microsoft/vscode/blob/c90951b/src/vs/workbench/browser/style.ts#L72 const fontFamily = isWindows diff --git a/addons/isl/src/responsive.tsx b/addons/isl/src/responsive.tsx index ee8c46c91ded5..601ebe3fe2c91 100644 --- a/addons/isl/src/responsive.tsx +++ b/addons/isl/src/responsive.tsx @@ -5,16 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import {atom, useSetAtom} from 'jotai'; +import {useEffect, useRef} from 'react'; import {useCommand} from './ISLShortcuts'; import { + atomWithOnChange, configBackedAtom, localStorageBackedAtom, - atomWithOnChange, readAtom, writeAtom, } from './jotaiUtils'; -import {atom, useSetAtom} from 'jotai'; -import {useRef, useEffect} from 'react'; export const mainContentWidthState = atom(500); diff --git a/addons/isl/src/selection.ts b/addons/isl/src/selection.ts index 33df09b5dd131..1b2b91c7552a6 100644 --- a/addons/isl/src/selection.ts +++ b/addons/isl/src/selection.ts @@ -5,9 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import type {ISLCommandName} from './ISLShortcuts'; import type React from 'react'; +import type {ISLCommandName} from './ISLShortcuts'; +import {isMac} from 'isl-components/OperatingSystem'; +import {atom} from 'jotai'; +import {useCallback} from 'react'; import {commitMode} from './CommitInfoView/CommitInfoState'; import {useCommand} from './ISLShortcuts'; import {useSelectAllCommitsShortcut} from './SelectAllCommits'; @@ -27,9 +30,6 @@ import {latestDag} from './serverAPIState'; import {latestSuccessorUnlessExplicitlyObsolete} from './successionUtils'; import {exactRevset, type CommitInfo, type Hash} from './types'; import {firstOfIterable, registerCleanup} from './utils'; -import {isMac} from 'isl-components/OperatingSystem'; -import {atom} from 'jotai'; -import {useCallback} from 'react'; /** * The name of the key to toggle individual selection. diff --git a/addons/isl/src/serverAPIState.ts b/addons/isl/src/serverAPIState.ts index 14a021246e796..b3564eb64dfd5 100644 --- a/addons/isl/src/serverAPIState.ts +++ b/addons/isl/src/serverAPIState.ts @@ -18,6 +18,10 @@ import type { UncommittedChanges, } from './types'; +import {DEFAULT_DAYS_OF_COMMITS_TO_LOAD} from 'isl-server/src/constants'; +import {atom} from 'jotai'; +import {reuseEqualObjects} from 'shared/deepEqualExt'; +import {randomId} from 'shared/utils'; import {hiddenRemoteBookmarksAtom} from './BookmarksData'; import serverAPI from './ClientToServerAPI'; import {latestSuccessorsMapAtom, successionTracker} from './SuccessionTracker'; @@ -27,10 +31,6 @@ import {atomFamilyWeak, configBackedAtom, readAtom, writeAtom} from './jotaiUtil import platform from './platform'; import {atomResetOnCwdChange, repositoryData} from './repositoryData'; import {registerCleanup, registerDisposable} from './utils'; -import {DEFAULT_DAYS_OF_COMMITS_TO_LOAD} from 'isl-server/src/constants'; -import {atom} from 'jotai'; -import {reuseEqualObjects} from 'shared/deepEqualExt'; -import {randomId} from 'shared/utils'; export {repositoryData}; diff --git a/addons/isl/src/sloc/useFetchSignificantLinesOfCode.ts b/addons/isl/src/sloc/useFetchSignificantLinesOfCode.ts index c5f9ea48566e5..07bbc82445ef4 100644 --- a/addons/isl/src/sloc/useFetchSignificantLinesOfCode.ts +++ b/addons/isl/src/sloc/useFetchSignificantLinesOfCode.ts @@ -5,10 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {CommitInfo, RepoRelativePath, SlocInfo} from '../types'; import type {Atom, Getter} from 'jotai'; import type {Loadable} from 'jotai/vanilla/utils/loadable'; +import type {CommitInfo, RepoRelativePath, SlocInfo} from '../types'; +import {atom, useAtomValue} from 'jotai'; +import {loadable} from 'jotai/utils'; +import {useRef} from 'react'; import serverAPI from '../ClientToServerAPI'; import {commitInfoViewCurrentCommits} from '../CommitInfoView/CommitInfoState'; import {getGeneratedFilesFrom} from '../GeneratedFile'; @@ -19,9 +22,6 @@ import {uncommittedChangesWithPreviews} from '../previews'; import {commitByHash} from '../serverAPIState'; import {GeneratedStatus} from '../types'; import {MAX_FILES_ALLOWED_FOR_DIFF_STAT} from './diffStatConstants'; -import {atom, useAtomValue} from 'jotai'; -import {loadable} from 'jotai/utils'; -import {useRef} from 'react'; const getGeneratedFiles = (files: ReadonlyArray): Array => { const generatedStatuses = getGeneratedFilesFrom(files); diff --git a/addons/isl/src/stackEdit/__tests__/absorb.test.ts b/addons/isl/src/stackEdit/__tests__/absorb.test.ts index f537aff6062a3..161baa4802c8d 100644 --- a/addons/isl/src/stackEdit/__tests__/absorb.test.ts +++ b/addons/isl/src/stackEdit/__tests__/absorb.test.ts @@ -5,10 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import type {Map as ImMap} from 'immutable'; import type {AbsorbEdit, AbsorbEditId} from '../absorb'; import type {FileRev} from '../fileStackState'; -import type {Map as ImMap} from 'immutable'; +import {splitLines} from 'shared/diff'; import { analyseFileStack, applyFileStackEditsWithAbsorbId, @@ -18,7 +19,6 @@ import { revWithAbsorb, } from '../absorb'; import {FileStackState} from '../fileStackState'; -import {splitLines} from 'shared/diff'; // See also [test-fb-ext-absorb-filefixupstate.py](https://github.com/facebook/sapling/blob/eb3d35d/eden/scm/tests/test-fb-ext-absorb-filefixupstate.py#L75) describe('analyseFileStack', () => { diff --git a/addons/isl/src/stackEdit/__tests__/commitStackState.test.ts b/addons/isl/src/stackEdit/__tests__/commitStackState.test.ts index 97610945ace22..7039270c05db5 100644 --- a/addons/isl/src/stackEdit/__tests__/commitStackState.test.ts +++ b/addons/isl/src/stackEdit/__tests__/commitStackState.test.ts @@ -5,9 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import type {FileRev, CommitRev} from '../commitStackState'; import type {ExportCommit, ExportStack} from 'shared/types/stack'; +import type {CommitRev, FileRev} from '../commitStackState'; +import {Map as ImMap, Set as ImSet, List} from 'immutable'; +import {nullthrows} from 'shared/utils'; import {WDIR_NODE} from '../../dag/virtualCommit'; import { ABSENT_FILE, @@ -19,8 +21,6 @@ import { } from '../commitStackState'; import {FileStackState} from '../fileStackState'; import {describeAbsorbIdChunkMap} from './absorb.test'; -import {List, Set as ImSet, Map as ImMap} from 'immutable'; -import {nullthrows} from 'shared/utils'; const exportCommitDefault: ExportCommit = { requested: true, diff --git a/addons/isl/src/stackEdit/absorb.ts b/addons/isl/src/stackEdit/absorb.ts index dc248da16ab93..ef0ede05f94fb 100644 --- a/addons/isl/src/stackEdit/absorb.ts +++ b/addons/isl/src/stackEdit/absorb.ts @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ +import type {RecordOf} from 'immutable'; import type {LineInfo} from '../linelog'; import type {FileStackIndex} from './commitStackState'; -import type {FileStackState, FileRev} from './fileStackState'; -import type {RecordOf} from 'immutable'; +import type {FileRev, FileStackState} from './fileStackState'; +import {Map as ImMap, List, Record} from 'immutable'; +import {diffLines, splitLines} from 'shared/diff'; +import {dedup, nullthrows} from 'shared/utils'; import {t} from '../i18n'; import {assert} from '../utils'; import {max, prev} from './revMath'; -import {List, Record, Map as ImMap} from 'immutable'; -import {diffLines, splitLines} from 'shared/diff'; -import {dedup, nullthrows} from 'shared/utils'; /** A diff chunk analyzed by `analyseFileStack`. */ export type AbsorbEditProps = { diff --git a/addons/isl/src/stackEdit/chunkSelectState.ts b/addons/isl/src/stackEdit/chunkSelectState.ts index 34189db2ffa2d..605e0cc0752bc 100644 --- a/addons/isl/src/stackEdit/chunkSelectState.ts +++ b/addons/isl/src/stackEdit/chunkSelectState.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {FlattenLine, LineIdx} from '../linelog'; import type {RecordOf} from 'immutable'; +import type {FlattenLine, LineIdx} from '../linelog'; -import {FileStackState} from './fileStackState'; -import {List, Record, Set as ImSet} from 'immutable'; +import {Set as ImSet, List, Record} from 'immutable'; import {LRU, cachedMethod} from 'shared/LRU'; import {SelfUpdate} from 'shared/immutableExt'; +import {FileStackState} from './fileStackState'; /** * Represents selections of changes between 2 texts (`a` and `b`), optionally diff --git a/addons/isl/src/stackEdit/commitStackState.ts b/addons/isl/src/stackEdit/commitStackState.ts index a114c8a24d195..28489e02ca0ce 100644 --- a/addons/isl/src/stackEdit/commitStackState.ts +++ b/addons/isl/src/stackEdit/commitStackState.ts @@ -5,19 +5,24 @@ * LICENSE file in the root directory of this source tree. */ -import type {AbsorbEdit, AbsorbEditId} from './absorb'; -import type {FileRev} from './fileStackState'; import type {RecordOf} from 'immutable'; import type {Author, Hash, RepoPath} from 'shared/types/common'; import type { - ExportStack, ExportFile, - ImportStack, + ExportStack, + ImportAction, ImportCommit, + ImportStack, Mark, - ImportAction, } from 'shared/types/stack'; +import type {AbsorbEdit, AbsorbEditId} from './absorb'; +import type {FileRev} from './fileStackState'; +import deepEqual from 'fast-deep-equal'; +import {Map as ImMap, Set as ImSet, List, Record, Seq, is} from 'immutable'; +import {LRU, cachedMethod} from 'shared/LRU'; +import {SelfUpdate} from 'shared/immutableExt'; +import {firstLine, generatorContains, nullthrows, zip} from 'shared/utils'; import { commitMessageFieldsSchema, commitMessageFieldsToString, @@ -36,11 +41,6 @@ import { } from './absorb'; import {FileStackState} from './fileStackState'; import {max, next, prev} from './revMath'; -import deepEqual from 'fast-deep-equal'; -import {Seq, List, Map as ImMap, Set as ImSet, Record, is} from 'immutable'; -import {LRU, cachedMethod} from 'shared/LRU'; -import {SelfUpdate} from 'shared/immutableExt'; -import {firstLine, generatorContains, nullthrows, zip} from 'shared/utils'; type CommitStackProps = { /** diff --git a/addons/isl/src/stackEdit/fileStackState.ts b/addons/isl/src/stackEdit/fileStackState.ts index caf8836caef32..4f660bd9d1cc8 100644 --- a/addons/isl/src/stackEdit/fileStackState.ts +++ b/addons/isl/src/stackEdit/fileStackState.ts @@ -5,13 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import type {FlattenLine, LineIdx} from '../linelog'; import type {RecordOf} from 'immutable'; +import type {FlattenLine, LineIdx} from '../linelog'; +import {List, Record} from 'immutable'; +import {SelfUpdate} from 'shared/immutableExt'; import {LineLog} from '../linelog'; import {next} from './revMath'; -import {Record, List} from 'immutable'; -import {SelfUpdate} from 'shared/immutableExt'; /** * A stack of file contents with stack editing features. diff --git a/addons/isl/src/stackEdit/reorderState.ts b/addons/isl/src/stackEdit/reorderState.ts index 1576f38e96165..1635cd75c4344 100644 --- a/addons/isl/src/stackEdit/reorderState.ts +++ b/addons/isl/src/stackEdit/reorderState.ts @@ -7,8 +7,8 @@ import type {CommitRev} from './commitStackState'; -import {CommitStackState} from './commitStackState'; import {List, Record} from 'immutable'; +import {CommitStackState} from './commitStackState'; type ReorderResult = { /** Offset of the move. Positive: move up. Negative: move down. */ diff --git a/addons/isl/src/stackEdit/stackDag.ts b/addons/isl/src/stackEdit/stackDag.ts index 6810388e7fdc9..f4cdfff80abbb 100644 --- a/addons/isl/src/stackEdit/stackDag.ts +++ b/addons/isl/src/stackEdit/stackDag.ts @@ -7,10 +7,10 @@ import type {CommitStackState} from './commitStackState'; -import {Dag, DagCommitInfo} from '../dag/dag'; -import {YOU_ARE_HERE_VIRTUAL_COMMIT, WDIR_NODE} from '../dag/virtualCommit'; import {cached} from 'shared/LRU'; import {firstLine, nullthrows} from 'shared/utils'; +import {Dag, DagCommitInfo} from '../dag/dag'; +import {WDIR_NODE, YOU_ARE_HERE_VIRTUAL_COMMIT} from '../dag/virtualCommit'; /** * Calculate a virtual "Dag" purely from "stack". diff --git a/addons/isl/src/stackEdit/ui/AbsorbStackEditPanel.tsx b/addons/isl/src/stackEdit/ui/AbsorbStackEditPanel.tsx index c43c9e06759af..f8181d9d479c8 100644 --- a/addons/isl/src/stackEdit/ui/AbsorbStackEditPanel.tsx +++ b/addons/isl/src/stackEdit/ui/AbsorbStackEditPanel.tsx @@ -5,6 +5,11 @@ * LICENSE file in the root directory of this source tree. */ +import type {Map as ImMap} from 'immutable'; +import type {ReactNode} from 'react'; +import type {Comparison} from 'shared/Comparison'; +import type {ContextMenuItem} from 'shared/ContextMenu'; +import type {ParsedDiff} from 'shared/patch/parse'; import type {Context} from '../../ComparisonView/SplitDiffView/types'; import type {DragHandler} from '../../DragHandle'; import type {RenderGlyphResult} from '../../RenderDag'; @@ -12,13 +17,20 @@ import type {Dag} from '../../dag/dag'; import type {DagCommitInfo} from '../../dag/dagCommitInfo'; import type {HashSet} from '../../dag/set'; import type {AbsorbEdit, AbsorbEditId} from '../absorb'; -import type {CommitStackState, FileRev, FileStackIndex, CommitRev} from '../commitStackState'; -import type {Map as ImMap} from 'immutable'; -import type {ReactNode} from 'react'; -import type {Comparison} from 'shared/Comparison'; -import type {ContextMenuItem} from 'shared/ContextMenu'; -import type {ParsedDiff} from 'shared/patch/parse'; +import type {CommitRev, CommitStackState, FileRev, FileStackIndex} from '../commitStackState'; +import * as stylex from '@stylexjs/stylex'; +import {Banner, BannerKind} from 'isl-components/Banner'; +import {Button} from 'isl-components/Button'; +import {Column, Row} from 'isl-components/Flex'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {stylexPropsWithClassName} from 'isl-components/utils'; +import {atom, useAtomValue} from 'jotai'; +import React, {useEffect, useMemo, useRef} from 'react'; +import {ComparisonType} from 'shared/Comparison'; +import {useContextMenu} from 'shared/ContextMenu'; +import {firstLine, nullthrows} from 'shared/utils'; import {FileHeader, IconType} from '../../ComparisonView/SplitDiffView/SplitDiffFileHeader'; import {SplitDiffTable} from '../../ComparisonView/SplitDiffView/SplitDiffHunk'; import {ScrollY} from '../../ComponentUtils'; @@ -32,18 +44,6 @@ import {themeState} from '../../theme'; import {prev} from '../revMath'; import {calculateDagFromStack} from '../stackDag'; import {stackEditStack, useStackEditState} from './stackEditState'; -import * as stylex from '@stylexjs/stylex'; -import {Banner, BannerKind} from 'isl-components/Banner'; -import {Button} from 'isl-components/Button'; -import {Column, Row} from 'isl-components/Flex'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {stylexPropsWithClassName} from 'isl-components/utils'; -import {atom, useAtomValue} from 'jotai'; -import React, {useEffect, useMemo, useRef} from 'react'; -import {ComparisonType} from 'shared/Comparison'; -import {useContextMenu} from 'shared/ContextMenu'; -import {firstLine, nullthrows} from 'shared/utils'; const styles = stylex.create({ container: { diff --git a/addons/isl/src/stackEdit/ui/ConfirmUnsavedEditsBeforeSplit.tsx b/addons/isl/src/stackEdit/ui/ConfirmUnsavedEditsBeforeSplit.tsx index 0539ac30b72db..3dc469e0b6b87 100644 --- a/addons/isl/src/stackEdit/ui/ConfirmUnsavedEditsBeforeSplit.tsx +++ b/addons/isl/src/stackEdit/ui/ConfirmUnsavedEditsBeforeSplit.tsx @@ -5,10 +5,16 @@ * LICENSE file in the root directory of this source tree. */ +import type {MutableRefObject} from 'react'; import type {FieldsBeingEdited} from '../../CommitInfoView/types'; import type {CommitInfo} from '../../types'; -import type {MutableRefObject} from 'react'; +import {Button} from 'isl-components/Button'; +import {Divider} from 'isl-components/Divider'; +import {Icon} from 'isl-components/Icon'; +import {useAtomValue} from 'jotai'; +import {useCallback} from 'react'; +import {useAutofocusRef} from 'shared/hooks'; import {Commit} from '../../Commit'; import { editedCommitMessages, @@ -21,12 +27,6 @@ import {T, t} from '../../i18n'; import {readAtom, writeAtom} from '../../jotaiUtils'; import {CommitPreview} from '../../previews'; import {useModal} from '../../useModal'; -import {Button} from 'isl-components/Button'; -import {Divider} from 'isl-components/Divider'; -import {Icon} from 'isl-components/Icon'; -import {useAtomValue} from 'jotai'; -import {useCallback} from 'react'; -import {useAutofocusRef} from 'shared/hooks'; import './ConfirmUnsavedEditsBeforeSplit.css'; diff --git a/addons/isl/src/stackEdit/ui/EditStackModal.tsx b/addons/isl/src/stackEdit/ui/EditStackModal.tsx index 8c1da7f97727e..ccd615c276ae7 100644 --- a/addons/isl/src/stackEdit/ui/EditStackModal.tsx +++ b/addons/isl/src/stackEdit/ui/EditStackModal.tsx @@ -5,7 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -import {Row, FlexSpacer, ScrollY, Center} from '../../ComponentUtils'; +import * as stylex from '@stylexjs/stylex'; +import {ErrorNotice} from 'isl-components/ErrorNotice'; +import {Icon} from 'isl-components/Icon'; +import {Panels} from 'isl-components/Panels'; +import {useAtom, useAtomValue} from 'jotai'; +import {useState} from 'react'; +import {Center, FlexSpacer, Row, ScrollY} from '../../ComponentUtils'; import {Modal} from '../../Modal'; import {tracker} from '../../analytics'; import {t} from '../../i18n'; @@ -13,13 +19,7 @@ import {AbsorbStackEditPanel} from './AbsorbStackEditPanel'; import {SplitStackEditPanel, SplitStackToolbar} from './SplitStackEditPanel'; import {StackEditConfirmButtons} from './StackEditConfirmButtons'; import {StackEditSubTree} from './StackEditSubTree'; -import {loadingStackState, editingStackIntentionHashes} from './stackEditState'; -import * as stylex from '@stylexjs/stylex'; -import {ErrorNotice} from 'isl-components/ErrorNotice'; -import {Icon} from 'isl-components/Icon'; -import {Panels} from 'isl-components/Panels'; -import {useAtom, useAtomValue} from 'jotai'; -import {useState} from 'react'; +import {editingStackIntentionHashes, loadingStackState} from './stackEditState'; const styles = stylex.create({ container: { diff --git a/addons/isl/src/stackEdit/ui/FileStackEditPanel.tsx b/addons/isl/src/stackEdit/ui/FileStackEditPanel.tsx index b68b54ddc12fa..caed10009f33f 100644 --- a/addons/isl/src/stackEdit/ui/FileStackEditPanel.tsx +++ b/addons/isl/src/stackEdit/ui/FileStackEditPanel.tsx @@ -5,20 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -import type {FileStackState, FileRev} from '../fileStackState'; +import type {FileRev, FileStackState} from '../fileStackState'; import type {Mode} from './FileStackEditorLines'; -import {Row} from '../../ComponentUtils'; -import {EmptyState} from '../../EmptyState'; -import {t, T} from '../../i18n'; -import {FileStackEditorRow} from './FileStackEditor'; -import {bumpStackEditMetric, useStackEditState} from './stackEditState'; import {Checkbox} from 'isl-components/Checkbox'; import {Dropdown} from 'isl-components/Dropdown'; import {RadioGroup} from 'isl-components/Radio'; import {atom, useAtom} from 'jotai'; import {useState} from 'react'; import {nullthrows} from 'shared/utils'; +import {Row} from '../../ComponentUtils'; +import {EmptyState} from '../../EmptyState'; +import {t, T} from '../../i18n'; +import {FileStackEditorRow} from './FileStackEditor'; +import {bumpStackEditMetric, useStackEditState} from './stackEditState'; const editModeAtom = atom('unified-diff'); diff --git a/addons/isl/src/stackEdit/ui/FileStackEditor.tsx b/addons/isl/src/stackEdit/ui/FileStackEditor.tsx index 8cdcdad5bb99a..550f2a872af9d 100644 --- a/addons/isl/src/stackEdit/ui/FileStackEditor.tsx +++ b/addons/isl/src/stackEdit/ui/FileStackEditor.tsx @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ -import type {FileStackState, FileRev} from '../fileStackState'; +import type {Block, LineIdx} from 'shared/diff'; +import type {FileRev, FileStackState} from '../fileStackState'; import type {Mode} from './FileStackEditorLines'; import type {RangeInfo} from './TextEditable'; -import type {Block, LineIdx} from 'shared/diff'; +import deepEqual from 'fast-deep-equal'; +import {Set as ImSet, List, Range} from 'immutable'; +import {Checkbox} from 'isl-components/Checkbox'; +import React, {useEffect, useLayoutEffect, useRef, useState} from 'react'; +import {collapseContextBlocks, diffBlocks, mergeBlocks, splitLines} from 'shared/diff'; +import {nullthrows} from 'shared/utils'; import {CommitTitle} from '../../CommitTitle'; import {Row, ScrollX, ScrollY} from '../../ComponentUtils'; import {FlattenLine} from '../../linelog'; import {max, next, prev} from '../revMath'; import {computeLinesForFileStackEditor} from './FileStackEditorLines'; import {TextEditable} from './TextEditable'; -import deepEqual from 'fast-deep-equal'; -import {Set as ImSet, Range, List} from 'immutable'; -import {Checkbox} from 'isl-components/Checkbox'; -import React, {useState, useRef, useEffect, useLayoutEffect} from 'react'; -import {mergeBlocks, collapseContextBlocks, diffBlocks, splitLines} from 'shared/diff'; -import {nullthrows} from 'shared/utils'; import './FileStackEditor.css'; diff --git a/addons/isl/src/stackEdit/ui/FileStackEditorLines.tsx b/addons/isl/src/stackEdit/ui/FileStackEditorLines.tsx index fe802233d710e..3f6b868d7cd4f 100644 --- a/addons/isl/src/stackEdit/ui/FileStackEditorLines.tsx +++ b/addons/isl/src/stackEdit/ui/FileStackEditorLines.tsx @@ -7,15 +7,15 @@ import type {TokenizedHunk} from '../../ComparisonView/SplitDiffView/syntaxHighlightingTypes'; import type {FlattenLine} from '../../linelog'; -import type {FileStackState, FileRev} from '../fileStackState'; +import type {FileRev, FileStackState} from '../fileStackState'; import type {RangeInfo} from './TextEditable'; -import {t} from '../../i18n'; -import {prev} from '../revMath'; -import {bumpStackEditMetric} from './stackEditState'; import {Set as ImSet, Range} from 'immutable'; import {applyTokenizationToLine} from 'shared/createTokenizedIntralineDiff'; import {type Block, collapseContextBlocks, type LineIdx} from 'shared/diff'; +import {t} from '../../i18n'; +import {prev} from '../revMath'; +import {bumpStackEditMetric} from './stackEditState'; export type ComputedFileStackLines = { leftGutter: JSX.Element[]; diff --git a/addons/isl/src/stackEdit/ui/SplitButton.tsx b/addons/isl/src/stackEdit/ui/SplitButton.tsx index fcbcd34b212a3..8e93670133178 100644 --- a/addons/isl/src/stackEdit/ui/SplitButton.tsx +++ b/addons/isl/src/stackEdit/ui/SplitButton.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ -import type {CommitInfo} from '../../types'; import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; +import type {CommitInfo} from '../../types'; +import {Button} from 'isl-components/Button'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue, useSetAtom} from 'jotai'; import {tracker} from '../../analytics'; import {T, t} from '../../i18n'; import {SplitCommitIcon} from '../../icons/SplitCommitIcon'; import {uncommittedChangesWithPreviews} from '../../previews'; import {useConfirmUnsavedEditsBeforeSplit} from './ConfirmUnsavedEditsBeforeSplit'; import {bumpStackEditMetric, editingStackIntentionHashes} from './stackEditState'; -import {Button} from 'isl-components/Button'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue, useSetAtom} from 'jotai'; /** Button to open split UI for the current commit. Expected to be shown on the head commit. * Loads that one commit in the split UI. */ diff --git a/addons/isl/src/stackEdit/ui/SplitStackEditPanel.tsx b/addons/isl/src/stackEdit/ui/SplitStackEditPanel.tsx index 62725cf68d370..9e22162c73444 100644 --- a/addons/isl/src/stackEdit/ui/SplitStackEditPanel.tsx +++ b/addons/isl/src/stackEdit/ui/SplitStackEditPanel.tsx @@ -5,13 +5,26 @@ * LICENSE file in the root directory of this source tree. */ -import type {CommitMessageFields} from '../../CommitInfoView/types'; -import type {CommitStackState, FileMetadata, FileStackIndex, CommitRev} from '../commitStackState'; -import type {FileStackState, FileRev} from '../fileStackState'; -import type {UseStackEditState} from './stackEditState'; import type {EnsureAssignedTogether} from 'shared/EnsureAssignedTogether'; import type {RepoPath} from 'shared/types/common'; +import type {CommitMessageFields} from '../../CommitInfoView/types'; +import type {CommitRev, CommitStackState, FileMetadata, FileStackIndex} from '../commitStackState'; +import type {FileRev, FileStackState} from '../fileStackState'; +import type {UseStackEditState} from './stackEditState'; +import * as stylex from '@stylexjs/stylex'; +import {Set as ImSet, type List, Range} from 'immutable'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Subtle} from 'isl-components/Subtle'; +import {TextField} from 'isl-components/TextField'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useAtomValue} from 'jotai'; +import {useEffect, useMemo, useRef, useState} from 'react'; +import {useContextMenu} from 'shared/ContextMenu'; +import {diffBlocks, type LineIdx, splitLines} from 'shared/diff'; +import {useThrottledEffect} from 'shared/hooks'; +import {firstLine, nullthrows} from 'shared/utils'; import {BranchIndicator} from '../../BranchIndicator'; import {commitMessageTemplate} from '../../CommitInfoView/CommitInfoState'; import { @@ -32,19 +45,6 @@ import {isAbsent} from '../commitStackState'; import {max, next, prev} from '../revMath'; import {computeLinesForFileStackEditor} from './FileStackEditorLines'; import {bumpStackEditMetric, SplitRangeRecord, useStackEditState} from './stackEditState'; -import * as stylex from '@stylexjs/stylex'; -import {Set as ImSet, type List, Range} from 'immutable'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Subtle} from 'isl-components/Subtle'; -import {TextField} from 'isl-components/TextField'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useAtomValue} from 'jotai'; -import {useRef, useState, useEffect, useMemo} from 'react'; -import {useContextMenu} from 'shared/ContextMenu'; -import {type LineIdx, splitLines, diffBlocks} from 'shared/diff'; -import {useThrottledEffect} from 'shared/hooks'; -import {firstLine, nullthrows} from 'shared/utils'; import './SplitStackEditPanel.css'; diff --git a/addons/isl/src/stackEdit/ui/StackEditConfirmButtons.tsx b/addons/isl/src/stackEdit/ui/StackEditConfirmButtons.tsx index 326ccc843082f..528154aee292f 100644 --- a/addons/isl/src/stackEdit/ui/StackEditConfirmButtons.tsx +++ b/addons/isl/src/stackEdit/ui/StackEditConfirmButtons.tsx @@ -7,6 +7,11 @@ import type {Hash} from '../../types'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {DOCUMENTATION_DELAY, Tooltip} from 'isl-components/Tooltip'; +import {useAtom, useAtomValue} from 'jotai'; +import {useCallback} from 'react'; import { editedCommitMessages, getDefaultEditedCommitMessage, @@ -25,11 +30,6 @@ import { sendStackEditMetrics, useStackEditState, } from './stackEditState'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip, DOCUMENTATION_DELAY} from 'isl-components/Tooltip'; -import {useAtom, useAtomValue} from 'jotai'; -import {useCallback} from 'react'; export function StackEditConfirmButtons(): React.ReactElement { const [[stackIntention], setStackIntentionHashes] = useAtom(editingStackIntentionHashes); diff --git a/addons/isl/src/stackEdit/ui/StackEditSubTree.tsx b/addons/isl/src/stackEdit/ui/StackEditSubTree.tsx index 7523a613bef00..63ffc2fceeb57 100644 --- a/addons/isl/src/stackEdit/ui/StackEditSubTree.tsx +++ b/addons/isl/src/stackEdit/ui/StackEditSubTree.tsx @@ -6,9 +6,15 @@ */ import type {DragHandler} from '../../DragHandle'; -import type {CommitState, CommitRev} from '../commitStackState'; +import type {CommitRev, CommitState} from '../commitStackState'; import type {StackEditOpDescription, UseStackEditState} from './stackEditState'; +import {is} from 'immutable'; +import {Button} from 'isl-components/Button'; +import {Icon} from 'isl-components/Icon'; +import {Tooltip} from 'isl-components/Tooltip'; +import {useRef, useState} from 'react'; +import {nullthrows} from 'shared/utils'; import {AnimatedReorderGroup} from '../../AnimatedReorderGroup'; import {CommitTitle as StandaloneCommitTitle} from '../../CommitTitle'; import {Row} from '../../ComponentUtils'; @@ -19,12 +25,6 @@ import {SplitCommitIcon} from '../../icons/SplitCommitIcon'; import {reorderedRevs} from '../commitStackState'; import {ReorderState} from '../reorderState'; import {bumpStackEditMetric, useStackEditState, WDIR_NODE} from './stackEditState'; -import {is} from 'immutable'; -import {Button} from 'isl-components/Button'; -import {Icon} from 'isl-components/Icon'; -import {Tooltip} from 'isl-components/Tooltip'; -import {useRef, useState} from 'react'; -import {nullthrows} from 'shared/utils'; import './StackEditSubTree.css'; diff --git a/addons/isl/src/stackEdit/ui/stackEditState.ts b/addons/isl/src/stackEdit/ui/stackEditState.ts index f3396ad49a29e..a4fcbf755d5b8 100644 --- a/addons/isl/src/stackEdit/ui/stackEditState.ts +++ b/addons/isl/src/stackEdit/ui/stackEditState.ts @@ -5,11 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {Hash} from '../../types'; -import type {CommitState} from '../commitStackState'; import type {RecordOf} from 'immutable'; import type {ExportStack} from 'shared/types/stack'; +import type {Hash} from '../../types'; +import type {CommitState} from '../commitStackState'; +import {List, Record} from 'immutable'; +import {atom, useAtom} from 'jotai'; +import {nullthrows} from 'shared/utils'; import clientToServerAPI from '../../ClientToServerAPI'; import {latestCommitMessageFieldsWithEdits} from '../../CommitInfoView/CommitInfoState'; import { @@ -24,9 +27,6 @@ import {waitForNothingRunning} from '../../operationsState'; import {uncommittedSelection} from '../../partialSelection'; import {CommitStackState} from '../../stackEdit/commitStackState'; import {assert, registerDisposable} from '../../utils'; -import {List, Record} from 'immutable'; -import {atom, useAtom} from 'jotai'; -import {nullthrows} from 'shared/utils'; /** * The "edit stack" dialog state that works with undo/redo in the dialog. diff --git a/addons/isl/src/stylexUtils.tsx b/addons/isl/src/stylexUtils.tsx index dede769c1ccb3..48a3bb145eff7 100644 --- a/addons/isl/src/stylexUtils.tsx +++ b/addons/isl/src/stylexUtils.tsx @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {spacing} from '../../components/theme/tokens.stylex'; import * as stylex from '@stylexjs/stylex'; +import {spacing} from '../../components/theme/tokens.stylex'; export const layout = stylex.create({ flexRow: { diff --git a/addons/isl/src/testQueries.ts b/addons/isl/src/testQueries.ts index 5604fdee3cb44..44b43cddbd46a 100644 --- a/addons/isl/src/testQueries.ts +++ b/addons/isl/src/testQueries.ts @@ -7,6 +7,8 @@ import type {Hash} from './types'; +import {act, fireEvent, screen, waitFor, within} from '@testing-library/react'; +import {nullthrows} from 'shared/utils'; import {commitMessageFieldsSchema} from './CommitInfoView/CommitMessageFields'; import {OSSCommitMessageFieldSchema} from './CommitInfoView/OSSCommitMessageFieldsSchema'; import {convertFieldNameToKey} from './CommitInfoView/utils'; @@ -14,8 +16,6 @@ import {readAtom} from './jotaiUtils'; import {individualToggleKey} from './selection'; import {expectMessageSentToServer} from './testUtils'; import {assert} from './utils'; -import {screen, within, fireEvent, waitFor, act} from '@testing-library/react'; -import {nullthrows} from 'shared/utils'; export const CommitTreeListTestUtils = { withinCommitTree() { diff --git a/addons/isl/src/testUtils.tsx b/addons/isl/src/testUtils.tsx index 14584a957b75f..86499f606a3fc 100644 --- a/addons/isl/src/testUtils.tsx +++ b/addons/isl/src/testUtils.tsx @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +import type {Writable} from 'shared/typeUtils'; import type {TestingEventBus} from './TestingMessageBus'; import type { ClientToServerMessage, @@ -15,13 +16,12 @@ import type { SmartlogCommits, UncommittedChanges, } from './types'; -import type {Writable} from 'shared/typeUtils'; +import {act, screen, waitFor, within} from '@testing-library/react'; +import {nextTick} from 'shared/testUtils'; import platform from './platform'; import {deserializeFromString, serializeToString} from './serialize'; import {mostRecentSubscriptionIds} from './serverAPIState'; -import {screen, act, within, waitFor} from '@testing-library/react'; -import {nextTick} from 'shared/testUtils'; const testMessageBus = platform.messageBus as TestingEventBus; diff --git a/addons/isl/src/theme.tsx b/addons/isl/src/theme.tsx index be6e8fee92b7d..dddc0eb3aef9a 100644 --- a/addons/isl/src/theme.tsx +++ b/addons/isl/src/theme.tsx @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ +import {atom} from 'jotai'; import {useCommand} from './ISLShortcuts'; import {localStorageBackedAtom, writeAtom} from './jotaiUtils'; import platform from './platform'; import {registerDisposable} from './utils'; -import {atom} from 'jotai'; -import 'isl-components/theme/themeLight.css'; import 'isl-components/theme/themeDark.css'; +import 'isl-components/theme/themeLight.css'; const THEME_LOCAL_STORAGE_KEY = 'isl-color-theme'; diff --git a/addons/isl/src/third-party/jotai-devtools/utils/index.ts b/addons/isl/src/third-party/jotai-devtools/utils/index.ts index 2e6a7fe85c376..3d57e4857b447 100644 --- a/addons/isl/src/third-party/jotai-devtools/utils/index.ts +++ b/addons/isl/src/third-party/jotai-devtools/utils/index.ts @@ -1,5 +1,5 @@ -export { useAtomsSnapshot } from './useAtomsSnapshot'; -export { useGotoAtomsSnapshot } from './useGotoAtomsSnapshot'; -export { useAtomsDebugValue } from './useAtomsDebugValue'; export { useAtomDevtools } from './useAtomDevtools'; +export { useAtomsDebugValue } from './useAtomsDebugValue'; export { useAtomsDevtools } from './useAtomsDevtools'; +export { useAtomsSnapshot } from './useAtomsSnapshot'; +export { useGotoAtomsSnapshot } from './useGotoAtomsSnapshot'; diff --git a/addons/isl/src/third-party/jotai-devtools/utils/useAtomDevtools.ts b/addons/isl/src/third-party/jotai-devtools/utils/useAtomDevtools.ts index e7257338efe01..17c5d15d3d093 100644 --- a/addons/isl/src/third-party/jotai-devtools/utils/useAtomDevtools.ts +++ b/addons/isl/src/third-party/jotai-devtools/utils/useAtomDevtools.ts @@ -1,6 +1,6 @@ -import { useEffect, useRef } from 'react'; import { useAtom } from 'jotai/react'; import type { Atom, WritableAtom } from 'jotai/vanilla'; +import { useEffect, useRef } from 'react'; import { Connection, createReduxConnection, diff --git a/addons/isl/src/third-party/jotai-devtools/utils/useAtomsDebugValue.ts b/addons/isl/src/third-party/jotai-devtools/utils/useAtomsDebugValue.ts index 52a12cd8db09c..ee0c5f6a87a37 100644 --- a/addons/isl/src/third-party/jotai-devtools/utils/useAtomsDebugValue.ts +++ b/addons/isl/src/third-party/jotai-devtools/utils/useAtomsDebugValue.ts @@ -1,5 +1,7 @@ import { isDev as __DEV__ } from '../../../utils'; +import { useStore } from 'jotai/react'; +import type { Atom } from 'jotai/vanilla'; import { useDebugValue, useEffect, @@ -7,8 +9,6 @@ import { useRef, useState, } from 'react'; -import { useStore } from 'jotai/react'; -import type { Atom } from 'jotai/vanilla'; type Store = ReturnType; type AtomState = NonNullable< diff --git a/addons/isl/src/third-party/jotai-devtools/utils/useAtomsSnapshot.ts b/addons/isl/src/third-party/jotai-devtools/utils/useAtomsSnapshot.ts index 60cd08bd5c8fa..3687bc7d8160d 100644 --- a/addons/isl/src/third-party/jotai-devtools/utils/useAtomsSnapshot.ts +++ b/addons/isl/src/third-party/jotai-devtools/utils/useAtomsSnapshot.ts @@ -1,5 +1,5 @@ -import { useEffect, useLayoutEffect, useRef, useState } from 'react'; import { useStore } from 'jotai/react'; +import { useEffect, useLayoutEffect, useRef, useState } from 'react'; import type { AtomsDependents, AtomsSnapshot, diff --git a/addons/isl/src/third-party/jotai-devtools/utils/useGotoAtomsSnapshot.ts b/addons/isl/src/third-party/jotai-devtools/utils/useGotoAtomsSnapshot.ts index 08f108912d468..d213c7107ac69 100644 --- a/addons/isl/src/third-party/jotai-devtools/utils/useGotoAtomsSnapshot.ts +++ b/addons/isl/src/third-party/jotai-devtools/utils/useGotoAtomsSnapshot.ts @@ -1,5 +1,5 @@ -import { useCallback } from 'react'; import { useStore } from 'jotai/react'; +import { useCallback } from 'react'; import type { AtomsSnapshot, Options } from '../types'; export function useGotoAtomsSnapshot(options?: Options) { diff --git a/addons/isl/src/toast.ts b/addons/isl/src/toast.ts index 5a119289952b6..e3e83da446e91 100644 --- a/addons/isl/src/toast.ts +++ b/addons/isl/src/toast.ts @@ -7,11 +7,11 @@ import type {ReactNode} from 'react'; +import {List} from 'immutable'; +import {atom} from 'jotai'; import {t} from './i18n'; import {atomWithOnChange, writeAtom} from './jotaiUtils'; import platform from './platform'; -import {List} from 'immutable'; -import {atom} from 'jotai'; /** * Push a toast. It will be displayed immediately and auto hides after a timeout. diff --git a/addons/isl/src/types.ts b/addons/isl/src/types.ts index 91c0057b8e05e..d21b99cc34b89 100644 --- a/addons/isl/src/types.ts +++ b/addons/isl/src/types.ts @@ -5,9 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import type {TypeaheadKind} from './CommitInfoView/types'; -import type {InternalTypes} from './InternalTypes'; -import type {Serializable} from './serialize'; import type {TypeaheadResult} from 'isl-components/Types'; import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; import type {TrackDataWithEventName} from 'isl-server/src/analytics/types'; @@ -17,6 +14,9 @@ import type {ParsedDiff} from 'shared/patch/parse'; import type {AllUndefined, Json} from 'shared/typeUtils'; import type {Hash} from 'shared/types/common'; import type {ExportStack, ImportedStack, ImportStack} from 'shared/types/stack'; +import type {TypeaheadKind} from './CommitInfoView/types'; +import type {InternalTypes} from './InternalTypes'; +import type {Serializable} from './serialize'; export type Result = {value: T; error?: undefined} | {value?: undefined; error: Error}; diff --git a/addons/isl/src/useModal.tsx b/addons/isl/src/useModal.tsx index ad0c668106fab..af35a90d0920d 100644 --- a/addons/isl/src/useModal.tsx +++ b/addons/isl/src/useModal.tsx @@ -7,14 +7,14 @@ import type {Deferred} from 'shared/utils'; -import {useCommand} from './ISLShortcuts'; -import {Modal} from './Modal'; -import {writeAtom} from './jotaiUtils'; import {Button} from 'isl-components/Button'; import {Icon} from 'isl-components/Icon'; import {atom, useAtom, useSetAtom} from 'jotai'; import React, {useCallback, useEffect, useRef} from 'react'; import {defer} from 'shared/utils'; +import {useCommand} from './ISLShortcuts'; +import {Modal} from './Modal'; +import {writeAtom} from './jotaiUtils'; import './useModal.css'; diff --git a/addons/isl/src/utils.ts b/addons/isl/src/utils.ts index 5388582e6d6cd..24f60066bff78 100644 --- a/addons/isl/src/utils.ts +++ b/addons/isl/src/utils.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Disposable, Hash} from './types'; import type {ViteHotContext} from 'vite/types/hot'; +import type {Disposable, Hash} from './types'; export function firstOfIterable(it: IterableIterator): T | undefined { return it.next().value; diff --git a/addons/package.json b/addons/package.json index 5110360c67bac..9964108e02643 100644 --- a/addons/package.json +++ b/addons/package.json @@ -17,6 +17,7 @@ "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-rulesdir": "^0.2.1", "prettier": "2.8.8", + "prettier-plugin-organize-imports": "^4.1.0", "ts-node": "10.9.2", "tsx": "^4.19.2" }, diff --git a/addons/prettier.config.cjs b/addons/prettier.config.cjs new file mode 100644 index 0000000000000..325d99d8511b2 --- /dev/null +++ b/addons/prettier.config.cjs @@ -0,0 +1,42 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// Note: there are 2 versions of prettiers: +// - Local prettier. Affects `yarn run prettier`, and editors like `nvim`. +// - Monorepo prettier. Affects `arc lint`, and the internal VSCode. +// Thoroughly test when making changes. + +const config = { + arrowParens: 'avoid', + bracketSpacing: false, + bracketSameLine: true, + useTabs: false, + singleQuote: true, + tabWidth: 2, + printWidth: 100, + trailingComma: 'all', +}; + +// `arc lint` runs the monorepo prettier, with cwd == monorepo root +// related code path: tools/arcanist/lint/external/prettier_linter.js +const isArcLint = process.env.ARC2_COMMAND != null; // could be: 'lint', 'linttool', 'f' +if (isArcLint) { + // Use prettier2's "plugin search" to discover and load the plugin. + // (see "externalAutoLoadPluginInfos" in tools/third-party/prettier/node_modules/prettier/index.js) + // Need a different approach for prettier3 (https://github.com/prettier/prettier/pull/14759). + config.pluginSearchDirs = ['.']; +} else { + // Explicitly set the plugin. + // Does not work with the monorepo prettier (arc lint). + // - `prettier-plugin-organize-imports` cannot be imported from monorepo root. + // - `require('prettier-plugin-organize-imports')` does not work either + // because its dependency (ex. `typescript`) cannot be imported from + // monorepo root. + config.plugins = ['prettier-plugin-organize-imports']; +} + +module.exports = config; diff --git a/addons/screenshot-tool/src/example.ts b/addons/screenshot-tool/src/example.ts index afe105b5d5c0a..86ed934f422e7 100644 --- a/addons/screenshot-tool/src/example.ts +++ b/addons/screenshot-tool/src/example.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {OpenISLOptions, PageOptions} from './testBrowser'; import type {Context} from 'node:vm'; +import type {OpenISLOptions, PageOptions} from './testBrowser'; +import {join} from 'node:path'; +import * as repl from 'node:repl'; import {TestBrowser} from './testBrowser'; import {TestRepo} from './testRepo'; import {getCacheDir} from './utils'; -import {join} from 'node:path'; -import * as repl from 'node:repl'; /** Reexport for convenience. */ export type {TestBrowser, TestRepo}; diff --git a/addons/screenshot-tool/src/examples/stackEdit.ts b/addons/screenshot-tool/src/examples/stackEdit.ts index 1408da47b94bf..21ad23e8569b8 100644 --- a/addons/screenshot-tool/src/examples/stackEdit.ts +++ b/addons/screenshot-tool/src/examples/stackEdit.ts @@ -7,9 +7,9 @@ import type {Example, TestRepo} from '../example'; -import {BASE_EXAMPLE} from '../example'; import {dirname, join} from 'node:path'; import {fileURLToPath} from 'node:url'; +import {BASE_EXAMPLE} from '../example'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/addons/screenshot-tool/src/testBrowser.ts b/addons/screenshot-tool/src/testBrowser.ts index 0ee6c2382e573..7757756613a70 100644 --- a/addons/screenshot-tool/src/testBrowser.ts +++ b/addons/screenshot-tool/src/testBrowser.ts @@ -7,15 +7,15 @@ /* eslint-disable no-await-in-loop */ -import type * as testRepo from './testRepo'; import type {Browser, Page} from 'puppeteer-core'; import type * as Rrweb from 'rrweb'; +import type * as testRepo from './testRepo'; -import {getCacheDir, sha1} from './utils'; import fs from 'node:fs'; import {dirname, join} from 'node:path'; import {fileURLToPath} from 'node:url'; import puppeteer from 'puppeteer-core'; +import {getCacheDir, sha1} from './utils'; export type PageOptions = { width?: number; diff --git a/addons/screenshot-tool/src/testRepo.ts b/addons/screenshot-tool/src/testRepo.ts index 23c2cdf7f0837..c34a78ff2d8be 100644 --- a/addons/screenshot-tool/src/testRepo.ts +++ b/addons/screenshot-tool/src/testRepo.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import {getCacheDir, sha1} from './utils'; import {spawn} from 'node:child_process'; import * as fs from 'node:fs/promises'; import {join} from 'node:path'; import {dirSync} from 'tmp'; +import {getCacheDir, sha1} from './utils'; const logger = console; const keepTmp = process.env.KEEP != null; diff --git a/addons/scripts/dev.ts b/addons/scripts/dev.ts index ecf214e7c9e55..7756377263187 100644 --- a/addons/scripts/dev.ts +++ b/addons/scripts/dev.ts @@ -7,11 +7,11 @@ import type {EjecaChildProcess} from 'shared/ejeca'; -import {Internal} from './Internal'; import chalk from 'chalk'; import path from 'path'; import {ejeca} from 'shared/ejeca'; import {defer} from 'shared/utils'; +import {Internal} from './Internal'; function usage() { process.stdout.write(` diff --git a/addons/shared/LRU.ts b/addons/shared/LRU.ts index 26e79de5b81cc..76ed34e3ac64e 100644 --- a/addons/shared/LRU.ts +++ b/addons/shared/LRU.ts @@ -7,9 +7,9 @@ import type {ValueObject} from 'immutable'; -import {isPromise} from './utils'; import deepEqual from 'fast-deep-equal'; -import {isValueObject, is, List} from 'immutable'; +import {is, isValueObject, List} from 'immutable'; +import {isPromise} from './utils'; type LRUKey = LRUHashKey | ValueObject; type LRUHashKey = string | number | boolean | null | undefined | object; diff --git a/addons/shared/__tests__/ContextMenu.test.tsx b/addons/shared/__tests__/ContextMenu.test.tsx index 63387879aac0f..5937aa6ebf6fc 100644 --- a/addons/shared/__tests__/ContextMenu.test.tsx +++ b/addons/shared/__tests__/ContextMenu.test.tsx @@ -8,9 +8,9 @@ */ import '@testing-library/jest-dom'; -import {ContextMenus, useContextMenu} from '../ContextMenu'; -import {fireEvent, render, screen, act} from '@testing-library/react'; +import {act, fireEvent, render, screen} from '@testing-library/react'; import {Provider} from 'jotai'; +import {ContextMenus, useContextMenu} from '../ContextMenu'; const onClick1 = jest.fn(); const onClick2 = jest.fn(); diff --git a/addons/shared/__tests__/LRU.test.ts b/addons/shared/__tests__/LRU.test.ts index 8880282b1913b..e7a3632afe6eb 100644 --- a/addons/shared/__tests__/LRU.test.ts +++ b/addons/shared/__tests__/LRU.test.ts @@ -7,9 +7,9 @@ import type {LRUWithStats} from '../LRU'; -import {cached, LRU, clearTrackedCache, cachedMethod} from '../LRU'; -import {SelfUpdate} from '../immutableExt'; import {List, Record} from 'immutable'; +import {cached, cachedMethod, clearTrackedCache, LRU} from '../LRU'; +import {SelfUpdate} from '../immutableExt'; describe('LRU', () => { it('evicts oldest items after reaching the max', () => { diff --git a/addons/shared/__tests__/SplitDiffView/organizeLinesIntoGroups.test.ts b/addons/shared/__tests__/SplitDiffView/organizeLinesIntoGroups.test.ts index 532eb28e31d65..9342f2962005c 100644 --- a/addons/shared/__tests__/SplitDiffView/organizeLinesIntoGroups.test.ts +++ b/addons/shared/__tests__/SplitDiffView/organizeLinesIntoGroups.test.ts @@ -7,8 +7,8 @@ import type {Hunk} from 'diff'; -import organizeLinesIntoGroups from '../../SplitDiffView/organizeLinesIntoGroups'; import {structuredPatch} from 'diff'; +import organizeLinesIntoGroups from '../../SplitDiffView/organizeLinesIntoGroups'; test('file with only one line that is changed (no context)', () => { const hunks = diffIntoHunks(['lowerCamelCase'], ['UpperCamelCase']); diff --git a/addons/shared/__tests__/diff.test.ts b/addons/shared/__tests__/diff.test.ts index 78b0f1f6907a7..31c45a007fe41 100644 --- a/addons/shared/__tests__/diff.test.ts +++ b/addons/shared/__tests__/diff.test.ts @@ -7,7 +7,7 @@ import type {Block} from '../diff'; -import {diffBlocks, splitLines, collapseContextBlocks, mergeBlocks} from '../diff'; +import {collapseContextBlocks, diffBlocks, mergeBlocks, splitLines} from '../diff'; describe('diffBlocks', () => { it('returns a "=" block for unchanged content', () => { diff --git a/addons/shared/__tests__/hooks.test.tsx b/addons/shared/__tests__/hooks.test.tsx index a388e846fbd9d..48913023e9ca8 100644 --- a/addons/shared/__tests__/hooks.test.tsx +++ b/addons/shared/__tests__/hooks.test.tsx @@ -7,10 +7,10 @@ * @jest-environment jsdom */ -import {useDeepMemo, usePrevious, useThrottledEffect} from '../hooks'; -import {fireEvent, render, screen, act} from '@testing-library/react'; import '@testing-library/jest-dom'; +import {act, fireEvent, render, screen} from '@testing-library/react'; import {useState} from 'react'; +import {useDeepMemo, usePrevious, useThrottledEffect} from '../hooks'; describe('useThrottledEffect', () => { afterEach(() => { diff --git a/addons/shared/__tests__/immutableExt.test.ts b/addons/shared/__tests__/immutableExt.test.ts index 9a6c2b1f12de2..db621f5bef1b4 100644 --- a/addons/shared/__tests__/immutableExt.test.ts +++ b/addons/shared/__tests__/immutableExt.test.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import {SelfUpdate} from '../immutableExt'; import Immutable, {List} from 'immutable'; +import {SelfUpdate} from '../immutableExt'; describe('SelfUpdate', () => { it('is needed because of immutable.js deepEquals', () => { diff --git a/addons/shared/createTokenizedIntralineDiff.tsx b/addons/shared/createTokenizedIntralineDiff.tsx index ddb3d70d49978..f80a4474ccbe8 100644 --- a/addons/shared/createTokenizedIntralineDiff.tsx +++ b/addons/shared/createTokenizedIntralineDiff.tsx @@ -7,8 +7,8 @@ import type {HighlightedToken} from './textmate-lib/tokenize'; -import {CSS_CLASS_PREFIX} from './textmate-lib/textmateStyles'; import {diffWordsWithSpace} from 'diff'; +import {CSS_CLASS_PREFIX} from './textmate-lib/textmateStyles'; /** Type of Chunk: Added, Removed, Unmodified. */ type ChunkType = 'A' | 'R' | 'U'; diff --git a/addons/shared/ejeca.ts b/addons/shared/ejeca.ts index ee9496e2e1d5e..fab17fc6f3851 100644 --- a/addons/shared/ejeca.ts +++ b/addons/shared/ejeca.ts @@ -5,14 +5,14 @@ * LICENSE file in the root directory of this source tree. */ -import type {ChildProcess, IOType, SpawnOptions, Serializable} from 'node:child_process'; +import type {ChildProcess, IOType, Serializable, SpawnOptions} from 'node:child_process'; import type {Stream} from 'node:stream'; -import {truncate} from './utils'; import getStream from 'get-stream'; import {spawn} from 'node:child_process'; import {Readable} from 'node:stream'; import os from 'os'; +import {truncate} from './utils'; const LF = '\n'; const LF_BINARY = LF.codePointAt(0); diff --git a/addons/shared/hooks.tsx b/addons/shared/hooks.tsx index e3e28d04c7889..443e4b435e529 100644 --- a/addons/shared/hooks.tsx +++ b/addons/shared/hooks.tsx @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import {debounce} from './debounce'; import deepEqual from 'fast-deep-equal'; import {useCallback, useEffect, useMemo, useRef} from 'react'; +import {debounce} from './debounce'; /** * Like useEffect, but throttles calls to the effect callback. diff --git a/addons/shared/testUtils.ts b/addons/shared/testUtils.ts index 25fcbf2c3bbb5..ad954a1f98e42 100644 --- a/addons/shared/testUtils.ts +++ b/addons/shared/testUtils.ts @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import type {Json} from './typeUtils'; import type {MeasureMemoryOptions} from 'node:vm'; +import type {Json} from './typeUtils'; -import {Logger} from '../isl-server/src/logger'; import {measureMemory} from 'node:vm'; +import {Logger} from '../isl-server/src/logger'; export class MockLogger extends Logger { write() { diff --git a/addons/shared/textmate-lib/createTextMateRegistry.ts b/addons/shared/textmate-lib/createTextMateRegistry.ts index ecafa6f60b81c..fc34ee69702f7 100644 --- a/addons/shared/textmate-lib/createTextMateRegistry.ts +++ b/addons/shared/textmate-lib/createTextMateRegistry.ts @@ -5,8 +5,8 @@ * LICENSE file in the root directory of this source tree. */ -import type {Grammar, TextMateGrammar} from './types'; import type {IRawGrammar, IRawTheme} from 'vscode-textmate'; +import type {Grammar, TextMateGrammar} from './types'; import {createOnigScanner, createOnigString} from 'vscode-oniguruma'; import {Registry, parseRawGrammar} from 'vscode-textmate'; diff --git a/addons/textmate/src/LanguageExtensionOnDisk.ts b/addons/textmate/src/LanguageExtensionOnDisk.ts index 1b61d76f4b7ec..74bb7eee2e862 100644 --- a/addons/textmate/src/LanguageExtensionOnDisk.ts +++ b/addons/textmate/src/LanguageExtensionOnDisk.ts @@ -5,9 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -import AbstractLanguageExtension from './AbstractLanguageExtension.js'; import {promises as fs} from 'node:fs'; import pathMod from 'node:path'; +import AbstractLanguageExtension from './AbstractLanguageExtension.js'; export default class LanguageExtensionOnDisk extends AbstractLanguageExtension { constructor(private extensionRoot: string) { diff --git a/addons/textmate/src/LanguageExtensionOnGitHub.ts b/addons/textmate/src/LanguageExtensionOnGitHub.ts index 00d92af13d8b8..ec34d4a5d3f32 100644 --- a/addons/textmate/src/LanguageExtensionOnGitHub.ts +++ b/addons/textmate/src/LanguageExtensionOnGitHub.ts @@ -7,11 +7,11 @@ import type {ExecFileOptions} from 'node:child_process'; -import AbstractLanguageExtension from './AbstractLanguageExtension.js'; import child_process, {execFile} from 'node:child_process'; import {promises as fs} from 'node:fs'; import osMod from 'node:os'; import pathMod from 'node:path'; +import AbstractLanguageExtension from './AbstractLanguageExtension.js'; type ConstructorArgs = { /** GitHub organization for repo. */ diff --git a/addons/textmate/src/index.ts b/addons/textmate/src/index.ts index e8b0816b0fe25..6cc7e6570a6e9 100644 --- a/addons/textmate/src/index.ts +++ b/addons/textmate/src/index.ts @@ -5,23 +5,23 @@ * LICENSE file in the root directory of this source tree. */ +import type AbstractLanguageExtension from './AbstractLanguageExtension.js'; import type { ExtensionManifest, GrammarContribution, GrammarSource, NormalizedLanguageExtensionPoint, } from './AbstractLanguageExtension.js'; -import type AbstractLanguageExtension from './AbstractLanguageExtension.js'; import type {LanguageExtensionAmendment} from './languageExtensionAmendments.js'; -import LanguageExtensionOnDisk from './LanguageExtensionOnDisk.js'; -import builtInExtensions from './extensions.js'; -import languageExtensionAmendments from './languageExtensionAmendments.js'; import minimist from 'minimist'; import assert from 'node:assert'; import {promises as fs} from 'node:fs'; import pathMod from 'node:path'; import prettier from 'prettier'; +import LanguageExtensionOnDisk from './LanguageExtensionOnDisk.js'; +import builtInExtensions from './extensions.js'; +import languageExtensionAmendments from './languageExtensionAmendments.js'; const GENERATED_SIGIL = '\x40generated'; diff --git a/addons/vscode/extension/SaplingFileDecorationProvider.ts b/addons/vscode/extension/SaplingFileDecorationProvider.ts index 6e5a360e1ec5a..237c3bccbae00 100644 --- a/addons/vscode/extension/SaplingFileDecorationProvider.ts +++ b/addons/vscode/extension/SaplingFileDecorationProvider.ts @@ -5,17 +5,17 @@ * LICENSE file in the root directory of this source tree. */ -import type {SaplingResourceGroup, VSCodeRepo} from './VSCodeRepo'; import type {Logger} from 'isl-server/src/logger'; import type {Disposable, Event} from 'vscode'; +import type {SaplingResourceGroup, VSCodeRepo} from './VSCodeRepo'; import { EventEmitter, + ThemeIcon, Uri, + window, type FileDecoration, type FileDecorationProvider, - window, - ThemeIcon, } from 'vscode'; export default class SaplingFileDecorationProvider implements FileDecorationProvider { diff --git a/addons/vscode/extension/VSCodeRepo.ts b/addons/vscode/extension/VSCodeRepo.ts index ee21e2a08ae93..3c3ee41aee01b 100644 --- a/addons/vscode/extension/VSCodeRepo.ts +++ b/addons/vscode/extension/VSCodeRepo.ts @@ -5,25 +5,25 @@ * LICENSE file in the root directory of this source tree. */ -import type {EnabledSCMApiFeature} from './types'; import type {RepositoryReference} from 'isl-server/src/RepositoryCache'; import type {ServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; import type {Logger} from 'isl-server/src/logger'; import type {ChangedFile} from 'isl/src/types'; import type {Comparison} from 'shared/Comparison'; import type {Writable} from 'shared/typeUtils'; +import type {EnabledSCMApiFeature} from './types'; -import {encodeSaplingDiffUri} from './DiffContentProvider'; -import SaplingFileDecorationProvider from './SaplingFileDecorationProvider'; -import {executeVSCodeCommand} from './commands'; -import {getCLICommand} from './config'; -import {t} from './i18n'; import {Repository} from 'isl-server/src/Repository'; import {repositoryCache} from 'isl-server/src/RepositoryCache'; import {ResolveOperation, ResolveTool} from 'isl/src/operations/ResolveOperation'; import * as path from 'path'; import {ComparisonType} from 'shared/Comparison'; import * as vscode from 'vscode'; +import {encodeSaplingDiffUri} from './DiffContentProvider'; +import SaplingFileDecorationProvider from './SaplingFileDecorationProvider'; +import {executeVSCodeCommand} from './commands'; +import {getCLICommand} from './config'; +import {t} from './i18n'; const mergeConflictStartRegex = new RegExp('<{7}|>{7}|={7}|[|]{7}'); diff --git a/addons/vscode/extension/__tests__/DiffContentProvider.test.ts b/addons/vscode/extension/__tests__/DiffContentProvider.test.ts index 607b74ab63712..d40d7627cf421 100644 --- a/addons/vscode/extension/__tests__/DiffContentProvider.test.ts +++ b/addons/vscode/extension/__tests__/DiffContentProvider.test.ts @@ -10,16 +10,16 @@ import type {ServerPlatform} from 'isl-server/src/serverPlatform'; import type {RepositoryContext} from 'isl-server/src/serverTypes'; import type {CommitInfo} from 'isl/src/types'; -import { - decodeSaplingDiffUri, - encodeSaplingDiffUri, - SaplingDiffContentProvider, -} from '../DiffContentProvider'; import {makeServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; import {ComparisonType} from 'shared/Comparison'; import {mockLogger} from 'shared/testUtils'; import {nullthrows} from 'shared/utils'; import * as vscode from 'vscode'; +import { + decodeSaplingDiffUri, + encodeSaplingDiffUri, + SaplingDiffContentProvider, +} from '../DiffContentProvider'; const mockCancelToken = {} as vscode.CancellationToken; diff --git a/addons/vscode/extension/__tests__/VSCodeRepo.test.ts b/addons/vscode/extension/__tests__/VSCodeRepo.test.ts index 811b755a51d8d..1b99f118b1a40 100644 --- a/addons/vscode/extension/__tests__/VSCodeRepo.test.ts +++ b/addons/vscode/extension/__tests__/VSCodeRepo.test.ts @@ -5,19 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -import type {EnabledSCMApiFeature} from '../types'; import type {Repository} from 'isl-server/src/Repository'; import type {ServerPlatform} from 'isl-server/src/serverPlatform'; import type {RepositoryContext} from 'isl-server/src/serverTypes'; import type {RepoInfo, ValidatedRepoInfo} from 'isl/src/types'; +import type {EnabledSCMApiFeature} from '../types'; -import {VSCodeReposList} from '../VSCodeRepo'; import {repositoryCache} from 'isl-server/src/RepositoryCache'; import {makeServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; import {Logger} from 'isl-server/src/logger'; import {TypedEventEmitter} from 'shared/TypedEventEmitter'; import {nextTick} from 'shared/testUtils'; import * as vscode from 'vscode'; +import {VSCodeReposList} from '../VSCodeRepo'; export class MockLogger extends Logger { write() { diff --git a/addons/vscode/extension/blame/__tests__/blame.test.ts b/addons/vscode/extension/blame/__tests__/blame.test.ts index cbaa670a1c1cc..dff3d74d0059f 100644 --- a/addons/vscode/extension/blame/__tests__/blame.test.ts +++ b/addons/vscode/extension/blame/__tests__/blame.test.ts @@ -8,10 +8,10 @@ import type {Repository} from 'isl-server/src/Repository'; import type {CommitInfo} from 'isl/src/types'; -import {getDiffBlameHoverMarkup} from '../blameHover'; -import {getRealignedBlameInfo, shortenAuthorName} from '../blameUtils'; import {GitHubCodeReviewProvider} from 'isl-server/src/github/githubCodeReviewProvider'; import {mockLogger} from 'shared/testUtils'; +import {getDiffBlameHoverMarkup} from '../blameHover'; +import {getRealignedBlameInfo, shortenAuthorName} from '../blameUtils'; describe('blame', () => { describe('getRealignedBlameInfo', () => { diff --git a/addons/vscode/extension/blame/blame.ts b/addons/vscode/extension/blame/blame.ts index 7e28956d329d4..ce429f99a711e 100644 --- a/addons/vscode/extension/blame/blame.ts +++ b/addons/vscode/extension/blame/blame.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import type {VSCodeReposList} from '../VSCodeRepo'; import type {Repository} from 'isl-server/src/Repository'; import type {RepositoryContext} from 'isl-server/src/serverTypes'; import type {CommitInfo, Result} from 'isl/src/types'; @@ -17,16 +16,17 @@ import type { TextEditor, TextEditorSelectionChangeEvent, } from 'vscode'; +import type {VSCodeReposList} from '../VSCodeRepo'; -import {Internal} from '../Internal'; -import {getDiffBlameHoverMarkup} from './blameHover'; -import {getRealignedBlameInfo, shortenAuthorName} from './blameUtils'; import {getUsername} from 'isl-server/src/analytics/environment'; import {relativeDate} from 'isl/src/relativeDate'; import {LRU} from 'shared/LRU'; import {debounce} from 'shared/debounce'; import {nullthrows} from 'shared/utils'; import {DecorationRangeBehavior, MarkdownString, Position, Range, window, workspace} from 'vscode'; +import {Internal} from '../Internal'; +import {getDiffBlameHoverMarkup} from './blameHover'; +import {getRealignedBlameInfo, shortenAuthorName} from './blameUtils'; function areYouTheAuthor(author: string) { const you = getUsername(); diff --git a/addons/vscode/extension/commands.ts b/addons/vscode/extension/commands.ts index 141091d4d0894..d84538312760d 100644 --- a/addons/vscode/extension/commands.ts +++ b/addons/vscode/extension/commands.ts @@ -11,10 +11,6 @@ import type {Operation} from 'isl/src/operations/Operation'; import type {RepoRelativePath} from 'isl/src/types'; import type {Comparison} from 'shared/Comparison'; -import {encodeDeletedFileUri} from './DeletedFileContentProvider'; -import {encodeSaplingDiffUri} from './DiffContentProvider'; -import {shouldOpenBeside} from './config'; -import {t} from './i18n'; import {repoRelativePathForAbsolutePath} from 'isl-server/src/Repository'; import {repositoryCache} from 'isl-server/src/RepositoryCache'; import {findPublicAncestor} from 'isl-server/src/utils'; @@ -23,6 +19,10 @@ import fs from 'node:fs'; import path from 'node:path'; import {ComparisonType, labelForComparison} from 'shared/Comparison'; import * as vscode from 'vscode'; +import {encodeDeletedFileUri} from './DeletedFileContentProvider'; +import {encodeSaplingDiffUri} from './DiffContentProvider'; +import {shouldOpenBeside} from './config'; +import {t} from './i18n'; /** * VS Code Commands registered by the Sapling extension. diff --git a/addons/vscode/extension/config.ts b/addons/vscode/extension/config.ts index fc8ff903def41..c13a20c8c8e9e 100644 --- a/addons/vscode/extension/config.ts +++ b/addons/vscode/extension/config.ts @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -import {Internal} from 'isl-server/src/Internal'; import os from 'node:os'; import * as vscode from 'vscode'; diff --git a/addons/vscode/extension/extension.ts b/addons/vscode/extension/extension.ts index c48724c05c8ba..97e081fb17e2e 100644 --- a/addons/vscode/extension/extension.ts +++ b/addons/vscode/extension/extension.ts @@ -5,11 +5,15 @@ * LICENSE file in the root directory of this source tree. */ -import type {EnabledSCMApiFeature} from './types'; import type {Level} from 'isl-server/src/logger'; import type {ServerPlatform} from 'isl-server/src/serverPlatform'; import type {RepositoryContext} from 'isl-server/src/serverTypes'; +import type {EnabledSCMApiFeature} from './types'; +import {makeServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; +import {Logger} from 'isl-server/src/logger'; +import * as util from 'node:util'; +import * as vscode from 'vscode'; import {DeletedFileContentProvider} from './DeletedFileContentProvider'; import {registerSaplingDiffContentProvider} from './DiffContentProvider'; import {Internal} from './Internal'; @@ -21,10 +25,6 @@ import {ensureTranslationsLoaded} from './i18n'; import {registerISLCommands} from './islWebviewPanel'; import {extensionVersion} from './utils'; import {getVSCodePlatform} from './vscodePlatform'; -import {makeServerSideTracker} from 'isl-server/src/analytics/serverSideTracker'; -import {Logger} from 'isl-server/src/logger'; -import * as util from 'node:util'; -import * as vscode from 'vscode'; export async function activate(context: vscode.ExtensionContext) { const start = Date.now(); diff --git a/addons/vscode/extension/islWebviewPanel.ts b/addons/vscode/extension/islWebviewPanel.ts index 423d7cbac0de1..619a6582bfee5 100644 --- a/addons/vscode/extension/islWebviewPanel.ts +++ b/addons/vscode/extension/islWebviewPanel.ts @@ -5,22 +5,22 @@ * LICENSE file in the root directory of this source tree. */ -import type {VSCodeServerPlatform} from './vscodePlatform'; import type {Logger} from 'isl-server/src/logger'; import type {ServerPlatform} from 'isl-server/src/serverPlatform'; import type {AppMode, ClientToServerMessage, ServerToClientMessage} from 'isl/src/types'; import type {Comparison} from 'shared/Comparison'; +import type {VSCodeServerPlatform} from './vscodePlatform'; -import {executeVSCodeCommand} from './commands'; -import {getCLICommand, PERSISTED_STORAGE_KEY_PREFIX, shouldOpenBeside} from './config'; -import {getWebviewOptions, htmlForWebview} from './htmlForWebview'; -import {locale, t} from './i18n'; -import {extensionVersion} from './utils'; import {onClientConnection} from 'isl-server/src'; import {deserializeFromString, serializeToString} from 'isl/src/serialize'; import {ComparisonType, isComparison, labelForComparison} from 'shared/Comparison'; import {nullthrows} from 'shared/utils'; import * as vscode from 'vscode'; +import {executeVSCodeCommand} from './commands'; +import {getCLICommand, PERSISTED_STORAGE_KEY_PREFIX, shouldOpenBeside} from './config'; +import {getWebviewOptions, htmlForWebview} from './htmlForWebview'; +import {locale, t} from './i18n'; +import {extensionVersion} from './utils'; let islPanelOrView: vscode.WebviewPanel | vscode.WebviewView | undefined = undefined; let hasOpenedISLWebviewBeforeState = false; diff --git a/addons/vscode/extension/openFile.ts b/addons/vscode/extension/openFile.ts index 64293d7b212f1..de3a2aa64e3ae 100644 --- a/addons/vscode/extension/openFile.ts +++ b/addons/vscode/extension/openFile.ts @@ -8,9 +8,9 @@ import type {Repository} from 'isl-server/src/Repository'; import type {AbsolutePath} from 'isl/src/types'; -import {shouldOpenBeside} from './config'; import * as pathModule from 'node:path'; import * as vscode from 'vscode'; +import {shouldOpenBeside} from './config'; const IMAGE_EXTENSIONS = new Set(['.bmp', '.gif', '.ico', '.jpeg', '.jpg', '.png', '.webp']); function looksLikeImageUri(uri: vscode.Uri): boolean { diff --git a/addons/vscode/extension/vscodePlatform.ts b/addons/vscode/extension/vscodePlatform.ts index 1ed9876c1aba6..06c79dcc5dd36 100644 --- a/addons/vscode/extension/vscodePlatform.ts +++ b/addons/vscode/extension/vscodePlatform.ts @@ -17,14 +17,14 @@ import type { } from 'isl/src/types'; import type {Json} from 'shared/typeUtils'; -import {executeVSCodeCommand} from './commands'; -import {PERSISTED_STORAGE_KEY_PREFIX} from './config'; -import {t} from './i18n'; -import openFile from './openFile'; import {Repository} from 'isl-server/src/Repository'; import {arraysEqual} from 'isl/src/utils'; import * as pathModule from 'node:path'; import * as vscode from 'vscode'; +import {executeVSCodeCommand} from './commands'; +import {PERSISTED_STORAGE_KEY_PREFIX} from './config'; +import {t} from './i18n'; +import openFile from './openFile'; export type VSCodeServerPlatform = ServerPlatform & { panelOrView: undefined | vscode.WebviewPanel | vscode.WebviewView; diff --git a/addons/vscode/rollup.extension.config.mjs b/addons/vscode/rollup.extension.config.mjs index 08a18da29a6e1..1c39b52f55e6f 100644 --- a/addons/vscode/rollup.extension.config.mjs +++ b/addons/vscode/rollup.extension.config.mjs @@ -11,8 +11,8 @@ import importJson from '@rollup/plugin-json'; import nodeResolve from '@rollup/plugin-node-resolve'; import replace from '@rollup/plugin-replace'; import path from 'node:path'; -import esbuild from 'rollup-plugin-esbuild'; import {fileURLToPath} from 'node:url'; +import esbuild from 'rollup-plugin-esbuild'; // eslint-disable-next-line no-undef const isProduction = process.env.NODE_ENV === 'production'; diff --git a/addons/vscode/webview/AddMoreCwdsHint.tsx b/addons/vscode/webview/AddMoreCwdsHint.tsx index 20e4ce18ffb74..0f2fab333b80a 100644 --- a/addons/vscode/webview/AddMoreCwdsHint.tsx +++ b/addons/vscode/webview/AddMoreCwdsHint.tsx @@ -5,11 +5,11 @@ * LICENSE file in the root directory of this source tree. */ -import serverApi from '../../isl/src/ClientToServerAPI'; import * as stylex from '@stylexjs/stylex'; import {Button} from 'isl-components/Button'; import {Tooltip} from 'isl-components/Tooltip'; import {t, T} from 'isl/src/i18n'; +import serverApi from '../../isl/src/ClientToServerAPI'; const styles = stylex.create({ wideButton: { diff --git a/addons/vscode/webview/VSCodeSettings.tsx b/addons/vscode/webview/VSCodeSettings.tsx index e9333672ac4b0..94258a02692b0 100644 --- a/addons/vscode/webview/VSCodeSettings.tsx +++ b/addons/vscode/webview/VSCodeSettings.tsx @@ -7,8 +7,6 @@ import type {Json} from 'shared/typeUtils'; -import serverAPI from '../../isl/src/ClientToServerAPI'; -import {ComparisonPanelMode, comparisonPanelMode, setComparisonPanelMode} from './state'; import {Checkbox} from 'isl-components/Checkbox'; import {Dropdown} from 'isl-components/Dropdown'; import {Column} from 'isl-components/Flex'; @@ -18,6 +16,8 @@ import {Setting} from 'isl/src/Setting'; import {T, t} from 'isl/src/i18n'; import {writeAtom} from 'isl/src/jotaiUtils'; import {atom, useAtom, useAtomValue} from 'jotai'; +import serverAPI from '../../isl/src/ClientToServerAPI'; +import {ComparisonPanelMode, comparisonPanelMode, setComparisonPanelMode} from './state'; export default function VSCodeSettings() { const panelMode = useAtomValue(comparisonPanelMode); diff --git a/addons/vscode/webview/islWebviewEntry.tsx b/addons/vscode/webview/islWebviewEntry.tsx index 9e6bccf2b5874..582094a67f468 100644 --- a/addons/vscode/webview/islWebviewEntry.tsx +++ b/addons/vscode/webview/islWebviewEntry.tsx @@ -5,12 +5,12 @@ * LICENSE file in the root directory of this source tree. */ -import serverAPI from '../../isl/src/ClientToServerAPI'; -import {Internal} from './Internal'; import App from 'isl/src/App'; import {getLastestOperationInfo, onOperationExited} from 'isl/src/operationsState'; import {registerDisposable} from 'isl/src/utils'; import ReactDOM from 'react-dom/client'; +import serverAPI from '../../isl/src/ClientToServerAPI'; +import {Internal} from './Internal'; // start state side effect fetches import './state'; diff --git a/addons/vscode/webview/state.tsx b/addons/vscode/webview/state.tsx index 2bfca79a3b189..0cc85e3474fc6 100644 --- a/addons/vscode/webview/state.tsx +++ b/addons/vscode/webview/state.tsx @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -import serverAPI from '../../isl/src/ClientToServerAPI'; import {readAtom, writeAtom} from 'isl/src/jotaiUtils'; import {registerDisposable} from 'isl/src/utils'; import {atom} from 'jotai'; +import serverAPI from '../../isl/src/ClientToServerAPI'; /** Should match the sapling.comparisonPanelMode enum in package.json */ export enum ComparisonPanelMode { diff --git a/addons/vscode/webview/vscodeWebviewPlatform.tsx b/addons/vscode/webview/vscodeWebviewPlatform.tsx index 50a5d0cacccd8..48592bf78dba9 100644 --- a/addons/vscode/webview/vscodeWebviewPlatform.tsx +++ b/addons/vscode/webview/vscodeWebviewPlatform.tsx @@ -5,18 +5,18 @@ * LICENSE file in the root directory of this source tree. */ -import type {VSCodeAPI} from './vscodeApi'; import type {Platform} from 'isl/src/platform'; import type {ThemeColor} from 'isl/src/theme'; import type {MessageBusStatus, RepoRelativePath} from 'isl/src/types'; import type {Comparison} from 'shared/Comparison'; import type {Json} from 'shared/typeUtils'; +import type {VSCodeAPI} from './vscodeApi'; -import {Internal} from './Internal'; -import {vscodeApi} from './vscodeApi'; import {browserClipboardCopy} from 'isl/src/platform/browerPlatformImpl'; import {registerCleanup} from 'isl/src/utils'; import {lazy} from 'react'; +import {Internal} from './Internal'; +import {vscodeApi} from './vscodeApi'; const VSCodeSettings = lazy(() => import('./VSCodeSettings')); const AddMoreCwdsHint = lazy(() => import('./AddMoreCwdsHint')); diff --git a/addons/yarn.lock b/addons/yarn.lock index 7e53730f59c40..d8f4ec9d1244d 100644 --- a/addons/yarn.lock +++ b/addons/yarn.lock @@ -6956,6 +6956,11 @@ prettier@2.8.8: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== +prettier-plugin-organize-imports@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.1.0.tgz#f3d3764046a8e7ba6491431158b9be6ffd83b90f" + integrity sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A== + prettier@3.2.5: version "3.2.5" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"