Skip to content

Commit ca6b398

Browse files
committedFeb 1, 2024
chore: add eslint/prettier, import sorts
1 parent ac28a7b commit ca6b398

9 files changed

+2021
-90
lines changed
 

‎.eslintrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": [
3+
"@rocketseat/eslint-config/react"
4+
],
5+
"plugins": [
6+
"simple-import-sort"
7+
],
8+
"rules": {
9+
"simple-import-sort/imports": "error"
10+
}
11+
}

‎package.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
"tailwindcss-animate": "^1.0.7"
2121
},
2222
"devDependencies": {
23+
"@rocketseat/eslint-config": "^2.1.0",
2324
"@types/node": "^20.11.16",
2425
"@types/react": "^18.2.43",
2526
"@types/react-dom": "^18.2.17",
2627
"@vitejs/plugin-react": "^4.2.1",
2728
"autoprefixer": "^10.4.17",
29+
"eslint": "^8.56.0",
30+
"eslint-plugin-simple-import-sort": "^10.0.0",
2831
"postcss": "^8.4.33",
32+
"prettier-plugin-tailwindcss": "^0.5.11",
2933
"tailwindcss": "^3.4.1",
3034
"typescript": "^5.2.2",
3135
"vite": "^5.0.8"

‎pnpm-lock.yaml

+1,934-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎prettier.config.cjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['prettier-plugin-tailwindcss'],
3+
}

‎src/App.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import './global.css.css'
1+
import './global.css'
22

3-
export function App() {
3+
import { Button } from './components/ui/button'
44

5+
export function App() {
56
return (
6-
<>
7-
<h1>Hello World</h1>
8-
</>
7+
<div className="flex h-screen items-center justify-center">
8+
<Button>Enviar</Button>
9+
</div>
910
)
1011
}

‎src/components/ui/button.tsx

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
1+
/* eslint-disable prettier/prettier */
2+
import { Slot } from '@radix-ui/react-slot'
3+
import { cva, type VariantProps } from 'class-variance-authority'
4+
import * as React from 'react'
45

5-
import { cn } from "@/lib/utils"
6+
import { cn } from '@/lib/utils'
67

78
const buttonVariants = cva(
8-
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
9+
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
910
{
1011
variants: {
1112
variant: {
12-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13+
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
1314
destructive:
14-
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
15+
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
1516
outline:
16-
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17+
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
1718
secondary:
18-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19-
ghost: "hover:bg-accent hover:text-accent-foreground",
20-
link: "text-primary underline-offset-4 hover:underline",
19+
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
20+
ghost: 'hover:bg-accent hover:text-accent-foreground',
21+
link: 'text-primary underline-offset-4 hover:underline',
2122
},
2223
size: {
23-
default: "h-10 px-4 py-2",
24-
sm: "h-9 rounded-md px-3",
25-
lg: "h-11 rounded-md px-8",
26-
icon: "h-10 w-10",
24+
default: 'h-10 px-4 py-2',
25+
sm: 'h-9 rounded-md px-3',
26+
lg: 'h-11 rounded-md px-8',
27+
icon: 'h-10 w-10',
2728
},
2829
},
2930
defaultVariants: {
30-
variant: "default",
31-
size: "default",
31+
variant: 'default',
32+
size: 'default',
3233
},
33-
}
34+
},
3435
)
3536

3637
export interface ButtonProps
3738
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38-
VariantProps<typeof buttonVariants> {
39+
VariantProps<typeof buttonVariants> {
3940
asChild?: boolean
4041
}
4142

4243
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
4344
({ className, variant, size, asChild = false, ...props }, ref) => {
44-
const Comp = asChild ? Slot : "button"
45+
const Comp = asChild ? Slot : 'button'
4546
return (
4647
<Comp
4748
className={cn(buttonVariants({ variant, size, className }))}
4849
ref={ref}
4950
{...props}
5051
/>
5152
)
52-
}
53+
},
5354
)
54-
Button.displayName = "Button"
55+
Button.displayName = 'Button'
5556

5657
export { Button, buttonVariants }

‎src/lib/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { type ClassValue, clsx } from "clsx"
2-
import { twMerge } from "tailwind-merge"
1+
import { type ClassValue, clsx } from 'clsx'
2+
import { twMerge } from 'tailwind-merge'
33

