dify icon indicating copy to clipboard operation
dify copied to clipboard

前端代码的格式化规范统一

Open saifeiLee opened this issue 1 year ago • 2 comments

你好,我想贡献代码,但是发现项目里没有统一代码格式化的配置。能否补充一下,方便我们以统一格式提交代码。

saifeiLee avatar May 24 '23 02:05 saifeiLee

@iamjoel @nite-knite

JohnJyong avatar May 24 '23 02:05 JohnJyong

下面我们会加 lint 之类的配置。目前的 rule 是这样的(web/.eslintrc.json):

{
  "extends": [
    "@antfu",
    "plugin:react-hooks/recommended"
  ],
  "rules": {
    "@typescript-eslint/consistent-type-definitions": [
      "error",
      "type"
    ],
    "no-console": "off",
    "indent": "off",
    "@typescript-eslint/indent": [
      "error",
      2,
      {
        "SwitchCase": 1,
        "flatTernaryExpressions": false,
        "ignoredNodes": [
          "PropertyDefinition[decorators]",
          "TSUnionType",
          "FunctionExpression[params]:has(Identifier[decorators])"
        ]
      }
    ],
    "react-hooks/exhaustive-deps": "warning"
  }
}

iamjoel avatar May 24 '23 07:05 iamjoel

Added: https://github.com/langgenius/dify/pull/242

iamjoel avatar May 29 '23 09:05 iamjoel