Skip to content

Commit b25d1dd

Browse files
committed
chore(linting): add prettier, husky, lint-staged
1 parent d77f261 commit b25d1dd

38 files changed

+380
-287
lines changed

Diff for: .eslintrc.cjs

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ module.exports = {
22
root: true,
33
env: { browser: true, es2020: true },
44
extends: [
5-
'eslint:recommended',
6-
'plugin:react/recommended',
7-
'plugin:react/jsx-runtime',
8-
'plugin:react-hooks/recommended',
5+
"eslint:recommended",
6+
"plugin:react/recommended",
7+
"plugin:react/jsx-runtime",
8+
"plugin:react-hooks/recommended",
99
],
10-
ignorePatterns: ['dist', '.eslintrc.cjs'],
11-
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12-
settings: { react: { version: '18.2' } },
13-
plugins: ['react-refresh'],
10+
ignorePatterns: ["dist", ".eslintrc.cjs"],
11+
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
12+
settings: { react: { version: "18.2" } },
13+
plugins: ["react-refresh"],
1414
rules: {
15-
'react-refresh/only-export-components': [
16-
'warn',
15+
"react-refresh/only-export-components": [
16+
"warn",
1717
{ allowConstantExport: true },
1818
],
1919
},

Diff for: .github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy to GitHub Pages
33
on:
44
# Runs on pushes targeting the default branch
55
push:
6-
branches: ['main', 'temp']
6+
branches: ["main", "temp"]
77

88
# Allows you to run this workflow manually from the Actions tab
99
workflow_dispatch:
@@ -16,7 +16,7 @@ permissions:
1616

1717
# Allow one concurrent deployment
1818
concurrency:
19-
group: 'pages'
19+
group: "pages"
2020
cancel-in-progress: true
2121

2222
jobs:
@@ -63,7 +63,7 @@ jobs:
6363
uses: actions/upload-pages-artifact@v1
6464
with:
6565
# Upload dist repository
66-
path: './dist'
66+
path: "./dist"
6767
- name: Deploy to GitHub Pages
6868
id: deployment
69-
uses: actions/deploy-pages@v1
69+
uses: actions/deploy-pages@v1

Diff for: .husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

Diff for: .prettierignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
dist
2+
build
3+
coverage
4+
.husky
5+
.huskyrc
6+
*.lockb
7+
8+
*.png
9+
*.jpg
10+
*.jpeg
11+
*.webp
12+
*.ico
13+
14+
.gitignore
15+
.prettierignore
16+
LICENSE
17+
18+
19+
.next
20+
.cache
21+
package-lock.json
22+
public
23+
node_modules
24+
next-env.d.ts
25+
next.config.ts
26+
yarn.lock

Diff for: .prettierrc.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bracketSpacing: true
2+
endOfLine: lf
3+
printWidth: 80
4+
semi: false
5+
singleQuote: false
6+
trailingComma: all
7+
8+
overrides:
9+
- files: "*.svg"
10+
options:
11+
parser: "html"
12+
- files: "*.xml"
13+
options:
14+
parser: "html"

Diff for: index.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -9,7 +9,10 @@
99
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
1010
rel="stylesheet"
1111
/>
12-
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
12+
<link
13+
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
14+
rel="stylesheet"
15+
/>
1316
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
1417
<title>ALiAS</title>
1518
</head>

Diff for: package.json

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
9-
"upload" : "gh-pages -d dist",
109
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
11-
"preview": "vite preview"
10+
"preview": "vite preview",
11+
"check": "prettier --check \"**/*\"",
12+
"format": "prettier --write \"**/*\"",
13+
"prepare": "husky"
1214
},
1315
"dependencies": {
1416
"gh-pages": "^6.0.0",
@@ -23,6 +25,19 @@
2325
"eslint-plugin-react": "^7.32.2",
2426
"eslint-plugin-react-hooks": "^4.6.0",
2527
"eslint-plugin-react-refresh": "^0.4.3",
28+
"eslint-config-prettier": "^9.1.0",
29+
"eslint-plugin-prettier": "^5.1.3",
30+
"husky": "^9.0.11",
31+
"lint-staged": "^15.2.2",
32+
"prettier": "^3.2.5",
2633
"vite": "^4.4.5"
34+
},
35+
"husky": {
36+
"hooks": {
37+
"pre-commit": "lint-staged"
38+
}
39+
},
40+
"lint-staged": {
41+
"**/*": "prettier --write --ignore-unknown"
2742
}
2843
}

Diff for: src/App.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import './App.css'
2-
import Home from './pages/Home/Home'
1+
import "./App.css"
2+
import Home from "./pages/Home/Home"
33

