mirror of
https://gitee.com/mirrors/AllinSSL.git
synced 2026-03-11 09:11:10 +08:00
【新增】私有证书
This commit is contained in:
46
frontend/env/eslint/src/index.js
vendored
Normal file
46
frontend/env/eslint/src/index.js
vendored
Normal 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
48
frontend/env/eslint/src/next.js
vendored
Normal 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
16
frontend/env/eslint/src/vitest.js
vendored
Normal 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
36
frontend/env/eslint/src/vue.js
vendored
Normal 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,
|
||||
}],
|
||||
},
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user