From b2be1ffe59774a997573508790b780cac816fd14 Mon Sep 17 00:00:00 2001 From: Cupid Valentine <53572196+valcosmos@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:25:17 +0800 Subject: [PATCH] chore: update deps --- .eslintignore | 2 -- .eslintrc.js | 42 ------------------------ .vscode/settings.json | 49 +++++++++++++++++++++++++++- eslint.config.mjs | 20 ++++++++++++ package.json | 76 +++++++++++++++++++++---------------------- 5 files changed, 105 insertions(+), 84 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index a3e9066..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -.eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index f6b7e57..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - env: { - browser: true, - amd: true, - node: true, - es6: true, - }, - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:jsx-a11y/recommended', - 'plugin:prettier/recommended', - 'next', - 'next/core-web-vitals', - ], - parserOptions: { - project: true, - tsconfigRootDir: __dirname, - }, - rules: { - 'prettier/prettier': 'error', - 'react/react-in-jsx-scope': 'off', - 'jsx-a11y/anchor-is-valid': [ - 'error', - { - components: ['Link'], - specialLink: ['hrefLeft', 'hrefRight'], - aspects: ['invalidHref', 'preferButton'], - }, - ], - 'react/prop-types': 0, - '@typescript-eslint/no-unused-vars': 0, - 'react/no-unescaped-entities': 0, - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - }, -} diff --git a/.vscode/settings.json b/.vscode/settings.json index fae8e3d..12a0370 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,51 @@ { "typescript.tsdk": "node_modules/typescript/lib", - "typescript.enablePromptUseWorkspaceTsdk": true + "typescript.enablePromptUseWorkspaceTsdk": true, + // Disable the default formatter, use eslint instead + "prettier.enable": false, + "editor.formatOnSave": false, + + // Auto fix + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + // Silent the stylistic rules in you IDE, but still auto fix them + "eslint.rules.customizations": [ + { "rule": "style/*", "severity": "off", "fixable": true }, + { "rule": "format/*", "severity": "off", "fixable": true }, + { "rule": "*-indent", "severity": "off", "fixable": true }, + { "rule": "*-spacing", "severity": "off", "fixable": true }, + { "rule": "*-spaces", "severity": "off", "fixable": true }, + { "rule": "*-order", "severity": "off", "fixable": true }, + { "rule": "*-dangle", "severity": "off", "fixable": true }, + { "rule": "*-newline", "severity": "off", "fixable": true }, + { "rule": "*quotes", "severity": "off", "fixable": true }, + { "rule": "*semi", "severity": "off", "fixable": true } + ], + + // Enable eslint for all supported languages + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "jsonc", + "yaml", + "toml", + "xml", + "gql", + "graphql", + "astro", + "css", + "less", + "scss", + "pcss", + "postcss" + ] } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..54bf433 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,20 @@ +import antfu from '@antfu/eslint-config' +import nextPlugin from '@next/eslint-plugin-next' +import tailwind from 'eslint-plugin-tailwindcss' + +export default antfu( + { + ignores: ['node_modules', '**/node_modules/**', '.eslintrc.js', '**/.eslintrc.js/**'], + formatters: true, + react: true, + plugins: { '@next/next': nextPlugin }, + rules: { + ...nextPlugin.configs.recommended.rules, + ...nextPlugin.configs['core-web-vitals'].rules, + '@next/next/no-duplicate-head': 'off', + 'react-hooks/exhaustive-deps': 'off', + '@next/next/no-page-custom-font': 'off' + } + }, + ...tailwind.configs['flat/recommended'] +) diff --git a/package.json b/package.json index 1a1102e..965cc62 100644 --- a/package.json +++ b/package.json @@ -2,73 +2,71 @@ "name": "blogi", "version": "2.2.0", "private": true, + "packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b", "scripts": { "start": "next dev", "dev": "cross-env INIT_CWD=$PWD next dev", "build": "cross-env INIT_CWD=$PWD next build && cross-env NODE_OPTIONS='--experimental-json-modules' node ./scripts/postbuild.mjs", "serve": "next start", "analyze": "cross-env ANALYZE=true next build", - "lint": "next lint --fix --dir pages --dir app --dir components --dir lib --dir layouts --dir scripts", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "prepare": "husky" }, "dependencies": { - "@headlessui/react": "1.7.19", - "@next/bundle-analyzer": "14.2.3", - "@tailwindcss/forms": "^0.5.7", - "@tailwindcss/typography": "^0.5.12", - "autoprefixer": "^10.4.13", + "@headlessui/react": "2.1.8", + "@next/bundle-analyzer": "14.2.13", + "@tailwindcss/forms": "^0.5.9", + "@tailwindcss/typography": "^0.5.15", + "autoprefixer": "^10.4.20", "body-scroll-lock": "^4.0.0-beta.0", "contentlayer2": "0.5.1", - "esbuild": "0.20.2", + "esbuild": "0.24.0", "github-slugger": "^2.0.0", - "gray-matter": "^4.0.2", + "gray-matter": "^4.0.3", "hast-util-from-html-isomorphic": "^2.0.0", - "image-size": "1.0.0", - "next": "14.2.3", + "image-size": "1.1.1", + "next": "14.2.13", "next-contentlayer2": "0.5.1", "next-themes": "^0.3.0", - "pliny": "0.2.1", - "postcss": "^8.4.24", + "pliny": "0.3.1", + "postcss": "^8.4.47", "react": "18.3.1", "react-dom": "18.3.1", "reading-time": "1.5.0", "rehype-autolink-headings": "^7.1.0", - "rehype-citation": "^2.0.0", - "rehype-katex": "^7.0.0", - "rehype-preset-minify": "7.0.0", + "rehype-citation": "^2.1.2", + "rehype-katex": "^7.0.1", + "rehype-preset-minify": "7.0.1", "rehype-prism-plus": "^2.0.0", "rehype-slug": "^6.0.0", - "remark": "^15.0.0", + "remark": "^15.0.1", "remark-gfm": "^4.0.0", "remark-github-blockquote-alert": "^1.2.1", "remark-math": "^6.0.0", - "tailwindcss": "^3.4.3", + "tailwindcss": "^3.4.13", "unist-util-visit": "^5.0.0" }, "devDependencies": { - "@svgr/webpack": "^8.0.1", - "@types/mdx": "^2.0.12", - "@types/react": "^18.2.73", - "@typescript-eslint/eslint-plugin": "^6.1.0", - "@typescript-eslint/parser": "^6.1.0", + "@antfu/eslint-config": "^3.7.3", + "@eslint-react/eslint-plugin": "^1.14.2", + "@svgr/webpack": "^8.1.0", + "@types/mdx": "^2.0.13", + "@types/react": "^18.3.10", + "@typescript-eslint/eslint-plugin": "^8.7.0", + "@typescript-eslint/parser": "^8.7.0", "cross-env": "^7.0.3", - "eslint": "^8.45.0", - "eslint-config-next": "14.2.3", - "eslint-config-prettier": "^8.8.0", - "eslint-plugin-prettier": "^5.0.0", - "husky": "^9.0.0", - "lint-staged": "^13.0.0", - "prettier": "^3.0.0", - "prettier-plugin-tailwindcss": "^0.5.11", - "typescript": "^5.1.3" + "eslint": "^9.11.1", + "eslint-config-next": "14.2.13", + "eslint-plugin-format": "^0.1.2", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.12", + "eslint-plugin-tailwindcss": "^3.17.4", + "husky": "^9.1.6", + "lint-staged": "^15.2.10", + "typescript": "^5.6.2" }, "lint-staged": { - "*.+(js|jsx|ts|tsx)": [ - "eslint --fix" - ], - "*.+(js|jsx|ts|tsx|json|css|md|mdx)": [ - "prettier --write" - ] - }, - "packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b" + "*": "eslint --fix" + } }