44
export function cn(...inputs: ClassValue[]) {
55
return twMerge(clsx(inputs))

‎tailwind.config.js

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
11
/** @type {import('tailwindcss').Config} */
22
module.exports = {
3-
darkMode: ["class"],
3+
darkMode: ['class'],
44
content: [
55
'./pages/**/*.{ts,tsx}',
66
'./components/**/*.{ts,tsx}',
77
'./app/**/*.{ts,tsx}',
88
'./src/**/*.{ts,tsx}',
99
],
10-
prefix: "",
10+
prefix: '',
1111
theme: {
1212
container: {
1313
center: true,
14-
padding: "2rem",
14+
padding: '2rem',
1515
screens: {
16-
"2xl": "1400px",
16+
'2xl': '1400px',
1717
},
1818
},
1919
extend: {
2020
colors: {
21-
border: "hsl(var(--border))",
22-
input: "hsl(var(--input))",
23-
ring: "hsl(var(--ring))",
24-
background: "hsl(var(--background))",
25-
foreground: "hsl(var(--foreground))",
21+
border: 'hsl(var(--border))',
22+
input: 'hsl(var(--input))',
23+
ring: 'hsl(var(--ring))',
24+
background: 'hsl(var(--background))',
25+
foreground: 'hsl(var(--foreground))',
2626
primary: {
27-
DEFAULT: "hsl(var(--primary))",
28-
foreground: "hsl(var(--primary-foreground))",
27+
DEFAULT: 'hsl(var(--primary))',
28+
foreground: 'hsl(var(--primary-foreground))',
2929
},
3030
secondary: {
31-
DEFAULT: "hsl(var(--secondary))",
32-
foreground: "hsl(var(--secondary-foreground))",
31+
DEFAULT: 'hsl(var(--secondary))',
32+
foreground: 'hsl(var(--secondary-foreground))',
3333
},
3434
destructive: {
35-
DEFAULT: "hsl(var(--destructive))",
36-
foreground: "hsl(var(--destructive-foreground))",
35+
DEFAULT: 'hsl(var(--destructive))',
36+
foreground: 'hsl(var(--destructive-foreground))',
3737
},
3838
muted: {
39-
DEFAULT: "hsl(var(--muted))",
40-
foreground: "hsl(var(--muted-foreground))",
39+
DEFAULT: 'hsl(var(--muted))',
40+
foreground: 'hsl(var(--muted-foreground))',
4141
},
4242
accent: {
43-
DEFAULT: "hsl(var(--accent))",
44-
foreground: "hsl(var(--accent-foreground))",
43+
DEFAULT: 'hsl(var(--accent))',
44+
foreground: 'hsl(var(--accent-foreground))',
4545
},
4646
popover: {
47-
DEFAULT: "hsl(var(--popover))",
48-
foreground: "hsl(var(--popover-foreground))",
47+
DEFAULT: 'hsl(var(--popover))',
48+
foreground: 'hsl(var(--popover-foreground))',
4949
},
5050
card: {
51-
DEFAULT: "hsl(var(--card))",
52-
foreground: "hsl(var(--card-foreground))",
51+
DEFAULT: 'hsl(var(--card))',
52+
foreground: 'hsl(var(--card-foreground))',
5353
},
5454
},
5555
borderRadius: {
56-
lg: "var(--radius)",
57-
md: "calc(var(--radius) - 2px)",
58-
sm: "calc(var(--radius) - 4px)",
56+
lg: 'var(--radius)',
57+
md: 'calc(var(--radius) - 2px)',
58+
sm: 'calc(var(--radius) - 4px)',
5959
},
6060
keyframes: {
61-
"accordion-down": {
62-
from: { height: "0" },
63-
to: { height: "var(--radix-accordion-content-height)" },
61+
'accordion-down': {
62+
from: { height: '0' },
63+
to: { height: 'var(--radix-accordion-content-height)' },
6464
},
65-
"accordion-up": {
66-
from: { height: "var(--radix-accordion-content-height)" },
67-
to: { height: "0" },
65+
'accordion-up': {
66+
from: { height: 'var(--radix-accordion-content-height)' },
67+
to: { height: '0' },
6868
},
6969
},
7070
animation: {
71-
"accordion-down": "accordion-down 0.2s ease-out",
72-
"accordion-up": "accordion-up 0.2s ease-out",
71+
'accordion-down': 'accordion-down 0.2s ease-out',
72+
'accordion-up': 'accordion-up 0.2s ease-out',
7373
},
7474
},
7575
},
76-
plugins: [require("tailwindcss-animate")],
77-
}
76+
plugins: [require('tailwindcss-animate')],
77+
}

‎vite.config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
3-
import path from "node:path"
3+
import path from 'node:path'
44

55
// https://vitejs.dev/config/
66
export default defineConfig({
77
plugins: [react()],
88
resolve: {
99
alias: {
10-
"@": path.resolve(__dirname, "./src"),
10+
'@': path.resolve(__dirname, './src'),
1111
},
1212
},
1313
})

0 commit comments

Comments
 (0)
Please sign in to comment.