chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -5,7 +5,7 @@ module.exports = [
|
||||
...require('./eslint.config.base.js'),
|
||||
{
|
||||
plugins: {
|
||||
// TODO: 需要根据不同类型配置plugin?需要阅读源码确认是否影响性能
|
||||
// TODO: Need to configure plugins according to different types? You need to read the source code to confirm whether it affects performance
|
||||
'react-hooks': require('eslint-plugin-react-hooks'),
|
||||
react: require('eslint-plugin-react'),
|
||||
risxss: require('eslint-plugin-risxss'),
|
||||
|
||||
@@ -28,7 +28,7 @@ const readBlockList = () =>
|
||||
|
||||
/** @type {(import('eslint').Linter.Config)[]} */
|
||||
module.exports = [
|
||||
// NOTE: 不能和下一项配置合并
|
||||
// NOTE: Cannot be merged with the next configuration
|
||||
{
|
||||
ignores: [
|
||||
'**/*.d.ts',
|
||||
@@ -68,7 +68,7 @@ module.exports = [
|
||||
...require('@coze-arch/eslint-plugin').configs.recommended,
|
||||
require('@coze-arch/eslint-plugin/zustand').configs.recommended,
|
||||
{
|
||||
files: ['**/*.?(m|c)?(j|t)s?(x)'], // 排除规则对package.json生效
|
||||
files: ['**/*.?(m|c)?(j|t)s?(x)'], // Exclusion rules take effect for package.json
|
||||
plugins: {
|
||||
prettier: require('eslint-plugin-prettier'),
|
||||
'@babel': require('@babel/eslint-plugin'),
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = [
|
||||
{
|
||||
files: ['**/*.?(m|c)?(j|t)s?(x)'],
|
||||
settings: {
|
||||
// TODO: 全局保留一份配置
|
||||
// TODO: Keep a configuration globally
|
||||
'import/resolver': {
|
||||
node: {
|
||||
moduleDirectory: ['node_modules', 'src'],
|
||||
@@ -72,8 +72,8 @@ module.exports = [
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
// TODO: 目前由于 edenx 会动态生成一些插件模块,因此启动会报错
|
||||
// 后续需要修复问题,启动下述规则
|
||||
// TODO: At present, because edenx will dynamically generate some plug-in modules, an error will be reported when starting.
|
||||
// You need to fix the problem later, and start the following rules.
|
||||
// "import/no-unresolved": "error"
|
||||
},
|
||||
},
|
||||
|
||||
@@ -59,9 +59,9 @@ module.exports = [
|
||||
{
|
||||
vars: 'all',
|
||||
args: 'none', // function arguments should not force to match this rule.
|
||||
argsIgnorePattern: '^_', // 规范允许下划线
|
||||
ignoreRestSiblings: true, //使用rest语法(如 `var { foo, ...rest } = data`) 忽略foo。
|
||||
destructuredArrayIgnorePattern: '^_', //结构数组允许使用_
|
||||
argsIgnorePattern: '^_', // Specifications allow underlining
|
||||
ignoreRestSiblings: true, //Use rest syntax (such as'var {foo,... rest} = data ') to ignore foo.
|
||||
destructuredArrayIgnorePattern: '^_', //Structural arrays allow _
|
||||
caughtErrors: 'none',
|
||||
// "caughtErrorsIgnorePattern": "^e$"
|
||||
},
|
||||
@@ -314,7 +314,7 @@ module.exports = [
|
||||
},
|
||||
},
|
||||
|
||||
// TODO: 之前overides的内容,后需可考虑直接合入上面标准配置
|
||||
// TODO: The content of overides before can be considered to be directly integrated into the above standard configuration later
|
||||
{
|
||||
files: ['**/*.?(m|c)ts?(x)'],
|
||||
rules: {
|
||||
@@ -324,8 +324,8 @@ module.exports = [
|
||||
fixStyle: 'inline-type-imports',
|
||||
},
|
||||
],
|
||||
// 这些规则都是从 packages/config/.eslintrc.react.js 复制迁移过来
|
||||
// 后续在做调整
|
||||
// These rules are copied and migrated from packages/config/.eslintrc.react.js
|
||||
// Adjustments are being made later.
|
||||
'@typescript-eslint/no-redundant-type-constituents': 0,
|
||||
'@typescript-eslint/no-throw-literal': 'off',
|
||||
'@typescript-eslint/no-unnecessary-condition': 0,
|
||||
@@ -335,14 +335,14 @@ module.exports = [
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'no-shadow': 'off',
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
// TODO: 后续开启
|
||||
// TODO: Follow-up opening
|
||||
// 'import/no-cycle': 'error',
|
||||
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 0,
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 0,
|
||||
'@typescript-eslint/no-implied-eval': 0, // warning
|
||||
|
||||
// TODO: 打开下面这些配置
|
||||
// TODO: Open the following configurations
|
||||
// fix: https://stackoverflow.com/questions/63961803/eslint-says-all-enums-in-typescript-app-are-already-declared-in-the-upper-scope
|
||||
// 'no-shadow': 'off',
|
||||
// '@typescript-eslint/no-shadow': ['error'],
|
||||
@@ -364,7 +364,7 @@ module.exports = [
|
||||
// },
|
||||
// ],
|
||||
// complexity: ['error', { max: 15 }],
|
||||
// 后面统一使用CustomError后 再开启
|
||||
// After using CustomError uniformly later, open it again.
|
||||
'@coze-arch/no-new-error': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
# 某些系统可能没有 realpath 命令,
|
||||
# Some systems may not have the realpath command.
|
||||
if ! command -v realpath &>/dev/null; then
|
||||
echo "未找到 realpath 命令"
|
||||
echo "请执行以下命令安装必要依赖"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
# 某些系统可能没有 realpath 命令,
|
||||
# Some systems may not have the realpath command.
|
||||
if ! command -v realpath &>/dev/null; then
|
||||
echo "未找到 realpath 命令"
|
||||
echo "请执行以下命令安装必要依赖"
|
||||
|
||||
@@ -2,9 +2,9 @@ require('sucrase/register/ts');
|
||||
|
||||
const { defineConfig } = require('./define-config');
|
||||
|
||||
// node@16 没有 structuredClone 方法导致报错:
|
||||
// node@16 no structuredClone method causes an error:
|
||||
// ReferenceError: Error while loading rule '@typescript-eslint/naming-convention': structuredClone is not defined
|
||||
// 此处做个简单 polyfill
|
||||
// Make a simple polyfill here
|
||||
if (typeof structuredClone === 'undefined') {
|
||||
global.structuredClone = obj => JSON.parse(JSON.stringify(obj));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import { SemiRspackPlugin } from '@douyinfe/semi-rspack-plugin';
|
||||
const getDefine = () => {
|
||||
const define = {};
|
||||
Object.keys(GLOBAL_ENVS).forEach(key => {
|
||||
// 在rspack的define中,字符串需要前后拼接上双引号,才能在代码中作为字符串使用。
|
||||
// In the definition of rspack, strings need to be enclosed in double quotes before they can be used as strings in code.
|
||||
if (typeof GLOBAL_ENVS[key] === 'string') {
|
||||
define[key] = `"${GLOBAL_ENVS[key]}"`;
|
||||
} else {
|
||||
@@ -115,7 +115,7 @@ export const defineConfig = (options: Partial<RsbuildConfig>) => {
|
||||
),
|
||||
},
|
||||
include: [
|
||||
// 以下几个包包含未降级的 ES 2022 语法(private methods)需要参与打包
|
||||
// The following packages contain undegraded ES 2022 syntax (private methods) that need to be packaged
|
||||
/\/node_modules\/(marked|@dagrejs|@tanstack)\//,
|
||||
],
|
||||
},
|
||||
|
||||
@@ -6,9 +6,9 @@ module.exports = {
|
||||
],
|
||||
plugins: ['./plugins/plugin-disallow-nesting-level-one-global.js'],
|
||||
rules: {
|
||||
// 变量命名规则,适应仓库内的代码风格
|
||||
// Variable naming rules to adapt to the code style in the warehouse
|
||||
'custom-property-pattern': '^([A-Za-z0-9]*)([-_]+[A-Za-z0-9]+)*$',
|
||||
// 对于less函数判断有问题
|
||||
// There is a problem with judging the less function
|
||||
'less/no-duplicate-variables': null,
|
||||
'media-feature-range-notation': null,
|
||||
'max-nesting-depth': [
|
||||
|
||||
@@ -5,7 +5,7 @@ const plugin = require('tailwindcss/plugin');
|
||||
const lightModeVariables = require('./light');
|
||||
const darkModeVariables = require('./dark');
|
||||
|
||||
// 用于生成 CSS 变量的帮助函数
|
||||
// Helper functions for generating CSS variables
|
||||
function generateCssVariables(variables, theme) {
|
||||
return Object.entries(variables).reduce((acc, [key, value]) => {
|
||||
acc[`--${key}`] = theme ? theme(value) : value;
|
||||
@@ -13,7 +13,7 @@ function generateCssVariables(variables, theme) {
|
||||
}, {});
|
||||
}
|
||||
|
||||
// 样式语义化
|
||||
// style semantics
|
||||
function generateSemanticVariables(semantics, theme, property) {
|
||||
return Object.entries(semantics).map(([key, value]) => ({
|
||||
[`.${key}`]: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 暗色模式的 CSS 变量
|
||||
// CSS Variables for Dark Mode
|
||||
const darkModeVariables = {
|
||||
background: '2, 8, 23',
|
||||
foreground: '249, 249, 249',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// 消费者和生产者公共的 tailwind 配置和工具函数
|
||||
// Common tailwind configurations and tool functions for consumers and producers
|
||||
|
||||
export function designTokenToTailwindConfig(
|
||||
tokenJson: Record<string, unknown>,
|
||||
@@ -103,6 +103,6 @@ function borderRadiusTransformer(borderRadiusObj: Record<string, string>) {
|
||||
return res;
|
||||
}
|
||||
|
||||
// 获取其他packages,并且拼接上 /src/**/*.{ts,tsx}
|
||||
// Get other packages and splice /src /**/*.{ ts, tsx}
|
||||
|
||||
export { getTailwindContents } from './tailwind-contents';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 浅色模式的 CSS 变量
|
||||
// CSS Variables for Light Mode
|
||||
const lightModeVariables = {
|
||||
background: '255, 255, 255',
|
||||
foreground: '28, 28, 35',
|
||||
@@ -27,7 +27,7 @@ const lightModeVariables = {
|
||||
'coze-fg-3': '15, 21, 40',
|
||||
'coze-fg-2': '32, 41, 69',
|
||||
'coze-fg-1': '55, 67, 106',
|
||||
// TODO: 需要删除bg9
|
||||
// TODO: need to remove bg9
|
||||
'coze-bg-9': '6, 7, 9',
|
||||
'coze-bg-8': '68, 83, 130',
|
||||
'coze-bg-7': '75, 90, 140',
|
||||
@@ -151,7 +151,7 @@ const lightModeVariables = {
|
||||
'coze-3': '3px',
|
||||
'coze-2': '2px',
|
||||
'coze-1': '1px',
|
||||
// TODO: rspress编译不出来,需要通过一些工具处理,目前没有用到,暂时注释处理
|
||||
// TODO: rspress cannot be compiled, and it needs to be processed by some tools. It is not used at present. Temporary comment processing
|
||||
// 'coze-0.5': '0.5px',
|
||||
'coze-0-5': '0.5px',
|
||||
|
||||
@@ -174,7 +174,7 @@ const lightModeVariables = {
|
||||
'coze-bg-6-alpha': '0.13',
|
||||
'coze-bg-7-alpha': '0.19',
|
||||
'coze-bg-8-alpha': '0.25',
|
||||
// TODO: 需要删除bg9
|
||||
// TODO: need to remove bg9
|
||||
'coze-bg-9-alpha': '0.16',
|
||||
'coze-stroke-5-alpha': '0.13',
|
||||
'coze-stroke-6-alpha': '0.25',
|
||||
|
||||
@@ -46,7 +46,7 @@ export const getTailwindContents = (projectRoot: string) => {
|
||||
.map(location => path.resolve(location, 'src/**/*.{ts,tsx}')),
|
||||
);
|
||||
|
||||
// 兼容 coze-design 内部 tailwind 样式
|
||||
// Compatible with coze-design internal tailwind style
|
||||
contents.push('./node_modules/@coze-arch/coze-design/**/*.{js,jsx}');
|
||||
|
||||
return contents;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
BASE_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
# 某些系统可能没有 realpath 命令,
|
||||
# Some systems may not have the realpath command.
|
||||
if ! command -v realpath &>/dev/null; then
|
||||
echo "未找到 realpath 命令"
|
||||
echo "请执行以下命令安装必要依赖"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"moduleResolution": "node",
|
||||
"module": "CommonJS",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
// 这个普遍反馈会让代码变得啰嗦,暂定遵循原本 bot 的设置,关闭
|
||||
// This general feedback will make the code verbose, tentatively follow the original bot's settings, close
|
||||
"noImplicitReturns": false,
|
||||
"removeComments": false,
|
||||
"resolveJsonModule": true,
|
||||
|
||||
@@ -46,7 +46,7 @@ const calBasePreset = (preset: string) => {
|
||||
|
||||
export interface OtherConfig {
|
||||
/**
|
||||
* 用于修复semi的package.json导出的配置问题
|
||||
* Used to fix the configuration issue of semi's package.json export
|
||||
*/
|
||||
fixSemi: boolean;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
export const defaultVitestConfig: UserConfig = {
|
||||
plugins: [tsconfigPaths()],
|
||||
resolve: {
|
||||
// 优先识别 main,如果没有配置 main,则识别 module
|
||||
// Priority to identify main, if main is not configured, identify the module
|
||||
mainFields: ['main', 'module', 'exports'],
|
||||
},
|
||||
server: {
|
||||
@@ -38,14 +38,14 @@ export const defaultVitestConfig: UserConfig = {
|
||||
},
|
||||
},
|
||||
sequence: {
|
||||
// vitest 2.0之后,所有钩子默认串行运行
|
||||
// After vitest 2.0, all hooks run serially by default
|
||||
hooks: 'parallel',
|
||||
},
|
||||
globals: true,
|
||||
mockReset: false,
|
||||
silent: process.env.CI === 'true',
|
||||
coverage: {
|
||||
// 逐步对各包开启
|
||||
// Gradually open each package
|
||||
all: false,
|
||||
include: ['src/**/*.ts', 'src/**/*.tsx'],
|
||||
exclude: coverageConfigDefaults.exclude,
|
||||
|
||||
Reference in New Issue
Block a user