Skip to content

Commit 32736df

Browse files
authored
perf: switch to typescript (#25)
1 parent 10b5a94 commit 32736df

File tree

103 files changed

+22680
-7740
lines changed

Some content is hidden

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

103 files changed

+22680
-7740
lines changed

.babelrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.eslintrc.js
3+
jest*js
4+
tailwind.config.js
5+
postcss.config.js
6+

.eslintrc

Lines changed: 0 additions & 23 deletions
This file was deleted.

.eslintrc.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es6: true,
5+
jest: true,
6+
},
7+
extends: [
8+
'plugin:react/recommended',
9+
'airbnb',
10+
'airbnb-typescript',
11+
'plugin:prettier/recommended',
12+
],
13+
parser: '@typescript-eslint/parser',
14+
parserOptions: {
15+
ecmaFeatures: {
16+
jsx: true,
17+
},
18+
ecmaVersion: 2018,
19+
sourceType: 'module',
20+
project: './tsconfig.json',
21+
},
22+
plugins: [
23+
'react',
24+
'@typescript-eslint',
25+
'import',
26+
'no-relative-import-paths',
27+
'prettier',
28+
],
29+
rules: {
30+
'react/function-component-definition': 'off',
31+
'react/prop-types': 'off',
32+
'react/react-in-jsx-scope': 'off',
33+
'import/extensions': [
34+
'error',
35+
'ignorePackages',
36+
{ ts: 'never', tsx: 'never' },
37+
],
38+
'react/jsx-filename-extension': [
39+
'error',
40+
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
41+
],
42+
'import/prefer-default-export': 'off',
43+
'no-unused-vars': 'off',
44+
'react/jsx-props-no-spreading': 'off',
45+
'react/jsx-no-useless-fragment': 'off',
46+
'react/require-default-props': 'off',
47+
'no-relative-import-paths/no-relative-import-paths': [
48+
'error',
49+
{ rootDir: 'src' },
50+
],
51+
'no-restricted-exports': 'off',
52+
'no-eval': 'off',
53+
},
54+
settings: {
55+
'import/resolver': {
56+
node: {
57+
extensions: ['.js', '.jsx', '.d.ts', '.ts', '.tsx'],
58+
moduleDirectory: ['node_modules', 'src'],
59+
},
60+
},
61+
react: {
62+
version: 'detect',
63+
},
64+
},
65+
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Pull Request
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
fetch-depth: 0
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version-file: '.nvmrc'
15+
- name: Install dependencies
16+
run: npm ci
17+
- name: Code Lint
18+
run: npm run lint
19+
- name: Commit Lint
20+
uses: wagoid/commitlint-github-action@v5
21+
with:
22+
failOnWarnings: true
23+
- name: Test Coverage
24+
uses: ArtiomTr/jest-coverage-report-action@v2
25+
id: coverage
26+
with:
27+
output: report-markdown
28+
- name: Publish Coverage
29+
uses: marocchino/sticky-pull-request-comment@v2
30+
with:
31+
message: ${{ steps.coverage.outputs.report }}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm run pre-commit

.nvmrc

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

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"singleQuote": true,
3-
"printWidth": 100,
43
"arrowParens": "avoid"
54
}

LICENSE.md

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) 2022 Khalid Elshafie
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: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## js-playground (JavaScript Playground)
22

33
![GitHub package.json version](https://img.shields.io/github/package-json/v/abolkog/js-playground)
4+
![](https://img.shields.io/github/license/abolkog/js-playground.svg)
45

56
A simple JavaScript playground / code sandbox hooked up with few libraries for quick code testing
67

@@ -9,7 +10,6 @@ A simple JavaScript playground / code sandbox hooked up with few libraries for q
910
## Available Libraries
1011

1112
- [Redux](https://redux.js.org/)
12-
- [Moment](https://momentjs.com/)
1313
- [Lodash](https://lodash.com/)
1414
- [Axios](https://github.com/axios/axios)
1515
- [Luxon](https://moment.github.io/luxon/#/)
@@ -22,13 +22,40 @@ You can see demo at [This link](https://abolkog.github.io/js-playground/index.ht
2222

2323
1- Clone the Repo
2424

25-
2- Install the dependencies
25+
2- If you are using `nvm`, setup node version using the `.nvmrc` file
2626

27+
```shell
28+
nvm use
2729
```
30+
31+
3- Install the dependencies
32+
33+
```shell
2834
npm install
35+
```
36+
37+
4- Start the dev server
38+
39+
```shell
2940
npm start
3041
```
3142

32-
2- Visit [http://localhost:3000](http://localhost:3000) on your browser.
43+
5- Visit [http://localhost:3000](http://localhost:3000) on your browser.
44+
45+
6- Start writing JS code !
46+
47+
## Contributing
48+
49+
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
50+
51+
Please make sure to update tests as appropriate.
52+
53+
## Authors
54+
55+
- **Khalid Elshafie** - _Initial work_ - [abolkog](https://github.com/abolkog)
56+
57+
See also the list of [contributors](https://github.com/abolkog/js-playground/contributors) who participated in this project.
58+
59+
## License
3360

34-
3- Start writing JS code !
61+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

0 commit comments

Comments
 (0)