Skip to content

Commit

Permalink
chore: prettier is arguing with itself
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 16, 2024
1 parent 492732a commit dff468c
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 42 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-posthog-js": "link:eslint-rules",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"expect": "^29.7.0",
Expand All @@ -102,7 +102,7 @@
"node-fetch": "^2.6.11",
"posthog-js": "link:",
"preact-render-to-string": "^6.3.1",
"prettier": "^2.7.1",
"prettier": "^3.4.2",
"rollup": "^4.24.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-visualizer": "^5.12.0",
Expand Down
44 changes: 31 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ describe('Error conversion', () => {
})

class FakeDomError {
constructor(public name: string, public message: string) {}
constructor(
public name: string,
public message: string
) {}
[Symbol.toStringTag] = 'DOMError'
}

Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/extensions/replay/sessionrecording.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const createMetaSnapshot = (event = {}): metaEvent =>
href: 'https://has-to-be-present-or-invalid.com',
},
...event,
} as metaEvent)
}) as metaEvent

const createStyleSnapshot = (event = {}): incrementalSnapshotEvent =>
({
Expand All @@ -77,14 +77,14 @@ const createStyleSnapshot = (event = {}): incrementalSnapshotEvent =>
source: IncrementalSource.StyleDeclaration,
},
...event,
} as incrementalSnapshotEvent)
}) as incrementalSnapshotEvent

const createFullSnapshot = (event = {}): fullSnapshotEvent =>
({
type: FULL_SNAPSHOT_EVENT_TYPE,
data: {},
...event,
} as fullSnapshotEvent)
}) as fullSnapshotEvent

const createIncrementalSnapshot = (event = {}): incrementalSnapshotEvent => ({
type: INCREMENTAL_SNAPSHOT_EVENT_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/heatmaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('heatmaps', () => {
clientX: 10,
clientY: 20,
...props,
} as unknown as MouseEvent)
}) as unknown as MouseEvent

beforeEach(async () => {
beforeSendMock = beforeSendMock.mockClear()
Expand Down
5 changes: 4 additions & 1 deletion src/entrypoints/dead-clicks-autocapture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ class LazyLoadedDeadClicksAutocapture implements LazyLoadedDeadClicksAutocapture
}
}

constructor(readonly instance: PostHog, config?: DeadClicksAutoCaptureConfig) {
constructor(
readonly instance: PostHog,
config?: DeadClicksAutoCaptureConfig
) {
this._config = this.asRequiredConfig(config)
this._onCapture = this._config.__onCapture
}
Expand Down
10 changes: 5 additions & 5 deletions src/extensions/exception-autocapture/error-conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ function errorPropertiesFromString(candidate: string, metadata?: ErrorMetadata):

const exceptionType = metadata?.overrideExceptionType
? metadata.overrideExceptionType
: metadata?.defaultExceptionType ?? 'Error'
: (metadata?.defaultExceptionType ?? 'Error')
const exceptionMessage = metadata?.overrideExceptionMessage
? metadata.overrideExceptionMessage
: candidate
? candidate
: metadata?.defaultExceptionMessage
? candidate
: metadata?.defaultExceptionMessage

const exception: Exception = {
type: exceptionType,
Expand Down Expand Up @@ -213,8 +213,8 @@ function errorPropertiesFromObject(candidate: Record<string, unknown>, metadata?
const exceptionType = metadata?.overrideExceptionType
? metadata.overrideExceptionType
: isEvent(candidate)
? candidate.constructor.name
: 'Error'
? candidate.constructor.name
: 'Error'
const exceptionMessage = metadata?.overrideExceptionMessage
? metadata.overrideExceptionMessage
: `Non-Error ${'exception'} captured with keys: ${extractExceptionKeysForMessage(candidate)}`
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/replay/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const buildNetworkRequestOptions = (
? (data) => {
const cleanedRequest = enforcedCleaningFn(data)
return cleanedRequest
? instanceConfig.session_recording.maskCapturedNetworkRequestFn?.(cleanedRequest) ?? undefined
? (instanceConfig.session_recording.maskCapturedNetworkRequestFn?.(cleanedRequest) ?? undefined)
: undefined
}
: (data) => scrubPayloads(enforcedCleaningFn(data))
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/replay/external/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ files in here are intended for the lazy loaded portion of replay

you aren't supposed to import them from outside the entrypoint file

they could cause an increase in bundle size
they could cause an increase in bundle size
2 changes: 1 addition & 1 deletion src/extensions/replay/sessionrecording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ export class SessionRecording {
}

const eventToSend =
this.instance.config.session_recording.compress_events ?? true ? compressEvent(event) : event
(this.instance.config.session_recording.compress_events ?? true) ? compressEvent(event) : event
const size = estimateSize(eventToSend)

const properties = {
Expand Down
8 changes: 4 additions & 4 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ export class PostHog {
this.compression = includes(config['supportedCompression'], Compression.GZipJS)
? Compression.GZipJS
: includes(config['supportedCompression'], Compression.Base64)
? Compression.Base64
: undefined
? Compression.Base64
: undefined
}

if (config.analytics?.endpoint) {
Expand All @@ -587,8 +587,8 @@ export class PostHog {
person_profiles: this._initialPersonProfilesConfig
? this._initialPersonProfilesConfig
: config['defaultIdentifiedOnly']
? 'identified_only'
: 'always',
? 'identified_only'
: 'always',
})

this.siteApps?.onRemoteConfig(config)
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ export type ErrorEventArgs = [
source?: string | undefined,
lineno?: number | undefined,
colno?: number | undefined,
error?: Error | undefined
error?: Error | undefined,
]

export type ErrorMetadata = {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/event-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ export const Info = {
initial_referrer == null
? undefined
: initial_referrer == '$direct'
? '$direct'
: convertToURL(initial_referrer)?.host
? '$direct'
: convertToURL(initial_referrer)?.host

const props: Record<string, string | undefined> = {
$initial_referrer: initial_referrer,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/user-agent-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export const detectBrowserVersion = function (userAgent: string, vendor: string
// the first regex that matches uses its matcher function to return the result
const osMatchers: [
RegExp,
[string, string] | ((match: RegExpMatchArray | null, user_agent: string) => [string, string])
[string, string] | ((match: RegExpMatchArray | null, user_agent: string) => [string, string]),
][] = [
[
new RegExp(XBOX + '; ' + XBOX + ' (.*?)[);]', 'i'),
Expand Down
9 changes: 4 additions & 5 deletions src/web-experiments-types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export interface WebExperimentTransform {
attributes?:
| {
name: string
value: string
}[]
attributes?: {
name: string
value: string
}[]
selector?: string
text?: string
html?: string
Expand Down

0 comments on commit dff468c

Please sign in to comment.