Skip to content

Commit

Permalink
[ci] lint
Browse files Browse the repository at this point in the history
  • Loading branch information
studiocms-no-reply committed Dec 8, 2024
1 parent 14be139 commit bb57ba8
Show file tree
Hide file tree
Showing 33 changed files with 278 additions and 258 deletions.
24 changes: 12 additions & 12 deletions docs/scripts/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import fs from 'node:fs'
import { EOL } from 'node:os'
import fs from 'node:fs';
import { EOL } from 'node:os';

export function normalizeLineEndings(contents: string) {
return contents.replace(/\r\n/g, '\n')
return contents.replace(/\r\n/g, '\n');
}

export function splitLines(contents: string) {
return normalizeLineEndings(contents).split(/\n/)
return normalizeLineEndings(contents).split(/\n/);
}

export function readFileLines(filePath: string) {
return splitLines(fs.readFileSync(filePath, 'utf8'))
return splitLines(fs.readFileSync(filePath, 'utf8'));
}

export function writeFileLines(filePath: string, lines: string | string[]) {
const normalizedLines = splitLines(Array.isArray(lines) ? lines.join('\n') : lines)
fs.writeFileSync(filePath, normalizedLines.join(EOL))
const normalizedLines = splitLines(Array.isArray(lines) ? lines.join('\n') : lines);
fs.writeFileSync(filePath, normalizedLines.join(EOL));
}

