diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..7100590
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,16 @@
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md]
+max_line_length = off
+trim_trailing_whitespace = false
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 0000000..6aa0f68
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1,42 @@
+module.exports = {
+ env: {
+ browser: true,
+ es2021: true,
+ node: true
+ },
+ extends: [
+ 'eslint:recommended',
+ 'plugin:@typescript-eslint/recommended',
+ 'plugin:react/recommended',
+ 'plugin:react/jsx-runtime'
+ ],
+ overrides: [
+ {
+ env: {
+ node: true
+ },
+ files: ['.eslintrc.{js,cjs}'],
+ parserOptions: {
+ sourceType: 'script'
+ }
+ },
+ {
+ files: ['**/*.tsx'],
+ rules: {
+ 'react/prop-types': 'off'
+ }
+ }
+ ],
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module'
+ },
+ plugins: ['@typescript-eslint', 'react'],
+ rules: {
+ indent: ['error', 2],
+ 'linebreak-style': ['error', 'unix'],
+ quotes: ['error', 'single'],
+ semi: ['error', 'never']
+ }
+}
diff --git a/.github/ISSUE_TEMPLATE/oscp.yml b/.github/ISSUE_TEMPLATE/oscp.yml
index 017efd9..3287b14 100644
--- a/.github/ISSUE_TEMPLATE/oscp.yml
+++ b/.github/ISSUE_TEMPLATE/oscp.yml
@@ -1,5 +1,5 @@
name: 'AntV OSCP 计划'
-description: AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP)
+description: AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP)
body:
- type: checkboxes
id: AntV_OSCP_program
@@ -8,7 +8,7 @@ body:
description: |
AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP) 期望可以基于 AntV 的开源 Roadmap 开放具体开发任务到社区,以社区共建任务的形式推动“AntV” 的开源发展,也期望有更多社区伙伴各各种形式参与到 AntV 的开源共建中,共同参与数据可视化开源生态的持续建设。
若有感兴趣想要认领的任务,可直接回复认领,如果你是首次认领可先完成[新手任务](https://www.yuque.com/antv/cyggvg/cwc9kacfvd9aivsp)
-
+
options:
- label: 我同意将这个 Issue 参与 OSCP 计划
validations:
@@ -28,7 +28,7 @@ body:
id: oscp_task_description
attributes:
label: 任务介绍
- description: |
+ description: |
简单描述任务背景信息,为了解决哪些问题
validations:
required: false
@@ -36,8 +36,7 @@ body:
id: oscp_task_info_description_2
attributes:
label: 参考说明
- description: |
- 提供一些可参考的demo,相关教程辅助用户解决问题
+ description: |
+ 提供一些可参考的demo,相关教程辅助用户解决问题
validations:
required: false
-
diff --git a/.github/ISSUE_TEMPLATE/site_report.yml b/.github/ISSUE_TEMPLATE/site_report.yml
index 552dd6a..596a368 100644
--- a/.github/ISSUE_TEMPLATE/site_report.yml
+++ b/.github/ISSUE_TEMPLATE/site_report.yml
@@ -8,7 +8,7 @@ body:
description: |
输入站点名称
placeholder: |
- https://l7editor.antv.antgroup.com/
+ https://l7editor.antv.antgroup.com/
validations:
required: true
- type: input
@@ -18,7 +18,7 @@ body:
description: |
输入站点 URL
placeholder: |
- https://l7editor.antv.antgroup.com/
+ https://l7editor.antv.antgroup.com/
validations:
required: true
- type: textarea
@@ -52,7 +52,7 @@ body:
- type: textarea
id: logo
attributes:
- label: 图标
+ label: 图标
description: 站点 logo 或 icon 图标, URL 地址或者复制图片
placeholder: |
可以将你的图片拖拽到此处↓
diff --git a/.husky/commit-msg b/.husky/commit-msg
new file mode 100755
index 0000000..1a089f4
--- /dev/null
+++ b/.husky/commit-msg
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npx --no-install commitlint --edit $1
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 0000000..75fac8e
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,4 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+
+npm run lint
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..a032a61
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,3 @@
+build
+node_modules
+public
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 0000000..2944819
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,7 @@
+{
+ "useTabs": false,
+ "tabWidth": 2,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "semi": false
+}
diff --git a/README.md b/README.md
index 0492724..f87d969 100644
--- a/README.md
+++ b/README.md
@@ -12,25 +12,27 @@ Inspired by [larkmap](https://larkmap.com/)
[点击提交站点信息](https://github.com/DipperMap/dippermap/issues/new?assignees=&labels=&projects=&template=site_report.yml)
-#### 方式二 提交 PR
+#### 方式二 提交 PR
直接修改站点配置文件,通过 PR 的方式,合并代码,代码合并后站点生效
-[点击修改配置文件](https://github.com/DipperMap/dippermap/edit/main/src/data/config.ts)
-
## 本地开发
### clone 代码
```bash
git clone https://github.com/DipperMap/dippermap.git
-````
+```
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+### `npm commit`
+
+Submit your code this way.
+
## 👬 Contributors
![https://github.com/DipperMap/dippermap/graphs/contributors](https://contrib.rocks/image?repo=DipperMap/dippermap)
diff --git a/commitlint.config.cjs b/commitlint.config.cjs
new file mode 100644
index 0000000..a4f4369
--- /dev/null
+++ b/commitlint.config.cjs
@@ -0,0 +1,3 @@
+module.exports = {
+ extends: ['@commitlint/config-conventional']
+}
diff --git a/package.json b/package.json
index 111ed83..73a562c 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,21 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
- "eject": "react-scripts eject"
+ "eject": "react-scripts eject",
+ "prettier": "prettier --write .",
+ "lint": "lint-staged",
+ "commit": "cz"
+ },
+ "lint-staged": {
+ "src/*.{js,ts,jsx,tsx,vue}": [
+ "node_modules/.bin/prettier --write .",
+ "node_modules/.bin/eslint --fix .",
+ "git add ."
+ ],
+ "src/*.{css,scss,less,json,html,md}": [
+ "node_modules/.bin/prettier --write .",
+ "git add ."
+ ]
},
"eslintConfig": {
"extends": [
@@ -43,6 +57,19 @@
]
},
"devDependencies": {
- "antd": "^5.11.5"
+ "@commitlint/cli": "^18.4.3",
+ "@commitlint/config-conventional": "^18.4.3",
+ "antd": "^5.11.5",
+ "commitizen": "^4.3.0",
+ "cz-conventional-changelog": "^3.3.0",
+ "eslint": "^8.54.0",
+ "husky": "^8.0.3",
+ "lint-staged": "^15.1.0",
+ "prettier": "^3.1.0"
+ },
+ "config": {
+ "commitizen": {
+ "path": "./node_modules/cz-conventional-changelog"
+ }
}
}
diff --git a/src/App.test.tsx b/src/App.test.tsx
index 2a68616..3a7a8cc 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,9 +1,9 @@
-import React from 'react';
-import { render, screen } from '@testing-library/react';
-import App from './App';
+import React from 'react'
+import { render, screen } from '@testing-library/react'
+import App from './App'
test('renders learn react link', () => {
- render(