Skip to content

Commit 4a8c4b2

Browse files
committed
style: add format script and run it
1 parent 6350959 commit 4a8c4b2

23 files changed

Lines changed: 105 additions & 79 deletions

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"test": "lerna run test --",
1717
"lint": "lerna run lint -- --fix",
1818
"build": "lerna run build",
19+
"format": "prettier --write packages/**/src",
1920
"cleanup": "lerna exec -- rm -rf ./dist",
2021
"prepublish": "yarn run cleanup && lerna run prepublish --scope='@consent-manager/core' && lerna run prepublish --ignore='@consent-manager/core'",
2122
"start:app": "yarn --cwd example && yarn --cwd example start",

packages/core/src/.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"env": {
33
"jest": true
44
}

packages/core/src/components/IntegrationWrapperComponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const IntegrationWrapperComponents: React.FC<{
2020
}
2121

2222
return config.integrations
23-
.filter(i => decisions[i.id] === true)
23+
.filter((i) => decisions[i.id] === true)
2424
.filter((i): i is IntegrationWithWrapperComponent =>
2525
Boolean(i.WrapperComponent)
2626
)

packages/core/src/decisions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function useCombinedIntegrationStoreDecisions(): InitializeDecisionsFromStorageR
6060

6161
export function useDecisions(): [
6262
ConsentManagerDecisions,
63-
Dispatch<SetStateAction<ConsentManagerDecisions>>
63+
Dispatch<SetStateAction<ConsentManagerDecisions>>,
6464
] {
6565
const {
6666
config: { onChangeDecision },
@@ -79,7 +79,7 @@ export function useDecisions(): [
7979
}, [decisions, decisionsState, setDecisions, setStore])
8080

8181
const setAndStoreDecisions: typeof setDecisions = useCallback(
82-
newDecisionState => {
82+
(newDecisionState) => {
8383
const nextDecisionState =
8484
typeof newDecisionState === 'function'
8585
? newDecisionState(decisionsState)
@@ -88,7 +88,7 @@ export function useDecisions(): [
8888
if (onChangeDecision) {
8989
onChangeDecision(decisionsState, nextDecisionState)
9090
}
91-
setStore(store => ({ ...store, decisions: nextDecisionState }))
91+
setStore((store) => ({ ...store, decisions: nextDecisionState }))
9292
},
9393
[decisionsState, onChangeDecision, setStore]
9494
)

packages/core/src/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ export function useDecision(
4949
const newStateValue =
5050
typeof value === 'function' ? value(decision) : value
5151

52-
setAndStoreDecisions(decisions => ({ ...decisions, [id]: newStateValue }))
52+
setAndStoreDecisions((decisions) => ({
53+
...decisions,
54+
[id]: newStateValue,
55+
}))
5356
},
5457
]
5558
}
5659

57-
export function useFallbackComponent(): React.ComponentType<
58-
FallbackComponentProps
59-
> {
60+
export function useFallbackComponent(): React.ComponentType<FallbackComponentProps> {
6061
const { fallbackComponent: FallbackComponent } = useContext(
6162
ConsentManagerContext
6263
)
@@ -94,7 +95,7 @@ export function usePageViewEventTrigger(
9495
): PageViewEventTrigger {
9596
const [decision] = useDecision(id)
9697
const { config } = useContext(ConsentManagerContext)
97-
const integration = config.integrations.find(i => i.id === id)
98+
const integration = config.integrations.find((i) => i.id === id)
9899

99100
if (
100101
!decision ||

packages/core/src/integration-helpers.tsx

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ export function getForegroundColor(bgHex: string): string {
1010
export const createIconComponentFromSimpleIconsSvgPath: (
1111
title: string,
1212
path: string
13-
) => React.FC<IntegrationIconComponentProps> = (
14-
title: string,
15-
path: string
16-
) => ({ color = 'currentColor', ...props }: IntegrationIconComponentProps) => (
17-
<svg
18-
xmlns="http://www.w3.org/2000/svg"
19-
fill={color}
20-
viewBox="0 0 24 24"
21-
/* Ensure SVG behaves responsive on Safari and some older browsers like IE */
22-
height="100%"
23-
width="100%"
24-
{...props}
25-
>
26-
<title>{title}</title>
27-
<path d={path} />
28-
</svg>
29-
)
13+
) => React.FC<IntegrationIconComponentProps> =
14+
(title: string, path: string) =>
15+
({ color = 'currentColor', ...props }: IntegrationIconComponentProps) => (
16+
<svg
17+
xmlns="http://www.w3.org/2000/svg"
18+
fill={color}
19+
viewBox="0 0 24 24"
20+
/* Ensure SVG behaves responsive on Safari and some older browsers like IE */
21+
height="100%"
22+
width="100%"
23+
{...props}
24+
>
25+
<title>{title}</title>
26+
<path d={path} />
27+
</svg>
28+
)

packages/core/src/integrations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { useDecisions } from './decisions'
99

1010
export function useEnabledIntegrations(): [
1111
IntegrationId[],
12-
Dispatch<SetStateAction<IntegrationId[]>>
12+
Dispatch<SetStateAction<IntegrationId[]>>,
1313
] {
1414
const integrations = useIntegrations()
1515
const [decisions, setDecisions] = useDecisions()
@@ -48,5 +48,5 @@ export function useIntegration(
4848
id: IntegrationId
4949
): IntegrationConfig | undefined {
5050
const integrations = useIntegrations()
51-
return integrations.find(i => i.id === id)
51+
return integrations.find((i) => i.id === id)
5252
}

packages/core/src/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export type ConsentManagerStateHook = (
44
initialState: SetStateAction<ConsentManagerStorageState>
55
) => [
66
ConsentManagerStorageState,
7-
Dispatch<SetStateAction<ConsentManagerStorageState>>
7+
Dispatch<SetStateAction<ConsentManagerStorageState>>,
88
]
99

1010
export interface ConsentManagerStorageState {
@@ -13,5 +13,5 @@ export interface ConsentManagerStorageState {
1313

1414
export type ConsentManagerStore<S = ConsentManagerStorageState> = [
1515
S,
16-
Dispatch<SetStateAction<S>>
16+
Dispatch<SetStateAction<S>>,
1717
]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
* home - introduction about the how and why
2+
3+
* tutorials
4+
* quick start - default interface with one integration
5+
* highlight features
6+
* show how to add addons, based on one example (matomo or google docs?)
7+
* offer next steps:
8+
* how to track and render while checking for user consent
9+
* Style default interface
10+
* i18n integration of default interface (translate default interface)
11+
* Implement your own interface
12+
* Create a custom tracking integration
13+
14+
* integrations
15+
* make more examples on how to track with certain integrations (for example matomo track events, page view and so on)
16+
* make sure all config options are listed
17+
18+
19+
20+
* other todos
21+
* maybe its the way we store the tracking in our hooks @stanford & @maneframe why tracking stays active even when user denies (set reference of object ot null is not acutally deleting the object from ram?)
22+
* actively ask for co contributors in readme and on website
23+
* can we do some seo for our docs page?

packages/docs/src/components/vimeo-video.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ export interface VimeoVideoProps {
55
id: string
66
}
77

8-
const VimeoVideoRenderer = React.lazy(() =>
9-
import(/* webpackChunkName: "vimeo-video-player" */ './vimeo-renderer')
8+
const VimeoVideoRenderer = React.lazy(
9+
() => import(/* webpackChunkName: "vimeo-video-player" */ './vimeo-renderer')
1010
)
1111

12-
export const VimeoVideo: React.FC<VimeoVideoProps> = props => (
12+
export const VimeoVideo: React.FC<VimeoVideoProps> = (props) => (
1313
<PrivacyShield id="vimeo">
1414
<React.Suspense fallback={null}>
1515
<VimeoVideoRenderer {...props} />

0 commit comments

Comments
 (0)