/**
Expand All @@ -29,10 +29,10 @@ export function serializeStringWithSingleQuotes(input: string): string {
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
}
};

return escapeMap[match] || match
})
return escapeMap[match] || match;
});

return `'${escapedString}'`
}
return `'${escapedString}'`;
}
16 changes: 8 additions & 8 deletions docs/src/components/Youtube.astro
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
import { YouTube } from 'astro-embed';
interface Props {
id: string;
title?: string;
}
const { id, title } = Astro.props;
import { YouTube } from 'astro-embed';
interface Props {
id: string;
title?: string;
}
const { id, title } = Astro.props;
---
<YouTube id={id} title={title} />

Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/icons/GitHubIcon.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import type { HTMLAttributes } from 'astro/types';
interface Props extends HTMLAttributes<'svg'> {
width?: number;
height?: number;
width?: number;
height?: number;
}
const { width = 98, height = 96, ...props } = Astro.props;
Expand Down
24 changes: 12 additions & 12 deletions docs/src/components/landing/HeroSection.astro
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
import {
Button,
Checkbox,
Divider,
Dropdown,
Input,
RadioGroup,
SearchSelect,
Select,
Textarea,
ThemeToggle,
Toggle,
User
Button,
Checkbox,
Divider,
Dropdown,
Input,
RadioGroup,
SearchSelect,
Select,
Textarea,
ThemeToggle,
Toggle,
User,
} from '@studiocms/ui/components';
import Icon from '@studiocms/ui/utils/Icon.astro';
Expand Down
8 changes: 4 additions & 4 deletions docs/src/components/landing/PageHeader.astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
import Icon from '@studiocms/ui/utils/Icon.astro';
import type { HeroIconName } from '@studiocms/ui/utils/iconType.js'
import type { HeroIconName } from '@studiocms/ui/utils/iconType.js';
interface Props {
icon: HeroIconName;
title: string;
subtitle?: string;
icon: HeroIconName;
title: string;
subtitle?: string;
}
const { icon, title, subtitle } = Astro.props;
Expand Down
18 changes: 9 additions & 9 deletions docs/src/components/landing/SocialProofCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import { Image } from 'astro:assets';
interface Props {
avatar: string;
name: string;
handle: string;
message: string;
image?: {
path: string;
width: number;
height: number;
};
avatar: string;
name: string;
handle: string;
message: string;
image?: {
path: string;
width: number;
height: number;
};
}
const { avatar, name, handle, message, image } = Astro.props;
Expand Down
4 changes: 2 additions & 2 deletions docs/src/components/landing/SocialProofSection.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const chunkSize = socialProofEntries.length / 3;
const chunkedSocialProofEntries = [];
for (let i = 0; i < socialProofEntries.length; i += chunkSize) {
const chunk = socialProofEntries.slice(i, i + chunkSize);
chunkedSocialProofEntries.push(chunk);
const chunk = socialProofEntries.slice(i, i + chunkSize);
chunkedSocialProofEntries.push(chunk);
}
---
<section class="social-proof not-content">
Expand Down
10 changes: 5 additions & 5 deletions docs/src/components/landing/styles.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
form {
padding: 1.5rem;
background: hsl(var(--background-base));
padding: 1.5rem;
background: hsl(var(--background-base));
}

form > span {
font-size: 1.5em;
font-weight: 700;
margin-bottom: .75rem;
font-size: 1.5em;
font-weight: 700;
margin-bottom: .75rem;
}
2 changes: 1 addition & 1 deletion packages/studiocms_ui/src/components/Checkbox.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Props {
disabled?: boolean;
name?: string;
isRequired?: boolean;
};
}
const {
size = 'md',
Expand Down
4 changes: 2 additions & 2 deletions packages/studiocms_ui/src/components/Divider.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
interface Props {
background?: 'background-base' | 'background-step-1' | 'background-step-2' | 'background-step-3';
};
background?: 'background-base' | 'background-step-1' | 'background-step-2' | 'background-step-3';
}
const { background = 'background-base' } = Astro.props;
---
Expand Down
21 changes: 14 additions & 7 deletions packages/studiocms_ui/src/components/Dropdown/Dropdown.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@ interface Option {
value: string;
disabled?: boolean;
color?: StudioCMSColorway;
icon?: HeroIconName;
href?: string;
};
icon?: HeroIconName;
href?: string;
}
interface Props {
options: Option[];
disabled?: boolean;
id: string;
align?: 'start' | 'center' | 'end';
triggerOn?: 'left' | 'right' | 'both';
offset?: number;
};
const { options, disabled = false, align = 'center', id, triggerOn = 'left', offset = 0 } = Astro.props;
offset?: number;
}
const {
options,
disabled = false,
align = 'center',
id,
triggerOn = 'left',
offset = 0,
} = Astro.props;
---
<div
class="sui-dropdown-container"
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_ui/src/components/Dropdown/dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DropdownHelper {
private alignment: 'start' | 'center' | 'end';
private triggerOn: 'left' | 'right' | 'both';
private fullWidth = false;

active = false;

constructor(id: string, fullWidth?: boolean) {
Expand Down
16 changes: 8 additions & 8 deletions packages/studiocms_ui/src/components/Footer.astro
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
---
import type { HTMLAttributes } from 'astro/types'
import type { HTMLAttributes } from 'astro/types';
interface Props extends HTMLAttributes<'footer'> {
links: {
[label: string]: {
label: string;
href: string;
}[];
},
copyright: string;
links: {
[label: string]: {
label: string;
href: string;
}[];
};
copyright: string;
}
const { copyright, links, ...props } = Astro.props;
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_ui/src/components/Input.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Props extends HTMLAttributes<'input'> {
disabled?: boolean;
defaultValue?: string;
class?: string;
};
}
const {
label,
Expand Down
15 changes: 11 additions & 4 deletions packages/studiocms_ui/src/components/Modal/Modal.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Icon from '../../utils/Icon.astro';
import Button from '../Button.astro';
interface ButtonType {
label: string;
color: StudioCMSColorway;
label: string;
color: StudioCMSColorway;
}
interface Props {
Expand All @@ -15,9 +15,16 @@ interface Props {
cancelButton?: string | ButtonType;
actionButton?: string | ButtonType;
isForm?: boolean;
};
}
const { id, size = 'md', dismissable = true, isForm = false, cancelButton, actionButton } = Astro.props;
const {
id,
size = 'md',
dismissable = true,
isForm = false,
cancelButton,
actionButton,
} = Astro.props;
---
<dialog
popover
Expand Down
5 changes: 4 additions & 1 deletion packages/studiocms_ui/src/components/Modal/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class ModalHelper {
}

private addButtonListeners = (id: string, dismissable: boolean) => {
if (dismissable || (!this.element.dataset.hasCancelButton && !this.element.dataset.hasActionButton)) {
if (
dismissable ||
(!this.element.dataset.hasCancelButton && !this.element.dataset.hasActionButton)
) {
const xMarkButton = document.getElementById(`${id}-btn-x`) as HTMLButtonElement;
xMarkButton.addEventListener('click', this.hide);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/studiocms_ui/src/components/RadioGroup.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Option {
label: string;
value: string;
disabled?: boolean;
};
}
interface Props {
label: string;
Expand All @@ -18,7 +18,7 @@ interface Props {
isRequired?: boolean;
horizontal?: boolean;
class?: string;
};
}
const {
label,
Expand Down
2 changes: 1 addition & 1 deletion packages/studiocms_ui/src/components/Row.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { HTMLAttributes } from 'astro/types';
interface Props extends HTMLAttributes<'div'> {
alignCenter?: boolean;
gapSize?: 'sm' | 'md' | 'lg';
};
}
const { alignCenter, gapSize = 'md', ...props } = Astro.props;
---
Expand Down
8 changes: 4 additions & 4 deletions packages/studiocms_ui/src/components/SearchSelect.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Option {
label: string;
value: string;
disabled?: boolean;
};
}
interface Props {
label?: string;
Expand All @@ -18,8 +18,8 @@ interface Props {
options: Option[];
disabled?: boolean;
fullWidth?: boolean;
placeholder?: string;
};
placeholder?: string;
}
const {
label,
Expand All @@ -30,7 +30,7 @@ const {
options = [],
disabled,
fullWidth,
placeholder
placeholder,
} = Astro.props;
---

Expand Down
6 changes: 3 additions & 3 deletions packages/studiocms_ui/src/components/Select.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface Option {
label: string;
value: string;
disabled?: boolean;
};
}
interface Props {
label?: string;
Expand All @@ -18,7 +18,7 @@ interface Props {
disabled?: boolean;
fullWidth?: boolean;
placeholder?: string;
};
}
const {
label,
Expand All @@ -29,7 +29,7 @@ const {
options = [],
disabled,
fullWidth,
placeholder
placeholder,
} = Astro.props;
---

Expand Down
Loading

0 comments on commit bb57ba8

Please sign in to comment.