Fail lint check on error (#5398)

pull/5407/head
Alex van Andel 2022-11-07 21:12:12 +00:00 committed by GitHub
parent e5ba861621
commit 47a663f5a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 14 deletions

View File

@ -30,7 +30,10 @@ jobs:
if: steps.yarn-cache.outputs.cache-hit != 'true' if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile run: yarn --frozen-lockfile
- name: Lint - name: Test Code Linting
run: yarn lint
- name: Save Code Linting Reports
run: yarn lint:report run: yarn lint:report
continue-on-error: true continue-on-error: true

View File

@ -1,17 +1,19 @@
import Script from "next/script"; import Script from "next/script";
import { getEventTypeAppData } from "@calcom/app-store/utils"; import { getEventTypeAppData } from "@calcom/app-store/utils";
import { trackingApps } from "./eventTypeAnalytics"; import { trackingApps } from "./eventTypeAnalytics";
export type AppScript = {attrs?: Record<string, string>} & ({src: undefined, content?: string} | {src?: string, content:undefined}) export type AppScript = { attrs?: Record<string, string> } & (
| { src: undefined; content?: string }
| { src?: string; content: undefined }
);
export default function BookingPageTagManager({ export default function BookingPageTagManager({
eventType, eventType,
}: { }: {
eventType: Parameters<typeof getEventTypeAppData>[0]; eventType: Parameters<typeof getEventTypeAppData>[0];
}) { }) {
return ( return (
<> <>
{Object.entries(trackingApps).map(([appId, scriptConfig]) => { {Object.entries(trackingApps).map(([appId, scriptConfig]) => {
@ -19,22 +21,32 @@ export default function BookingPageTagManager({
if (!trackingId) { if (!trackingId) {
return null; return null;
} }
const parseValue = <T extends string|undefined, >(val: T ):T => val ? val.replace(/\{TRACKING_ID\}/g, trackingId) as T : val const parseValue = <T extends string | undefined>(val: T): T =>
val ? (val.replace(/\{TRACKING_ID\}/g, trackingId) as T) : val;
return scriptConfig.scripts.map((script, index)=>{
return scriptConfig.scripts.map((script, index) => {
const parsedAttributes: NonNullable<AppScript["attrs"]> = {}; const parsedAttributes: NonNullable<AppScript["attrs"]> = {};
const attrs = script.attrs || {}; const attrs = script.attrs || {};
Object.entries(attrs).forEach(([name, value]) => { Object.entries(attrs).forEach(([name, value]) => {
if (typeof value === "string") { if (typeof value === "string") {
value = parseValue(value) value = parseValue(value);
} }
parsedAttributes[name] = value; parsedAttributes[name] = value;
}); });
return <Script src={parseValue(script.src)} key={`${appId}-${index}`} {...{dangerouslySetInnerHTML:{ return (
__html: parseValue(script.content) || "" <Script
}, ...parsedAttributes}} defer />; src={parseValue(script.src)}
}) id={`${appId}-${index}`}
key={`${appId}-${index}`}
dangerouslySetInnerHTML={{
__html: parseValue(script.content) || "",
}}
{...parsedAttributes}
defer
/>
);
});
})} })}
</> </>
); );

View File

@ -29,7 +29,7 @@ const InputOption: React.FC<OptionProps<any, boolean, GroupBase<any>>> = ({
<components.Option <components.Option
className={classNames( className={classNames(
className, className,
"dark:bg-darkgray-100 text-[inherit] !flex !cursor-pointer !py-3", "dark:bg-darkgray-100 !flex !cursor-pointer !py-3 text-[inherit]",
isFocused && "dark:!bg-darkgray-200 !bg-gray-100", isFocused && "dark:!bg-darkgray-200 !bg-gray-100",
isSelected && "dark:!bg-darkgray-300 !bg-neutral-900" isSelected && "dark:!bg-darkgray-300 !bg-neutral-900"
)} )}