From 37dd759ff9171eac698175e9dbd738e02a397163 Mon Sep 17 00:00:00 2001 From: gaoziman <2942894660@qq.com> Date: Wed, 5 Nov 2025 09:46:41 +0800 Subject: [PATCH] =?UTF-8?q?chore(=E9=85=8D=E7=BD=AE):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A7=84=E8=8C=83=E5=92=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 配置 ESLint 代码检查规则和忽略文件 - 配置 Prettier 代码格式化规则 - 配置 StyleLint 样式检查规则和忽略文件 - 配置 Husky Git hooks 实现提交前自动检查 --- .eslintignore | 1 + .eslintrc | 34 ++++++++++++++++++++++++++++++++++ .husky/pre-commit | 6 ++++++ .prettierrc | 7 +++++++ .stylelintignore | 4 ++++ .stylelintrc | 17 +++++++++++++++++ 6 files changed, 69 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100755 .husky/pre-commit create mode 100644 .prettierrc create mode 100644 .stylelintignore create mode 100644 .stylelintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +node_modules diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..8067077 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,34 @@ +{ + "root": true, + "env": { + "browser": true, + "commonjs": true, + "es6": true, + "node": true, + "jest": true + }, + "parser": "@typescript-eslint/parser", + "extends": [ + "prettier", + "plugin:@typescript-eslint/recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended" + ], + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true, + "jsx": true + }, + "sourceType": "module" + }, + "settings": { + "react": { + "version": "16.8" + } + }, + "plugins": ["react", "babel", "@typescript-eslint/eslint-plugin"], + "rules": { + "react/display-name": 0, + "react/prop-types": 0 + } +} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..e24ff61 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npm run pre-commit +npm run pre-commit +npm run pre-commit diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..8e3a54d --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "singleQuote": true, + "jsxSingleQuote": false, + "useTabs": false, + "tabWidth": 2 +} diff --git a/.stylelintignore b/.stylelintignore new file mode 100644 index 0000000..ec719bc --- /dev/null +++ b/.stylelintignore @@ -0,0 +1,4 @@ +**/*.ts +**/*.tsx +**/*.jsx +**/*.js diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 0000000..c09537c --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,17 @@ +{ + "extends": ["stylelint-config-standard", "stylelint-config-prettier"], + "customSyntax": "postcss-less", + "rules": { + "selector-class-pattern": null, + "no-descending-specificity": null, + "no-duplicate-selectors": null, + "color-function-notation": null, + "font-family-no-missing-generic-family-keyword": null, + "selector-pseudo-class-no-unknown": [ + true, + { + "ignorePseudoClasses": ["global"] + } + ] + } +}