Skip to content

Commit 57975dd

Browse files
committed
chore: add typescript to the project
1 parent 19285dd commit 57975dd

File tree

16 files changed

+17507
-9904
lines changed

16 files changed

+17507
-9904
lines changed

.eslintrc.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,39 @@ module.exports = {
22
env: {
33
browser: true,
44
es2020: true,
5-
'jest/globals': true
6-
},
7-
globals: {
8-
JestMockFn: true,
95
},
106
extends: [
117
'plugin:react/recommended',
128
'airbnb',
139
'plugin:prettier/recommended',
14-
'plugin:jest/recommended'
10+
'plugin:@typescript-eslint/eslint-recommended',
11+
'plugin:@typescript-eslint/recommended',
1512
],
13+
parser: '@typescript-eslint/parser',
1614
parserOptions: {
1715
ecmaFeatures: {
1816
jsx: true,
1917
},
2018
ecmaVersion: 11,
2119
sourceType: 'module',
2220
},
23-
plugins: ['jest', 'react', 'react-hooks', 'prettier'],
21+
plugins: ['react', 'react-hooks', '@typescript-eslint', 'prettier'],
2422
settings: {
2523
'import/resolver': {
2624
node: {
27-
extensions: ['.js', '.jsx', '.json'],
25+
extensions: ['.js', '.ts', '.tsx'],
2826
},
2927
},
3028
},
29+
ignorePatterns: ["./example/*"],
3130
rules: {
3231
'react-hooks/rules-of-hooks': 'error',
3332
'react-hooks/exhaustive-deps': 'error',
34-
'react/jsx-filename-extension': [
35-
'error',
36-
{ extensions: ['.js', '.jsx', '.json'] },
37-
],
33+
'@typescript-eslint/explicit-function-return-type': 'off',
34+
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
3835
'react/prop-types': 'off',
3936
'react/jsx-one-expression-per-line': 'off',
40-
'import/extensions': ['off'],
37+
'import/extensions': ['error', 'never'],
4138
'import/prefer-default-export': 'off',
4239
'import/no-unresolved': ['error', { ignore: ['react-hooks-fetch'] }],
4340
camelcase: [
@@ -50,5 +47,6 @@ module.exports = {
5047
],
5148
'react/state-in-constructor': 'off',
5249
'no-console': 'off',
50+
'react/react-in-jsx-scope': 'off',
5351
},
5452
};

babel.config.js

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

example/package-lock.json

Lines changed: 16793 additions & 8067 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"license": "MIT",
66
"private": true,
77
"dependencies": {
8-
"@material-ui/core": "^4.11.3",
9-
"react": "file:../node_modules/react",
10-
"react-dom": "^16.9.0",
11-
"react-scripts": "^3.0.1",
8+
"@material-ui/core": "^4.12.1",
9+
"react": "17.0.2",
10+
"react-dom": "^17.0.2",
11+
"react-scripts": "^4.0.3",
1212
"react-use-downloader": "file:.."
1313
},
1414
"scripts": {
15-
"start": "react-scripts start",
15+
"start": "SKIP_PREFLIGHT_CHECK=true react-scripts start",
1616
"build": "react-scripts build",
1717
"test": "react-scripts test --env=jsdom",
1818
"eject": "react-scripts eject"

example/src/App.js renamed to example/src/App.jsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ const useStyles = makeStyles({
2222

2323
export default function App() {
2424
const classes = useStyles();
25-
const {
26-
size,
27-
elapsed,
28-
percentage,
29-
download,
30-
cancel,
31-
error,
32-
isInProgress,
33-
} = useDownloader();
25+
const { size, elapsed, percentage, download, cancel, error, isInProgress } =
26+
useDownloader();
3427

3528
const fileUrl =
3629
'https://upload.wikimedia.org/wikipedia/commons/4/4d/%D0%93%D0%BE%D0%B2%D0%B5%D1%80%D0%BB%D0%B0_%D1%96_%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D1%81_%D0%B2_%D0%BF%D1%80%D0%BE%D0%BC%D1%96%D0%BD%D1%8F%D1%85_%D0%B2%D1%80%D0%B0%D0%BD%D1%96%D1%88%D0%BD%D1%8C%D0%BE%D0%B3%D0%BE_%D1%81%D0%BE%D0%BD%D1%86%D1%8F.jpg';
File renamed without changes.

jest.config.js

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

0 commit comments

Comments
 (0)