Skip to content

Commit

Permalink
fix: eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
nico1988 committed Feb 11, 2023
1 parent aa5ba28 commit 06d7315
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 28 deletions.
13 changes: 11 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
Expand Down Expand Up @@ -47,6 +46,16 @@
"no-undef": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/jsx-props-no-spreading": "off"
"react/jsx-props-no-spreading": "off",
"react/jsx-filename-extension": [
1,
{
"extensions": [
".tsx",
".js",
".jsx"
]
}
]
}
}
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html>
<html lang="en">
<head />
<body>{children}</body>
</html>
Expand Down
10 changes: 2 additions & 8 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import { ThemeProvider } from 'next-themes';

function Index() {
return (
<div className="flex items-center justify-center h-screen">
<button className="rounded-xl px-5 py-2 bg-orange-200 text-orange-500 text-lg font-medium hover:bg-orange-300 active:bg-orange-200 active:scale-95 duration-300">
<div className="flex h-screen items-center justify-center">
<button className="rounded-xl bg-orange-200 px-5 py-2 text-lg font-medium text-orange-500 duration-300 hover:bg-orange-300 active:scale-95 active:bg-orange-200">
Hello, Next.js 13!
</button>

<div className="text-6xl text-[#fb0067] ">
222
</div>
</div>
);
}
Expand Down
8 changes: 3 additions & 5 deletions components/Buttons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';

const Buttons = () => {
return <button>Click</button>;
};

export default Buttons;
export default function Buttons() {
return <button type="button">Click</button>;
}
14 changes: 7 additions & 7 deletions components/Dark.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// pages/index.tsx
import { useTheme } from "next-themes";

import { useTheme } from 'next-themes';

export default function IndexPage() {
const { theme, setTheme } = useTheme();
const toggleTheme = () =>
setTheme(theme === "light" ? "dark" : "light");
const toggleTheme = () => setTheme(theme === 'light' ? 'dark' : 'light');

return (
<div>
<h1>The current theme is {theme === "dark" ? "dark" : "light"}</h1>
<button onClick={toggleTheme}>Change Theme</button>
<h1>The current theme is {theme === 'dark' ? 'dark' : 'light'}</h1>
<button type="button" onClick={toggleTheme}>
Change Theme
</button>
</div>
);
}
}
6 changes: 6 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
env: {
customKey: 'my-value',
},
eslint: {
ignoreDuringBuilds: true,
},
reactStrictMode: true,
experimental: {
appDir: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"dependencies": {
"next": "13.0.2",
"next-themes": "0.2.0",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down Expand Up @@ -55,7 +56,6 @@
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"lint-staged": "^13.0.3",
"next-themes": "0.2.0",
"postcss": "^8.4.18",
"prettier": "^2.7.1",
"prettier-plugin-tailwindcss": "^0.1.8",
Expand Down
6 changes: 2 additions & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { AppProps } from "next/app";
import type { AppProps } from 'next/app';
import { ThemeProvider } from 'next-themes';

function MyApp({ Component, pageProps }) {
export default function MyApp({ Component, pageProps }) {
return (
<ThemeProvider defaultTheme="system" enableSystem={true} attribute="class">
<Component {...pageProps} />;
</ThemeProvider>
);
}

export default MyApp;

0 comments on commit 06d7315

Please sign in to comment.