Skip to content
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: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint and Format Check

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint-and-format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install dependencies
run: yarn install --immutable

- name: Run Prettier check
run: yarn format:check

- name: Run ESLint
run: yarn lint
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
},
"lint": {
"cache": true
},
"lint:fix": {
"cache": true
},
"format:check": {
"cache": true
}
},
"defaultBase": "main",
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
"packages/*"
],
"scripts": {
"lint": "nx run-many --target=lint",
"lint:fix": "nx run-many --target=lint:fix",
"format": "nx run-many --target=format",
"format:check": "nx run-many --target=format:check",
"dev": "yarn workspaces foreach --all --interlaced --parallel run dev",
"build": "nx run-many --target=build",
"start": "nx run-many --target=start",
Expand Down
3 changes: 2 additions & 1 deletion packages/executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"build": "tsc",
"compile": "yarn build",
"start": "yarn build && LOG_LEVEL=debug DEBUG='*,-puppeteer:protocol*' MONGODB_URI=mongodb://localhost:27017/extension-a11y-checker node --no-experimental-require-module dist/index.js",
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write"
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write",
"format:check": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --check"
},
"dependencies": {
"extension-a11y-checker-storage": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"dev": "tsc --watch",
"build": "tsc",
"compile": "yarn build",
"lint": "exit 1",
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write"
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write",
"format:check": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --check"
},
"dependencies": {
"@typegoose/typegoose": "^12.11.0",
Expand Down
1 change: 1 addition & 0 deletions packages/web2/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.gen.ts
2 changes: 1 addition & 1 deletion packages/web2/app/actions/commons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const validateCron = (cronExpression: string | undefined) => {
{ status: 400 },
);
}
} catch (e) {
} catch {
return new Response("Invalid cron expression", { status: 400 });
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web2/app/actions/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const updateProfileDomain = createServerFn({ method: "POST" })
domain: z
.string()
.regex(
/^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9\-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})$/,
/^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})$/,
"Not a valid domain name.",
),
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/web2/app/components/create/components/domain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Domain = ({
rules={{
pattern: {
value:
/^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9\-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})$/,
/^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9][a-z0-9-]{0,60}|[a-z0-9-]{1,30}\.[a-z]{2,})$/,
message:
"Bitte gib die Domain ohne Protokoll ein. Beispiel: www.example.com oder example.com",
},
Expand Down
4 changes: 2 additions & 2 deletions packages/web2/app/components/create/components/pathsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export const PathsList = ({
setTouched(false);
}

const removePathFromFormValues = (value: string | String) => {
const removePathFromFormValues = (value: string) => {
const values = form.getValues("paths");
values.delete(value.toString());
form.setValue("paths", values);
};

const PathList = typedList<String>();
const PathList = typedList<string>();
const pathsList = (
<PathList.List aria-label="Pfade">
<PathList.StaticData data={Array.from(paths)} />
Expand Down
4 changes: 2 additions & 2 deletions packages/web2/app/components/create/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export function extractDomainFromUrl(url: string): string {
try {
return new URL(url).hostname;
} catch (error) {
} catch {
return url;
}
}

export function extractPathFromUrl(url: string): string {
try {
return new URL(url).pathname;
} catch (error) {
} catch {
return url;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ export const CronFields: FC<Props> = (props) => {
showTimeField ? watchedCronTime : undefined,
);
form.setValue(name, newValue.cron);
newValue.time && form.setValue("cronTime", newValue.time);
if (newValue.time) {
form.setValue("cronTime", newValue.time);
}
}, [watchedCronInterval]);

useEffect(() => {
const newValue =
watchedCronInterval === "custom"
? getTimeFromCron(watchedCron)
: undefined;
newValue && form.setValue("cronTime", newValue);
if (newValue) {
form.setValue("cronTime", newValue);
}
}, [watchedCron]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ interface Props {
export const NextExecutionsLabeledValue: FC<Props> = (props) => {
const { cron } = props;

const executions = useMemo(() => getExecutions(cron), [cron]);

if (cron === "" || !isValidCron(cron)) {
return null;
}

const executions = useMemo(() => getExecutions(cron), [cron]);

const nextExecutions = executions.map((date) => {
return (
<React.Fragment key={date.toISOString()}>
Expand Down
6 changes: 3 additions & 3 deletions packages/web2/app/components/profile/CronFields/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const getCronText = (cronSyntax: string) => {
locale: "de",
verbose: true,
})}`;
} catch (ignoredError) {
} catch {
return undefined;
}
};
Expand Down Expand Up @@ -163,7 +163,7 @@ export const isSmallIntervall = (schedule: string) => {
const dayInHours = 24;

return hoursDiff < dayInHours * 5;
} catch (ignoredError) {
} catch {
return false;
}
};
Expand All @@ -179,7 +179,7 @@ export const getExecutions = (cron: string) => {
}

return executions;
} catch (ignoredError) {
} catch {
return [];
}
};
1 change: 0 additions & 1 deletion packages/web2/app/ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
defaultStreamHandler,
} from "@tanstack/react-start/server";
import { getRouterManifest } from "@tanstack/react-start/router-manifest";
import React from "react";

import { createRouter } from "./router";

Expand Down
24 changes: 12 additions & 12 deletions packages/web2/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ["dist", ".vinxi", ".output", "node_modules"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
)
);
4 changes: 3 additions & 1 deletion packages/web2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"start": "vinxi start",
"compile": "yarn build",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"preview": "nx vite:preview",
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write"
"format": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --write",
"format:check": "prettier $@ '**/*.{ts,tsx,yaml,yml,json,md,mdx}' --check"
},
"dependencies": {
"@mittwald/api-client": "^4.131.0",
Expand Down