Skip to content

Commit 1a2b565

Browse files
authored
Switch import sorter Prettier plugin (#1808)
* switch import sorter to one that groups imports from the same package * combine all type and non-type imports into one statement!
1 parent 4c01cd6 commit 1a2b565

File tree

146 files changed

+548
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+548
-438
lines changed

.prettierrc.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88

99
module.exports = {
1010
// note: it seems like tailwind has to be last for it to work
11-
plugins: ['@trivago/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
11+
plugins: ['@ianvs/prettier-plugin-sort-imports', 'prettier-plugin-tailwindcss'],
1212
printWidth: 92,
1313
singleQuote: true,
1414
semi: false,
1515
trailingComma: 'es5', // default changed to all in prettier 3, wanted to minimize diff
16-
importOrder: ['<THIRD_PARTY_MODULES>', '^@oxide/(.*)$', '^app/(.*)$', '^[./]'],
17-
importOrderGroupNamespaceSpecifiers: true,
18-
importOrderSeparation: true,
19-
importOrderSortSpecifiers: true,
16+
importOrder: [
17+
'<THIRD_PARTY_MODULES>',
18+
'',
19+
'^@oxide/(.*)$',
20+
'',
21+
'^app/(.*)$',
22+
'',
23+
'^[./]',
24+
],
25+
importOrderTypeScriptVersion: '5.2.2',
2026
}

app/components/CapacityMetric.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
*/
88
import { useMemo } from 'react'
99

10-
import type { SystemMetricName } from '@oxide/api'
11-
import { useApiQuery } from '@oxide/api'
10+
import { useApiQuery, type SystemMetricName } from '@oxide/api'
1211
import { splitDecimal } from '@oxide/util'
1312

1413
import RoundedSector from 'app/components/RoundedSector'

app/components/MswBanner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright Oxide Computer Company
77
*/
8-
import { type ReactNode, useState } from 'react'
8+
import { useState, type ReactNode } from 'react'
99

1010
import {
1111
Button,

app/components/RefetchIntervalPicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { useEffect, useState } from 'react'
1111

1212
import {
1313
Listbox,
14-
type ListboxItem,
1514
Refresh16Icon,
1615
SpinnerLoader,
1716
Time16Icon,
1817
useInterval,
18+
type ListboxItem,
1919
} from '@oxide/ui'
2020

2121
const intervalPresets = {

app/components/StatusBadge.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* Copyright Oxide Computer Company
77
*/
88
import type { DiskState, InstanceState, SnapshotState } from '@oxide/api'
9-
import type { BadgeColor, BadgeProps } from '@oxide/ui'
10-
import { Badge } from '@oxide/ui'
9+
import { Badge, type BadgeColor, type BadgeProps } from '@oxide/ui'
1110

1211
const INSTANCE_COLORS: Record<InstanceState, Pick<BadgeProps, 'color' | 'variant'>> = {
1312
creating: { color: 'purple', variant: 'solid' },

app/components/SystemMetric.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
*/
88
import React, { Suspense, useMemo, useRef } from 'react'
99

10-
import type { ChartDatum, SystemMetricName } from '@oxide/api'
11-
import { synthesizeData, useApiQuery } from '@oxide/api'
10+
import {
11+
synthesizeData,
12+
useApiQuery,
13+
type ChartDatum,
14+
type SystemMetricName,
15+
} from '@oxide/api'
1216
import { Badge, DirectionDownIcon, DirectionUpIcon, Spinner } from '@oxide/ui'
1317
import { splitDecimal } from '@oxide/util'
1418

app/components/Terminal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
* Copyright Oxide Computer Company
77
*/
88
import { useEffect, useRef, useState } from 'react'
9-
import type { ITerminalOptions } from 'xterm'
10-
import { Terminal as XTerm } from 'xterm'
9+
import { Terminal as XTerm, type ITerminalOptions } from 'xterm'
1110
import { FitAddon } from 'xterm-addon-fit'
1211

1312
import { DirectionDownIcon, DirectionUpIcon } from '@oxide/ui'

app/components/TopBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { useNavigate } from 'react-router-dom'
1111
import { navToLogin, useApiMutation } from '@oxide/api'
1212
import {
1313
Button,
14+
buttonStyle,
1415
DirectionDownIcon,
1516
DropdownMenu,
1617
Info16Icon,
1718
Profile16Icon,
18-
buttonStyle,
1919
} from '@oxide/ui'
2020

2121
import { useCurrentUser } from 'app/layouts/AuthenticatedLayout'

app/components/TopBarPicker.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
import cn from 'classnames'
99
import { Link } from 'react-router-dom'
1010

11-
import type { Project } from '@oxide/api'
12-
import { useApiQuery } from '@oxide/api'
11+
import { useApiQuery, type Project } from '@oxide/api'
1312
import {
1413
Button,
1514
DropdownMenu,

app/components/form/Form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import cn from 'classnames'
99
import { cloneElement } from 'react'
1010

11-
import { Button, type ButtonProps, Error12Icon } from '@oxide/ui'
11+
import { Button, Error12Icon, type ButtonProps } from '@oxide/ui'
1212
import { classed, flattenChildren, invariant, isOneOf, pluckFirstOfType } from '@oxide/util'
1313

1414
import './form.css'

0 commit comments

Comments
 (0)