Skip to content

Commit 54357aa

Browse files
committed
优化文档
1 parent e302778 commit 54357aa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+676
-1693
lines changed

.editorconfig

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# http://editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
# Change these settings to your own preference
10+
indent_style = space
11+
indent_size = 2
12+
13+
# We recommend you to keep these unchanged
14+
end_of_line = lf
15+
charset = utf-8
16+
trim_trailing_whitespace = true
17+
insert_final_newline = true
18+
19+
# editorconfig-tools is unable to ignore longs strings or urls
20+
max_line_length = null

.eslintrc.js

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
const path = require('path');
2+
3+
// ESLint configuration
4+
// http://eslint.org/docs/user-guide/configuring
5+
module.exports = {
6+
env: { browser: true, es6: true, node: true },
7+
extends: ['react-app', 'prettier', 'prettier/react'],
8+
parser: 'babel-eslint',
9+
parserOptions: {
10+
ecmaFeatures: { jsx: true },
11+
ecmaVersion: 2018,
12+
sourceType: 'module',
13+
},
14+
plugins: ['prettier', 'react-hooks'],
15+
16+
rules: {
17+
// Forbid the use of extraneous packages
18+
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
19+
'import/no-extraneous-dependencies': ['off'],
20+
21+
// Recommend not to leave any console.log in your code
22+
// Use console.error, console.warn and console.info instead
23+
// https://eslint.org/docs/rules/no-console
24+
'no-console': [
25+
'error',
26+
{
27+
allow: ['warn', 'error', 'info', 'log'],
28+
},
29+
],
30+
31+
// Prefer destructuring from arrays and objects
32+
// http://eslint.org/docs/rules/prefer-destructuring
33+
'prefer-destructuring': [
34+
'error',
35+
{
36+
VariableDeclarator: {
37+
array: false,
38+
object: true,
39+
},
40+
AssignmentExpression: {
41+
array: false,
42+
object: false,
43+
},
44+
},
45+
{
46+
enforceForRenamedProperties: false,
47+
},
48+
],
49+
50+
// Allow .js files to use JSX syntax
51+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
52+
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],
53+
54+
// Functional and class components are equivalent from React’s point of view
55+
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
56+
'react/prefer-stateless-function': 'off',
57+
58+
// ESLint plugin for prettier formatting
59+
// https://github.com/prettier/eslint-plugin-prettier
60+
'prettier/prettier': 'error',
61+
62+
'react-hooks/rules-of-hooks': 'error',
63+
'react-hooks/exhaustive-deps': 'warn',
64+
},
65+
66+
settings: {
67+
// Allow absolute paths in imports, e.g. import Button from 'components/Button'
68+
// https://github.com/benmosher/eslint-plugin-import/tree/master/resolvers
69+
'import/resolver': {
70+
webpack: {
71+
config: path.resolve(__dirname, 'config/webpack.config.js'),
72+
},
73+
},
74+
},
75+
overrides: [
76+
{
77+
files: ['**/*.ts', '**/*.tsx'],
78+
env: { browser: true, es6: true, node: true },
79+
extends: [
80+
// 'eslint:recommended',
81+
// 'plugin:react/recommended',
82+
// 'plugin:@typescript-eslint/eslint-recommended',
83+
'plugin:@typescript-eslint/recommended',
84+
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
85+
'plugin:prettier/recommended',
86+
],
87+
parser: '@typescript-eslint/parser',
88+
parserOptions: {
89+
ecmaFeatures: { jsx: true },
90+
ecmaVersion: 2018,
91+
sourceType: 'module',
92+
project: './tsconfig.json',
93+
},
94+
plugins: ['react', '@typescript-eslint'],
95+
rules: {
96+
// indent: ['error', 2, { SwitchCase: 1 }],
97+
'linebreak-style': ['error', 'unix'],
98+
quotes: ['error', 'single'],
99+
// 'comma-dangle': ['error', 'always-multiline'],
100+
'@typescript-eslint/no-explicit-any': 0,
101+
'@typescript-eslint/no-use-before-define': 0,
102+
'@typescript-eslint/camelcase': 0,
103+
// '@typescript-eslint/no-unused-vars': 0,
104+
'@typescript-eslint/explicit-function-return-type': 0,
105+
'@typescript-eslint/no-empty-function': 0,
106+
'@typescript-eslint/no-var-requires': 0,
107+
'no-case-declarations': 0,
108+
'react/display-name': 0,
109+
'react/prop-types': 0,
110+
},
111+
settings: { react: { version: 'detect' } },
112+
},
113+
],
114+
};

.gitattributes

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Automatically normalize line endings for all text-based files
2+
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion
3+
* text=auto
4+
5+
# For the following file types, normalize line endings to LF on
6+
# checkin and prevent conversion to CRLF when they are checked out
7+
# (this is required in order to prevent newline related issues like,
8+
# for example, after the build script is run)
9+
.* text eol=lf
10+
*.html text eol=lf
11+
*.css text eol=lf
12+
*.less text eol=lf
13+
*.styl text eol=lf
14+
*.scss text eol=lf
15+
*.sass text eol=lf
16+
*.sss text eol=lf
17+
*.js text eol=lf
18+
*.jsx text eol=lf
19+
*.json text eol=lf
20+
*.md text eol=lf
21+
*.mjs text eol=lf
22+
*.sh text eol=lf
23+
*.svg text eol=lf
24+
*.txt text eol=lf
25+
*.xml text eol=lf

