Skip to content

Commit 57a9ef9

Browse files
committed
Add biome js
Biome é um formatador e linter com suporte para js (inclui jsx), css e json. Comparado ao prettier ele é mais rápido Quando estava trabalhando no protótipo do blog observei que tinha inconsistência na codebase. As vezes usava singlequote ou doblequote, indentação, espaço. Adicionei uma action para verificar a formatação no ci. Desativei o linter porque ele implica em alteração na semântica do código js. Nesse PR já tem muita alteração, acho melhor fazer em outro PR as correções do linter. Também desativei a formatação para arquivos css e json. Alguns arquivos json estão vazios o que torna eles inválidos.
1 parent 3135528 commit 57a9ef9

File tree

254 files changed

+14505
-10025
lines changed

Some content is hidden

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

254 files changed

+14505
-10025
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
ci:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install dependencies
14+
run: npm ci
15+
working-directory: next
16+
17+
- name: Run Biome format check
18+
run: ./node_modules/.bin/biome format .
19+
working-directory: next

next/axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ export const setAccessToken = (token) => {
3636
if (!token || token === "null")
3737
return (axiosInstance.defaults.headers.common["Authorization"] = null);
3838
axiosInstance.defaults.headers.common["Authorization"] = `Token ${token}`;
39-
};
39+
};

next/biome.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "space",
15+
"ignore": [".next/"]
16+
},
17+
"organizeImports": {
18+
"enabled": true
19+
},
20+
"linter": {
21+
"enabled": false,
22+
"ignore": [".next/"],
23+
"rules": {
24+
"recommended": true
25+
}
26+
},
27+
"javascript": {
28+
"formatter": {
29+
"enabled": true
30+
}
31+
},
32+
"json": {
33+
"formatter": {
34+
"enabled": false
35+
}
36+
},
37+
"css": {
38+
"linter": {
39+
"enabled": false
40+
},
41+
"formatter": {
42+
"enabled": false
43+
}
44+
}
45+
}

next/components/atoms/Button.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
Box,
3-
} from "@chakra-ui/react";
1+
import { Box } from "@chakra-ui/react";
42

53
export default function Button({ children, onClick, ...props }) {
64
return (
@@ -23,11 +21,11 @@ export default function Button({ children, onClick, ...props }) {
2321
gap="8px"
2422
lineHeight="20px"
2523
_hover={{
26-
backgroundColor:"#22703E"
24+
backgroundColor: "#22703E",
2725
}}
2826
{...props}
2927
>
3028
{children}
3129
</Box>
32-
)
33-
}
30+
);
31+
}

next/components/atoms/Carousel.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
import { Swiper, SwiperSlide } from "swiper/react";
22
import { Navigation, Pagination, Autoplay, Mousewheel } from "swiper";
33

4-
54
import "swiper/css";
65
import "swiper/css/navigation";
76
import "swiper/css/pagination";
87
import "swiper/css/autoplay";
98

109
export default function Carousel({ settings, children }) {
1110
return (
12-
<Swiper modules={[Navigation, Pagination, Autoplay, Mousewheel]} {...settings}>
13-
{children && children.map((elm, i)=> {
14-
return (
15-
<SwiperSlide key={i}>
16-
{elm}
17-
</SwiperSlide>
18-
)
19-
})}
11+
<Swiper
12+
modules={[Navigation, Pagination, Autoplay, Mousewheel]}
13+
{...settings}
14+
>
15+
{children &&
16+
children.map((elm, i) => {
17+
return <SwiperSlide key={i}>{elm}</SwiperSlide>;
18+
})}
2019
</Swiper>
21-
)
22-
}
20+
);
21+
}
Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import { Image } from "@chakra-ui/react";
22

33
export function CategoryIcon({ url, active, size = "50px", ...style }) {
4-
return (
5-
<Image
6-
width={size}
7-
height={size}
8-
border="0px"
9-
src={url}
10-
{...style}
11-
/>
12-
);
4+
return <Image width={size} height={size} border="0px" src={url} {...style} />;
135
}

next/components/atoms/Checkbox.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import {
2-
Checkbox,
3-
Icon
4-
} from '@chakra-ui/react';
1+
import { Checkbox, Icon } from "@chakra-ui/react";
52

