Skip to content

Commit f6e67a8

Browse files
committed
adjust types and tracing configuration
1 parent b74736c commit f6e67a8

File tree

5 files changed

+15
-26
lines changed

5 files changed

+15
-26
lines changed

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ module.exports = {
2727
'@nuxtjs/eslint-config-typescript',
2828
],
2929
rules: {
30+
'comma-dangle': 'off',
3031
'constructor-super': 'off', // ts(2335) & ts(2377)
3132
'getter-return': 'off', // ts(2378)
3233
'import/named': 'off',
@@ -54,6 +55,7 @@ module.exports = {
5455
'@typescript-eslint/adjacent-overload-signatures': 'error',
5556
'@typescript-eslint/ban-ts-comment': 'error',
5657
'@typescript-eslint/ban-types': 'error',
58+
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
5759
'@typescript-eslint/explicit-module-boundary-types': 'warn',
5860
'no-array-constructor': 'off',
5961
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none', requireLast: false } }],

docs/content/en/guide/setup.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ Then, add `@nuxtjs/sentry` to the `modules` section of `nuxt.config.js`:
4949
}
5050
```
5151

52+
<alert type="info">
53+
54+
For Typescript or type-checked JavaScript projects, you might have to install the `@sentry/tracing` package even when not using the tracing functionality. In that case, the package can be installed as a dev-only dependency.
55+
56+
</alert>
57+
5258
## Types
5359

54-
For typescript projects, add `@nuxtjs/sentry` to tsconfig types array
60+
In Typescript or type-checked JavaScript projects, add `@nuxtjs/sentry` to the `types` array in `tsconfig.json` to enable module types.
5561

5662
```json [tsconfig.json]
5763
{
@@ -65,4 +71,4 @@ For typescript projects, add `@nuxtjs/sentry` to tsconfig types array
6571

6672
## Configuration
6773

68-
See [Options](/sentry/options) for a list of available options
74+
See [Options](/sentry/options) for a list of available options.

docs/content/en/sentry/options.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,11 @@ export default function () {
316316
{
317317
tracesSampleRate: 1.0,
318318
trackComponents: true
319-
hooks: [ 'mount', 'update' ],
320-
timeout: 2000,
321319
browserTracing: {}
322320
}
323321
```
324322
- Sentry documentation strongly recommends reducing the `tracesSampleRate` value; it should be between 0.0 and 1.0 (percentage of requests to capture)
325-
- Available browserTracing options can be found [here](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/#configuration-options)
323+
- See available [browserTracing options](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/#configuration-options)
326324
327325
### config
328326

lib/core/options.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ function resolveTracingOptions (options, config) {
9898
const tracingOptions = merge(
9999
{
100100
tracesSampleRate: 1,
101-
hooks: ['mount', 'update'],
102-
timeout: 2000,
103101
trackComponents: true,
104102
browserTracing: {},
105103
},

types/sentry.d.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22
import { IncomingMessage, ServerResponse } from 'http'
33
import { Options as WebpackOptions } from 'webpack'
4+
import { BrowserTracing } from '@sentry/tracing'
45
import { Options as SentryOptions } from '@sentry/types'
5-
import type { Options as SentryVueOptions } from '@sentry/vue/types/types'
6+
import { Options as SentryVueOptions, TracingOptions as SentryVueTracingOptions } from '@sentry/vue/types/types'
67
import { SentryCliPluginOptions } from '@sentry/webpack-plugin'
78
import { Handlers } from '@sentry/node'
89

@@ -22,24 +23,8 @@ export interface LazyConfiguration {
2223
webpackPreload?: boolean
2324
}
2425

25-
declare type Operation = 'activate' | 'create' | 'destroy' | 'mount' | 'update'
26-
export interface TracingConfiguration {
27-
tracesSampleRate?: number
28-
/**
29-
* Decides whether to track components by hooking into its lifecycle methods.
30-
* Can be either set to `boolean` to enable/disable tracking for all of them.
31-
* Or to an array of specific component names (case-sensitive).
32-
*/
33-
trackComponents: boolean | string[]
34-
/** How long to wait until the tracked root activity is marked as finished and sent of to Sentry */
35-
timeout: number
36-
/**
37-
* List of hooks to keep track of during component lifecycle.
38-
* Available hooks: 'activate' | 'create' | 'destroy' | 'mount' | 'update'
39-
* Based on https://vuejs.org/v2/api/#Options-Lifecycle-Hooks
40-
*/
41-
hooks: Operation[]
42-
tracePropagationTargets: (string|RegExp)[]
26+
export interface TracingConfiguration extends Partial<SentryVueTracingOptions>, Pick<SentryOptions, 'tracesSampleRate'> {
27+
browserTracing?: Partial<BrowserTracing['options']>
4328
}
4429

4530
export interface ModuleConfiguration {

0 commit comments

Comments
 (0)