Skip to content

PR Rules

Neptune edited this page Nov 29, 2021 · 1 revision

English Version

In order to perform PR Merge more efficiently, several PR principles have been formulated. Please check your own PR according to these principles before submitting a PR.

Common

  • Must pass ESLint, StyleLint detection
  • Forbidden the use of unstable syntax declared in Typescript documentation
  • Strictly follow the Commit Message format
  • Strictly ensure that the PR target branch can be officially modified by Semi

TSX (@douyinfe/semi-ui)

  • Must be able to be compiled normally by the tsc command
  • Must be clearly stated the reason for the DOM change
  • The adapter method defined in the component foundation must be fully implemented
  • Forbidden to import other component style files. If this component needs to import other component scss, please use the @import syntax of scss under the scss file of this component to import
  • Forbidden to directly modify the component state (setState). When you need to change the internal state of a component, you need to notify the foundation, and the foundation will notify the adapter to modify the component state
  • Forbidden to keep invalid import
  • Forbidden to import Foundation resources through relative paths. E.g: ✅ import { what you need } from "@douyinfe/semi-foundation", ❌ import { what you need } from "../semi-foundation"

Foundation (@douyinfe/semi-foundation)

  • Must be able to be compiled normally by the tsc command
  • Forbidden to include @douyinfe/semi-ui in the foundation file

Style (@douyinfe/semi-foundation)

  • Must be able to be compiled normally
  • Forbidden to use !important syntax
  • Forbidden use of color literal values, use Semi color variables. E.g: ✅ color: var(--semi-color-primary) ,❌ color: #66ccff
  • Forbidden adding new css-variables
  • Forbidden to use literals in font size, level, size, and equivalent. Priority is given to using the predefined scss variables in the variable.scss file under each component folder. If it is missing, it can be added in variable.scss as appropriate

中文版本

为了更加高效地进行PR的Merge,现制定了几条PR原则,请大家在提交PR前根据该原则,对自己的PR进行检查。

Common

  • 必须通过ESLint、StyleLint检测
  • 禁止使用 Typescript 文档中声明的不稳定语法
  • 严格遵守Commit Message格式
  • 严格确保 PR 目标分支可被 Semi 官方修改

TSX (@douyinfe/semi-ui)

  • 必须可被 tsc 命令正常编译
  • 必须完整实现该组件 foundation 中定义的 adapter 方法
  • 禁止引入其他组件样式文件,若该组件需要引入其他组件 scss,请在该组件的 scss 文件下使用 scss 的 @import 语法来引入
  • 禁止直接修改组件状态(setState) 。需更改组件内部状态时,都需通知 foundation,由foundation 通知 adapter 去修改组件状态
  • 禁止保留无效 import
  • 禁止通过相对路径引入 Foundation 资源。例如:✅ import { what you need } from "@douyinfe/semi-foundation",❌ import { what you need } from "../semi-foundation"
  • 必须说明清楚DOM改动原因

Foundation (@douyinfe/semi-foundation)

  • 必须可被 tsc 命令正常编译
  • 禁止 在 foundation文件中引入@douyinfe/semi-ui

Style (@douyinfe/semi-foundation)

  • 禁止使用 !important 语法
  • 禁止使用颜色字面量值,使用Semi颜色变量。例如:✅ color: var(--semi-color-primary) ,❌ color: #66ccff
  • 禁止添加新 css 变量
  • 禁止在字号,层级,大小,等值使用字面量,优先使用各个组件文件夹下的 variable.scss 文件中预定义的 scss 变量,如缺少,可酌情在 variable.scss 中添加
  • 需要使用 node-sass, dart-sass 同时支持的 scss 语法