Skip to content

Commit bee514e

Browse files
committed
feature: 支持commonJS模块引入和es模块引入,支持tree-shaking
1 parent a151ffd commit bee514e

18 files changed

+5199
-13
lines changed

Diff for: .DS_Store

0 Bytes
Binary file not shown.

Diff for: .eslintignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.tmp/**
2+
/docs/**
3+
/dist/**
4+
/node_modules/**

Diff for: .eslintrc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
extends: [
3+
'eslint-config-airbnb-base',
4+
'eslint-config-airbnb'
5+
].map(require.resolve),
6+
plugins: [
7+
'react-hooks' // eslint-plugin-react-hooks 对react hooks语法的规范提示
8+
],
9+
rules: {
10+
'react-hooks/rules-of-hooks': 'error',
11+
'eol-last': 'off',
12+
'comma-dangle': 'off',
13+
'import/no-unresolved': ['error', { ignore: ['react'] }]
14+
}
15+
};

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npm-debug.log
2+
node_modules/
3+
/.tmp/
4+
.env

Diff for: README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1-
# Smarty Custom React Hooks
1+
# Smarty React Hooks
22

3-
> 自己项目中使用的自定义react-hooks
3+
> 自己项目中使用的自定义react-hooks. 使用rollup打包。
4+
5+
## hooks list
6+
> 功能及使用说明见源码文件顶部注释
7+
8+
- useAnimation
9+
- useAsyncDebounce
10+
- useAsync
11+
- useCountdown
12+
- useInput

Diff for: babel.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
// useBuiltIns: 'usage',
7+
modules: false,
8+
targets: {
9+
browsers: [
10+
'> 1%',
11+
'Android >= 4.4',
12+
'IOS >= 7',
13+
'ie >= 9'
14+
]
15+
}
16+
}
17+
]
18+
]
19+
};

Diff for: dist/index.cjs.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/index.es.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: index.js

Whitespace-only changes.

0 commit comments

Comments
 (0)