From 53188ff9cff9331e0c316e0cd17b8a914f820590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 22 Jan 2025 11:54:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20ESLint=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9B=B4=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=EF=BC=8C=E8=B0=83=E6=95=B4=20npm=20=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .npmrc | 1 + eslint.config.js => eslint.config.ts | 22 ++++++++++++++-------- tsconfig.node.json | 1 + 3 files changed, 16 insertions(+), 8 deletions(-) rename eslint.config.js => eslint.config.ts (68%) diff --git a/.npmrc b/.npmrc index 011df7f..42372c2 100644 --- a/.npmrc +++ b/.npmrc @@ -7,6 +7,7 @@ registry=https://nexus.oo1.dev/repository/npm/ # https://pnpm.io/zh/npmrc#node-mirrorltreleasedir use-node-version=22.13.0 node-mirror:release=https://npmmirror.com/mirrors/node/ # pnpm config set node-mirror:release=https://npmmirror.com/mirrors/node/ +node-mirror:release=https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/ node-mirror:rc=https://npmmirror.com/mirrors/node-rc/ node-mirror:nightly=https://npmmirror.com/mirrors/node-nightly/ diff --git a/eslint.config.js b/eslint.config.ts similarity index 68% rename from eslint.config.js rename to eslint.config.ts index 5afe7aa..593ff97 100644 --- a/eslint.config.js +++ b/eslint.config.ts @@ -1,7 +1,7 @@ import { includeIgnoreFile } from '@eslint/compat'; import pluginVitest from '@vitest/eslint-plugin'; import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'; -import vueTsEslintConfig from '@vue/eslint-config-typescript'; +import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'; import oxlint from 'eslint-plugin-oxlint'; import perfectionist from 'eslint-plugin-perfectionist'; import pluginVue from 'eslint-plugin-vue'; @@ -12,10 +12,12 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const gitignorePath = path.resolve(__dirname, '.gitignore'); -/** - * @type import('eslint').Linter.Config[] - */ -export default [ +// To allow more languages other than `ts` in `.vue` files, uncomment the following lines: +import { configureVueProject } from '@vue/eslint-config-typescript'; +configureVueProject({ scriptLangs: ['ts', 'tsx', 'js', 'jsx'] }); +// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup + +export default defineConfigWithVueTs( includeIgnoreFile(gitignorePath), // oxlint . --fix -D correctness --ignore-path .gitignore { name: 'app/files-to-lint', @@ -27,14 +29,18 @@ export default [ ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'], }, - ...pluginVue.configs['flat/essential'], - ...vueTsEslintConfig({ supportedScriptLangs: { ts: true, tsx: true, js: true, jsx: true } }), + pluginVue.configs['flat/essential'], + vueTsConfigs.recommended, { ...pluginVitest.configs.recommended, files: ['src/**/__tests__/*'], }, + // { + // ...pluginCypress.configs.recommended, + // files: ['cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}', 'cypress/support/**/*.{js,ts,jsx,tsx}'], + // }, oxlint.configs['flat/recommended'], skipFormatting, @@ -62,4 +68,4 @@ export default [ 'perfectionist/sort-imports': ['error'], }, }, -]; +); diff --git a/tsconfig.node.json b/tsconfig.node.json index d800a9f..ac0d7e7 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -6,6 +6,7 @@ "cypress.config.*", "nightwatch.conf.*", "playwright.config.*", + "eslint.config.*", "fake/**/*" ], "compilerOptions": {