Skip to content

Commit

Permalink
feat: 将 react custom hooks 拆分出来,使用 lerna 管理仓库
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaosongxiaosong committed Aug 23, 2019
1 parent 023c2b9 commit 89f3adf
Show file tree
Hide file tree
Showing 97 changed files with 15,229 additions and 22,613 deletions.
10 changes: 10 additions & 0 deletions .eslintignore
@@ -0,0 +1,10 @@
# build/*
# dist/*
# node_modules/*

build
dist
node_modules
# packages/*/node_modules/*
# packages/*/build/*
# packages/*/dist/*
15 changes: 12 additions & 3 deletions .eslintrc.js
@@ -1,7 +1,7 @@
module.exports = {
// parser: 'babel-eslint',
extends: ['react-app', 'prettier', 'prettier/react'],
plugins: ['prettier', 'react', 'react-hooks'],
parser: 'babel-eslint',
extends: ['react-app', 'airbnb', 'prettier', 'prettier/react'],
plugins: ['prettier'],
globals: {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
Expand All @@ -22,6 +22,15 @@ module.exports = {
],
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'error', // Checks effect dependencies
yoda: [2, 'always'],
'no-undefined': 1,
'no-debugger': 1,
'jsx-a11y/anchor-is-valid': 1,
'jsx-a11y/label-has-for': 1,
'jsx-a11y/label-has-associated-control': 1,
'react/destructuring-assignment': 1,
'react/forbid-prop-types': 0,
'react/jsx-filename-extension': 0,
},
// settings: {
// version: require('./package.json').peerDependencies.react,
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
@@ -1,16 +1,16 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build
/dist
build
dist

# misc
.DS_Store
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -20,8 +20,7 @@ install:
script:
- yarn lint
- yarn build
- yarn test
- yarn test --watchAll=false

after_success:
- yarn cov
# - yarn deploy
- yarn coveralls
115 changes: 0 additions & 115 deletions CommitMessage.md

This file was deleted.

54 changes: 54 additions & 0 deletions config-overrides.js
@@ -0,0 +1,54 @@
/* eslint-disable */
module.exports = {
// The Webpack config to use when compiling your react app for development or production.
webpack(config, env) {
// ...add your webpack config
return config;
},
// The Jest config to use when running your jest tests - note that the normal rewires do not
// work here.
jest(config) {
// ...add your jest config customisation...
// Example: enable/disable some tests based on environment variables in the .env file.
// console.log(config.roots);
// console.log(config.testMatch);
config.roots = ['<rootDir>/packages/'];
config.testMatch = [
'<rootDir>/packages/**/__tests__/**/*.{js,jsx,ts,tsx}',
'<rootDir>/packages/**/*.{spec,test}.{js,jsx,ts,tsx}',
];
config.collectCoverageFrom = ['packages/**/lib/*.js', 'packages/**/src/*.js', 'packages/**/src/**/*.js'];
return config;
},
// The function to use to create a webpack dev server configuration when running the development
// server with 'npm run start' or 'yarn start'.
// Example: set the dev server to use a specific certificate in https.
devServer(configFunction) {
// Return the replacement function for create-react-app to use to generate the Webpack
// Development Server config. "configFunction" is the function that would normally have
// been used to generate the Webpack Development server config - you can use it to create
// a starting configuration to then modify instead of having to create a config from scratch.
return function(proxy, allowedHost) {
// Create the default config by calling configFunction with the proxy/allowedHost parameters
const config = configFunction(proxy, allowedHost);

// Change the https certificate options to match your certificate, using the .env file to
// set the file paths & passphrase.
const fs = require('fs');
config.https = {
key: fs.readFileSync(process.env.REACT_HTTPS_KEY, 'utf8'),
cert: fs.readFileSync(process.env.REACT_HTTPS_CERT, 'utf8'),
ca: fs.readFileSync(process.env.REACT_HTTPS_CA, 'utf8'),
passphrase: process.env.REACT_HTTPS_PASS,
};

// Return your customised Webpack Development Server config.
return config;
};
},
// The paths config to use when compiling your react app for development or production.
paths(paths, env) {
// ...add your paths config
return paths;
},
};
23 changes: 0 additions & 23 deletions example/.gitignore

This file was deleted.

68 changes: 0 additions & 68 deletions example/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions example/src/App.test.js

This file was deleted.

0 comments on commit 89f3adf

Please sign in to comment.