6-
function CustomCheckbockIcon({ variant, isIndeterminate, isChecked, ...props }) {
3+
function CustomCheckbockIcon({
4+
variant,
5+
isIndeterminate,
6+
isChecked,
7+
...props
8+
}) {
79
function variantIcon() {
8-
if(isIndeterminate) return "M5.06135 11.0002C4.76599 11.0002 4.51496 10.9029 4.30826 10.7084C4.10157 10.514 3.99823 10.2778 3.99823 9.99984C3.99823 9.72193 4.10157 9.48573 4.30826 9.29124C4.51496 9.09676 4.76599 8.99951 5.06135 8.99951H14.9391C15.2344 8.99951 15.4855 9.09676 15.6922 9.29124C15.8988 9.48573 16.0022 9.72193 16.0022 9.99984C16.0022 10.2778 15.8988 10.514 15.6922 10.7084C15.4855 10.9029 15.2344 11.0002 14.9391 11.0002H5.06135Z"
9-
return "M7.17894 10.9259L13.306 4.7988C13.5043 4.60057 13.7378 4.50146 14.0068 4.50146C14.2758 4.50146 14.5094 4.60057 14.7076 4.7988C14.9058 4.99702 15.0049 5.23196 15.0049 5.50364C15.0049 5.7753 14.9058 6.01024 14.7076 6.20846L7.87972 13.0444C7.6815 13.2427 7.44791 13.3418 7.17894 13.3418C6.90998 13.3418 6.67639 13.2427 6.47817 13.0444L3.2943 9.86058C3.09609 9.66236 2.99834 9.42742 3.00103 9.15576C3.00373 8.88408 3.10418 8.64914 3.30241 8.45091C3.50063 8.25269 3.73557 8.15358 4.00725 8.15358C4.27891 8.15358 4.51385 8.25269 4.71207 8.45091L7.17894 10.9259Z"
10+
if (isIndeterminate)
11+
return "M5.06135 11.0002C4.76599 11.0002 4.51496 10.9029 4.30826 10.7084C4.10157 10.514 3.99823 10.2778 3.99823 9.99984C3.99823 9.72193 4.10157 9.48573 4.30826 9.29124C4.51496 9.09676 4.76599 8.99951 5.06135 8.99951H14.9391C15.2344 8.99951 15.4855 9.09676 15.6922 9.29124C15.8988 9.48573 16.0022 9.72193 16.0022 9.99984C16.0022 10.2778 15.8988 10.514 15.6922 10.7084C15.4855 10.9029 15.2344 11.0002 14.9391 11.0002H5.06135Z";
12+
return "M7.17894 10.9259L13.306 4.7988C13.5043 4.60057 13.7378 4.50146 14.0068 4.50146C14.2758 4.50146 14.5094 4.60057 14.7076 4.7988C14.9058 4.99702 15.0049 5.23196 15.0049 5.50364C15.0049 5.7753 14.9058 6.01024 14.7076 6.20846L7.87972 13.0444C7.6815 13.2427 7.44791 13.3418 7.17894 13.3418C6.90998 13.3418 6.67639 13.2427 6.47817 13.0444L3.2943 9.86058C3.09609 9.66236 2.99834 9.42742 3.00103 9.15576C3.00373 8.88408 3.10418 8.64914 3.30241 8.45091C3.50063 8.25269 3.73557 8.15358 4.00725 8.15358C4.27891 8.15358 4.51385 8.25269 4.71207 8.45091L7.17894 10.9259Z";
1013
}
1114

1215
return (
@@ -19,16 +22,21 @@ function CustomCheckbockIcon({ variant, isIndeterminate, isChecked, ...props })
1922
viewBox={isIndeterminate ? "0 0 16 18" : "0 0 18 18"}
2023
_focus={{
2124
boxShadow: "none",
22-
outline: "none"
25+
outline: "none",
2326
}}
2427
{...props}
2528
>
2629
<path fill="currentColor" d={variantIcon()} />
2730
</Icon>
28-
)
31+
);
2932
}
3033

31-
export default function CustomCheckbox({ children, hasIndeterminate = false , icon, ...props}) {
34+
export default function CustomCheckbox({
35+
children,
36+
hasIndeterminate = false,
37+
icon,
38+
...props
39+
}) {
3240
return (
3341
<Checkbox
3442
width="20px"
@@ -44,16 +52,12 @@ export default function CustomCheckbox({ children, hasIndeterminate = false , ic
4452
}}
4553
_focus={{
4654
boxShadow: "none",
47-
outline: "none"
55+
outline: "none",
4856
}}
49-
icon={
50-
<CustomCheckbockIcon
51-
{...icon}
52-
/>
53-
}
57+
icon={<CustomCheckbockIcon {...icon} />}
5458
{...props}
5559
>
5660
{children}
5761
</Checkbox>
58-
)
59-
}
62+
);
63+
}

next/components/atoms/ControlledInput.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
InputGroup,
44
InputRightAddon,
55
InputRightElement,
6-
InputLeftElement
6+
InputLeftElement,
77
} from "@chakra-ui/react";
88
import { useEffect, useState } from "react";
99

