Skip to content

Commit 6731773

Browse files
committed
format: run prettier
1 parent ab25dd2 commit 6731773

9 files changed

Lines changed: 51 additions & 46 deletions

File tree

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"semi": false,
55
"tabWidth": 2,
66
"bracketSpacing": true,
7-
"jsxBracketSameLine": false,
7+
"bracketSameLine": false,
88
"arrowParens": "always",
99
"trailingComma": "none"
1010
}

example/src/main.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { SnackbarProvider } from 'notistack'
77
import PiwikPro from '@piwikpro/react-piwik-pro'
88

99
PiwikPro.initialize(
10-
'957285ba-7867-4c6b-a8be-5e3e6c069b71',
10+
'0c0a8661-8c10-4f59-b8fc-1c926cbac184',
1111
'https://astralprojection.promilci.com'
1212
)
1313

@@ -36,5 +36,8 @@ const App = () => (
3636
)
3737

3838
const container = document.getElementById('root')
39-
// @ts-ignore
39+
if(!container){
40+
throw new Error("#root element not found")
41+
}
42+
4043
createRoot(container).render(<App />)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"predeploy": "cd example && yarn install && yarn run build",
2424
"deploy": "gh-pages -d example/build",
2525
"format":"prettier src/**/*.ts --list-different",
26-
"format:fix":"npm run format --write"
26+
"format:fix":"npm run format -- --write"
2727
},
2828
"peerDependencies": {
2929
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",

src/interfaces/payment.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export type PaymentInformation = {
2-
orderId: string;
3-
grandTotal: number | string;
4-
subTotal?: number | string;
5-
tax?: number | string;
6-
shipping?: number | string;
7-
discount?: number | string;
8-
};
2+
orderId: string
3+
grandTotal: number | string
4+
subTotal?: number | string
5+
tax?: number | string
6+
shipping?: number | string
7+
discount?: number | string
8+
}

src/interfaces/piwikpro.window.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { AnyData, QueueItem } from './utils';
1+
import { AnyData, QueueItem } from './utils'
22

33
export interface PiwikProWindow {
4-
_paq?: QueueItem[];
5-
dataLayer?: AnyData[];
6-
IS_DEBUG?: boolean;
4+
_paq?: QueueItem[]
5+
dataLayer?: AnyData[]
6+
IS_DEBUG?: boolean
77
}

src/interfaces/product.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { LimitedArrayFiveStrings } from './utils'
22

3-
type DimensionId = number;
3+
type DimensionId = number
44

55
export type Product = {
6-
sku: string,
7-
name?: string,
8-
category?: LimitedArrayFiveStrings<string[]>,
9-
price?: number,
10-
quantity?: number,
11-
brand?: string,
12-
variant?: string,
13-
customDimensions?: Record<DimensionId, string>,
6+
sku: string
7+
name?: string
8+
category?: LimitedArrayFiveStrings<string[]>
9+
price?: number
10+
quantity?: number
11+
brand?: string
12+
variant?: string
13+
customDimensions?: Record<DimensionId, string>
1414
}

src/interfaces/tracker.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { VisitorInfo } from "./visitorInfo";
1+
import { VisitorInfo } from './visitorInfo'
22

33
export type Tracker = {
4-
hasCookies: () => boolean;
5-
getCustomDimensionValue: (id: string | number) => string | undefined;
6-
getLinkTrackingTimer: () => number;
7-
getEcommerceItems: () => object;
8-
getUserId: () => string;
9-
getVisitorId: () => string;
10-
getVisitorInfo:()=> VisitorInfo
11-
};
4+
hasCookies: () => boolean
5+
getCustomDimensionValue: (id: string | number) => string | undefined
6+
getLinkTrackingTimer: () => number
7+
getEcommerceItems: () => object
8+
getUserId: () => string
9+
getVisitorId: () => string
10+
getVisitorInfo: () => VisitorInfo
11+
}

src/interfaces/utils.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { TRACK_EVENT } from "../constants/track-event.constant";
2-
import { Tracker } from "./tracker";
1+
import { TRACK_EVENT } from '../constants/track-event.constant'
2+
import { Tracker } from './tracker'
33

4-
export type LimitedArrayFiveStrings<T extends string[] = []> = [string, ...T] | [string, string, string, string, string];
4+
export type LimitedArrayFiveStrings<T extends string[] = []> =
5+
| [string, ...T]
6+
| [string, string, string, string, string]
57

68
// eslint-disable-next-line @typescript-eslint/no-explicit-any
79
export type AnyData = any
810

9-
export type Dimensions = Record<`dimension${number}`,string>
11+
export type Dimensions = Record<`dimension${number}`, string>
1012

11-
export type QueueItem =[TRACK_EVENT, ...unknown[]] | [(this: Tracker) => void]
13+
export type QueueItem = [TRACK_EVENT, ...unknown[]] | [(this: Tracker) => void]

src/interfaces/visitorInfo.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export type VisitorInfo = [
2-
isNew: '0' | '1',
3-
visitorId: string,
4-
firstVisitTS: number,
5-
previousVisitCount: string | number,
6-
currentVisitTS: number,
7-
lastVisitTS: number | '',
8-
lastEcommerceOrderTS: number | ''
9-
]
2+
isNew: '0' | '1',
3+
visitorId: string,
4+
firstVisitTS: number,
5+
previousVisitCount: string | number,
6+
currentVisitTS: number,
7+
lastVisitTS: number | '',
8+
lastEcommerceOrderTS: number | ''
9+
]

0 commit comments

Comments
 (0)