Skip to content

Commit

Permalink
cleanup types and lint issues (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Oct 21, 2023
1 parent 8dc80b5 commit a780302
Show file tree
Hide file tree
Showing 27 changed files with 864 additions and 557 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-coins-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

- cleanup types and lint issues
5 changes: 4 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ package-lock.json
yarn.lock
.changeset/
.prettierrc
package.json
package.json

vite.config.js.timestamp-*
vite.config.ts.timestamp-*
28 changes: 24 additions & 4 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,42 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/prettier",
"plugin:svelte/recommended",
"prettier"
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
ecmaVersion: "latest",
extraFileExtensions: [".svelte"]
},
env: {
browser: true,
es2017: true,
es2024: true,
node: true
},
globals: { $$Generic: "readable" },
globals: { $$Generic: "readable", NodeJS: true },
rules: {
"no-console": "warn",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_"
}
],
"svelte/no-target-blank": "error",
"svelte/no-immutable-reactive-statements": "error",
"svelte/prefer-style-directive": "error",
"svelte/no-reactive-literals": "error",
"svelte/no-useless-mustaches": "error",
"svelte/button-has-type": "off",
"svelte/require-each-key": "off",
"svelte/no-at-html-tags": "off",
"svelte/no-unused-svelte-ignore": "off",
"svelte/require-stores-init": "off"
},
overrides: [
{
files: ["*.svelte"],
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: CI

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
check:
name: Run svelte-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/setup-node@v3
with:
node-version: 18

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run svelte-check
run: pnpm check

lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Node.JS
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8

# PNPM Store cache setup
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- run: pnpm lint
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ package.json
.vercel
.contentlayer
dist

vite.config.js.timestamp-*
vite.config.ts.timestamp-*
2 changes: 1 addition & 1 deletion contentlayer.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocumentType, defineNestedType, makeSource } from "contentlayer/source-files";
import { defineDocumentType, makeSource } from "contentlayer/source-files";
import path from "path";

/** @type {import('contentlayer/source-files').ComputedFields} */
Expand Down
1 change: 1 addition & 0 deletions mdsvex.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export function rehypeComponentExample() {
if (!index) return;
parent.children.splice(index + 1, 0, sourceCodeNode);
} catch (e) {
// eslint-disable-next-line no-console
console.error(e);
}
}
Expand Down
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"package": "svelte-kit sync && svelte-package && publint",
"prepublishOnly": "pnpm run package",
"test": "pnpm run test:integration && pnpm run test:unit",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check": "pnpm build:content && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"format": "prettier --plugin-search-dir . --write .",
Expand All @@ -40,51 +40,51 @@
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/adapter-vercel": "^3.0.3",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/package": "^2.0.0",
"@tailwindcss/typography": "^0.5.9",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.14",
"@sveltejs/kit": "^1.26.0",
"@sveltejs/package": "^2.2.2",
"@tailwindcss/typography": "^0.5.10",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"autoprefixer": "^10.4.16",
"clsx": "^2.0.0",
"concurrently": "^8.2.0",
"concurrently": "^8.2.2",
"contentlayer": "^0.3.4",
"eslint": "^8.28.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte": "^2.30.0",
"eslint-plugin-svelte": "^2.34.0",
"esm-env": "^1.0.0",
"hast-util-to-html": "^9.0.0",
"lucide-svelte": "^0.268.0",
"postcss": "^8.4.24",
"postcss": "^8.4.31",
"postcss-load-config": "^4.0.1",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"publint": "^0.1.9",
"publint": "^0.2.5",
"radix-icons-svelte": "^1.2.1",
"rehype-pretty-code": "^0.10.0",
"remark-gfm": "^3.0.1",
"shiki": "^0.14.3",
"shikiji": "^0.4.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.3",
"remark-gfm": "^4.0.0",
"shiki": "^0.14.5",
"shikiji": "^0.6.10",
"svelte": "^4.2.2",
"svelte-check": "^3.5.2",
"svelte-sequential-preprocessor": "^2.0.1",
"svelte-wrap-balancer": "^0.0.4",
"tailwind-merge": "^1.14.0",
"tailwind-variants": "^0.1.13",
"tailwindcss": "^3.3.2",
"tailwindcss-animate": "^1.0.6",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"tailwind-variants": "^0.1.14",
"tailwindcss": "^3.3.3",
"tailwindcss-animate": "^1.0.7",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"unist-builder": "^4.0.0",
"unist-util-visit": "^5.0.0",
"vite": "^4.4.2",
"vitest": "^0.32.2"
"vite": "^4.5.0",
"vitest": "^0.34.6"
},
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"dependencies": {
"@melt-ui/svelte": "0.55.2",
"@melt-ui/svelte": "0.55.3",
"nanoid": "^4.0.2"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit a780302

Please sign in to comment.