Skip to content

Commit

Permalink
fix prettier and eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgill committed Mar 31, 2024
1 parent b08f88b commit 85163a7
Show file tree
Hide file tree
Showing 20 changed files with 1,483 additions and 72 deletions.
6 changes: 3 additions & 3 deletions .github/shared/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Setup and install'
description: 'Common setup steps for pnpm actions'
name: "Setup and install"
description: "Common setup steps for pnpm actions"

# See: https://github.com/t3-oss/create-t3-turbo/blob/main/tooling/github/setup/action.yml

Expand All @@ -19,7 +19,7 @@ runs:
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
cache: 'pnpm'
cache: "pnpm"

- shell: bash
run: pnpm install --frozen-lockfile
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/shared
- run: pnpm format:check
- run: pnpm format-check

lint:
runs-on: ubuntu-latest
Expand All @@ -34,4 +34,3 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/shared
- run: pnpm tsc

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm exec lint-staged --concurrent false --relative
pnpm exec lint-staged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apps/docs/.astro
apps/docs/.vercel
apps/docs/dist
pnpm-lock.yaml
File renamed without changes.
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"prettier.documentSelectors": ["**/*.astro"],
"[astro]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"eslint.experimental.useFlatConfig": true
}
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.format.enable": true,
"eslint.experimental.useFlatConfig": true
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# llm-ui
# llm-ui
5 changes: 0 additions & 5 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"build": "astro build --remote",
"preview": "astro preview",
"astro": "astro",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
"tsc": "astro check"
},
"dependencies": {
Expand Down Expand Up @@ -58,10 +56,7 @@
"devDependencies": {
"@astrojs/check": "^0.5.10",
"@tailwindcss/typography": "^0.5.10",
"globals": "^15.0.0",
"mdast-util-toc": "^7.0.0",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
"remark": "^15.0.1",
"typescript": "^5.4.3",
"unist-util-visit": "^5.0.0"
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/components/content/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export const MdxComponents = {
alt,
...props
}: React.ImgHTMLAttributes<HTMLImageElement>) => (
// eslint-disable-next-line @next/next/no-img-element
<img className={cn("rounded-md border", className)} alt={alt} {...props} />
),
hr: ({ ...props }) => <hr className="my-4 md:my-8" {...props} />,
Expand Down
4 changes: 1 addition & 3 deletions apps/docs/src/components/forms/waitlist-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export function WaitlistForm() {
if (data.message === "success") {
toast.success("Thanks for your support!", {
description: (
<span>
We're added <b>{values.email}</b> to the waitlist!
</span>
<span>{"We're added <b>{values.email}</b> to the waitlist!"}</span>
),
});
form.reset();
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/components/layout/sheet-mobile-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function SheetMobileNav({
<a
href={subItem.href}
target={subItem?.external ? "_blank" : undefined}
rel="noreferrer"
className="text-muted-foreground"
>
{subItem.title}
Expand Down
1 change: 0 additions & 1 deletion apps/docs/src/components/main-navigation-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from "react";

import { cn } from "@/lib/utils";
import { Icons } from "@/icons";
import {
NavigationMenu,
NavigationMenuContent,
Expand Down
2 changes: 0 additions & 2 deletions apps/docs/src/components/toc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { cn } from "@/lib/utils";
interface TocProps {
toc: TableOfContents;
}
const x = "2";

export function DashboardTableOfContents({ toc }: TocProps) {
const itemIds = toc.items
? toc.items
Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineCollection, z } from "astro:content";

const blog = defineCollection({
// Type-check frontmatter using a schema
// eslint-disable-next-line no-unused-vars
schema: ({ image }) =>
z.object({
title: z.string(),
Expand Down
45 changes: 45 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import reactRecommended from "eslint-plugin-react/configs/recommended.js";
import globals from "globals";
import typescriptParser from "@typescript-eslint/parser";
import typescriptPlugin from "@typescript-eslint/eslint-plugin";
import js from "@eslint/js";

export default [
{ ignores: ["apps/docs/{dist,.vercel,.astro}/**/*"] },
{
files: ["apps/docs/**/*.{ts,tsx}"],
plugins: {
"@typescript-eslint": typescriptPlugin,
},
languageOptions: {
parser: typescriptParser,
parserOptions: {
project: "apps/docs/tsconfig.json",
sourceType: "module",
ecmaVersion: 2020,
},
},
},
{
files: ["apps/docs/**/*.{jsx,tsx}"],
...reactRecommended,
languageOptions: {
...reactRecommended.languageOptions,
globals: {
...globals.browser,
},
},
rules: {
...reactRecommended.rules,
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
},
{
files: ["apps/docs/**/*.{js,jsx,mjs,cjs,ts,tsx}"],
...js.configs.recommended,
rules: {
"no-unused-vars": ["error", { varsIgnorePattern: "React" }],
},
},
];
9 changes: 5 additions & 4 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
'{apps,packages,tools}/**/*.{js,ts,jsx,tsx,json,astro,css}': [
files => `nx affected:lint --files=${files.join(',')}`,
files => `nx format:write --files=${files.join(',')}`,
],
"{apps,packages,tools}/**/*.{cjs,mjs,js,ts,jsx,tsx,json,yaml,yml,astro,css}":
[
(files) => `pnpm exec eslint ${files.join(" ")}`,
(files) => `pnpm exec prettier --write ${files.join(" ")}`,
],
};
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@
"name": "llm-ui",
"packageManager": "[email protected]+sha256.4b4efa12490e5055d59b9b9fc9438b7d581a6b7af3b5675eb5c5f447cee1a589",
"scripts": {
"format:check": "nx run-many -t format:check",
"lint": "nx run-many -t lint",
"lint": "eslint .",
"tsc": "nx run-many -t tsc",
"prepare": "husky"
"prepare": "husky",
"format-check": "prettier --check .",
"format-write": "prettier --write ."
},
"devDependencies": {
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"nx": "18.2.1",
"typescript": "^5.4.3"
"typescript": "^5.4.3",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"globals": "^15.0.0",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0"
},
"license": "ISC"
}
Loading

0 comments on commit 85163a7

Please sign in to comment.