.gitignore

+27-98
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,33 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
20-
21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
24-
25-
# nyc test coverage
26-
.nyc_output
27-
28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
30-
31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
33-
34-
# node-waf configuration
35-
.lock-wscript
36-
37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
39-
40-
# Dependency directories
41-
node_modules/
42-
jspm_packages/
43-
44-
# TypeScript v1 declaration files
45-
typings/
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
462

47-
# TypeScript cache
48-
*.tsbuildinfo
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
497

50-
# Optional npm cache directory
51-
.npm
8+
# testing
9+
/coverage
5210

53-
# Optional eslint cache
54-
.eslintcache
11+
# production
12+
/build
5513

56-
# Microbundle cache
57-
.rpt2_cache/
58-
.rts2_cache_cjs/
59-
.rts2_cache_es/
60-
.rts2_cache_umd/
14+
# misc
15+
.npmrc
16+
.DS_Store
17+
.env.local
18+
.env.development.local
19+
.env.test.local
20+
.env.production.local
6121

62-
# Optional REPL history
63-
.node_repl_history
64-
65-
# Output of 'npm pack'
66-
*.tgz
67-
68-
# Yarn Integrity file
69-
.yarn-integrity
70-
71-
# dotenv environment variables file
72-
.env
73-
.env.test
74-
75-
# parcel-bundler cache (https://parceljs.org/)
76-
.cache
77-
78-
# Next.js build output
79-
.next
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# Serverless directories
95-
.serverless/
96-
97-
# FuseBox cache
98-
.fusebox/
99-
100-
# DynamoDB Local files
101-
.dynamodb/
22+
# Logs
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
10226

103-
# TernJS port file
104-
.tern-port
27+
# Editors and IDEs
28+
.idea
29+
.vscode/*
30+
!.vscode/settings.json
31+
!.vscode/tasks.json
32+
!.vscode/launch.json
33+
!.vscode/extensions.json

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Prettier configuration
2+
// https://prettier.io/docs/en/configuration.html
3+
module.exports = {
4+
printWidth: 80,
5+
singleQuote: true,
6+
trailingComma: 'es5'
7+
};

.storybook/config.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { configure, addParameters } from '@storybook/react';
2+
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';
3+
4+
//指定story的位置
5+
const req = require.context('../src/stories', true, /\.stories\.(js|mdx)$/);
6+
function loadStories() {
7+
req.keys().map(fileName => req(fileName));
8+
}
9+
10+
configure(loadStories, module);
11+
12+
addParameters({
13+
docs: {
14+
container: DocsContainer,
15+
page: DocsPage,
16+
},
17+
});

.storybook/index.html

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<!-- <meta name="viewport" content="width=device-width, initial-scale=1" /> -->
7+
<meta name="theme-color" content="#000000" />
8+
<!-- <link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/ionicons.min.css" />
9+
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/titilliumweb.css" /> -->
10+
<!--
11+
manifest.json provides metadata used when your web app is added to the
12+
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
13+
-->
14+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15+
<!--
16+
Notice the use of %PUBLIC_URL% in the tags above.
17+
It will be replaced with the URL of the `public` folder during the build.
18+
Only files inside the `public` folder can be referenced from the HTML.
19+
20+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
21+
work correctly both with client-side routing and a non-root public URL.
22+
Learn how to configure a non-root public URL by running `npm run build`.
23+
-->
24+
<!--高德地图JS API-->
25+
<script
26+
src="https://webapi.amap.com/maps?v=1.4.15&key=3bcf5ffad0dfb938584c040db30f7fa9"
27+
type="text/javascript"
28+
></script>
29+
<title>React App Stater</title>
30+
</head>
31+
<body>
32+
<noscript>
33+
You need to enable JavaScript to run this app.
34+
</noscript>
35+
<div id="root"></div>
36+
<!--
37+
This HTML file is a template.
38+
If you open it directly in the browser, you will see an empty page.
39+
40+
You can add webfonts, meta tags, or analytics to this file.
41+
The build step will place the bundled scripts into the <body> tag.
42+
43+
To begin the development, run `npm start` or `yarn start`.
44+
To create a production bundle, use `npm run build` or `yarn build`.
45+
-->
46+
</body>
47+
</html>

.storybook/main.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
stories: ['../src/**/*.stories.(js|jsx|mdx)'],
5+
addons: [
6+
'@storybook/preset-create-react-app',
7+
'@storybook/addon-actions',
8+
'@storybook/addon-links',
9+
'@storybook/addon-docs/register',
10+
// {
11+
// name: '@storybook/addon-docs',
12+
// options: {
13+
// configureJSX: true,
14+
// },
15+
// },
16+
],
17+
// webpackFinal: async config => {
18+
// config.resolve.alias = {
19+
// '@src': path.resolve(__dirname, '../src'),
20+
// };
21+
// return config;
22+
// },
23+
};

0 commit comments

Comments
 (0)