refactor: 将 unicorn / TypeScript 规则迁移至 oxlint,并完善 oxfmt 配置 (#8067)
* chore: update deps * chore: update archiver v8 * fix: 还原 vue/html-closing-bracket-newline * feat: 增加默认配置和配置注释 * feat: 增加oxlint默认插件配置和注释 * refactor: remove unicorn ESLint configuration and update dependencies - Deleted the unicorn ESLint configuration file from the lint-configs package. - Removed unicorn configuration from the main index file. - Updated oxlint-config to include a comprehensive set of unicorn rules. - Adjusted preferences and vxe-table files to disable specific unicorn rules. - Removed references to eslint-plugin-unicorn from pnpm-lock.yaml and pnpm-workspace.yaml. * refactor: 移除 eslint 的 @typescript-eslint/eslint-plugin 依赖,将 TypeScript 配置迁移到 oxlint * feat: open typeAware * fix: mac 和linux下报错
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -38,7 +38,7 @@
|
||||
|
||||
// lint && format
|
||||
"oxc.enable": true,
|
||||
"oxc.typeAware": false,
|
||||
"oxc.typeAware": true,
|
||||
"oxc.configPath": "oxlint.config.ts",
|
||||
"oxc.fmt.configPath": "oxfmt.config.ts",
|
||||
"eslint.useFlatConfig": true,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { defineNitroConfig } from 'nitropack/config';
|
||||
|
||||
import errorHandler from './error';
|
||||
|
||||
process.env.COMPATIBILITY_DATE = new Date().toISOString();
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
{
|
||||
"extends": "./.nitro/types/tsconfig.json"
|
||||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"extends": "@vben/tsconfig/node.json",
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
"~/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules", "dist", ".nitro"]
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint/js": "catalog:",
|
||||
"@typescript-eslint/eslint-plugin": "catalog:",
|
||||
"@typescript-eslint/parser": "catalog:",
|
||||
"@vben/oxlint-config": "workspace:*",
|
||||
"eslint": "catalog:",
|
||||
@@ -36,7 +35,6 @@
|
||||
"eslint-plugin-n": "catalog:",
|
||||
"eslint-plugin-perfectionist": "catalog:",
|
||||
"eslint-plugin-pnpm": "catalog:",
|
||||
"eslint-plugin-unicorn": "catalog:",
|
||||
"eslint-plugin-unused-imports": "catalog:",
|
||||
"eslint-plugin-vue": "catalog:",
|
||||
"eslint-plugin-yml": "catalog:",
|
||||
|
||||
@@ -5,6 +5,5 @@ export * from './node';
|
||||
export * from './perfectionist';
|
||||
export * from './pnpm';
|
||||
export * from './typescript';
|
||||
export * from './unicorn';
|
||||
export * from './vue';
|
||||
export * from './yaml';
|
||||
|
||||
@@ -2,24 +2,17 @@ import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
const rulesCoveredByOxlint = new Set([
|
||||
'@typescript-eslint/ban-ts-comment',
|
||||
'@typescript-eslint/no-non-null-assertion',
|
||||
'@typescript-eslint/no-unused-expressions',
|
||||
'@typescript-eslint/no-unused-vars',
|
||||
'@typescript-eslint/triple-slash-reference',
|
||||
]);
|
||||
|
||||
/**
|
||||
* @typescript-eslint 的规则已迁移到 oxlint(typescript 插件)。
|
||||
* 这里仅保留 TS 解析器,供其它 eslint 插件(perfectionist、n 等)解析 TS/TSX 文件。
|
||||
* 因不再有类型感知规则,已移除 parserOptions.project,eslint 解析更快。
|
||||
*
|
||||
* 注意:移除 @typescript-eslint 插件后,unused-imports/no-unused-vars 会退回核心实现,
|
||||
* 无法识别 TS 类型签名里的形参(会误报)。故对 TS/TSX/Vue 统一关闭该规则,
|
||||
* 未使用变量改由 oxlint 的 no-unused-vars(类型感知)负责。
|
||||
*/
|
||||
export async function typescript(): Promise<Linter.Config[]> {
|
||||
const [pluginTs, parserTs] = await Promise.all([
|
||||
interopDefault(import('@typescript-eslint/eslint-plugin')),
|
||||
interopDefault(import('@typescript-eslint/parser')),
|
||||
] as const);
|
||||
const strictRules = Object.fromEntries(
|
||||
Object.entries(pluginTs.configs.strict?.rules ?? {}).filter(
|
||||
([ruleName]) => !rulesCoveredByOxlint.has(ruleName),
|
||||
),
|
||||
);
|
||||
const parserTs = await interopDefault(import('@typescript-eslint/parser'));
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -27,30 +20,23 @@ export async function typescript(): Promise<Linter.Config[]> {
|
||||
languageOptions: {
|
||||
parser: parserTs,
|
||||
parserOptions: {
|
||||
createDefaultProgram: false,
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
ecmaVersion: 'latest',
|
||||
extraFileExtensions: ['.vue'],
|
||||
jsxPragma: 'React',
|
||||
project: './tsconfig.*.json',
|
||||
sourceType: 'module',
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': pluginTs as any,
|
||||
},
|
||||
rules: {
|
||||
...pluginTs.configs['eslint-recommended']?.overrides?.[0]?.rules,
|
||||
...strictRules,
|
||||
// '@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
|
||||
'@typescript-eslint/consistent-type-definitions': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-namespace': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'unused-imports/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// Vue `<script>` 的未使用变量同样交给 oxlint,避免核心规则误报 TS 类型签名形参
|
||||
files: ['**/*.vue'],
|
||||
rules: {
|
||||
'unused-imports/no-unused-vars': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
import { interopDefault } from '../util';
|
||||
|
||||
const rulesCoveredByOxlint = new Set([
|
||||
'unicorn/consistent-function-scoping',
|
||||
'unicorn/no-process-exit',
|
||||
'unicorn/prefer-global-this',
|
||||
'unicorn/prefer-module',
|
||||
]);
|
||||
|
||||
export async function unicorn(): Promise<Linter.Config[]> {
|
||||
const pluginUnicorn = await interopDefault(import('eslint-plugin-unicorn'));
|
||||
const recommendedRules = Object.fromEntries(
|
||||
Object.entries(pluginUnicorn.configs.recommended.rules ?? {}).filter(
|
||||
([ruleName]) => !rulesCoveredByOxlint.has(ruleName),
|
||||
),
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
plugins: {
|
||||
unicorn: pluginUnicorn,
|
||||
},
|
||||
rules: {
|
||||
...recommendedRules,
|
||||
|
||||
'unicorn/better-regex': 'off',
|
||||
'unicorn/consistent-destructuring': 'off',
|
||||
'unicorn/expiring-todo-comments': 'off',
|
||||
'unicorn/filename-case': 'off',
|
||||
'unicorn/import-style': 'off',
|
||||
'unicorn/no-array-for-each': 'off',
|
||||
'unicorn/no-null': 'off',
|
||||
'unicorn/no-useless-undefined': 'off',
|
||||
'unicorn/prefer-at': 'off',
|
||||
'unicorn/prefer-dom-node-text-content': 'off',
|
||||
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
|
||||
'unicorn/prefer-top-level-await': 'off',
|
||||
'unicorn/prevent-abbreviations': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -85,13 +85,7 @@ export async function vue(): Promise<Linter.Config[]> {
|
||||
'vue/dot-location': ['error', 'property'],
|
||||
'vue/dot-notation': ['error', { allowKeywords: true }],
|
||||
'vue/eqeqeq': ['error', 'smart'],
|
||||
'vue/html-closing-bracket-newline': [
|
||||
'error',
|
||||
{
|
||||
multiline: 'never',
|
||||
selfClosingTag: { multiline: 'never' },
|
||||
},
|
||||
],
|
||||
'vue/html-closing-bracket-newline': 'error',
|
||||
'vue/html-indent': 'off',
|
||||
// 'vue/html-indent': ['error', 2],
|
||||
'vue/html-quotes': ['error', 'double'],
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
perfectionist,
|
||||
pnpm,
|
||||
typescript,
|
||||
unicorn,
|
||||
vue,
|
||||
yaml,
|
||||
} from './configs';
|
||||
@@ -31,7 +30,6 @@ async function defineConfig(config: FlatConfig[] = []) {
|
||||
jsonc(),
|
||||
node(),
|
||||
perfectionist(),
|
||||
unicorn(),
|
||||
yaml(),
|
||||
pnpm(),
|
||||
...customConfig,
|
||||
|
||||
@@ -2,13 +2,107 @@ import { defineConfig as defineOxfmtConfig } from 'oxfmt';
|
||||
|
||||
type OxfmtConfig = Parameters<typeof defineOxfmtConfig>[0];
|
||||
|
||||
/**
|
||||
* oxfmt 配置文件,详见下方链接
|
||||
* https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
||||
*/
|
||||
const oxfmtConfig: OxfmtConfig = defineOxfmtConfig({
|
||||
/**
|
||||
* 单行长度 oxfmt,适配 prettier 的 80
|
||||
* Default:100
|
||||
*/
|
||||
printWidth: 80,
|
||||
/**
|
||||
* 缩进宽度
|
||||
* Default:2
|
||||
*/
|
||||
tabWidth: 2,
|
||||
/**
|
||||
* Markdown、MDX、YAML 文件格式化包裹
|
||||
* type: always | never | preserve
|
||||
* Default: preserve
|
||||
*/
|
||||
proseWrap: 'never',
|
||||
/**
|
||||
* 结尾添加分号
|
||||
* Default:true
|
||||
*/
|
||||
semi: true,
|
||||
/**
|
||||
* 使用单引号
|
||||
* Default:false
|
||||
*/
|
||||
singleQuote: true,
|
||||
/**
|
||||
* 对象属性添加引号
|
||||
* Default:as-needed
|
||||
*/
|
||||
quoteProps: 'as-needed',
|
||||
/**
|
||||
* 将多行元素的 > 放在最后一行的末尾,而不是单独放在下一行
|
||||
* Default:false
|
||||
*/
|
||||
bracketSameLine: false,
|
||||
/**
|
||||
* 对象字面量的大括号间添加空格
|
||||
* Default:true
|
||||
*/
|
||||
bracketSpacing: true,
|
||||
/**
|
||||
* 箭头函数参数总是使用括号
|
||||
* type: always | avoid
|
||||
* Default:always
|
||||
*/
|
||||
arrowParens: 'always',
|
||||
/**
|
||||
* 配置 package.json 排序,但是 oxfmt 不支持 pnpm-workspace
|
||||
* 现使用 eslint 搭配 eslint-plugin-pnpm eslint-plugin-yml 支持 package.json 和 pnpm-workspace.yaml 但排序风格不太一致
|
||||
* Default:true
|
||||
*/
|
||||
sortPackageJson: false,
|
||||
/**
|
||||
* 配置 import 排序,现在 使用 eslint-plugin-perfectionist,但是 oxfmt 不支持 export 等
|
||||
* 并且 customGroups 不支持 ts-equals-import
|
||||
* Default:false
|
||||
*/
|
||||
sortImports: false,
|
||||
/**
|
||||
* 多行结构中的后置逗号
|
||||
* Default:all
|
||||
*/
|
||||
trailingComma: 'all',
|
||||
/**
|
||||
* 行尾换行符
|
||||
* type: lf | crlf | cr
|
||||
* Default: lf
|
||||
*/
|
||||
endOfLine: 'lf',
|
||||
/**
|
||||
* 在文件最后插入一个换行
|
||||
* Default:true
|
||||
*/
|
||||
insertFinalNewline: true,
|
||||
/**
|
||||
* 控制格式化文件中例如,CSS-in-JS 或 JS-in-Vue 等
|
||||
* Default:auto
|
||||
*/
|
||||
embeddedLanguageFormatting: 'auto',
|
||||
/**
|
||||
* Vue/HTML/Angular/Handlebars 的空白敏感度(oxfmt 现会格式化 <template>)
|
||||
* type: css | strict | ignore
|
||||
* Default:css
|
||||
*/
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
/**
|
||||
* 暂时关闭,改动较多,后续可以考虑开启,支持 vue 但与现有的 eslint-plugin-better-tailwindcss 格式化会冲突
|
||||
* eslint-plugin-better-tailwindcss配置在 oxlint,在 vue文 件暂时不生效,ts等正常
|
||||
* Default:关闭
|
||||
*/
|
||||
// sortTailwindcss: {
|
||||
// functions: ['clsx', 'cn', 'cva', 'tw'],
|
||||
// stylesheet: './internal/tailwind-config/src/theme.css',
|
||||
// preserveWhitespace: true,
|
||||
// },
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
@@ -23,6 +117,8 @@ const oxfmtConfig: OxfmtConfig = defineOxfmtConfig({
|
||||
],
|
||||
options: {
|
||||
trailingComma: 'none',
|
||||
quoteProps: 'preserve',
|
||||
singleQuote: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -9,6 +9,15 @@ const overrides: OxlintConfig = {
|
||||
'typescript/triple-slash-reference': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// 这些 @typescript-eslint 规则此前不作用于 .vue(旧 eslint glob 不含 .vue)。
|
||||
// Vue 组件惯用 `interface Props extends XxxProps {}` 声明 props,保持迁移前行为放行。
|
||||
files: ['*.vue', '**/*.vue'],
|
||||
rules: {
|
||||
'typescript/no-empty-object-type': 'off',
|
||||
'typescript/no-unsafe-function-type': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/**/*.js',
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const plugins: OxlintConfig = {
|
||||
plugins: ['import', 'node', 'oxc', 'typescript', 'unicorn', 'vitest', 'vue'],
|
||||
/**
|
||||
* oxlint 支持的插件,将默认开启的也显示配置
|
||||
* type: eslint | react | unicorn | typescript | oxc |
|
||||
* import | jsdoc | jest | vitest | jsx-a11y | nextjs |
|
||||
* react-perf | promise | node | vue
|
||||
*
|
||||
* Default: eslint,typescript,unicorn,oxc
|
||||
*/
|
||||
plugins: [
|
||||
'eslint',
|
||||
'import',
|
||||
'node',
|
||||
'oxc',
|
||||
'typescript',
|
||||
'unicorn',
|
||||
'vitest',
|
||||
'vue',
|
||||
],
|
||||
};
|
||||
|
||||
export { plugins };
|
||||
|
||||
@@ -2,25 +2,49 @@ import type { OxlintConfig } from 'oxlint';
|
||||
|
||||
const typescript: OxlintConfig = {
|
||||
rules: {
|
||||
// —— 从 @typescript-eslint strict 预设迁移而来(非类型感知,oxlint 原生支持)——
|
||||
// no-array-constructor / no-useless-constructor 已由 javascript 配置以核心规则覆盖。
|
||||
'typescript/ban-ts-comment': 'error',
|
||||
// Keep the first type-aware rollout conservative. These rules currently
|
||||
// produce high-volume diagnostics and need file-by-file cleanup later.
|
||||
'typescript/no-duplicate-enum-values': 'error',
|
||||
'typescript/no-dynamic-delete': 'error',
|
||||
'typescript/no-empty-object-type': 'error',
|
||||
'typescript/no-extra-non-null-assertion': 'error',
|
||||
'typescript/no-extraneous-class': 'error',
|
||||
'typescript/no-invalid-void-type': 'error',
|
||||
'typescript/no-misused-new': 'error',
|
||||
'typescript/no-non-null-asserted-nullish-coalescing': 'error',
|
||||
'typescript/no-non-null-asserted-optional-chain': 'error',
|
||||
'typescript/no-non-null-assertion': 'error',
|
||||
'typescript/no-require-imports': 'error',
|
||||
'typescript/no-this-alias': 'error',
|
||||
'typescript/no-unnecessary-type-constraint': 'error',
|
||||
'typescript/no-unsafe-declaration-merging': 'error',
|
||||
'typescript/no-unsafe-function-type': 'error',
|
||||
'typescript/no-var-requires': 'error',
|
||||
'typescript/no-wrapper-object-types': 'error',
|
||||
'typescript/prefer-as-const': 'error',
|
||||
'typescript/prefer-literal-enum-member': 'error',
|
||||
'typescript/prefer-namespace-keyword': 'error',
|
||||
'typescript/triple-slash-reference': 'error',
|
||||
'typescript/unified-signatures': 'error',
|
||||
|
||||
'typescript/await-thenable': 'off',
|
||||
'typescript/consistent-return': 'off',
|
||||
'typescript/no-base-to-string': 'off',
|
||||
'typescript/no-duplicate-type-constituents': 'off',
|
||||
'typescript/no-floating-promises': 'off',
|
||||
'typescript/no-misused-spread': 'off',
|
||||
'typescript/no-non-null-assertion': 'error',
|
||||
'typescript/no-redundant-type-constituents': 'off',
|
||||
'typescript/no-unnecessary-boolean-literal-compare': 'off',
|
||||
'typescript/no-unnecessary-type-assertion': 'off',
|
||||
'typescript/no-unnecessary-type-arguments': 'off',
|
||||
'typescript/no-unnecessary-template-expression': 'off',
|
||||
'typescript/no-unnecessary-type-arguments': 'off',
|
||||
'typescript/no-unnecessary-type-assertion': 'off',
|
||||
'typescript/no-unnecessary-type-conversion': 'off',
|
||||
'typescript/no-unnecessary-type-parameters': 'off',
|
||||
'typescript/no-unsafe-enum-comparison': 'off',
|
||||
'typescript/no-unsafe-type-assertion': 'off',
|
||||
'typescript/no-var-requires': 'error',
|
||||
'typescript/no-useless-default-assignment': 'off',
|
||||
'typescript/restrict-template-expressions': 'off',
|
||||
'typescript/triple-slash-reference': 'error',
|
||||
'typescript/unbound-method': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,6 +8,123 @@ const unicorn: OxlintConfig = {
|
||||
'unicorn/no-useless-spread': 'off',
|
||||
'unicorn/prefer-global-this': 'off',
|
||||
'unicorn/prefer-module': 'error',
|
||||
|
||||
'unicorn/catch-error-name': 'error',
|
||||
'unicorn/consistent-assert': 'error',
|
||||
'unicorn/consistent-date-clone': 'error',
|
||||
'unicorn/consistent-empty-array-spread': 'error',
|
||||
'unicorn/consistent-existence-index-check': 'error',
|
||||
'unicorn/consistent-template-literal-escape': 'error',
|
||||
'unicorn/empty-brace-spaces': 'error',
|
||||
'unicorn/error-message': 'error',
|
||||
'unicorn/escape-case': 'error',
|
||||
'unicorn/explicit-length-check': 'error',
|
||||
'unicorn/new-for-builtins': 'error',
|
||||
'unicorn/no-abusive-eslint-disable': 'error',
|
||||
'unicorn/no-accessor-recursion': 'error',
|
||||
'unicorn/no-anonymous-default-export': 'error',
|
||||
'unicorn/no-array-callback-reference': 'error',
|
||||
'unicorn/no-array-method-this-argument': 'error',
|
||||
'unicorn/no-array-reduce': 'error',
|
||||
'unicorn/no-array-reverse': 'error',
|
||||
'unicorn/no-array-sort': 'error',
|
||||
'unicorn/no-await-expression-member': 'error',
|
||||
'unicorn/no-await-in-promise-methods': 'error',
|
||||
'unicorn/no-console-spaces': 'error',
|
||||
'unicorn/no-document-cookie': 'error',
|
||||
'unicorn/no-empty-file': 'error',
|
||||
'unicorn/no-hex-escape': 'error',
|
||||
// oxlint 实现较 eslint 更严格,会误报既有代码,暂关闭
|
||||
'unicorn/no-immediate-mutation': 'off',
|
||||
'unicorn/no-instanceof-builtins': 'error',
|
||||
'unicorn/no-invalid-fetch-options': 'error',
|
||||
'unicorn/no-invalid-remove-event-listener': 'error',
|
||||
'unicorn/no-lonely-if': 'error',
|
||||
'unicorn/no-magic-array-flat-depth': 'error',
|
||||
'unicorn/no-negated-condition': 'error',
|
||||
'unicorn/no-negation-in-equality-check': 'error',
|
||||
'unicorn/no-nested-ternary': 'error',
|
||||
'unicorn/no-new-array': 'error',
|
||||
'unicorn/no-new-buffer': 'error',
|
||||
'unicorn/no-object-as-default-parameter': 'error',
|
||||
'unicorn/no-static-only-class': 'error',
|
||||
'unicorn/no-thenable': 'error',
|
||||
'unicorn/no-this-assignment': 'error',
|
||||
'unicorn/no-typeof-undefined': 'error',
|
||||
'unicorn/no-unnecessary-array-flat-depth': 'error',
|
||||
'unicorn/no-unnecessary-array-splice-count': 'error',
|
||||
'unicorn/no-unnecessary-await': 'error',
|
||||
'unicorn/no-unnecessary-slice-end': 'error',
|
||||
'unicorn/no-unreadable-array-destructuring': 'error',
|
||||
'unicorn/no-unreadable-iife': 'error',
|
||||
'unicorn/no-useless-collection-argument': 'error',
|
||||
'unicorn/no-useless-error-capture-stack-trace': 'error',
|
||||
'unicorn/no-useless-fallback-in-spread': 'error',
|
||||
'unicorn/no-useless-iterator-to-array': 'error',
|
||||
'unicorn/no-useless-length-check': 'error',
|
||||
'unicorn/no-useless-promise-resolve-reject': 'error',
|
||||
'unicorn/no-useless-switch-case': 'error',
|
||||
'unicorn/no-zero-fractions': 'error',
|
||||
'unicorn/number-literal-case': 'error',
|
||||
'unicorn/numeric-separators-style': 'error',
|
||||
'unicorn/prefer-add-event-listener': 'error',
|
||||
'unicorn/prefer-array-find': 'error',
|
||||
'unicorn/prefer-array-flat': 'error',
|
||||
'unicorn/prefer-array-flat-map': 'error',
|
||||
'unicorn/prefer-array-index-of': 'error',
|
||||
'unicorn/prefer-array-some': 'error',
|
||||
'unicorn/prefer-bigint-literals': 'error',
|
||||
'unicorn/prefer-blob-reading-methods': 'error',
|
||||
'unicorn/prefer-class-fields': 'error',
|
||||
'unicorn/prefer-classlist-toggle': 'error',
|
||||
'unicorn/prefer-code-point': 'error',
|
||||
'unicorn/prefer-date-now': 'error',
|
||||
'unicorn/prefer-default-parameters': 'error',
|
||||
'unicorn/prefer-dom-node-append': 'error',
|
||||
'unicorn/prefer-dom-node-dataset': 'error',
|
||||
'unicorn/prefer-dom-node-remove': 'error',
|
||||
'unicorn/prefer-event-target': 'error',
|
||||
'unicorn/prefer-export-from': ['error', { checkUsedVariables: false }],
|
||||
'unicorn/prefer-includes': 'error',
|
||||
'unicorn/prefer-keyboard-event-key': 'error',
|
||||
'unicorn/prefer-logical-operator-over-ternary': 'error',
|
||||
'unicorn/prefer-math-min-max': 'error',
|
||||
'unicorn/prefer-math-trunc': 'error',
|
||||
'unicorn/prefer-modern-dom-apis': 'error',
|
||||
'unicorn/prefer-modern-math-apis': 'error',
|
||||
'unicorn/prefer-native-coercion-functions': 'error',
|
||||
'unicorn/prefer-negative-index': 'error',
|
||||
'unicorn/prefer-node-protocol': 'error',
|
||||
'unicorn/prefer-number-properties': 'error',
|
||||
'unicorn/prefer-object-from-entries': 'error',
|
||||
'unicorn/prefer-optional-catch-binding': 'error',
|
||||
'unicorn/prefer-prototype-methods': 'error',
|
||||
'unicorn/prefer-query-selector': 'error',
|
||||
'unicorn/prefer-reflect-apply': 'error',
|
||||
'unicorn/prefer-regexp-test': 'error',
|
||||
'unicorn/prefer-response-static-json': 'error',
|
||||
'unicorn/prefer-set-has': 'error',
|
||||
'unicorn/prefer-set-size': 'error',
|
||||
'unicorn/prefer-single-call': 'error',
|
||||
'unicorn/prefer-spread': 'error',
|
||||
'unicorn/prefer-string-raw': 'error',
|
||||
'unicorn/prefer-string-replace-all': 'error',
|
||||
'unicorn/prefer-string-slice': 'error',
|
||||
'unicorn/prefer-string-starts-ends-with': 'error',
|
||||
'unicorn/prefer-string-trim-start-end': 'error',
|
||||
// oxlint 实现较 eslint 更严格(含 cloneDeep),暂关闭以保持迁移前行为
|
||||
'unicorn/prefer-structured-clone': 'off',
|
||||
'unicorn/prefer-ternary': 'error',
|
||||
'unicorn/prefer-type-error': 'error',
|
||||
'unicorn/relative-url-style': 'error',
|
||||
'unicorn/require-array-join-separator': 'error',
|
||||
'unicorn/require-module-attributes': 'error',
|
||||
'unicorn/require-module-specifiers': 'error',
|
||||
'unicorn/require-number-to-fixed-digits-argument': 'error',
|
||||
'unicorn/switch-case-braces': 'error',
|
||||
'unicorn/switch-case-break-position': 'error',
|
||||
'unicorn/text-encoding-identifier-case': 'error',
|
||||
'unicorn/throw-new-error': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import fs from 'node:fs';
|
||||
import fsp from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import archiver from 'archiver';
|
||||
import { ZipArchive } from 'archiver';
|
||||
|
||||
export const viteArchiverPlugin = (
|
||||
options: ArchiverPluginOptions = {},
|
||||
@@ -49,7 +49,8 @@ async function zipFolder(
|
||||
): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const output = fs.createWriteStream(outputPath);
|
||||
const archive = archiver('zip', {
|
||||
|
||||
const archive = new ZipArchive({
|
||||
zlib: { level: 9 }, // 设置压缩级别为 9 以实现最高压缩率
|
||||
});
|
||||
|
||||
|
||||
@@ -106,5 +106,5 @@
|
||||
"node": "^22.18.0 || ^24.0.0",
|
||||
"pnpm": ">=11.0.0"
|
||||
},
|
||||
"packageManager": "pnpm@11.5.2"
|
||||
"packageManager": "pnpm@11.7.0"
|
||||
}
|
||||
|
||||
2
packages/@core/base/typings/vue-router.d.ts
vendored
2
packages/@core/base/typings/vue-router.d.ts
vendored
@@ -3,6 +3,6 @@ import type { RouteMeta as IRouteMeta } from './dist/index.d.mts';
|
||||
import 'vue-router';
|
||||
|
||||
declare module 'vue-router' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
// oxlint-disable-next-line typescript/no-empty-object-type
|
||||
interface RouteMeta extends IRouteMeta {}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ const _bem = (
|
||||
|
||||
const is: {
|
||||
(name: string): string;
|
||||
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
||||
// oxlint-disable-next-line typescript/unified-signatures
|
||||
(name: string, state: boolean | undefined): string;
|
||||
} = (name: string, ...args: [] | [boolean | undefined]) => {
|
||||
const state = args.length > 0 ? args[0] : true;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* oxlint-disable unicorn/prefer-export-from */
|
||||
import type { Preferences } from './types';
|
||||
|
||||
import { preferencesManager } from './preferences';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable unicorn/no-nested-ternary */
|
||||
/* oxlint-disable unicorn/no-nested-ternary */
|
||||
import type { VxeGridProps as VxeTableGridProps } from 'vxe-table';
|
||||
|
||||
import type {
|
||||
|
||||
2
packages/types/global.d.ts
vendored
2
packages/types/global.d.ts
vendored
@@ -3,7 +3,7 @@ import type { RouteMeta as IRouteMeta } from '@vben-core/typings';
|
||||
import 'vue-router';
|
||||
|
||||
declare module 'vue-router' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
||||
// oxlint-disable-next-line typescript/no-empty-object-type
|
||||
interface RouteMeta extends IRouteMeta {}
|
||||
}
|
||||
|
||||
|
||||
1339
pnpm-lock.yaml
generated
1339
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -48,36 +48,36 @@ catalog:
|
||||
'@eslint-community/eslint-plugin-eslint-comments': ^4.7.2
|
||||
'@eslint/js': ^10.0.1
|
||||
'@faker-js/faker': ^10.4.0
|
||||
'@iconify/json': ^2.2.483
|
||||
'@iconify/json': ^2.2.487
|
||||
'@iconify/tailwind4': ^1.2.3
|
||||
'@iconify/vue': ^5.0.1
|
||||
'@intlify/core-base': ^11.4.4
|
||||
'@intlify/core-base': ^11.4.5
|
||||
'@intlify/unplugin-vue-i18n': ^11.2.3
|
||||
'@jspm/generator': ^2.16.1
|
||||
'@lucide/vue': ^1.17.0
|
||||
'@lucide/vue': ^1.18.0
|
||||
'@manypkg/get-packages': ^3.1.0
|
||||
'@nolebase/vitepress-plugin-git-changelog': ^2.18.2
|
||||
'@playwright/test': ^1.60.0
|
||||
'@playwright/test': ^1.61.0
|
||||
'@pnpm/workspace.read-manifest': ^1000.3.1
|
||||
'@stylistic/stylelint-plugin': ^5.2.0
|
||||
'@tailwindcss/typography': ^0.5.19
|
||||
'@tailwindcss/vite': ^4.3.0
|
||||
'@tailwindcss/typography': ^0.5.20
|
||||
'@tailwindcss/vite': ^4.3.1
|
||||
'@tanstack/vue-query': ^5.101.0
|
||||
'@tanstack/vue-store': ^0.11.0
|
||||
'@tiptap/core': ^3.26.0
|
||||
'@tiptap/extension-document': ^3.26.0
|
||||
'@tiptap/extension-highlight': ^3.26.0
|
||||
'@tiptap/extension-image': ^3.26.0
|
||||
'@tiptap/extension-link': ^3.26.0
|
||||
'@tiptap/extension-placeholder': ^3.26.0
|
||||
'@tiptap/extension-text-align': ^3.26.0
|
||||
'@tiptap/extension-text-style': ^3.26.0
|
||||
'@tiptap/extension-underline': ^3.26.0
|
||||
'@tiptap/pm': ^3.26.0
|
||||
'@tiptap/starter-kit': ^3.26.0
|
||||
'@tiptap/vue-3': ^3.26.0
|
||||
'@tiptap/core': ^3.26.1
|
||||
'@tiptap/extension-document': ^3.26.1
|
||||
'@tiptap/extension-highlight': ^3.26.1
|
||||
'@tiptap/extension-image': ^3.26.1
|
||||
'@tiptap/extension-link': ^3.26.1
|
||||
'@tiptap/extension-placeholder': ^3.26.1
|
||||
'@tiptap/extension-text-align': ^3.26.1
|
||||
'@tiptap/extension-text-style': ^3.26.1
|
||||
'@tiptap/extension-underline': ^3.26.1
|
||||
'@tiptap/pm': ^3.26.1
|
||||
'@tiptap/starter-kit': ^3.26.1
|
||||
'@tiptap/vue-3': ^3.26.1
|
||||
'@tsdown/css': ^0.22.2
|
||||
'@types/archiver': ^7.0.0
|
||||
'@types/archiver': ^8.0.0
|
||||
'@types/html-minifier-terser': ^7.0.2
|
||||
'@types/json-bigint': ^1.0.4
|
||||
'@types/jsonwebtoken': ^9.0.10
|
||||
@@ -87,21 +87,20 @@ catalog:
|
||||
'@types/qrcode': ^1.5.6
|
||||
'@types/qs': ^6.15.1
|
||||
'@types/sortablejs': ^1.15.9
|
||||
'@typescript-eslint/eslint-plugin': ^8.60.1
|
||||
'@typescript-eslint/parser': ^8.60.1
|
||||
'@typescript-eslint/parser': ^8.61.1
|
||||
'@vee-validate/zod': ^4.15.1
|
||||
'@vite-pwa/vitepress': ^1.1.0
|
||||
'@vitejs/plugin-vue': ^6.0.7
|
||||
'@vitejs/plugin-vue-jsx': ^5.1.5
|
||||
'@vue/shared': ^3.5.35
|
||||
'@vue/shared': ^3.5.38
|
||||
'@vue/test-utils': ^2.4.11
|
||||
'@vueuse/core': ^14.3.0
|
||||
'@vueuse/integrations': ^14.3.0
|
||||
'@vueuse/motion': ^3.0.3
|
||||
ant-design-vue: ^4.2.6
|
||||
antdv-next: ^1.3.3
|
||||
archiver: ^7.0.1
|
||||
axios: ^1.17.0
|
||||
antdv-next: ^1.3.5
|
||||
archiver: ^8.0.0
|
||||
axios: ^1.18.0
|
||||
axios-mock-adapter: ^2.1.0
|
||||
cac: ^7.0.0
|
||||
chalk: ^5.6.2
|
||||
@@ -119,16 +118,15 @@ catalog:
|
||||
defu: ^6.1.7
|
||||
dotenv: ^17.4.2
|
||||
echarts: ^6.1.0
|
||||
element-plus: ^2.14.1
|
||||
es-toolkit: ^1.47.0
|
||||
element-plus: ^2.14.2
|
||||
es-toolkit: ^1.47.1
|
||||
eslint: ^10.5.0
|
||||
eslint-plugin-better-tailwindcss: ^4.5.0
|
||||
eslint-plugin-better-tailwindcss: ^4.6.0
|
||||
eslint-plugin-command: ^3.5.2
|
||||
eslint-plugin-jsonc: ^3.2.0
|
||||
eslint-plugin-n: ^18.0.1
|
||||
eslint-plugin-perfectionist: ^5.9.0
|
||||
eslint-plugin-n: ^18.1.0
|
||||
eslint-plugin-perfectionist: ^5.9.1
|
||||
eslint-plugin-pnpm: ^1.6.1
|
||||
eslint-plugin-unicorn: ^64.0.0
|
||||
eslint-plugin-unused-imports: ^4.4.1
|
||||
eslint-plugin-vue: ^10.9.2
|
||||
eslint-plugin-yml: ^3.4.0
|
||||
@@ -142,7 +140,7 @@ catalog:
|
||||
is-ci: ^4.1.0
|
||||
json-bigint: ^1.0.0
|
||||
jsonwebtoken: ^9.0.3
|
||||
knip: ^6.15.0
|
||||
knip: ^6.17.0
|
||||
lefthook: ^2.1.9
|
||||
lodash.clonedeep: ^4.5.0
|
||||
medium-zoom: ^1.1.0
|
||||
@@ -150,7 +148,7 @@ catalog:
|
||||
nitropack: ^2.13.4
|
||||
nprogress: ^0.2.0
|
||||
ora: ^9.4.0
|
||||
oxfmt: ^0.53.0
|
||||
oxfmt: ^0.55.0
|
||||
oxlint: ^1.70.0
|
||||
oxlint-tsgolint: ^0.23.0
|
||||
pinia: ^3.0.4
|
||||
@@ -163,15 +161,15 @@ catalog:
|
||||
publint: ^0.3.21
|
||||
qrcode: ^1.5.4
|
||||
qs: ^6.15.2
|
||||
reka-ui: ^2.9.9
|
||||
reka-ui: ^2.9.10
|
||||
resolve.exports: ^2.0.3
|
||||
rimraf: ^6.1.3
|
||||
rollup-plugin-visualizer: ^7.0.1
|
||||
sass: ^1.100.0
|
||||
sass: ^1.101.0
|
||||
sass-embedded: ^1.100.0
|
||||
secure-ls: ^2.0.0
|
||||
sortablejs: ^1.15.7
|
||||
stylelint: ^17.12.0
|
||||
stylelint: ^17.13.0
|
||||
stylelint-config-recess-order: ^7.7.0
|
||||
stylelint-config-recommended: ^18.0.0
|
||||
stylelint-config-recommended-scss: ^17.0.1
|
||||
@@ -196,19 +194,19 @@ catalog:
|
||||
vite-plugin-compression: ^0.5.1
|
||||
vite-plugin-lazy-import: ^1.0.7
|
||||
vite-plugin-pwa: ^1.3.0
|
||||
vite-plugin-vue-devtools: ^8.1.2
|
||||
vite-plugin-vue-devtools: ^8.1.3
|
||||
vitepress: ^2.0.0-alpha.17
|
||||
vitepress-plugin-group-icons: ^1.7.5
|
||||
vitest: ^4.1.9
|
||||
vue: ^3.5.35
|
||||
vue: ^3.5.38
|
||||
vue-eslint-parser: ^10.4.1
|
||||
vue-i18n: ^11.4.4
|
||||
vue-i18n: ^11.4.5
|
||||
vue-json-pretty: ^2.6.0
|
||||
vue-router: ^5.1.0
|
||||
vue-tippy: ^6.7.1
|
||||
vue-tsc: ^3.3.5
|
||||
vxe-pc-ui: ^4.14.30
|
||||
vxe-table: ^4.19.7
|
||||
vxe-pc-ui: ^4.14.39
|
||||
vxe-table: ^4.19.14
|
||||
watermark-js-plus: ^1.6.3
|
||||
yaml-eslint-parser: ^2.0.0
|
||||
zod: ^3.25.76
|
||||
|
||||
@@ -26,7 +26,7 @@ async function runLint({ format, threads }: LintCommandOptions) {
|
||||
await execaCommand(`oxfmt${threadsArg}`, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
await execaCommand(`oxlint --fix${threadsArg}`, {
|
||||
await execaCommand(`oxlint --fix --type-aware${threadsArg}`, {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
await execaCommand(`eslint . --cache --fix`, {
|
||||
@@ -36,7 +36,7 @@ async function runLint({ format, threads }: LintCommandOptions) {
|
||||
}
|
||||
const subprocesses = [
|
||||
execaCommand(`oxfmt --check${threadsArg}`, { stdio: 'inherit' }),
|
||||
execaCommand(`oxlint${threadsArg}`, { stdio: 'inherit' }),
|
||||
execaCommand(`oxlint --type-aware${threadsArg}`, { stdio: 'inherit' }),
|
||||
execaCommand(`eslint . --cache`, { stdio: 'inherit' }),
|
||||
execaCommand(`stylelint "**/*.{vue,css,less,scss}" --cache`, {
|
||||
stdio: 'inherit',
|
||||
|
||||
Reference in New Issue
Block a user