Skip to content

Commit c0744ff

Browse files
ci: apply automated fixes
1 parent ea3f58e commit c0744ff

File tree

7 files changed

+56
-50
lines changed

7 files changed

+56
-50
lines changed

examples/react/basic/package.json

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

examples/solid/basic/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@
3434
"last 1 safari version"
3535
]
3636
}
37-
}
37+
}

examples/solid/basic/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import solid from 'vite-plugin-solid'
33
import { devtools } from '@tanstack/devtools-vite'
44
// https://vite.dev/config/
55
export default defineConfig({
6-
plugins: [devtools(), solid({}),],
6+
plugins: [devtools(), solid({})],
77
})
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import { parse } from "@babel/parser"
2-
import * as t from "@babel/types"
3-
import generate from "@babel/generator"
4-
import traverse from "@babel/traverse"
1+
import { parse } from '@babel/parser'
2+
import * as t from '@babel/types'
3+
import generate from '@babel/generator'
4+
import traverse from '@babel/traverse'
55

66
export { parse, t }
77

88
export const trav =
9-
typeof (traverse as any).default !== "undefined"
10-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
11-
? ((traverse as any).default as typeof import("@babel/traverse").default)
12-
: traverse
9+
typeof (traverse as any).default !== 'undefined'
10+
? // eslint-disable-next-line @typescript-eslint/consistent-type-imports
11+
((traverse as any).default as typeof import('@babel/traverse').default)
12+
: traverse
1313

1414
export const gen =
15-
typeof (generate as any).default !== "undefined"
16-
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
17-
? ((generate as any).default as typeof import("@babel/generator").default)
18-
: generate
15+
typeof (generate as any).default !== 'undefined'
16+
? // eslint-disable-next-line @typescript-eslint/consistent-type-imports
17+
((generate as any).default as typeof import('@babel/generator').default)
18+
: generate
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
1-
import { normalizePath } from "vite";
2-
import { gen, parse, t, trav } from "./babel";
3-
import type { types as Babel } from "@babel/core"
4-
import type { ParseResult } from "@babel/parser"
5-
1+
import { normalizePath } from 'vite'
2+
import { gen, parse, t, trav } from './babel'
3+
import type { types as Babel } from '@babel/core'
4+
import type { ParseResult } from '@babel/parser'
65

76
const transform = (ast: ParseResult<Babel.File>, file: string) => {
8-
let didTransform = false;
7+
let didTransform = false
98
trav(ast, {
10-
JSXOpeningElement(path,) {
11-
const loc = path.node.loc;
12-
if (!loc) return;
13-
const line = loc.start.line;
14-
const column = loc.start.column;
9+
JSXOpeningElement(path) {
10+
const loc = path.node.loc
11+
if (!loc) return
12+
const line = loc.start.line
13+
const column = loc.start.column
1514

1615
// Inject data-source as a string: "<file>:<line>:<column>"
1716
path.node.attributes.push(
1817
t.jsxAttribute(
1918
t.jsxIdentifier('data-source'),
20-
t.stringLiteral(`${file}:${line}:${column}`)
21-
)
22-
);
19+
t.stringLiteral(`${file}:${line}:${column}`),
20+
),
21+
)
2322

24-
didTransform = true;
25-
}
23+
didTransform = true
24+
},
2625
})
2726

2827
return didTransform
2928
}
3029

31-
3230
export function addSourceToJsx(code: string, id: string) {
33-
const [filePath] = id.split("?")
31+
const [filePath] = id.split('?')
3432
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
3533
const location = filePath?.replace(normalizePath(process.cwd()), '')!
3634

3735
try {
38-
const ast = parse(code, { sourceType: "module", plugins: ["jsx", "typescript"] });
36+
const ast = parse(code, {
37+
sourceType: 'module',
38+
plugins: ['jsx', 'typescript'],
39+
})
3940
const didTransform = transform(ast, location)
4041
if (!didTransform) {
4142
return { code }
4243
}
43-
return gen(ast, { sourceMaps: true, filename: id, sourceFileName: filePath })
44+
return gen(ast, {
45+
sourceMaps: true,
46+
filename: id,
47+
sourceFileName: filePath,
48+
})
4449
} catch (e) {
45-
4650
return { code }
4751
}
48-
}
52+
}

packages/devtools-vite/src/plugin.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
4242

4343
return [
4444
{
45-
enforce: "pre",
45+
enforce: 'pre',
4646
name: '@tanstack/devtools:inject-source',
4747
apply(config) {
4848
return config.mode === 'development'
@@ -57,7 +57,7 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
5757
return code
5858

5959
return addSourceToJsx(code, id)
60-
}
60+
},
6161
},
6262
{
6363
enforce: 'pre',
@@ -107,11 +107,11 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
107107
)
108108
},
109109
transform(code) {
110-
if (code.includes("__TSD_PORT__")) {
111-
code = code.replace("__TSD_PORT__", String(port))
110+
if (code.includes('__TSD_PORT__')) {
111+
code = code.replace('__TSD_PORT__', String(port))
112112
}
113113
return code
114-
}
114+
},
115115
},
116116
{
117117
name: '@tanstack/devtools:better-console-logs',

packages/devtools/src/devtools.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default function DevTools() {
3030
setIsOpen(!open)
3131
setPersistOpen(!open)
3232
}
33-
createEffect(() => { })
33+
createEffect(() => {})
3434
// Used to resize the panel
3535
const handleDragStart = (
3636
panelElement: HTMLDivElement | undefined,
@@ -152,26 +152,28 @@ export default function DevTools() {
152152
})
153153

154154
createEffect(() => {
155-
156155
// this will only work with the Vite plugin
157156
const openSourceHandler = (e: Event) => {
158-
const isShiftHeld = (e as KeyboardEvent).shiftKey;
159-
const isCtrlHeld = (e as KeyboardEvent).ctrlKey || (e as KeyboardEvent).metaKey;
160-
if (!isShiftHeld || !isCtrlHeld) return;
157+
const isShiftHeld = (e as KeyboardEvent).shiftKey
158+
const isCtrlHeld =
159+
(e as KeyboardEvent).ctrlKey || (e as KeyboardEvent).metaKey
160+
if (!isShiftHeld || !isCtrlHeld) return
161161

162162
if (e.target instanceof HTMLElement) {
163163
const dataSource = e.target.getAttribute('data-source')
164164
window.getSelection()?.removeAllRanges()
165165
if (dataSource) {
166166
e.preventDefault()
167167
e.stopPropagation()
168-
fetch(`http://localhost:__TSD_PORT__/__tsd/open-source?source=${dataSource}`).catch(() => { })
168+
fetch(
169+
`http://localhost:__TSD_PORT__/__tsd/open-source?source=${dataSource}`,
170+
).catch(() => {})
169171
}
170172
}
171173
}
172-
window.addEventListener("click", openSourceHandler)
174+
window.addEventListener('click', openSourceHandler)
173175
onCleanup(() => {
174-
window.removeEventListener("click", openSourceHandler)
176+
window.removeEventListener('click', openSourceHandler)
175177
})
176178
})
177179

0 commit comments

Comments
 (0)