Skip to content

Commit 4c069ca

Browse files
ci: apply automated fixes
1 parent e27ec9c commit 4c069ca

16 files changed

Lines changed: 214 additions & 199 deletions

File tree

examples/react/basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
"last 1 safari version"
3939
]
4040
}
41-
}
41+
}

examples/react/basic/vite.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3-
import { devtools } from "@tanstack/devtools-vite"
3+
import { devtools } from '@tanstack/devtools-vite'
44
// https://vite.dev/config/
55
export default defineConfig({
66
plugins: [
7-
87
devtools(),
98
react({
109
// babel: {

examples/react/start/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@
4848
"vitest": "^3.1.2",
4949
"web-vitals": "^4.2.4"
5050
}
51-
}
51+
}

examples/react/start/src/components/devtools.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ export default function DevtoolsExample() {
1414
<TanStackDevtools
1515
eventBusConfig={{
1616
debug: false,
17-
connectToServerBus: true
17+
connectToServerBus: true,
1818
}}
19-
2019
plugins={[
2120
{
2221
name: 'TanStack Query',

examples/react/start/src/routes/__root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Route = createRootRoute({
2929
})
3030

3131
function RootDocument({ children }: { children: React.ReactNode }) {
32-
console.log("hello in root document")
32+
console.log('hello in root document')
3333
return (
3434
<html lang="en">
3535
<head>

examples/react/start/vite.config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
33
import viteReact from '@vitejs/plugin-react'
44
import viteTsConfigPaths from 'vite-tsconfig-paths'
55
import tailwindcss from '@tailwindcss/vite'
6-
import { devtools } from "@tanstack/devtools-vite"
6+
import { devtools } from '@tanstack/devtools-vite'
77
//import { devtoolsServer } from './src/server-setup'
88

99
const config = defineConfig({
1010
plugins: [
1111
devtools({
1212
eventBusConfig: {
13-
debug: false
13+
debug: false,
1414
},
1515
enhancedLogs: {
16-
enabled: true
17-
}
16+
enabled: true,
17+
},
1818
}),
1919
// this is the plugin that enables path aliases
2020
viteTsConfigPaths({
@@ -26,7 +26,6 @@ const config = defineConfig({
2626
customViteReactPlugin: true,
2727
}),
2828
viteReact(),
29-
3029
],
3130
})
3231

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@
8484
"@tanstack/solid-devtools": "workspace:*",
8585
"@tanstack/devtools-vite": "workspace:*"
8686
}
87-
}
87+
}

packages/devtools-vite/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This package is still under active development and might have breaking changes i
66

77
The `@tanstack/devtools-vite` package is designed to work with Vite projects.
88
Plug it into your plugins array:
9+
910
```ts
1011
import { devtools } from '@tanstack/devtools-vite'
1112

packages/devtools-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@
5454
"@tanstack/devtools-event-bus": "workspace:*",
5555
"chalk": "^5.6.0"
5656
}
57-
}
57+
}
Lines changed: 73 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,92 @@
1-
import { normalizePath } from "vite"
2-
import { checkPath } from "./utils.js"
1+
import { normalizePath } from 'vite'
2+
import { checkPath } from './utils.js'
33

44
type OpenSourceData = {
5-
type: "open-source"
6-
data: {
7-
/** The source file to open */
8-
source?: string
9-
/** The react router route ID, usually discovered via the hook useMatches */
10-
routeID?: string
11-
/** The line number in the source file */
12-
line?: number
13-
/** The column number in the source file */
14-
column?: number
15-
}
5+
type: 'open-source'
6+
data: {
7+
/** The source file to open */
8+
source?: string
9+
/** The react router route ID, usually discovered via the hook useMatches */
10+
routeID?: string
11+
/** The line number in the source file */
12+
line?: number
13+
/** The column number in the source file */
14+
column?: number
15+
}
1616
}
1717

1818
export type EditorConfig = {
19-
/** The name of the editor, used for debugging purposes */
20-
name: string
21-
/** Callback to open a file in the editor */
22-
open: (path: string, lineNumber: string | undefined, columnNumber?: string) => Promise<void>
19+
/** The name of the editor, used for debugging purposes */
20+
name: string
21+
/** Callback to open a file in the editor */
22+
open: (
23+
path: string,
24+
lineNumber: string | undefined,
25+
columnNumber?: string,
26+
) => Promise<void>
2327
}
2428

2529
export const DEFAULT_EDITOR_CONFIG: EditorConfig = {
26-
name: "VSCode",
27-
open: async (path, lineNumber, columnNumber) => {
28-
const { exec } = await import("node:child_process")
29-
exec(`code -g "${normalizePath(path).replaceAll("$", "\\$")}${lineNumber ? `:${lineNumber}` : ""}${columnNumber ? `:${columnNumber}` : ""}"`)
30-
},
30+
name: 'VSCode',
31+
open: async (path, lineNumber, columnNumber) => {
32+
const { exec } = await import('node:child_process')
33+
exec(
34+
`code -g "${normalizePath(path).replaceAll('$', '\\$')}${lineNumber ? `:${lineNumber}` : ''}${columnNumber ? `:${columnNumber}` : ''}"`,
35+
)
36+
},
3137
}
3238

3339
export const handleOpenSource = async ({
34-
data,
35-
openInEditor,
36-
appDir,
40+
data,
41+
openInEditor,
42+
appDir,
3743
}: {
38-
data: OpenSourceData
39-
appDir: string
40-
openInEditor: EditorConfig["open"]
44+
data: OpenSourceData
45+
appDir: string
46+
openInEditor: EditorConfig['open']
4147
}) => {
42-
const { source, line, routeID } = data.data
43-
const lineNum = line ? `${line}` : undefined
44-
const fs = await import("node:fs")
45-
const path = await import("node:path")
46-
if (source) {
47-
return openInEditor(source, lineNum)
48-
}
48+
const { source, line, routeID } = data.data
49+
const lineNum = line ? `${line}` : undefined
50+
const fs = await import('node:fs')
51+
const path = await import('node:path')
52+
if (source) {
53+
return openInEditor(source, lineNum)
54+
}
4955

50-
if (routeID) {
51-
const routePath = path.join(appDir, routeID)
52-
const checkedPath = await checkPath(routePath)
56+
if (routeID) {
57+
const routePath = path.join(appDir, routeID)
58+
const checkedPath = await checkPath(routePath)
5359

54-
if (!checkedPath) return
55-
const { type, validPath } = checkedPath
60+
if (!checkedPath) return
61+
const { type, validPath } = checkedPath
5662

57-
const reactExtensions = ["tsx", "jsx"]
58-
const allExtensions = ["ts", "js", ...reactExtensions]
59-
const isRoot = routeID === "root"
60-
const findFileByExtension = (prefix: string, filePaths: Array<string>) => {
61-
const file = filePaths.find((file) => allExtensions.some((ext) => file === `${prefix}.${ext}`))
62-
return file
63-
}
63+
const reactExtensions = ['tsx', 'jsx']
64+
const allExtensions = ['ts', 'js', ...reactExtensions]
65+
const isRoot = routeID === 'root'
66+
const findFileByExtension = (prefix: string, filePaths: Array<string>) => {
67+
const file = filePaths.find((file) =>
68+
allExtensions.some((ext) => file === `${prefix}.${ext}`),
69+
)
70+
return file
71+
}
6472

65-
if (isRoot) {
66-
if (!fs.existsSync(appDir)) return
67-
const filesInReactRouterPath = fs.readdirSync(appDir)
68-
const rootFile = findFileByExtension("root", filesInReactRouterPath)
69-
rootFile && openInEditor(path.join(appDir, rootFile), lineNum)
70-
return
71-
}
73+
if (isRoot) {
74+
if (!fs.existsSync(appDir)) return
75+
const filesInReactRouterPath = fs.readdirSync(appDir)
76+
const rootFile = findFileByExtension('root', filesInReactRouterPath)
77+
rootFile && openInEditor(path.join(appDir, rootFile), lineNum)
78+
return
79+
}
7280

73-
// If its not the root route, then we find the file or folder in the routes folder
74-
// We know that the route ID is in the form of "routes/contact" or "routes/user.profile" when is not root
75-
// so the ID already contains the "routes" segment, so we just need to find the file or folder in the routes folder
76-
if (type === "directory") {
77-
const filesInFolderRoute = fs.readdirSync(validPath)
78-
const routeFile = findFileByExtension("route", filesInFolderRoute)
79-
routeFile && openInEditor(path.join(appDir, routeID, routeFile), lineNum)
80-
return
81-
}
82-
return openInEditor(validPath, lineNum)
83-
}
81+
// If its not the root route, then we find the file or folder in the routes folder
82+
// We know that the route ID is in the form of "routes/contact" or "routes/user.profile" when is not root
83+
// so the ID already contains the "routes" segment, so we just need to find the file or folder in the routes folder
84+
if (type === 'directory') {
85+
const filesInFolderRoute = fs.readdirSync(validPath)
86+
const routeFile = findFileByExtension('route', filesInFolderRoute)
87+
routeFile && openInEditor(path.join(appDir, routeID, routeFile), lineNum)
88+
return
89+
}
90+
return openInEditor(validPath, lineNum)
91+
}
8492
}

0 commit comments

Comments
 (0)