From d37bcf34fc03f41cdabd47272b3c8701632449ef Mon Sep 17 00:00:00 2001 From: weishaodaren Date: Thu, 2 Feb 2023 15:59:25 +0800 Subject: [PATCH] disable defaultProps in SFC --- package.json | 2 +- rules/react.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 826679c..62f388b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-polaris", - "version": "1.3.1", + "version": "2.0.0", "description": "极星代码规范 ⭐️", "main": "index.js", "publishConfig": { diff --git a/rules/react.js b/rules/react.js index e238923..7720aaf 100644 --- a/rules/react.js +++ b/rules/react.js @@ -14,10 +14,10 @@ module.exports = { rules: { // 关闭展示displayName "react/display-name": 0, - // 强制使用默认值 - "react/require-default-props": 2, - // 强制使用与默认类型相同的默认值 - "react/default-props-match-prop-types": 2, + // 关闭强制使用默认值 + "react/require-default-props": 0, + // 关闭使用与默认类型相同的默认值(同上 SFC不使用defaultProps 推荐ES6默认参数) + "react/default-props-match-prop-types": 0, // 强制函数组件命名使用箭头函数 "react/function-component-definition": [ 2,