Skip to content

Commit 1a39d16

Browse files
committed
typescript config set up
1 parent 6b55874 commit 1a39d16

File tree

11 files changed

+953
-134
lines changed

11 files changed

+953
-134
lines changed

.babelrc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
},
77
"presets": [
88
"@babel/preset-env",
9-
"@babel/preset-react"
9+
"@babel/preset-react",
10+
"@babel/preset-typescript"
1011
],
1112
"plugins": [
12-
["@babel/transform-runtime"]
13-
],
13+
["@babel/transform-runtime"],
14+
["@babel/proposal-class-properties"],
15+
["@babel/proposal-object-rest-spread"]
16+
]
1417
}

package-lock.json

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

package.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"package-all": "electron-builder build -mwl",
1616
"package-linux": "electron-builder build --linux",
1717
"gh-publish-mac": "electron-builder build --x64 --mac -p always",
18-
"gh-publish": "electron-builder build -mwl -p always"
18+
"gh-publish": "electron-builder build -mwl -p always",
19+
"check-types": "tsc"
1920
},
2021
"author": {
2122
"name": "Swell",
@@ -230,15 +231,26 @@
230231
},
231232
"devDependencies": {
232233
"@babel/core": "^7.10.3",
234+
"@babel/plugin-proposal-class-properties": "^7.10.4",
235+
"@babel/plugin-proposal-object-rest-spread": "^7.10.4",
233236
"@babel/plugin-transform-runtime": "^7.10.3",
234237
"@babel/preset-env": "^7.10.3",
235238
"@babel/preset-react": "^7.10.1",
236-
"@babel/preset-typescript": "^7.10.1",
239+
"@babel/preset-typescript": "^7.10.4",
237240
"@jest-runner/electron": "^3.0.0",
238241
"@testing-library/jest-dom": "^5.11.0",
239242
"@testing-library/react": "^10.4.3",
240-
"@typescript-eslint/eslint-plugin": "^3.4.0",
241-
"@typescript-eslint/parser": "^3.4.0",
243+
"@types/cookie": "^0.4.0",
244+
"@types/jest": "^26.0.4",
245+
"@types/node": "^14.0.20",
246+
"@types/node-fetch": "^2.5.7",
247+
"@types/react": "^16.9.41",
248+
"@types/react-dom": "^16.9.8",
249+
"@types/react-redux": "^7.1.9",
250+
"@types/set-cookie-parser": "0.0.6",
251+
"@types/ws": "^7.2.6",
252+
"@typescript-eslint/eslint-plugin": "^3.6.0",
253+
"@typescript-eslint/parser": "^3.6.0",
242254
"babel-eslint": "^10.1.0",
243255
"babel-jest": "^24.9.0",
244256
"babel-loader": "^8.1.0",
@@ -275,8 +287,11 @@
275287
"prettier": "^2.0.5",
276288
"react-test-renderer": "^16.13.1",
277289
"sass-loader": "^7.3.1",
290+
"source-map-loader": "^1.0.1",
278291
"spectron": "^9.0.0",
279292
"style-loader": "^0.23.1",
293+
"ts-loader": "^8.0.0",
294+
"typescript": "^3.9.6",
280295
"url-loader": "^4.1.0",
281296
"webpack": "^4.43.0",
282297
"webpack-cli": "^3.3.12",

src/client/components/containers/App.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React, { Component } from "react";
22
import "../../../assets/style/App.scss";
3-
const { api } = window;
4-
import ContentsContainer from './ContentsContainer.jsx';
5-
// import ReqResCtrl from '../../controllers/reqResController';
3+
import { ContentsContainer } from "./ContentsContainer.tsx";
64
import SidebarContainer from "./SidebarContainer.jsx";
75
import UpdatePopUpContainer from "./UpdatePopUpContainer.jsx";
86
import historyController from "../../controllers/historyController";
97
import collectionsController from "../../controllers/collectionsController";
8+
// import ReqResCtrl from '../../controllers/reqResController';
9+
10+
const { api } = window;
1011
// const EventEmitter = require('events');
1112
// const {dialog} = require('electron').remote
1213
class App extends Component {

src/client/components/containers/ContentsContainer.jsx

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as React from "react";
2+
3+
// import GraphContainer from "./GraphContainer.jsx";
4+
import ReqResContainer from "./ReqResContainer.jsx";
5+
import NavBarContainer from "./NavBarContainer.jsx";
6+
7+
export class ContentsContainer extends React.Component<any, any> {
8+
constructor(props: any) {
9+
super(props);
10+
}
11+
12+
render() {
13+
return (
14+
<div className="contents">
15+
{/* <GraphContainer /> */}
16+
<NavBarContainer />
17+
<ReqResContainer />
18+
</div>
19+
);
20+
}
21+
}
22+
23+
// export default Contents;

src/client/components/display/Btn.jsx

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// import React, { Component } from 'react';
2+
import * as React from "react";
3+
// import { connect } from 'react-redux';
4+
// import ReqResCtrl from '../ReqResCtrl';
5+
// import * as store from '../../store';
6+
// import * as actions from '../../actions/actions';
7+
8+
export class Btn extends React.Component<any, any> {
9+
constructor(props: any) {
10+
super(props);
11+
this.state = {};
12+
}
13+
14+
render() {
15+
return <button type="button" />;
16+
}
17+
}
18+
19+
// export default Btn;

src/client/controllers/graphQLController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import gql from "graphql-tag";
33
import { InMemoryCache } from "apollo-cache-inmemory";
44
import { WebSocketLink } from "apollo-link-ws";
55
import { SubscriptionClient } from "subscriptions-transport-ws";
6-
//const { session } = require('electron').remote
7-
const { api } = window;
8-
96
import * as store from "../store";
107
import * as actions from "../actions/actions";
118

9+
const { api } = window;
10+
1211
const graphQLController = {
1312
openGraphQLConnection(reqResObj) {
1413
// initialize response data

tsconfig.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
/* Basic Options */
4+
// "outDir": "./dist/", // path to output directory. diabled because we are using babel-loader in webpack config
5+
"sourceMap": true, // allow sourcemap support
6+
// "strictNullChecks": true, // enable strict null checks as a best practice
7+
"module": "es6", // specify module code generation
8+
"jsx": "react", // use typescript to transpile jsx to js
9+
"target": "ESNext", // specify ECMAScript target version
10+
"allowJs": true, // allow a partial TypeScript and JavaScript codebase
11+
"noEmit": true, // don't emit; allow Babel to transform files
12+
13+
/* Strict Type-Checking Options */
14+
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
15+
16+
/* Additional Checks */
17+
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
18+
19+
/* Module Resolution Options */
20+
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
21+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
22+
23+
/* Advanced Options */
24+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
25+
},
26+
"include": ["./src/"],
27+
"exclude": ["node_modules", "dist", "build", "coverage", "mocks"]
28+
}

0 commit comments

Comments
 (0)