Skip to content

Commit a06f857

Browse files
authored
Prettier + ESLint + VS Code setup (#53)
* feat: vscode development config added * feat: prettier config added * feat: eslint config extended with tailwind, prettier, a11y * fix: all files linted and formatted * BackToTop: prefers smooth motion and aria labels * Email Subscription: <label> and aria labels added * RecentPosts: aria label added
1 parent 9c2073c commit a06f857

File tree

100 files changed

+4800
-4496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+4800
-4496
lines changed

.eslintrc.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
{
2-
"extends": "next/core-web-vitals",
3-
"root": true
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended",
5+
"plugin:prettier/recommended",
6+
"plugin:jsx-a11y/recommended",
7+
"plugin:tailwindcss/recommended",
8+
"next/core-web-vitals",
9+
"next"
10+
],
11+
"plugins": ["jsx-a11y", "tailwindcss"],
12+
"rules": {
13+
"@next/next/no-img-element": "off",
14+
"tailwindcss/no-custom-classname": [
15+
"warn",
16+
{
17+
"whitelist": [
18+
"mermaid",
19+
"skeleton-shimmer",
20+
"similar-tools",
21+
"text-destructive-foreground",
22+
"bg-destructive",
23+
"bg-destructive/80",
24+
"bg-destructive/90",
25+
"hover:bg-destructive/80",
26+
"hover:bg-destructive/90"
27+
]
28+
}
29+
]
30+
}
431
}

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.cache
2+
.next
3+
package.json
4+
package-lock.json
5+
public

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"endOfLine": "lf",
3+
"semi": false,
4+
"singleQuote": false,
5+
"tabWidth": 2,
6+
"trailingComma": "es5"
7+
}

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"bradlc.vscode-tailwindcss",
6+
"csstools.postcss"
7+
]
8+
}

.vscode/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.formatOnPaste": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode",
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll": "explicit"
7+
},
8+
"emmet.includeLanguages": {
9+
"javascript": "javascriptreact",
10+
"typescript": "typescriptreact"
11+
},
12+
"javascript.updateImportsOnFileMove.enabled": "always",
13+
"typescript.updateImportsOnFileMove.enabled": "always"
14+
}

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99
![Neon vs Supabase](public/images/img_4.png)
1010

