Skip to content

Commit 1804ab2

Browse files
committed
init
0 parents  commit 1804ab2

32 files changed

+7455
-0
lines changed

.commitlintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Config for commitlint
2+
//https://github.com/conventional-changelog/commitlint
3+
module.exports = {
4+
rules: {
5+
'body-leading-blank': [1, 'always'],
6+
'footer-leading-blank': [1, 'always'],
7+
'header-max-length': [2, 'always', 72],
8+
'subject-min-length': [2, 'always', 3],
9+
'scope-case': [2, 'always', 'lower-case'],
10+
'subject-case': [
11+
2,
12+
'never',
13+
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
14+
],
15+
'subject-empty': [2, 'never'],
16+
'subject-full-stop': [2, 'never', '.'],
17+
'type-case': [2, 'always', 'lower-case'],
18+
'type-empty': [2, 'never'],
19+
'type-enum': [
20+
2,
21+
'always',
22+
['chore', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert'],
23+
],
24+
},
25+
};

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintrc.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
},
6+
globals: {
7+
Atomics: 'readonly',
8+
SharedArrayBuffer: 'readonly',
9+
},
10+
parser: '@typescript-eslint/parser',
11+
parserOptions: {
12+
ecmaFeatures: {
13+
jsx: true,
14+
},
15+
ecmaVersion: 2018,
16+
sourceType: 'module',
17+
},
18+
plugins: ['react', '@typescript-eslint', 'prettier', 'react-hooks'],
19+
extends: [
20+
'plugin:react/recommended',
21+
'standard',
22+
'prettier',
23+
'prettier/@typescript-eslint',
24+
'plugin:prettier/recommended',
25+
'plugin:@typescript-eslint/eslint-recommended',
26+
'plugin:@typescript-eslint/recommended',
27+
],
28+
rules: {
29+
'prettier/prettier': 'error',
30+
'@typescript-eslint/explicit-function-return-type': 'off',
31+
'@typescript-eslint/no-unused-vars': 'off',
32+
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
33+
"react-hooks/exhaustive-deps": "warn" // Checks effect dependencies
34+
},
35+
};

