From 2778cf05c9f1ea7ea7528f58d67daa4ad6f29a33 Mon Sep 17 00:00:00 2001 From: Neila Date: Sun, 16 Jun 2024 22:30:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20eslint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 201 ++++++++++++++++++++++++++++++++++++++++++++- src/app/layout.tsx | 31 +++---- src/app/page.tsx | 146 ++++++++++++++++---------------- 3 files changed, 288 insertions(+), 90 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..58f9262 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,200 @@ { - "extends": "next/core-web-vitals" -} + "extends": "next/core-web-vitals", + "rules": { + "@next/next/no-img-element": "off", + "react-hooks/rules-of-hooks": "error", // 检查 Hook 的规则 + "react-hooks/exhaustive-deps": "off", + "semi": [ + "warn", + "always" + ], + "jsx-quotes": [ + "warn", + "prefer-double" + ], + "quotes": [ + "warn", + "double", + { + "allowTemplateLiterals": true + } + ], + "eqeqeq": [ + "error", + "always" + ], + "no-delete-var": "error", + "no-else-return": "warn", + "no-eval": "error", + "no-extra-label": "warn", + "no-extra-semi": "warn", + "no-proto": "error", + "no-script-url": "error", + "no-var": "error", + "no-with": "error", + "array-bracket-spacing": [ + "error", + "never" + ], + "arrow-parens": [ + "error", + "as-needed" + ], + "arrow-spacing": [ + "warn", + { + "before": true, + "after": true + } + ], + "block-spacing": "error", + "brace-style": "error", + "comma-dangle": [ + "error", + "never" + ], + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "comma-style": [ + "error", + "last" + ], + "dot-location": [ + "error", + "object" + ], + "eol-last": [ + "error", + "always" + ], + "func-call-spacing": [ + "error", + "never" + ], + "generator-star-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "implicit-arrow-linebreak": [ + "error" + ], + "indent": [ + "error", + 4, + { + "SwitchCase": 1 + } + ], + "key-spacing": [ + "error" + // 全部使用默认 + ], + "keyword-spacing": "error", + "linebreak-style": [ + "error", + "unix" + ], + "max-statements-per-line": [ + "error", + { + "max": 2 + } + ], + "multiline-ternary": [ + "error", + "never" + ], + "new-parens": "error", + "no-multi-spaces": "error", + "no-multiple-empty-lines": "error", + "no-trailing-spaces": "error", + "no-whitespace-before-property": "error", + "nonblock-statement-body-position": "error", + "object-curly-newline": [ + "error", + "always" + ], + "object-curly-spacing": [ + "error", + "never" + ], + "object-property-newline": "error", + "operator-linebreak": [ + "error", + "before" + ], + "padded-blocks": [ + "error", + "never" + ], + "rest-spread-spacing": [ + "error", + "never" + ], + "semi-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "semi-style": [ + "error", + "last" + ], + "space-before-blocks": [ + "error", + "always" + ], + "space-before-function-paren": [ + "error", + { + "anonymous": "always", + "named": "never", + "asyncArrow": "always" + } + ], + "space-in-parens": [ + "error", + "never" + ], + "space-infix-ops": [ + "error" + ], + "space-unary-ops": [ + "error", + { + "words": true, + "nonwords": false + } + ], + "switch-colon-spacing": [ + "error" + ], + "template-curly-spacing": [ + "error", + "never" + ], + "template-tag-spacing": [ + "error", + "never" + ], + "unicode-bom": "error", + "wrap-iife": [ + "error", + "inside" + ], + "yield-star-spacing": [ + "error", + "after" + ] + } +} \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 3314e47..490e6bd 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,22 +1,25 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; +import type { + Metadata +} from "next"; +import { + Inter +} from "next/font/google"; import "./globals.css"; - -const inter = Inter({ subsets: ["latin"] }); - +const inter = Inter({ + subsets: ["latin"] +}); export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", + title: "Create Next App", + description: "Generated by create next app" }; - export default function RootLayout({ - children, + children }: Readonly<{ children: React.ReactNode; }>) { - return ( - - {children} - - ); + return ( + + {children} + + ); } diff --git a/src/app/page.tsx b/src/app/page.tsx index af22d8d..329ceca 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,82 +1,80 @@ -import Image from "next/image"; import styles from "./page.module.css"; - export default function Home() { - return ( -
-
-

- Neila Persents -

-
- - Vornaseizo - v0.0.0 - -
-
+ return ( +
+
+

+ Neila Persents +

+
+ + Vornaseizo + v0.0.0 + +
+
-
-

- 向Jack同志致敬! -

-
+
+

+ 向Jack同志致敬! +

+
-
- -

- Docs -> -

-

Find in-depth information about Next.js features and API.

-
+
+ +

+ Docs -> +

+

Find in-depth information about Next.js features and API.

+
- -

- Learn -> -

-

Learn about Next.js in an interactive course with quizzes!

-
+ +

+ Learn -> +

+

Learn about Next.js in an interactive course with quizzes!

+
- -

- Templates -> -

-

Explore starter templates for Next.js.

-
+ +

+ Templates -> +

+

Explore starter templates for Next.js.

+
- -

- Deploy -> -

-

- Instantly deploy your Next.js site to a shareable URL with Vercel. -

-
-
-
- ); + +

+ Deploy -> +

+

+ Instantly deploy your Next.js site to a shareable URL with Vercel. +

+
+ +
+ ); }