Skip to content

Commit

Permalink
Add core linter (#238)
Browse files Browse the repository at this point in the history
* Add core linter

* Extend test timeout
  • Loading branch information
drwpow committed Mar 30, 2024
1 parent fdb175d commit 4b02c6b
Show file tree
Hide file tree
Showing 48 changed files with 2,341 additions and 908 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-coins-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cobalt-ui/utils": patch
---

Add additional helper utils
6 changes: 6 additions & 0 deletions .changeset/fuzzy-chefs-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@cobalt-ui/core": minor
"@cobalt-ui/cli": minor
---

Add core lint rules
38 changes: 31 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,55 @@ contributing here.

## Setup

This repo requires [pnpm]. Once installed, run:
This repo requires [pnpm](https://pnpm.io/). Once installed, run:

```
```sh
pnpm i
```

## Developing

To build TypeScript as you work, run:

```
```sh
pnpm run dev
```

## Testing

Tests are written in [Vitest](https://vitest.dev), a modern replacement for Jest. To run tests:

```
```sh
pnpm run build
pnpm test
```

## Opening a PR
⚠️ **Be sure to build first!** Many tests test the _actual_ built files, not the source `.ts` files.

## Opening a Pull Request

All PRs are welcome! But to save your time, here are some common PRs received and the best course of action to take:

_**Tip**: check out the [good first issue](https://github.com/drwpow/cobalt-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) and [help wanted](https://github.com/drwpow/cobalt-ui/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tags for open issues that need a PR!_

### 🐛 Bugfixes

1. **Open the PR directly.** Always accepted, with or without an accompanying issue, as long as you also add tests. Thank you for fixing it!

### 📖 Documentation Changes

1. **Open an issue.** If this is a larger restructuring, or making huge content changes, we’re open to that! But it may need discussion first. However, if this is a **translation** (always accepted) or **fixing a typo** no issue is needed; just open the PR.
2. **Open the PR.** This will be accepted 🙂.

### ✨ New Feature

1. **Open an issue to discuss.** Before opening a PR, the feature may need some discussion, and a clarifying design! Opening an issue makes sure no work is wasted when it’s time for a PR.
2. **Open the PR.** With a clear goal for the PR, it’ll be easier to write and review, and will chip more quickly!

### 💥 Breaking Change

All PRs are welcome! When opening a PR, be sure to complete the checklist within the template to make it easier on me 🙂.
1. **Open an issue to discuss.** Sure, we never plan _directly_ on breaking the API, but usually it’s part of a larger desired change. Let’s discuss it **in an issue** before opening a PR!
2. **Open a NON-BREAKING PR against `main`** Usually we can do some halfway workaround that somewhat solves the problem without breaking the existing API. But afterward, …
3. **Open a BREAKING PR in the future when pinged**. Cobalt doesn’t have a defined release cycle yet, but at certain times, there will be a branch that contains breaking changes for a future major release. The core maintainers will coordinate with you on how to get the breaking changes in, if they’re accepted.

[pnpm]: https://pnpm.io/
For all PRs, **adding tests** are required, as is **filling out the description template** and adding a 🦋 **Changeset** if a new version needs to be released (Changeset instructions automatically appear as a PR comment).
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default defineConfig({
{ text: 'tokens.json', link: '/guides/tokens' },
{ text: 'CLI', link: '/guides/cli' },
{ text: 'Modes', link: '/guides/modes' },
{ text: 'Linting', link: '/guides/linting' },
],
},
{
Expand Down
102 changes: 53 additions & 49 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,215 +4,215 @@
*/

@font-face {
font-family: 'Neue Montreal';
font-family: "Neue Montreal";
font-weight: 1 999;
src: url('https://drewhost.s3.amazonaws.com/PPNeueMontrealVariable.ttf') format('truetype');
src: url("https://drewhost.s3.amazonaws.com/PPNeueMontrealVariable.ttf") format("truetype");
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 300;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 300;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 500;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 500;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 600;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 600;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 700;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: italic;
font-weight: 700;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-italic-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 600;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin-ext.woff2) format("woff2");
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Red Hat Mono';
font-family: "Red Hat Mono";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format('woff2');
src: url(/fonts/redhatmono-v10-300-normal-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
Expand All @@ -222,13 +222,13 @@
* -------------------------------------------------------------------------- */

:root {
--vp-font-family-base: 'Neue Montreal', -apple-system, 'system-ui', 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
--vp-font-family-mono: 'Red Hat Mono', ui-monospace, monospace;
--vp-font-family-base: "Neue Montreal", -apple-system, "system-ui", "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
--vp-font-family-mono: "Red Hat Mono", ui-monospace, monospace;
}

em,
i {
font-variation-settings: 'ital' 900;
font-variation-settings: "ital" 900;
font-style: normal;
}

Expand Down Expand Up @@ -281,7 +281,7 @@ i {
--vp-c-brand-1: oklch(60% 0.216564 269);
--vp-c-brand-2: oklch(50% 0.216583 268);
--vp-c-brand-3: oklch(60% 0.216564 269);
--vp-c-brand-soft: oklch(60% 0.216564 269/0.2);
--vp-c-brand-soft: oklch(60% 0.216564 269/0.15);

--vp-code-color: var(--vp-c-text-1);

Expand Down Expand Up @@ -348,7 +348,11 @@ i {
--vp-custom-block-tip-border: transparent;
--vp-custom-block-tip-text: var(--vp-c-text-1);
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
--vp-custom-block-tip-code-bg: oklch(60% 0.216564 269 / 0.08);
}

.custom-block.tip code {
color: var(--vp-c-text-1);
}

/**
Expand All @@ -364,14 +368,14 @@ i {
* -------------------------------------------------------------------------- */

.VPHome {
background-image: url('/images/home-bg.png');
background-image: url("/images/home-bg.png");
background-repeat: no-repeat;
background-position: center 4rem;
background-size: 200% auto;
}

.dark .VPHome {
background-image: url('/images/home-bg-dark.png');
background-image: url("/images/home-bg-dark.png");
}

@media (min-width: 800px) {
Expand Down
Loading

0 comments on commit 4b02c6b

Please sign in to comment.