.gitignore

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
2+
# Created by https://www.gitignore.io/api/node,macos,visualstudiocode
3+
# Edit at https://www.gitignore.io/?templates=node,macos,visualstudiocode
4+
5+
### macOS ###
6+
# General
7+
.DS_Store
8+
.AppleDouble
9+
.LSOverride
10+
11+
# Icon must end with two \r
12+
Icon
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### Node ###
34+
# Logs
35+
logs
36+
*.log
37+
npm-debug.log*
38+
yarn-debug.log*
39+
yarn-error.log*
40+
lerna-debug.log*
41+
42+
# Diagnostic reports (https://nodejs.org/api/report.html)
43+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
44+
45+
# Runtime data
46+
pids
47+
*.pid
48+
*.seed
49+
*.pid.lock
50+
51+
# Directory for instrumented libs generated by jscoverage/JSCover
52+
lib-cov
53+
54+
# Coverage directory used by tools like istanbul
55+
coverage
56+
*.lcov
57+
58+
# nyc test coverage
59+
.nyc_output
60+
61+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
62+
.grunt
63+
64+
# Bower dependency directory (https://bower.io/)
65+
bower_components
66+
67+
# node-waf configuration
68+
.lock-wscript
69+
70+
# Compiled binary addons (https://nodejs.org/api/addons.html)
71+
build/Release
72+
73+
# Dependency directories
74+
node_modules/
75+
jspm_packages/
76+
77+
# TypeScript v1 declaration files
78+
typings/
79+
80+
# TypeScript cache
81+
*.tsbuildinfo
82+
83+
# Optional npm cache directory
84+
.npm
85+
86+
# Optional eslint cache
87+
.eslintcache
88+
89+
# Optional REPL history
90+
.node_repl_history
91+
92+
# Output of 'npm pack'
93+
*.tgz
94+
95+
# Yarn Integrity file
96+
.yarn-integrity
97+
98+
# dotenv environment variables file
99+
.env
100+
.env.test
101+
102+
# parcel-bundler cache (https://parceljs.org/)
103+
.cache
104+
105+
# next.js build output
106+
.next
107+
108+
# nuxt.js build output
109+
.nuxt
110+
111+
# react / gatsby
112+
public/
113+
114+
# vuepress build output
115+
.vuepress/dist
116+
117+
# Serverless directories
118+
.serverless/
119+
120+
# FuseBox cache
121+
.fusebox/
122+
123+
# DynamoDB Local files
124+
.dynamodb/
125+
126+
### VisualStudioCode ###
127+
.vscode
128+
### VisualStudioCode Patch ###
129+
# Ignore all local history of files
130+
.history
131+
132+
docs/**
133+
!docs/.gitkeep
134+
dist/**
135+
!dist/.gitkeep
136+
# End of https://www.gitignore.io/api/node,macos,visualstudiocode

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v12.13.1

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"semi": true,
5+
"singleQuote": true,
6+
"trailingComma": "es5"
7+
}

.versionrc.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Config for standard-version
2+
// https://github.com/conventional-changelog/standard-version
3+
module.exports = {
4+
types: [
5+
{
6+
type: 'feat',
7+
section: 'Features',
8+
},
9+
{
10+
type: 'fix',
11+
section: 'Bug Fixes',
12+
},
13+
{
14+
type: 'perf',
15+
section: 'Performance',
16+
},
17+
{
18+
type: 'refactor',
19+
section: 'Refactors',
20+
hidden: true,
21+
},
22+
],
23+
};

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) --currentYear-- --username--
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# react-typescript-library-template
2+
3+
## Install
4+
5+
### Github Users
6+
7+
Since this is a `template repository`, you can use that green `Use this template` button to start a new repository from this template.
8+
9+
### Non-Github Users
10+
11+
Clone the repository:
12+
13+
```
14+
git clone --depth 1 git@github.com:alioguzhan/react-typescript-library-template.git
15+
```
16+
17+
Install the deps:
18+
19+
```bash
20+
yarn install
21+
```
22+
23+
If you want to change or remove some parts of this template, do it before start development.
24+
Once you feel ready, remove the `.git` folder and start a new one:
25+
26+
```
27+
rm -rf .git && git init
28+
```
29+
30+
> You can check if there are any outdated package with [npm-check-updates](https://www.npmjs.com/package/npm-check-updates) tool.
31+
32+
## Development
33+
34+
Write your library code to `src/index.tsx` file and run:
35+
36+
```
37+
yarn start
38+
```
39+
40+
This will watch your changes and reloads the server.
41+
42+
### Commit Messages
43+
44+
This setup expects you to follow conventional-commits format. There is a husky command runs before every commit for validation.
45+
46+
To learn more about conventional commits see [its website](https://www.conventionalcommits.org/en/v1.0.0/).
47+
48+
You can remove that section from `package.json` also remove the related package(s):
49+
50+
```
51+
yarn remove -D @commitlint/cli
52+
```
53+
54+
## Build
55+
56+
Run:
57+
58+
```
59+
yarn build
60+
```
61+
62+
This will create your compiled files under `./dist` folder. And generates a documentation with `TypeDoc` under `./docs` folder.
63+
64+
## Test
65+
66+
Jest is configured and ready to use. Just run:
67+
68+
```
69+
yarn test
70+
```
71+
72+
## Docs
73+
74+
This template uses [TypeDoc](https://typedoc.org/) by default.
75+
76+
Run `yarn make:docs` and a folder named `docs` will be created in your root directory. Just open `index.html` in your browser to see if your like it or not.

dist/.gitkeep

Whitespace-only changes.

docs/.gitkeep

Whitespace-only changes.

example/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

0 commit comments

Comments
 (0)