diff --git a/.changeset/eslint-camelcase-devonly.md b/.changeset/eslint-camelcase-devonly.md new file mode 100644 index 0000000000..ec380ec43f --- /dev/null +++ b/.changeset/eslint-camelcase-devonly.md @@ -0,0 +1,3 @@ +--- +--- + diff --git a/.eslintrc.js b/.eslintrc.js index 16d975a68a..b2b44dca82 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -23,5 +23,8 @@ module.exports = { rules: { 'tsdoc/syntax': 'warn', '@typescript-eslint/prefer-as-const': 'warn', + 'camelcase': ['error', { + allow: ['rr_.*', 'legacy_.*', 'UNSAFE_.*', '__rrweb_.*'], + }], }, }; diff --git a/packages/rrweb/src/replay/index.ts b/packages/rrweb/src/replay/index.ts index 5dacdc104d..16335bdb53 100644 --- a/packages/rrweb/src/replay/index.ts +++ b/packages/rrweb/src/replay/index.ts @@ -760,13 +760,13 @@ export class Replayer { this.service.send({ type: 'CAST_EVENT', payload: { event } }); // events are kept sorted by timestamp, check if this is the last event - const last_index = this.service.state.context.events.length - 1; + const lastIndex = this.service.state.context.events.length - 1; if ( !this.config.liveMode && - event === this.service.state.context.events[last_index] + event === this.service.state.context.events[lastIndex] ) { const finish = () => { - if (last_index < this.service.state.context.events.length - 1) { + if (lastIndex < this.service.state.context.events.length - 1) { // more events have been added since the setTimeout return; } @@ -774,16 +774,16 @@ export class Replayer { this.service.send('END'); this.emitter.emit(ReplayerEvents.Finish); }; - let finish_buffer = 50; // allow for checking whether new events aren't just about to be loaded in + let finishBuffer = 50; // allow for checking whether new events aren't just about to be loaded in if ( event.type === EventType.IncrementalSnapshot && event.data.source === IncrementalSource.MouseMove && event.data.positions.length ) { // extend finish event if the last event is a mouse move so that the timer isn't stopped by the service before checking the last event - finish_buffer += Math.max(0, -event.data.positions[0].timeOffset); + finishBuffer += Math.max(0, -event.data.positions[0].timeOffset); } - setTimeout(finish, finish_buffer); + setTimeout(finish, finishBuffer); } this.emitter.emit(ReplayerEvents.EventCast, event);