File tree Expand file tree Collapse file tree 5 files changed +39
-3
lines changed
Expand file tree Collapse file tree 5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ module.exports = {
77 jsx : true ,
88 } ,
99 extends : [ '../../.eslintrc.js' ] ,
10+ rules : {
11+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'error' ,
12+ } ,
1013 overrides : [
1114 {
1215 files : [ 'scripts/**/*.ts' ] ,
@@ -27,5 +30,11 @@ module.exports = {
2730 globalThis : 'readonly' ,
2831 } ,
2932 } ,
33+ {
34+ files : [ 'test/**/*.ts' , 'test/**/*.tsx' ] ,
35+ rules : {
36+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'off' ,
37+ } ,
38+ } ,
3039 ] ,
3140} ;
Original file line number Diff line number Diff line change @@ -5,5 +5,14 @@ module.exports = {
55 extends : [ '../../.eslintrc.js' ] ,
66 rules : {
77 '@sentry-internal/sdk/no-class-field-initializers' : 'off' ,
8+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'error' ,
89 } ,
10+ overrides : [
11+ {
12+ files : [ 'test/**/*.ts' , 'test/**/*.tsx' ] ,
13+ rules : {
14+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'off' ,
15+ } ,
16+ } ,
17+ ] ,
918} ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import type {
1515 IntegrationFn ,
1616 OsContext ,
1717} from '@sentry/core' ;
18- import { defineIntegration } from '@sentry/core' ;
18+ import { _INTERNAL_safeDateNow , defineIntegration } from '@sentry/core' ;
1919
2020export const readFileAsync = promisify ( readFile ) ;
2121export const readDirAsync = promisify ( readdir ) ;
@@ -204,7 +204,7 @@ function getCultureContext(): CultureContext | undefined {
204204 */
205205export function getAppContext ( ) : AppContext {
206206 const app_memory = process . memoryUsage ( ) . rss ;
207- const app_start_time = new Date ( Date . now ( ) - process . uptime ( ) * 1000 ) . toISOString ( ) ;
207+ const app_start_time = new Date ( _INTERNAL_safeDateNow ( ) - process . uptime ( ) * 1000 ) . toISOString ( ) ;
208208 // https://nodejs.org/api/process.html#processavailablememory
209209 const appContext : AppContext = { app_start_time, app_memory } ;
210210
@@ -236,7 +236,7 @@ export function getDeviceContext(deviceOpt: DeviceContextOptions | true): Device
236236 // Hence, we only set boot time, if we get a valid uptime value.
237237 // @see https://github.com/getsentry/sentry-javascript/issues/5856
238238 if ( typeof uptime === 'number' ) {
239- device . boot_time = new Date ( Date . now ( ) - uptime * 1000 ) . toISOString ( ) ;
239+ device . boot_time = new Date ( _INTERNAL_safeDateNow ( ) - uptime * 1000 ) . toISOString ( ) ;
240240 }
241241
242242 device . arch = os . arch ( ) ;
Original file line number Diff line number Diff line change @@ -5,5 +5,14 @@ module.exports = {
55 extends : [ '../../.eslintrc.js' ] ,
66 rules : {
77 '@sentry-internal/sdk/no-class-field-initializers' : 'off' ,
8+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'error' ,
89 } ,
10+ overrides : [
11+ {
12+ files : [ 'test/**/*.ts' , 'test/**/*.tsx' ] ,
13+ rules : {
14+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'off' ,
15+ } ,
16+ } ,
17+ ] ,
918} ;
Original file line number Diff line number Diff line change @@ -5,5 +5,14 @@ module.exports = {
55 extends : [ '../../.eslintrc.js' ] ,
66 rules : {
77 '@sentry-internal/sdk/no-class-field-initializers' : 'off' ,
8+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'error' ,
89 } ,
10+ overrides : [
11+ {
12+ files : [ 'test/**/*.ts' , 'test/**/*.tsx' ] ,
13+ rules : {
14+ '@sentry-internal/sdk/no-unsafe-random-apis' : 'off' ,
15+ } ,
16+ } ,
17+ ] ,
918} ;
You can’t perform that action at this time.
0 commit comments