【新增】私有证书

This commit is contained in:
cai
2025-09-03 15:15:59 +08:00
parent efd052a297
commit 954cd1638d
442 changed files with 76787 additions and 7483 deletions

33
frontend/env/eslint/eslint.config.js vendored Normal file
View File

@@ -0,0 +1,33 @@
import js from '@eslint/js'
import prettierRules from 'eslint-config-prettier'
import turboPlugin from 'eslint-plugin-turbo'
import tseslint from 'typescript-eslint'
import onlyWarn from 'eslint-plugin-only-warn'
// eslint 配置
export default tseslint.config([
// 配置需要忽略的文件
{
ignores: ['node_modules', 'dist'],
},
// 配置 eslint 规则
js.configs.recommended,
...tseslint.configs.recommended,
// 配置 prettier 的 eslint 规则
prettierRules,
// 配置 turbo 的 eslint 规则
{
plugins: {
turbo: turboPlugin,
},
rules: {
'turbo/no-undeclared-env-vars': 'warn',
},
},
// 配置 only-warn 的 eslint 规则
{
plugins: {
onlyWarn,
},
},
])

32
frontend/env/eslint/package.json vendored Normal file
View File

@@ -0,0 +1,32 @@
{
"name": "@baota/eslint",
"version": "1.0.0",
"type": "module",
"description": "",
"exports": {
".": "./src/index.js",
"./vue": "./src/vue.js",
"./vitest": "./src/vitest.js",
"./next": "./src/next.js"
},
"devDependencies": {
"@baota/typescript": "workspace:*",
"@baota/prettier": "workspace:*",
"eslint": "^9.23.0",
"@eslint/js": "^9.20.0",
"@next/eslint-plugin-next": "^15.1.6",
"@vue/eslint-config-typescript": "^14.5.0",
"@vitest/eslint-plugin": "^1.1.38",
"eslint-plugin-playwright": "^2.2.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-turbo": "^2.4.0",
"globals": "^15.15.0",
"typescript-eslint": "^8.24.0",
"eslint-plugin-vue": "^9.32.0",
"eslint-plugin-oxlint": "^0.16.2",
"@vue/eslint-config-prettier": "10.2.0"
}
}

View File

@@ -0,0 +1,3 @@
import prettierConfig from '@baota/prettier'
export default prettierConfig

46
frontend/env/eslint/src/index.js vendored Normal file
View File

@@ -0,0 +1,46 @@
import js from "@eslint/js";
import prettierRules from "eslint-config-prettier"; // eslint插件 prettier
import turboPlugin from "eslint-plugin-turbo"; // eslint插件 turbo
import tseslint from "typescript-eslint"; // eslint插件 类型检查
import onlyWarn from "eslint-plugin-only-warn"; // eslint插件 只警告
// 配置 eslint 规则
export default tseslint.config([
// 配置需要忽略的文件
{
ignores: ["node_modules", "dist"],
},
// 配置 eslint 规则
js.configs.recommended,
...tseslint.configs.recommended,
// 配置 prettier 的 eslint 规则
prettierRules,
// 配置 turbo 的 eslint 规则
{
plugins: {
turbo: turboPlugin,
},
rules: {
"turbo/no-undeclared-env-vars": "warn",
},
},
// 配置 only-warn 的 eslint 规则
{
plugins: {
onlyWarn,
},
},
// 修复 TypeScript-ESLint 的 no-unused-expressions 规则问题
{
rules: {
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
},
},
]);

48
frontend/env/eslint/src/next.js vendored Normal file
View File

@@ -0,0 +1,48 @@
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import { rules as prettierRules } from 'eslint-config-prettier'
import * as pluginReactHooks from 'eslint-plugin-react-hooks'
import * as pluginReact from 'eslint-plugin-react'
import * as pluginNext from '@next/eslint-plugin-next'
import baseConfig from './index.js'
// 配置 next.js 的 eslint 规则
const nextConfig = tseslint.config([
...baseConfig,
js.configs.recommended,
prettierRules,
...tseslint.configs.recommended,
{
...pluginReact.configs.flat.recommended,
languageOptions: {
...pluginReact.configs.flat.recommended.languageOptions,
globals: {
...globals.serviceworker,
},
},
},
{
plugins: {
'@next/next': pluginNext,
},
rules: {
...pluginNext.configs.recommended.rules,
...pluginNext.configs['core-web-vitals'].rules,
},
},
{
plugins: {
'react-hooks': pluginReactHooks,
},
settings: { react: { version: 'detect' } },
rules: {
...pluginReactHooks.configs.recommended.rules,
// React scope no longer necessary with new JSX transform.
'react/react-in-jsx-scope': 'off',
},
},
])
export default nextConfig

16
frontend/env/eslint/src/vitest.js vendored Normal file
View File

@@ -0,0 +1,16 @@
import tseslint from 'typescript-eslint'
import pluginVitest from '@vitest/eslint-plugin' // vitest 插件,用于解析 .test 和 .spec 文件
import pluginPlaywright from 'eslint-plugin-playwright' // playwright 插件,用于解析 playwright 测试
export default tseslint.config([
// 配置 vitest 的 eslint 规则
{
...pluginVitest.configs.recommended,
files: ['src/**/__tests__/*'],
},
// 配置 playwright 的 eslint 规则
{
...pluginPlaywright.configs['flat/recommended'],
files: ['e2e/**/*.{test,spec}.{js,ts,jsx,tsx}'],
},
])

36
frontend/env/eslint/src/vue.js vendored Normal file
View File

@@ -0,0 +1,36 @@
import pluginVue from 'eslint-plugin-vue' // vue 插件,用于解析 .vue 文件
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' // vue ts 配置,用于解析 .ts 和 .tsx 文件
import oxlint from 'eslint-plugin-oxlint' // oxlint 插件,用于解析 oxlint 规则
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' // prettier 配置,用于跳过格式化
// 配置 vue 的 eslint 规则
export default defineConfigWithVueTs(
// 配置需要解析的文件
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
},
// 配置需要忽略的文件
{
name: 'app/files-to-ignore',
ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
},
// 配置 vue 的 eslint 规则
pluginVue.configs['flat/essential'],
// 配置 vue ts 的 eslint 规则
vueTsConfigs.recommended,
// 配置 oxlint 的 eslint 规则
...oxlint.configs['flat/recommended'],
// 配置 prettier 的 eslint 规则
skipFormatting,
// 修复 TypeScript-ESLint 的 no-unused-expressions 规则问题
{
rules: {
'@typescript-eslint/no-unused-expressions': ['error', {
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
}],
},
},
)

4
frontend/env/eslint/tsconfig.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"extends": "@baota/typescript/base.json",
"include": ["**/*.{js,ts,jsx,tsx}", "eslint.config.ts", "./types.d.ts"]
}

7
frontend/env/eslint/types.d.ts vendored Normal file
View File

@@ -0,0 +1,7 @@
declare module 'eslint-plugin-only-warn' {
const plugin: any
export default plugin
}
declare module '@next/eslint-plugin-next'
declare module 'globals'