Skip to content

Commit

Permalink
refactor: Refactor existing files to adhere to the prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin23 committed Nov 9, 2024
1 parent d4ccc4a commit 7c1adb0
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 128 deletions.
136 changes: 68 additions & 68 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,80 @@
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true,
root: true,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
ecmaFeatures: {
jsx: true
}
},
env: {
browser: true,
commonjs: true,
es6: true
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},

// Base config
extends: ["eslint:recommended"],
// Base config
extends: ["eslint:recommended"],

overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
settings: {
react: {
version: "detect",
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" },
],
"import/resolver": {
typescript: {},
overrides: [
// React
{
files: ["**/*.{js,jsx,ts,tsx}"],
plugins: ["react", "jsx-a11y"],
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended"
],
settings: {
react: {
version: "detect"
},
formComponents: ["Form"],
linkComponents: [
{ name: "Link", linkAttribute: "to" },
{ name: "NavLink", linkAttribute: "to" }
],
"import/resolver": {
typescript: {}
}
}
},
},
},

// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"],
},
typescript: {
alwaysTryTypes: true,
},
// Typescript
{
files: ["**/*.{ts,tsx}"],
plugins: ["@typescript-eslint", "import"],
parser: "@typescript-eslint/parser",
settings: {
"import/internal-regex": "^~/",
"import/resolver": {
node: {
extensions: [".ts", ".tsx"]
},
typescript: {
alwaysTryTypes: true
}
}
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
]
},
},
extends: [
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
},

// Node
{
files: [".eslintrc.js"],
env: {
node: true,
},
},
],
// Node
{
files: [".eslintrc.js"],
env: {
node: true
}
}
]
};
34 changes: 17 additions & 17 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration
} from "@remix-run/react";

import "~/styles/tailwind.css";

export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
</body>
</html>
);
</body>
</html>
);
}
8 changes: 4 additions & 4 deletions app/routes/api.issues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import type { RepoIssues, GitHubLoaderData } from "~/types/github";
const CONFIG = {
OWNER: "zufall-labs",
CACHE_DURATION: 5 * 60 * 1000, // 5 Minutes
GITHUB_API_BASE: "https://api.github.com",
GITHUB_API_BASE: "https://api.github.com"
} as const;

const envSchema = z.object({
REPOSITORIES: z.string().transform(str => str.split(",").map(s => s.trim())),
SECRET_ACCESS_TOKEN: z.string().min(1, "GitHub token is required"),
SECRET_ACCESS_TOKEN: z.string().min(1, "GitHub token is required")
});

let cachedData: RepoIssues[] | null = null;
Expand All @@ -23,8 +23,8 @@ const fetchRepoIssues = async (repo: string, token: string) => {
{
headers: {
"Authorization": `token ${token}`,
"Accept": "application/vnd.github.v3+json",
},
"Accept": "application/vnd.github.v3+json"
}
}
);

Expand Down
12 changes: 6 additions & 6 deletions app/routes/apitest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const loader: LoaderFunction = async ({ request }) => {
const data = await response.json();
return json<GitHubLoaderData>(data);
} catch (error) {
console.error('Error fetching issues:', error);
console.error("Error fetching issues:", error);
return json<GitHubLoaderData>({ data: [] });
}
};
Expand Down Expand Up @@ -44,10 +44,10 @@ export default function APITest() {
>
{issue.title}
</a>
<span className={`ml-2 px-2 py-1 text-sm rounded-full ${issue.state === 'open'
? 'bg-green-100 text-green-800'
: 'bg-gray-100 text-gray-800'
}`}>
<span className={`ml-2 px-2 py-1 text-sm rounded-full ${issue.state === "open"
? "bg-green-100 text-green-800"
: "bg-gray-100 text-gray-800"
}`}>
{issue.state}
</span>
</li>
Expand All @@ -58,4 +58,4 @@ export default function APITest() {
))}
</div>
);
}
}
1 change: 1 addition & 0 deletions app/styles/tailwind.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import "../../public/fonts/stylesheet.css";

@tailwind base;
@tailwind components;
@tailwind utilities;
4 changes: 2 additions & 2 deletions app/types/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface GitHubIssue {
id: number;
number: number;
title: string;
state: 'open' | 'closed';
state: "open" | "closed";
created_at: string;
updated_at: string;
html_url: string;
Expand All @@ -15,4 +15,4 @@ export interface RepoIssues {

export interface GitHubLoaderData {
data: RepoIssues[];
}
}
6 changes: 3 additions & 3 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
autoprefixer: {}
}
};
48 changes: 24 additions & 24 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import type { Config } from 'tailwindcss'
import type { Config } from "tailwindcss";

export default {
content: [
"./app/**/{**,.client,.server}/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {
fontFamily: {
'helvetica-now': [
'Helvetica Now Display',
'sans-serif',
],
},
fontWeight: {
'thin': '100',
'light': '300',
'normal': '400',
'medium': '500',
'bold': '700',
'extra-bold': '800',
'black': '900',
}
content: [
"./app/**/{**,.client,.server}/**/*.{js,jsx,ts,tsx}"
],
theme: {
extend: {
fontFamily: {
"helvetica-now": [
"Helvetica Now Display",
"sans-serif"
]
},
fontWeight: {
"thin": "100",
"light": "300",
"normal": "400",
"medium": "500",
"bold": "700",
"extra-bold": "800",
"black": "900"
}
}
},
},
plugins: [],
} satisfies Config
plugins: []
} satisfies Config;
17 changes: 14 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"include": ["env.d.ts", "**/*.ts", "**/*.tsx", "netlify-edge-plugin.ts"],
"include": [
"env.d.ts",
"**/*.ts",
"**/*.tsx",
"netlify-edge-plugin.ts"
],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"lib": [
"DOM",
"DOM.Iterable",
"ES2022"
],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
Expand All @@ -15,7 +24,9 @@
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
"~/*": [
"./app/*"
]
},
// Vite takes care of building everything, not tsc.
"noEmit": true
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import tsconfigPaths from "vite-tsconfig-paths";
import { netlifyPlugin } from "@netlify/remix-adapter/plugin";

export default defineConfig({
plugins: [remix(), netlifyPlugin(), tsconfigPaths()],
plugins: [remix(), netlifyPlugin(), tsconfigPaths()]
});

0 comments on commit 7c1adb0

Please sign in to comment.