Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): fix eslint config and add prettier #368

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
run: |
git diff --exit-code ./manifests

lint:
name: Lint
lint-go:
name: Lint Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -73,5 +73,29 @@ jobs:
version: v1.55
args: --timeout=5m

lint-ts:
name: Lint TS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install
dir: ui
- name: Run eslint
uses: borales/actions-yarn@v5
with:
cmd: lint
dir: ui
- name: Run prettier
uses: borales/actions-yarn@v5
with:
cmd: format-check
dir: ui

build-and-push:
uses: ./.github/workflows/build-and-push.yaml
uses: ./.github/workflows/build-and-push.yaml
18 changes: 0 additions & 18 deletions ui/.eslintrc.cjs

This file was deleted.

6 changes: 6 additions & 0 deletions ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80
}
31 changes: 31 additions & 0 deletions ui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import reactPlugin from 'eslint-plugin-react';
import hooksPlugin from 'eslint-plugin-react-hooks';
import tseslint from 'typescript-eslint';
import eslint from '@eslint/js';

export default [
{
plugins: {
react: reactPlugin,
},
rules: {
...reactPlugin.configs['jsx-runtime'].rules,
},
settings: {
react: {
version: 'detect',
},
},
},
{
plugins: {
'react-hooks': hooksPlugin,
},
rules: hooksPlugin.configs.recommended.rules,
},
eslint.configs.recommended,
...tseslint.configs.recommended,
{
ignores: ['**/dist'],
},
];
12 changes: 10 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"lint": "eslint -c eslint.config.mjs ./src/**/*.{ts,tsx} --report-unused-disable-directives --max-warnings 0 .",
"preview": "vite preview",
"format": "prettier --config .prettierrc 'src/**/*.{ts,tsx}' --write",
"format-check": "prettier --config .prettierrc 'src/**/*.{ts,tsx}' --check"
},
"dependencies": {
"@floating-ui/react": "^0.26.9",
Expand All @@ -22,18 +24,24 @@
"tailwind-merge": "^2.0.0"
},
"devDependencies": {
"@eslint/compat": "^1.2.1",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.13",
"postcss": "^8.4.38",
"prettier": "3.3.3",
"tailwindcss": "^3.4.4",
"typescript": "^5.3.3",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.9"
}
}
6 changes: 3 additions & 3 deletions ui/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
autoprefixer: {}
}
};
48 changes: 24 additions & 24 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import {
createBrowserRouter,
RouterProvider,
Navigate,
} from "react-router-dom";
Navigate
} from 'react-router-dom';

import ThemeProvider from "@/contexts/ThemeContext";
import ThemeProvider from '@/contexts/ThemeContext';

import Layout from "@/layout/Layout";
import Layers from "@/pages/Layers";
import Pulls from "@/pages/Pulls";
import Logs from "@/pages/Logs";
import Login from "@/pages/Login";
import Layout from '@/layout/Layout';
import Layers from '@/pages/Layers';
import Pulls from '@/pages/Pulls';
import Logs from '@/pages/Logs';
import Login from '@/pages/Login';

const queryClient = new QueryClient();
const router = createBrowserRouter([
{
path: "/",
path: '/',
element: <Layout />,
children: [
{
index: true,
element: <Navigate to="/layers" />,
element: <Navigate to="/layers" />
},
{
path: "layers",
element: <Layers />,
path: 'layers',
element: <Layers />
},
{
path: "pulls",
element: <Pulls />,
path: 'pulls',
element: <Pulls />
},
{
path: "logs/:namespace?/:layerId?/:runId?",
element: <Logs />,
},
],
path: 'logs/:namespace?/:layerId?/:runId?',
element: <Logs />
}
]
},
{
path: "/login",
element: <Login />,
path: '/login',
element: <Login />
},
{
path: "*",
element: <Navigate to="/" />,
},
path: '*',
element: <Navigate to="/" />
}
]);

function App() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/avocado/AvocadoOff.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const AvocadoOff = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/avocado/AvocadoOn.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const AvocadoOn = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/avocado/AvocadoSeed.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const AvocadoSeed = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/AngleDownIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const AngleDownIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/AppsIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const AppsIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/ArrowLeftIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const ArrowLeftIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/ArrowResizeDiagonalIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const ArrowResizeDiagonalIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/ArrowRightIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const ArrowRightIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/BarsIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const BarsIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/CheckIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const CheckIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/CodeBranchIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const CodeBranchIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/CopyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const CopyIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/DownloadAltIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const DownloadAltIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/ExclamationTriangleIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const ExclamationTriangleIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/EyeIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const EyeIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/EyeSlashIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const EyeSlashIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/GithubIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const GithubIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/GitlabIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const GitlabIcon = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/LayerGroupIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const LayerGroupIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/LoaderIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const LoaderIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/MinusIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const MinusIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/MultiplyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const MultiplyIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/SearchIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const SearchIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/SyncIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const SyncIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/TimesIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const TimesIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/icons/WindowIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const WindowIcon = (props: SVGProps<SVGSVGElement>) => (
<svg height={24} width={24} viewBox="0 0 24 24" {...props}>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/assets/illustrations/Burrito.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SVGProps } from "react";
import { SVGProps } from 'react';

const Burrito = (props: SVGProps<SVGSVGElement>) => (
<svg
Expand Down
Loading
Loading