Skip to content

Commit d901a43

Browse files
tzmanicsTara Z Manicsic
andauthored
chore: adds prettier and linting (#11)
* adds lint command and eslintrc.json * adds prettier * makes formatting changes from prettier Co-authored-by: Tara Z Manicsic <tzmanics@MacBook-Pro.local>
1 parent f5d7594 commit d901a43

File tree

19 files changed

+1733
-1807
lines changed

19 files changed

+1733
-1807
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["next/core-web-vitals", "prettier"]
3+
}

.prettierrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
printWidth: 80,
3+
semi: true,
4+
singleQuote: true,
5+
tabWidth: 2,
6+
useTabs: false,
7+
};

components/ArrowIcon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export default function ArrowIcon({ className, color = "text-primary" }) {
1+
export default function ArrowIcon({ className, color = 'text-primary' }) {
22
return (
33
<svg
44
xmlns="http://www.w3.org/2000/svg"

components/CustomLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Link from "next/link";
1+
import Link from 'next/link';
22

33
export default function CustomLink({ as, href, ...otherProps }) {
44
return (

components/Footer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ const ThemeSwitcher = () => {
5454
type="button"
5555
aria-label="Use Dark Mode"
5656
onClick={() => {
57-
document.documentElement.classList.add("dark");
58-
localStorage.setItem("theme", "dark");
57+
document.documentElement.classList.add('dark');
58+
localStorage.setItem('theme', 'dark');
5959
}}
6060
className="flex items-center h-full pr-2 dark:bg-primary rounded-3xl flex justify-center align-center p-2 w-24 h-10 transition"
6161
>
@@ -66,8 +66,8 @@ const ThemeSwitcher = () => {
6666
type="button"
6767
aria-label="Use Light Mode"
6868
onClick={() => {
69-
document.documentElement.classList.remove("dark");
70-
localStorage.setItem("theme", "light");
69+
document.documentElement.classList.remove('dark');
70+
localStorage.setItem('theme', 'light');
7171
}}
7272
className="flex items-center h-full pr-2 bg-primary dark:bg-transparent rounded-3xl flex justify-center align-center p-2 w-24 h-10 transition"
7373
>

components/Header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Link from "next/link";
1+
import Link from 'next/link';
22

33
export default function Header({ name }) {
44
return (

components/Layout.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import classNames from "classnames";
2-
import { useEffect } from "react";
3-
import styles from "./Layout.module.css";
1+
import classNames from 'classnames';
2+
import { useEffect } from 'react';
3+
import styles from './Layout.module.css';
44

55
export function GradientBackground({ variant, className }) {
66
const classes = classNames(
77
{
8-
[styles.colorBackground]: variant === "large",
9-
[styles.colorBackgroundBottom]: variant === "small",
8+
[styles.colorBackground]: variant === 'large',
9+
[styles.colorBackgroundBottom]: variant === 'small',
1010
},
1111
className
1212
);
@@ -16,27 +16,27 @@ export function GradientBackground({ variant, className }) {
1616

1717
export default function Layout({ children }) {
1818
const setAppTheme = () => {
19-
const darkMode = localStorage.getItem("theme") === "dark";
20-
const lightMode = localStorage.getItem("theme") === "light";
19+
const darkMode = localStorage.getItem('theme') === 'dark';
20+
const lightMode = localStorage.getItem('theme') === 'light';
2121

2222
if (darkMode) {
23-
document.documentElement.classList.add("dark");
23+
document.documentElement.classList.add('dark');
2424
} else if (lightMode) {
25-
document.documentElement.classList.remove("dark");
25+
document.documentElement.classList.remove('dark');
2626
}
2727
return;
2828
};
2929

3030
const handleSystemThemeChange = () => {
31-
var darkQuery = window.matchMedia("(prefers-color-scheme: dark)");
31+
var darkQuery = window.matchMedia('(prefers-color-scheme: dark)');
3232

3333
darkQuery.onchange = (e) => {
3434
if (e.matches) {
35-
document.documentElement.classList.add("dark");
36-
localStorage.setItem("theme", "dark");
35+
document.documentElement.classList.add('dark');
36+
localStorage.setItem('theme', 'dark');
3737
} else {
38-
document.documentElement.classList.remove("dark");
39-
localStorage.setItem("theme", "light");
38+
document.documentElement.classList.remove('dark');
39+
localStorage.setItem('theme', 'light');
4040
}
4141
};
4242
};

components/SEO.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Head from "next/head";
1+
import Head from 'next/head';
22

33
export default function SEO({ title, description }) {
44
return (

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"dev:watch": "next-remote-watch ./posts",
1818
"build": "next build",
1919
"start": "next start",
20-
"export": "next build && next export"
20+
"export": "next build && next export",
21+
"lint": "next lint"
2122
},
2223
"dependencies": {
2324
"@mapbox/rehype-prism": "^0.8.0",
@@ -33,6 +34,9 @@
3334
},
3435
"devDependencies": {
3536
"autoprefixer": "^10.4.0",
37+
"eslint": "<8.0.0",
38+
"eslint-config-next": "12.0.10",
39+
"eslint-config-prettier": "^8.3.0",
3640
"postcss": "^8.4.4",
3741
"tailwindcss": "^3.0.0"
3842
}

pages/_app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import "../styles/globals.css";
2-
import "prismjs/themes/prism-tomorrow.css";
1+
import '../styles/globals.css';
2+
import 'prismjs/themes/prism-tomorrow.css';
33

44
function MyApp({ Component, pageProps }) {
55
return (

0 commit comments

Comments
 (0)