Skip to content

Commit fadd955

Browse files
authored
docs: unify code conventions in example code within document (#156)
Fixes #155 ### Changes Remove unused commas, semicolons, and spaces. Also fix the incorrect constructor depth.
1 parent a2835d0 commit fadd955

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ createRoot(document.getElementById('root')!).render(
106106
<App />
107107

108108
<TanStackDevtools
109-
config={{ hideUntilHover: true, }}
109+
config={{ hideUntilHover: true }}
110110
eventBusConfig={{ debug: true }}
111111
plugins={[
112112
{

docs/framework/react/guides/custom-plugins.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ This is our library code:
1414
counter.ts
1515
```tsx
1616
export function createCounter() {
17-
let count = 0;
18-
const history = [];
17+
let count = 0
18+
const history = []
1919

2020
return {
2121
getCount: () => count,
2222
increment: () => {
23-
history.push(count);
24-
count++;
23+
history.push(count)
24+
count++
2525
},
2626
decrement: () => {
27-
history.push(count);
28-
count--;
27+
history.push(count)
28+
count--
2929
},
3030
};
3131
}
@@ -49,11 +49,11 @@ import { EventClient } from '@tanstack/devtools-event-client'
4949
type EventMap = {
5050
// The key of the event map is a combination of {pluginId}:{eventSuffix}
5151
// The value is the expected type of the event payload
52-
'custom-devtools:counter-state': { count: number, history: number[], }
52+
'custom-devtools:counter-state': { count: number, history: number[] }
5353
}
5454

5555
class CustomEventClient extends EventClient<EventMap> {
56-
constructor() {
56+
constructor() {
5757
super({
5858
// The pluginId must match that of the event map key
5959
pluginId: 'custom-devtools',
@@ -117,13 +117,13 @@ DevtoolsPanel.ts
117117
import { DevtoolsEventClient } from './eventClient.ts'
118118

119119
export function DevtoolPanel() {
120-
const [state,setState] = useState();
120+
const [state, setState] = useState()
121121

122122
useEffect(() => {
123123
// subscribe to the emitted event
124124
const cleanup = DevtoolsEventClient.on("counter-state", e => setState(e.payload)
125125
return cleanup
126-
}, []);
126+
}, [])
127127

128128
return (
129129
<div>

docs/framework/solid/basic-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ render(() => (
6565
]}
6666
/>
6767
</>
68-
), document.getElementById('root')!);
68+
), document.getElementById('root')!)
6969
```
7070

7171
Finally add any additional configuration you desire to the `TanStackDevtools` component, more information can be found under the [TanStack Devtools Configuration](../../../configuration.md) section.

docs/production.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Production
33
id: production
4-
---
5-
4+
---
5+
66

77
The whole point of devtools is to help you during development, so it's generally not recommended to include them in production builds, but if you know what you're doing, you can.
8-
8+
99

1010
## Vite Plugin Configuration
1111

@@ -39,9 +39,9 @@ Here's an example using environment variables:
3939
import { TanStackDevtools } from '@tanstack/react-devtools'
4040

4141
export default function Devtools(){
42-
return <TanStackDevtools plugins={[
42+
return <TanStackDevtools plugins={[
4343
// Add your custom plugins here
44-
]} />
44+
]} />
4545
}
4646

4747
// App.tsx
@@ -55,7 +55,7 @@ function App() {
5555
</>
5656
)
5757
}
58-
```
58+
```
5959

6060
## Where to install the Devtools
6161

@@ -69,4 +69,4 @@ This depends on if you are shedding development dependencies in production or no
6969

7070
For Development, you can install the devtools as a development dependency and import them in your application code. The Vite plugin will take care of stripping them out of the production build.
7171

72-
For Production, you can install the devtools as a regular dependency and import them in your application code using the `/production` sub-export and then you also need to set `removeDevtoolsOnBuild` to `false` in the Vite plugin configuration.
72+
For Production, you can install the devtools as a regular dependency and import them in your application code using the `/production` sub-export and then you also need to set `removeDevtoolsOnBuild` to `false` in the Vite plugin configuration.

docs/vite-plugin.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default {
2727
}
2828
```
2929

30-
And you're done!
30+
And you're done!
3131

3232
## Configuration
3333

@@ -61,16 +61,16 @@ export default {
6161
port: 1234,
6262
// console log debug logs or not
6363
debug: false
64-
},
64+
},
6565
}),
6666
// ... rest of your plugins here
6767
],
6868
}
69-
69+
7070
```
7171

7272
### editor
73-
73+
7474
> [!IMPORTANT] `editor` is used as an escape hatch to implement your own go-to-source functionality if your system/editor does not work OOTB. We use `launch-editor` under the hood which supports a lot of editors but not all. If your editor is not supported you can implement your own version here. Here is the list of supported editors: https://github.com/yyx990803/launch-editor?tab=readme-ov-file#supported-editors
7575
7676
The open in editor configuration which has two fields, `name` and `open`,
@@ -91,14 +91,14 @@ export default {
9191
`code -g "${(path).replaceAll('$', '\\$')}${lineNumber ? `:${lineNumber}` : ''}${columnNumber ? `:${columnNumber}` : ''}"`,
9292
)
9393
},
94-
},
94+
},
9595
}),
9696
// ... rest of your plugins here
9797
],
9898
}
99-
99+
100100
```
101-
101+
102102
### enhancedLogs
103103

104104
Configuration for enhanced logging. Defaults to enabled.
@@ -119,11 +119,12 @@ export default {
119119
```
120120

121121
### removeDevtoolsOnBuild
122-
122+
123123
Whether to remove devtools from the production build. Defaults to true.
124-
124+
125125
```ts
126126
import { devtools } from '@tanstack/devtools-vite'
127+
127128
export default {
128129
plugins: [
129130
devtools({
@@ -136,7 +137,7 @@ export default {
136137

137138
### logging
138139
Whether to log information to the console. Defaults to true.
139-
140+
140141
```ts
141142
import { devtools } from '@tanstack/devtools-vite'
142143

@@ -150,7 +151,7 @@ export default {
150151
}
151152
```
152153

153-
### injectSource
154+
### injectSource
154155

155156
Configuration for source injection. Defaults to enabled.
156157

@@ -181,4 +182,4 @@ the Panel available on the page. Simply click on any element while holding down
181182

182183
### Advanced console logs
183184

184-
Allows you to go directly to the console log location directly from the browser/terminal
185+
Allows you to go directly to the console log location directly from the browser/terminal

0 commit comments

Comments
 (0)