44
function App() {
5-
65
return (
76
<>
87
<Home />

Diff for: src/components/AboutUs/AboutUs.jsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { useState, useEffect } from "react";
2-
import AboutItem from "../Reusables/AboutItem/AboutItem";
3-
import styles from "./AboutUs.module.css";
1+
import { useState, useEffect } from "react"
2+
import AboutItem from "../Reusables/AboutItem/AboutItem"
3+
import styles from "./AboutUs.module.css"
44

55
/**
66
* Fetches data from "/data/about.json" and sets the fetched data in the component's state.
77
*
88
* @return {JSX.Element} The rendered AboutUs component.
99
*/
1010
const AboutUs = () => {
11-
const [data, setData] = useState([]);
11+
const [data, setData] = useState([])
1212

13-
useEffect( () => {
14-
fetchData();
15-
}, []);
13+
useEffect(() => {
14+
fetchData()
15+
}, [])
1616

1717
async function fetchData() {
18-
const response = await fetch("data/about.json");
19-
const data = await response.json();
20-
setData(data);
18+
const response = await fetch("data/about.json")
19+
const data = await response.json()
20+
setData(data)
2121
}
2222

2323
return (
@@ -34,11 +34,11 @@ const AboutUs = () => {
3434
title={item.title}
3535
description={item.description}
3636
/>
37-
);
37+
)
3838
})}
3939
</div>
4040
</div>
41-
);
42-
};
41+
)
42+
}
4343

44-
export default AboutUs;
44+
export default AboutUs

Diff for: src/components/AboutUs/AboutUs.module.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@
2727
.aboutus__container {
2828
flex-direction: column;
2929
align-items: center;
30-
margin: var(--margin-medium)
30+
margin: var(--margin-medium);
3131
}
3232
}
3333

34-
3534
@media screen and (max-width: 430px) {
3635
.aboutus__container {
3736
flex-direction: column;

Diff for: src/components/Alumni/Alumni.jsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import { useState, useEffect } from "react";
2-
import styles from "./Alumni.module.css";
3-
import Carousel from "../Reusables/Carousel/Carousel";
4-
import AlumniItem from "../Reusables/AlumniItem/AlumniItem";
1+
import { useState, useEffect } from "react"
2+
import styles from "./Alumni.module.css"
3+
import Carousel from "../Reusables/Carousel/Carousel"
4+
import AlumniItem from "../Reusables/AlumniItem/AlumniItem"
55

66
/**
77
* Fetches data from "/data/alumni.json" and sets the fetched data in the component's state.
88
*
99
* @return {JSX.Element} The rendered Alumni component.
1010
*/
1111
const Alumni = () => {
12-
const [data, setData] = useState([]);
12+
const [data, setData] = useState([])
1313

1414
useEffect(() => {
15-
fetchData();
16-
}, []);
15+
fetchData()
16+
}, [])
1717

1818
async function fetchData() {
19-
const response = await fetch("data/alumni.json");
20-
const data = await response.json();
21-
setData(data);
19+
const response = await fetch("data/alumni.json")
20+
const data = await response.json()
21+
setData(data)
2222
}
2323

2424
return (
@@ -38,11 +38,11 @@ const Alumni = () => {
3838
quote={item.quote}
3939
socials={item.social}
4040
/>
41-
);
41+
)
4242
})}
4343
/>
4444
</div>
45-
);
46-
};
45+
)
46+
}
4747

48-
export default Alumni;
48+
export default Alumni

Diff for: src/components/Alumni/Alumni.module.css

+1-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
--items: 2;
77
}
88

9-
109
.alumni__title {
1110
color: white;
1211
font-weight: 800;
@@ -20,14 +19,13 @@
2019
color: transparent;
2120
}
2221

23-
2422
@media screen and (max-width: 1400px) {
2523
.alumni {
2624
--items: 1.8;
2725
}
2826
}
2927

30-
@media screen and (max-width: 1315px ) {
28+
@media screen and (max-width: 1315px) {
3129
.alumni {
3230
--items: 1.65;
3331
}
@@ -49,16 +47,10 @@
4947
.alumni {
5048
--items: 1.2;
5149
}
52-
5350
}
5451

5552
@media screen and (max-width: 1024px) {
5653
.alumni {
5754
--items: 1;
5855
}
5956
}
60-
61-
62-
63-
64-

Diff for: src/components/Community/Community.jsx

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useState, useEffect } from "react";
2-
import styles from "./Community.module.css";
1+
import { useState, useEffect } from "react"
2+
import styles from "./Community.module.css"
33

44
/**
55
* @return {JSX.Element} The rendered Community component.
@@ -9,7 +9,11 @@ const Community = () => {
99
<div id="community" className={styles.community}>
1010
<h1 className={styles.community__title}>
1111
Our
12-
<span className={styles.community__title_highlight}> Community</span> Partners!
12+
<span className={styles.community__title_highlight}>
13+
{" "}
14+
Community
15+
</span>{" "}
16+
Partners!
1317
</h1>
1418
<div className={styles.powered}>
1519
<a href="https://pydelhi.org" target="_blank" rel="no noreferrer">
@@ -32,8 +36,8 @@ const Community = () => {
3236
src="assets/images/communities/ilugd.png"
3337
alt="India Linux User Group"
3438
/>
35-
</a>
36-
<a href="https://fossunited.org/" target="_blank" rel="no noreferrer">
39+
</a>
40+
<a href="https://fossunited.org/" target="_blank" rel="no noreferrer">
3741
<img
3842
className={styles.community__chapter}
3943
src="assets/images/communities/foss-united.png"
@@ -49,7 +53,7 @@ const Community = () => {
4953
</a>
5054
</div>
5155
</div>
52-
);
53-
};
56+
)
57+
}
5458

55-
export default Community;
59+
export default Community

Diff for: src/components/Community/Community.module.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@
7171
width: 70%;
7272
margin: var(--margin-medium) 0;
7373
}
74-
}
74+
}

0 commit comments

Comments
 (0)