11-
| Blog Post | Featured On | Description |
12-
| --- | --- |---------------------------------------------------------------------------------|
13-
| [Neon Postgres vs. Supabase](https://www.devtoolsacademy.com/blog/neon-vs-supabase) | Hacker News | Made it to the second page of Hacker News |
14-
| [Serverless Databases](https://www.devtoolsacademy.com/blog/state-of-databases-2024) | Hashnode | Featured on [Hashnode](https://theankurtyagi.hashnode.dev/serverless-databases) |
11+
| Blog Post | Featured On | Description |
12+
| ------------------------------------------------------------------------------------ | ---------------- | ------------------------------------------------------------------------------- |
13+
| [Neon Postgres vs. Supabase](https://www.devtoolsacademy.com/blog/neon-vs-supabase) | Hacker News | Made it to the second page of Hacker News |
14+
| [Serverless Databases](https://www.devtoolsacademy.com/blog/state-of-databases-2024) | Hashnode | Featured on [Hashnode](https://theankurtyagi.hashnode.dev/serverless-databases) |
1515
| [MongoDB vs. PostgreSQL](https://www.devtoolsacademy.com/blog/mongoDB-vs-postgreSQL) | DevTools Academy | What's the Difference Between MongoDB and PostgreSQL? |
16-
| [Supabase Auth vs. Clerk](https://www.devtoolsacademy.com/blog/supabase-vs-clerk) | DevTools Academy | A Deep Dive into Modern Auth SaaS Solutions |
16+
| [Supabase Auth vs. Clerk](https://www.devtoolsacademy.com/blog/supabase-vs-clerk) | DevTools Academy | A Deep Dive into Modern Auth SaaS Solutions |
1717

1818
## 🚀 Quick Start
1919

@@ -59,9 +59,11 @@ Have questions or suggestions? Open an issue or reach out to me at [hello@theank
5959
## 📄 License
6060

6161
This project is licensed under the Creative Commons License - see the [LICENSE](LICENSE) file for details.
62+
6263
- You are free to use this code as inspiration.
6364
- Please do not copy it directly.
6465
- Crediting the author is appreciated.
66+
6567
---
6668

6769
Let's build the go-to resource for developer tool space, together 🚀

global.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { PrismaClient } from '@prisma/client'
1+
import { PrismaClient } from "@prisma/client"
22

33
declare global {
4-
var prisma: PrismaClient | undefined
4+
var prisma: PrismaClient | undefined
55
}

middleware.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
1+
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server"
22

33
const isProtectedRoute = createRouteMatcher([
4-
"/dashboard(.*)",
5-
"/api/protected(.*)"
6-
]);
4+
"/dashboard(.*)",
5+
"/api/protected(.*)",
6+
])
77

88
export default clerkMiddleware((auth, req) => {
9-
if (isProtectedRoute(req)) {
10-
auth().protect();
11-
}
12-
});
9+
if (isProtectedRoute(req)) {
10+
auth().protect()
11+
}
12+
})
1313

1414
export const config = {
15-
matcher: [
16-
'/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
17-
'/(api|trpc)(.*)',
18-
],
19-
};
15+
matcher: [
16+
"/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)",
17+
"/(api|trpc)(.*)",
18+
],
19+
}

next.config.js

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
/** @type {import('next').NextConfig} */
22
const nextConfig = {
3-
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
4-
experimental: {
5-
mdxRs: true,
6-
},
7-
reactStrictMode: true,
8-
optimizeFonts: true,
9-
swcMinify: true,
10-
images: {
11-
remotePatterns: [
12-
{
13-
protocol: 'https',
14-
hostname: 'www.devtoolsacademy.com',
15-
port: '',
16-
pathname: '/**',
17-
},
3+
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
4+
experimental: {
5+
mdxRs: true,
6+
},
7+
reactStrictMode: true,
8+
optimizeFonts: true,
9+
swcMinify: true,
10+
images: {
11+
remotePatterns: [
12+
{
13+
protocol: "https",
14+
hostname: "www.devtoolsacademy.com",
15+
port: "",
16+
pathname: "/**",
17+
},
18+
],
19+
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
20+
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
21+
},
22+
async headers() {
23+
return [
24+
{
25+
source: "/(.*)",
26+
headers: [
27+
{
28+
key: "Cache-Control",
29+
value: "public, max-age=3600, must-revalidate",
30+
},
31+
{
32+
key: "X-Frame-Options",
33+
value: "DENY",
34+
},
35+
{
36+
key: "X-Content-Type-Options",
37+
value: "nosniff",
38+
},
1839
],
19-
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
20-
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
21-
},
22-
async headers() {
23-
return [
24-
{
25-
source: '/(.*)',
26-
headers: [
27-
{
28-
key: 'Cache-Control',
29-
value: 'public, max-age=3600, must-revalidate',
30-
},
31-
{
32-
key: 'X-Frame-Options',
33-
value: 'DENY',
34-
},
35-
{
36-
key: 'X-Content-Type-Options',
37-
value: 'nosniff',
38-
},
39-
],
40-
},
41-
];
42-
},
43-
webpack: (config, { dev, isServer }) => {
44-
if (!dev && !isServer) {
45-
config.optimization.splitChunks.cacheGroups.styles = {
46-
name: 'styles',
47-
test: /\.(css|scss)$/,
48-
chunks: 'all',
49-
enforce: true,
50-
};
51-
}
52-
if (dev) {
53-
config.devtool = 'eval-source-map';
54-
}
55-
return config;
56-
},
57-
};
40+
},
41+
]
42+
},
43+
webpack: (config, { dev, isServer }) => {
44+
if (!dev && !isServer) {
45+
config.optimization.splitChunks.cacheGroups.styles = {
46+
name: "styles",
47+
test: /\.(css|scss)$/,
48+
chunks: "all",
49+
enforce: true,
50+
}
51+
}
52+
if (dev) {
53+
config.devtool = "eval-source-map"
54+
}
55+
return config
56+
},
57+
}
5858

59-
const withMDX = require('@next/mdx')();
60-
module.exports = withMDX(nextConfig);
59+
const withMDX = require("@next/mdx")()
60+
module.exports = withMDX(nextConfig)

0 commit comments

Comments
 (0)