@@ -36,20 +36,20 @@ export function ControlledInput({
3636
onChange={(e) => onChange(e.target.value)}
3737
onKeyDown={checkForEnter}
3838
variant="outline"
39-
padding={{base: "24px 48px 24px 20px", lg: "24px 64px 24px 32px"}}
40-
height={{base: "50px", lg: "80px"}}
39+
padding={{ base: "24px 48px 24px 20px", lg: "24px 64px 24px 32px" }}
40+
height={{ base: "50px", lg: "80px" }}
4141
backgroundColor="#FFFFFF"
42-
borderRadius={{base: "18px", lg: "25px"}}
42+
borderRadius={{ base: "18px", lg: "25px" }}
4343
placeholder={placeholder}
4444
_placeholder={{
45-
color: "#717571"
45+
color: "#717571",
4646
}}
4747
boxShadow="0 1px 8px 1px rgba(64, 60, 67, 0.16) !important"
4848
border="0"
4949
fontFamily="Roboto"
5050
fontWeight="400"
51-
fontSize={{base: "16px", lg: "20px"}}
52-
lineHeight={{base: "24px", lg: "30px"}}
51+
fontSize={{ base: "16px", lg: "20px" }}
52+
lineHeight={{ base: "24px", lg: "30px" }}
5353
color="#252A32"
5454
{...inputStyle}
5555
/>
@@ -76,16 +76,18 @@ export function DebouncedSimpleControlledInput({
7676
fill,
7777
...props
7878
}) {
79-
const [skipFirstDebounced, setSkipFirstDebounced] = useState(true)
79+
const [skipFirstDebounced, setSkipFirstDebounced] = useState(true);
8080
const [_value, _setValue] = useState(value);
8181
const [_timeout, _setTimeout] = useState(null);
8282

8383
useEffect(() => {
8484
clearTimeout(_timeout);
85-
_setTimeout(setTimeout(() => {
86-
if(!skipFirstDebounced) onChange(_value)
87-
setSkipFirstDebounced(false)
88-
}, 1000));
85+
_setTimeout(
86+
setTimeout(() => {
87+
if (!skipFirstDebounced) onChange(_value);
88+
setSkipFirstDebounced(false);
89+
}, 1000),
90+
);
8991
}, [_value]);
9092

9193
useEffect(() => {
@@ -118,11 +120,11 @@ export function DebouncedSimpleControlledInput({
118120
border="2px solid transparent !important"
119121
color="#464A51"
120122
_hover={{
121-
border:"2px solid transparent !important",
122-
backgroundColor:"#DEDFE0",
123+
border: "2px solid transparent !important",
124+
backgroundColor: "#DEDFE0",
123125
}}
124126
_focus={{
125-
border:"2px solid #0068C5 !important",
127+
border: "2px solid #0068C5 !important",
126128
backgroundColor: "#FFF",
127129
}}
128130
paddingLeft="52px !important"
@@ -134,7 +136,7 @@ export function DebouncedSimpleControlledInput({
134136
fontFamily="Roboto"
135137
fontWeight="400"
136138
borderRadius="14px"
137-
_placeholder={{color: "#464A51", opacity: 1}}
139+
_placeholder={{ color: "#464A51", opacity: 1 }}
138140
{...inputStyle}
139141
/>
140142
</InputGroup>
@@ -191,11 +193,11 @@ export function ControlledInputSimple({
191193
border="2px solid transparent !important"
192194
color="#464A51"
193195
_hover={{
194-
border:"2px solid transparent !important",
195-
backgroundColor:"#DEDFE0",
196+
border: "2px solid transparent !important",
197+
backgroundColor: "#DEDFE0",
196198
}}
197199
_focus={{
198-
border:"2px solid #0068C5 !important",
200+
border: "2px solid #0068C5 !important",
199201
backgroundColor: "#FFF",
200202
}}
201203
paddingLeft="52px !important"
@@ -207,9 +209,9 @@ export function ControlledInputSimple({
207209
fontFamily="Roboto"
208210
fontWeight="400"
209211
borderRadius="14px"
210-
_placeholder={{color: "#464A51", opacity: 1}}
212+
_placeholder={{ color: "#464A51", opacity: 1 }}
211213
{...inputStyle}
212214
/>
213215
</InputGroup>
214-
)
215-
}
216+
);
217+
}

next/components/atoms/DatasetCardTag.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Link from './Link';
2-
import { Tag } from '@chakra-ui/react';
1+
import Link from "./Link";
2+
import { Tag } from "@chakra-ui/react";
33

44
export function DatasetCardTag({ slug, name, locale, ...props }) {
55
return (
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { useRouter } from 'next/router';
1+
import { useRouter } from "next/router";
22

33
export default function DomainComponent({ domains = [], children }) {
44
const router = useRouter();
5-
const hostname = typeof window !== 'undefined' ? window.location.hostname : '';
5+
const hostname =
6+
typeof window !== "undefined" ? window.location.hostname : "";
67

78
// Check if current hostname matches any of the allowed domains
89
const shouldRender = domains.includes(hostname);
910

1011
return shouldRender ? children : null;
11-
}
12+
}

0 commit comments

Comments
 (0)